/* =============================================
   Eneya Bookkeeping - Main Stylesheet
   ============================================= */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --info: #0891b2;
    --light: #f8fafc;
    --dark: #0f172a;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
    --sidebar-width: 220px;
    --header-height: 64px;
    --teal: #0d9488;
    --green: #16a34a;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-400: #94a3b8;
    --gray-600: #475569;
    --radius: 8px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    color: var(--text);
    background: #f1f5f9;
    line-height: 1.5;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* =============================================
   Layout
   ============================================= */

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-width);
    background: #1e293b;
    color: #cbd5e1;
    position: fixed;
    top: 0;
    left: 0;
    /* Use 100dvh (dynamic) where supported so the sidebar doesn't hide behind
       the iOS address bar; fall back to 100vh for older browsers. */
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* smooth scroll on iOS */
    overscroll-behavior: contain;      /* prevent body scroll bleed */
    z-index: 200;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px;
    border-bottom: 1px solid #334155;
}

.sidebar-logo img {
    height: 36px;
    width: auto;
}

.sidebar-logo span {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.sidebar-nav {
    padding: 12px 0;
    /* Extra bottom space so the last nav item can scroll fully into view.
       env(safe-area-inset-bottom) handles iOS home-indicator bar on iPhones. */
    padding-bottom: max(48px, env(safe-area-inset-bottom, 48px));
}

/* matches layout class: nav-section-label */
.nav-section-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    padding: 12px 20px 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 20px;
    color: #94a3b8;
    font-size: 13.5px;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
    min-height: 44px; /* touch target */
}

.nav-item:hover {
    background: #334155;
    color: #f1f5f9;
    text-decoration: none;
}

.nav-item.active {
    background: #2563eb;
    color: #fff;
}

.nav-item svg,
.nav-item i {
    width: 18px;
    flex-shrink: 0;
}

/* ── Sidebar overlay (mobile) ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 199;
}

.sidebar-overlay.active {
    display: block;
}

/* ── Main content area ── */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
    /* clip prevents children (topbar buttons, grids) from causing a page-level
       horizontal scrollbar when the sidebar is expanded.  We use 'clip' instead
       of 'hidden' so that position:sticky on .topbar still works. */
    overflow-x: clip;
}

/* ── Topbar (matches layout class: topbar) ── */
.topbar {
    height: var(--header-height);
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
    gap: 12px;
    overflow: hidden;
}

.topbar-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
    min-width: 0;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    min-width: 0;
}

/* Doc action buttons — single scrollable row */
.doc-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.doc-actions .btn,
.doc-actions form {
    flex-shrink: 0;
}

/* Hamburger toggle button (mobile only) */
.sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 6px;
    color: var(--text);
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: #f1f5f9;
}

/* Back button in topbar */
.back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    color: var(--text);
    flex-shrink: 0;
    transition: background 0.15s;
    text-decoration: none;
}
.back-btn:hover {
    background: #f1f5f9;
    text-decoration: none;
}

/* ── Page body (matches layout class: page-body) ── */
.page-body {
    padding: 24px;
    flex: 1;
}

/* =============================================
   Cards
   ============================================= */

.card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--dark);
}

.card-body {
    padding: 20px;
}

/* =============================================
   Stats / KPI Cards
   ============================================= */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
}

.stat-card .stat-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.stat-card .stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--dark);
}

.stat-card .stat-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.stat-card.primary  { border-top: 3px solid var(--primary); }
.stat-card.success  { border-top: 3px solid var(--success); }
.stat-card.warning  { border-top: 3px solid var(--warning); }
.stat-card.danger   { border-top: 3px solid var(--danger); }

/* =============================================
   Responsive Grid Layouts
   ============================================= */

/* 2-col content + sidebar layout (used in show/create views) */
.layout-with-sidebar {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
    align-items: start;
}

/* 2-col form grid */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* 2-col dashboard grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

/* Prevent grid items from expanding beyond their column (fixes horizontal page scroll) */
.dashboard-grid > *,
.stats-grid > * {
    min-width: 0;
}

/* =============================================
   Tables
   ============================================= */

.table-responsive,
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    background: #f8fafc;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    text-align: left;
}

tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    white-space: nowrap;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover td {
    background: #f8fafc;
}

/* =============================================
   Badges / Status
   ============================================= */

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

/* =============================================
   Date Range Filter (Reports)
   ============================================= */

.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px 20px;
}

.filters label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.filters label input[type="date"] {
    width: 160px;
    font-size: 14px;
    font-weight: 400;
}

.filters .btn {
    align-self: flex-end;
}

@media (max-width: 600px) {
    .filters {
        flex-direction: column;
        align-items: stretch;
    }
    .filters label input[type="date"] {
        width: 100%;
    }
}

.badge-success  { background: #dcfce7; color: #15803d; }
.badge-danger   { background: #fee2e2; color: #b91c1c; }
.badge-warning  { background: #fef3c7; color: #b45309; }
.badge-info     { background: #e0f2fe; color: #0369a1; }
.badge-secondary{ background: #f1f5f9; color: #475569; }
.badge-dark     { background: #1e293b; color: #f1f5f9; }

/* =============================================
   Buttons
   ============================================= */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 6px;
    font-size: 13.5px;
    font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    line-height: 1;
    white-space: nowrap;
    min-height: 36px;
}

.btn-primary   { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); text-decoration: none; color: #fff; }

.btn-secondary { background: #fff; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: #f8fafc; text-decoration: none; color: var(--text); }

.btn-outline   { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { background: #f8fafc; text-decoration: none; color: var(--text); }

.btn-success   { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #15803d; color: #fff; text-decoration: none; }

.btn-danger    { background: var(--danger);  color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #b91c1c; color: #fff; text-decoration: none; }

.btn-warning   { background: var(--warning); color: #fff; border-color: var(--warning); }

.btn-sm { padding: 6px 12px; font-size: 12px; min-height: 32px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }

/* =============================================
   Forms
   ============================================= */

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 5px;
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    color: var(--text);
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
    min-height: 40px;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.form-control.is-invalid {
    border-color: var(--danger);
}

.invalid-feedback {
    font-size: 12px;
    color: var(--danger);
    margin-top: 4px;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

/* =============================================
   Alerts
   ============================================= */

.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.alert-danger  { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }
.alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.alert-info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }

/* =============================================
   Pagination
   ============================================= */

.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.page-link {
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 13px;
    color: var(--text);
    transition: background 0.15s;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
}

.page-link:hover       { background: #f1f5f9; text-decoration: none; }
.page-link.active      { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-link.disabled    { opacity: 0.5; pointer-events: none; }

/* =============================================
   Utility
   ============================================= */

.text-right  { text-align: right; }
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.text-success{ color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning{ color: var(--warning); }
.fw-600      { font-weight: 600; }
.fw-700      { font-weight: 700; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mt-1 { margin-top: 8px; }
.mb-1 { margin-bottom: 8px; }
.mt-2 { margin-top: 16px; }
.mb-2 { margin-bottom: 16px; }
.mt-3 { margin-top: 24px; }
.mb-3 { margin-bottom: 24px; }
.gap-2 { gap: 8px; }
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-100 { width: 100%; }
.flex-wrap { flex-wrap: wrap; }

/* =============================================
   Product Search Dropdown
   ============================================= */

.product-search-wrapper {
    position: relative;
}

.product-dropdown {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    max-height: 220px;
    overflow-y: auto;
    z-index: 500;
    list-style: none;
    padding: 4px 0;
    margin: 0;
    min-width: 220px;
}

.product-dropdown li {
    padding: 8px 14px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.product-dropdown li:hover,
.product-dropdown li.highlighted {
    background: #f1f5f9;
}

.product-dropdown .pd-price {
    color: var(--text-muted);
    font-size: 12px;
    flex-shrink: 0;
}

.product-dropdown .no-match {
    color: var(--text-muted);
    font-style: italic;
    cursor: default;
    font-size: 12px;
}

.product-dropdown .no-match:hover {
    background: transparent;
}

/* =============================================
   Line Items Table (document create/edit)
   ============================================= */

/* Desktop column widths */
.items-table .col-product { width: 240px; }
.items-table .col-qty     { width: 80px; }
.items-table .col-price   { width: 110px; }
.items-table .col-disc    { width: 80px; }
.items-table .col-tax     { width: 110px; }
.items-table .col-total   { width: 110px; }
.items-table .col-del     { width: 48px; }

.items-table th,
.items-table td {
    white-space: nowrap;
}

.items-table td.td-product {
    white-space: normal;
    min-width: 200px;
}

.items-table td.td-product .product-search-wrapper {
    min-width: 200px;
}

/* ── Totals summary box ── */
.totals-box {
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.totals-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 14px;
    font-size: 13.5px;
    border-bottom: 1px solid var(--border);
}

.totals-row:last-child { border-bottom: none; }

.totals-row.grand {
    background: #f8fafc;
    font-size: 16px;
    font-weight: 700;
    padding: 12px 14px;
}

/* ── Icon button ── */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    min-height: auto;
}

/* =============================================
   Line Items — Mobile Card Layout (≤ 640px)
   ============================================= */

@media (max-width: 640px) {
    /* Hide the column headers */
    .items-table thead {
        display: none;
    }

    /* Table/tbody become block containers */
    .items-table,
    .items-table tbody {
        display: block;
    }

    /* Each row becomes a card */
    .items-table tbody tr {
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 8px;
        position: relative;
        background: #fff;
        border: 1px solid var(--border);
        border-radius: 8px;
        margin-bottom: 12px;
        padding: 12px 48px 12px 12px; /* right padding for delete button */
    }

    .items-table tbody td {
        display: block;
        border: none;
        padding: 0;
        white-space: normal;
    }

    /* Data labels above each input */
    .items-table td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-size: 10px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--text-muted);
        margin-bottom: 4px;
    }

    /* Product cell: full width, border below */
    .items-table td.td-product {
        flex: 0 0 100%;
        padding-bottom: 10px;
        border-bottom: 1px solid var(--border);
        min-width: 0;
    }

    /* Numeric cells: 2-up grid */
    .items-table td.td-qty,
    .items-table td.td-price,
    .items-table td.td-disc,
    .items-table td.td-tax {
        flex: 1 1 calc(50% - 8px);
        min-width: 80px;
    }

    /* Line total: full width at bottom */
    .items-table td.td-total {
        flex: 0 0 100%;
        text-align: right;
        border-top: 1px solid var(--border);
        padding-top: 8px;
        margin-top: 4px;
        font-size: 15px;
    }

    /* Delete button: absolute top-right of card */
    .items-table td.td-del {
        position: absolute;
        top: 10px;
        right: 10px;
        flex: none;
    }
}

/* =============================================
   Print / PDF
   ============================================= */

@media print {
    .sidebar, .topbar, .no-print { display: none !important; }
    .main-content { margin-left: 0; }
    .page-body { padding: 0; }
}

/* =============================================
   Responsive — Tablet (≤ 1024px)
   ============================================= */

@media (max-width: 1024px) {
    .layout-with-sidebar {
        grid-template-columns: 1fr 240px;
    }
}

/* =============================================
   Responsive — Mobile (≤ 768px)
   ============================================= */

@media (max-width: 768px) {
    /* Sidebar slides off-screen */
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }

    /* Show hamburger */
    .sidebar-toggle {
        display: flex;
    }

    /* Main fills full width */
    .main-content {
        margin-left: 0;
    }

    /* Prevent horizontal page scroll — use clip instead of hidden to avoid clipping positioned content */
    body { overflow-x: clip; }
    .main-content { max-width: 100vw; min-width: 0; }

    /* Topbar */
    .topbar {
        padding: 0 16px;
        gap: 8px;
        flex-wrap: wrap;
        height: auto;
        min-height: var(--header-height);
        padding-top: 8px;
        padding-bottom: 8px;
    }
    .topbar-title {
        font-size: 16px;
    }

    /* Page body */
    .page-body {
        padding: 16px;
    }

    /* Stats: 2 columns on tablet/phablet */
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    /* Layout grids → single column */
    .layout-with-sidebar,
    .form-grid,
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    /* Card header wraps */
    .card-header {
        flex-wrap: wrap;
    }

    /* Hide less important table columns */
    .table-hide-mobile {
        display: none;
    }

    /* Doc action buttons — single-row horizontal scroll on mobile */
    .doc-actions {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 6px;
        padding-bottom: 4px;
    }
    .doc-actions .btn { flex-shrink: 0; }

    /* Tables scroll within their container */
    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }

    /* Reduce table font on small screens */
    table { font-size: 12px; }
    thead th, tbody td { padding: 8px; }

    /* ── Document preview A4 scaling ──
       The JS in show.blade.php scales .doc-preview to fit the viewport
       while preserving A4-like positioning. These rules support that. */
    .doc-preview-scaler {
        position: relative;
        overflow: hidden;
    }
    .doc-preview {
        /* JS sets width/transform dynamically */
        transform-origin: top left;
    }

    /* Make table-responsive scroll properly in document cards */
    .card .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* =============================================
   Responsive — Small phone (≤ 480px)
   ============================================= */

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .page-body {
        padding: 12px;
    }

    /* Stack topbar right items tighter */
    .topbar-right .user-name {
        display: none;
    }

    .btn {
        padding: 8px 12px;
        font-size: 13px;
    }

    .btn-sm {
        padding: 6px 10px;
        font-size: 11px;
    }
}

/* =============================================
   Taxes page layout
   ============================================= */

.taxes-layout {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    gap: 20px;
    align-items: start;
}

/* Grid items must have min-width:0 so overflow-x:auto works inside them */
.taxes-form-card,
.taxes-table-card {
    min-width: 0;
}

/* On desktop: form on the right, table on the left */
@media (min-width: 768px) {
    .taxes-layout {
        grid-template-columns: 1fr 380px;
        grid-template-rows: auto;
    }
    .taxes-form-card { order: 2; }
    .taxes-table-card { order: 1; }
}

/* =============================================
   Hamburger button & collapsible sidebar
   ============================================= */

/* Always-visible hamburger (replaces mobile-only .sidebar-toggle) */
.hamburger {
    display: flex;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 8px;
    border: none;
    background: transparent;
    border-radius: 6px;
    transition: background 0.15s;
    flex-shrink: 0;
}
.hamburger:hover { background: #f1f5f9; }
.hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.25s, opacity 0.25s;
}

/* ── Desktop (≥ 1024px): collapse sidebar to icon-only ── */
@media (min-width: 1024px) {
    .sidebar { transition: width 0.25s ease, transform 0.25s ease; }

    .sidebar.collapsed {
        width: 64px;
        overflow: hidden;
    }
    /* font-size:0 hides raw text nodes (text labels are not elements, so *:not(svg) won't reach them) */
    .sidebar.collapsed .nav-item {
        justify-content: center;
        padding: 10px 0;
        gap: 0;
        font-size: 0;
    }
    /* Hide any inline spans (e.g. START HERE badge) — they carry explicit font-size
       so font-size:0 on the parent doesn't suppress them */
    .sidebar.collapsed .nav-item > span {
        display: none;
    }
    /* Keep SVG icons at their natural size */
    .sidebar.collapsed .nav-item svg {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }
    .sidebar.collapsed .nav-item.active {
        background: rgba(37,99,235,0.8);
        border-radius: 6px;
        margin: 0 4px;
    }
    .sidebar.collapsed .nav-section-label {
        display: none;
    }
    .sidebar.collapsed .sidebar-logo span {
        display: none;
    }
    .sidebar.collapsed .sidebar-logo {
        justify-content: center;
        padding: 16px 8px;
    }
    .main-content { transition: margin-left 0.25s ease; }
    .sidebar.collapsed ~ .main-content { margin-left: 64px; }
}

/* ── Mobile/tablet (< 1024px): overlay behaviour ── */
@media (max-width: 1023px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width) !important;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0,0,0,0.3);
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.45);
        z-index: 199;
    }
    .sidebar-overlay.visible { display: block; }
    .main-content { margin-left: 0 !important; }
}

/* =============================================
   Empty State
   ============================================= */

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state svg { width: 28px; height: 28px; opacity: 0.25; margin-bottom: 12px; }
.empty-state h3  { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.empty-state p   { font-size: 12px; margin-bottom: 16px; }
