/* ═══════════════════════════════════════════════════
   AITS Purchase Portal — App Layout & Dashboard Styles
   Light / Dark mode via data-theme on <html>
   ═══════════════════════════════════════════════════ */

/* ── Public layout ── */
.public-content {
    width: 100%;
}

/* ── App shell ── */
.app-layout {
    display: flex;
    min-height: 100vh;
    background: var(--bg);
    transition: background 0.3s ease;
    --sidebar-w: 200px;
}

/* ── Sidebar ── */
.sidebar {
    width: 200px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px 12px 12px;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 260;
    transition: width 0.25s ease, background 0.3s ease, border-color 0.3s ease;
    overflow: hidden;
}

/* Nav area = scrollable list + arrows, takes all free vertical space */
.nav-area {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* The actual scrollable body inside nav-area */
.nav-scroll-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
}
.nav-scroll-body::-webkit-scrollbar { display: none; }

/* Collapsed state */
.app-layout.sidebar-collapsed {
    --sidebar-w: 80px;
}
.app-layout.sidebar-collapsed .sidebar {
    width: 80px;
}

/* Push main content */
.main-content {
    margin-left: 200px;
    transition: margin-left 0.25s ease;
}

.app-layout.sidebar-collapsed .main-content {
    margin-left: 80px;
}

/* ── Sidebar toggle button ── */
.sidebar-toggle {
    position: absolute;
    top: 16px;
    right: -14px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 270;
    transition: background var(--transition), color var(--transition), box-shadow var(--transition);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    flex-shrink: 0;
}

    .sidebar-toggle:hover {
        background: var(--accent);
        color: #fff;
        border-color: var(--accent);
    }

/* ── Brand ── */
.sidebar-brand {
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-primary);
    padding: 4px 8px 14px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 6px;
    line-height: 1.5;
    white-space: normal;
    word-break: break-word;
    overflow: hidden;
    min-height: 36px;
}

    .sidebar-brand .accent {
        color: var(--accent);
    }

.brand-full {
    display: block;
}

.brand-accent {
    color: var(--accent);
}

.brand-short {
    display: none;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 1px;
    text-align: center;
}

.app-layout.sidebar-collapsed .brand-full {
    display: none;
}

.app-layout.sidebar-collapsed .brand-short {
    display: block;
}

.app-layout.sidebar-collapsed .sidebar-brand {
    text-align: center;
    padding: 8px 4px 24px;
}

/* ── Nav labels — hide text when sidebar collapsed (icons remain) ── */
.nav-label {
    transition: opacity 0.2s ease, max-width 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    max-width: 200px;
}

.app-layout.sidebar-collapsed .nav-label {
    opacity: 0;
    max-width: 0;
    pointer-events: none;
}

/* ── Nav links ── */
.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0;
    margin: 0 0 4px 0;
    overflow: visible;
}

/* ── Scroll arrow buttons ── */
.nav-scroll-btn {
    width: 100%;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-subtle);
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s, color .15s;
    border-radius: 4px;
}
.nav-scroll-btn.visible {
    opacity: 1;
    pointer-events: all;
}
.nav-scroll-btn.visible:hover {
    color: var(--accent);
}
.app-layout.sidebar-collapsed .nav-scroll-btn { display: none; }

/* ── Section labels ── */
.nav-section-label {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #8888aa;
    padding: 10px 10px 3px;
    white-space: nowrap;
    overflow: hidden;
    line-height: 1;
    background: var(--surface);
    /* NOT inside the scroll container, so no sticky needed */
}

/* When collapsed — hide section labels */
.app-layout.sidebar-collapsed .nav-section-label {
    display: none;
}

[data-theme="light"] .nav-section-label {
    color: #777799;
    background: var(--surface);
}

.nav-section-divider {
    height: 1px;
    background: var(--border);
    margin: 6px 10px 2px;
    flex-shrink: 0;
}
.app-layout.sidebar-collapsed .nav-section-divider { margin: 6px 16px; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
    white-space: nowrap;
    overflow: hidden;
}

    .nav-link:hover {
        background: var(--surface-2);
        color: var(--text-primary);
    }

    .nav-link.active {
        background: rgba(124,106,247,0.12);
        color: var(--accent);
    }

.app-layout.sidebar-collapsed .nav-link {
    justify-content: center;
    padding: 8px 0;
}

.app-layout.sidebar-collapsed .user-chip {
    justify-content: center;
}

.app-layout.sidebar-collapsed .btn-signout {
    justify-content: center;
    padding: 10px 0;
}

.app-layout.sidebar-collapsed .theme-toggle-label {
    justify-content: center;
}

.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0.75;
}

.nav-link:hover .nav-icon,
.nav-link.active .nav-icon {
    opacity: 1;
}

/* ── Sidebar footer ── */
.sidebar-footer {
    border-top: 1px solid var(--border);
    padding-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

/* Theme button row (no slider) */
.theme-icon-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    background: transparent;
    border: none;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 12px;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
    white-space: nowrap;
    overflow: hidden;
}
.theme-icon-row:hover { background: var(--surface-2); color: var(--text-primary); }
.footer-icon { font-size: 15px; flex-shrink: 0; }

/* Pill toggle (replaces old ON/OFF badge) */
.theme-pill-toggle {
    margin-left: auto;
    flex-shrink: 0;
    width: 36px;
    height: 20px;
    border-radius: 999px;
    background: var(--surface-3, #2a2a3a);
    border: 1px solid var(--border);
    position: relative;
    transition: background 0.25s, border-color 0.25s;
    display: inline-flex;
    align-items: center;
}
.theme-pill-toggle.active {
    background: var(--accent);
    border-color: var(--accent);
}
.theme-pill-knob {
    position: absolute;
    left: 3px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.25s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.theme-pill-toggle.active .theme-pill-knob {
    transform: translateX(16px);
}

/* Theme icon button (collapsed sidebar or mini footer) */
.theme-icon-btn {
    background: transparent;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
}
.theme-icon-btn:hover { background: var(--surface-2); }

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 8px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    overflow: hidden;
    white-space: nowrap;
}

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #b8a9ff);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.user-avatar--sm {
    width: 26px;
    height: 26px;
    font-size: 11px;
}

.user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 10px;
    color: var(--text-subtle);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-signout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 7px 10px;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    overflow: hidden;
}

.btn-signout:hover {
    background: rgba(239,75,108,0.08);
    border-color: rgba(239,75,108,0.3);
    color: var(--danger);
}

.app-layout.sidebar-collapsed .user-chip { justify-content: center; }
.app-layout.sidebar-collapsed .btn-signout { justify-content: center; padding: 8px 0; }

/* ── Sidebar footer: version / copyright ──
   A single quiet "status line": a slow-pulsing accent dot (like a live
   system indicator) + version + copyright, separated by a middot.
   Collapses to just the pulsing dot when the sidebar is collapsed. */
.sidebar-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 4px 2px;
    margin-top: 4px;
    border-top: 1px solid var(--border);
    cursor: default;
}
.sidebar-meta-pulse {
    position: relative;
    flex-shrink: 0;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 0 var(--accent-glow, rgba(124,106,247,.5));
    animation: sidebarMetaPulse 2.6s ease-out infinite;
}
@keyframes sidebarMetaPulse {
    0%   { box-shadow: 0 0 0 0 var(--accent-glow, rgba(124,106,247,.55)); }
    70%  { box-shadow: 0 0 0 6px rgba(124,106,247,0); }
    100% { box-shadow: 0 0 0 0 rgba(124,106,247,0); }
}
.sidebar-meta-text {
    display: flex;
    align-items: baseline;
    gap: 5px;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
}
.sidebar-meta-version {
    flex-shrink: 0;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .3px;
    color: var(--text-secondary, var(--text-muted));
}
.sidebar-meta-dot {
    flex-shrink: 0;
    color: var(--text-subtle);
}
.sidebar-meta-copyright {
    font-size: 10.5px;
    color: var(--text-subtle);
    overflow: hidden;
    text-overflow: ellipsis;
}
.app-layout.sidebar-collapsed .sidebar-meta {
    justify-content: center;
    padding: 10px 0 2px;
}

/* ── Mobile overlay ── */
.sidebar-overlay {
    display: none;
}

/* ── Main content (margin set by sidebar width above) ── */
.main-content {
    flex: 1;
    padding: 40px 28px;
    overflow-y: auto;
    min-height: 100vh;
}

/* ── Page header ── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 36px;
}

.page-eyebrow {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 4px;
}

.page-title {
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}

.header-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 6px var(--success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

/* ── Welcome banner ── */
.user-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px 24px;
    margin-bottom: 16px;
}

.user-banner-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.profile-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #b8a9ff);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    font-family: var(--font-display);
    flex-shrink: 0;
}

.banner-name {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 2px;
}

.banner-sub {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}

.banner-meta {
    text-align: right;
    font-size: 13px;
    color: var(--text-muted);
}

.banner-id {
    color: var(--text-subtle);
    margin-top: 4px;
}

/* ── Stats grid ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: border-color var(--transition), transform var(--transition);
}

    .stat-card:hover {
        border-color: rgba(124,106,247,0.3);
        transform: translateY(-2px);
    }

.stat-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dot-green {
    background: var(--success);
}

.dot-blue {
    background: var(--accent);
}

.stat-value {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── Info card ── */
.info-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px 32px;
    margin-bottom: 24px;
}

.info-card-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    margin: -28px -32px 20px;
}

.info-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 0;
}

/* ── Claims table ── */
.claims-clean-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

    .claims-clean-table tr {
        border-bottom: 1px solid var(--border);
    }

        .claims-clean-table tr:last-child {
            border-bottom: none;
        }

.claim-key {
    padding: 10px 0;
    color: var(--text-muted);
    width: 120px;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.claim-val {
    padding: 10px 0;
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

/* ── Top nav ── */
.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    margin-bottom: 32px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-nav-brand {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-primary);
}

    .top-nav-brand .accent {
        color: var(--accent);
    }

.top-nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.top-nav-link {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
}

    .top-nav-link:hover {
        background: var(--surface-2);
        color: var(--text-primary);
    }

    .top-nav-link.active {
        background: rgba(124,106,247,0.12);
        color: var(--accent);
    }

.top-nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Top nav theme toggle */
.top-theme-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.btn-signout-top {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition);
}

    .btn-signout-top:hover {
        background: rgba(239,75,108,0.08);
        border-color: rgba(239,75,108,0.3);
        color: var(--danger);
    }

/* ── Profile ── */
.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

.profile-avatar-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.profile-name {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.profile-email {
    font-size: 13px;
    color: var(--text-muted);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

    .detail-row:last-of-type {
        border-bottom: none;
    }

.detail-label {
    font-size: 13px;
    color: var(--text-muted);
}

.detail-value {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
}

.badge {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-success {
    background: rgba(45,217,143,0.1);
    color: var(--success);
    border: 1px solid rgba(45,217,143,0.25);
}

.badge-active {
    background: rgba(124,106,247,0.1);
    color: var(--accent);
    border: 1px solid rgba(124,106,247,0.25);
}

.mb-sm {
    margin-bottom: 16px;
}

/* ══════════════════════════════════════════
   GRN PURCHASE LIST — Data Grid
   ══════════════════════════════════════════ */

.grn-page {
    padding: 0;
}

.grn-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.company-tabs {
    display: flex;
    gap: 4px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    padding: 4px;
    border: 1px solid var(--border);
}

.company-tab {
    padding: 8px 18px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    background: transparent;
    color: var(--text-muted);
    transition: all var(--transition);
    font-family: var(--font-body);
}

    .company-tab.active {
        background: var(--accent);
        color: #fff;
        box-shadow: 0 2px 8px var(--accent-glow);
    }

    .company-tab:not(.active):hover {
        background: var(--surface);
        color: var(--text-primary);
    }

.grn-search {
    flex: 1;
    max-width: 320px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 14px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 13px;
    outline: none;
    transition: border-color var(--transition);
}

    .grn-search:focus {
        border-color: var(--border-focus);
    }

    .grn-search::placeholder {
        color: var(--text-subtle);
    }

.grn-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 13px;
    padding: 40px 0;
    justify-content: center;
}

.grn-error {
    background: rgba(239,75,108,0.08);
    border: 1px solid rgba(239,75,108,0.25);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    color: var(--danger);
    font-size: 13px;
    margin-bottom: 16px;
}

/* ── Data Grid Table ── */
.grn-table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
}

.grn-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

    .grn-table thead tr {
        background: var(--surface-2);
        border-bottom: 1px solid var(--border);
    }

    .grn-table th {
        padding: 12px 16px;
        text-align: left;
        font-size: 11px;
        font-weight: 700;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.7px;
        white-space: nowrap;
        cursor: pointer;
        user-select: none;
        transition: color var(--transition);
    }

        .grn-table th:hover {
            color: var(--text-primary);
        }

        .grn-table th.sort-active {
            color: var(--accent);
        }

    .grn-table tbody tr {
        border-bottom: 1px solid var(--border);
        transition: background var(--transition);
    }

        .grn-table tbody tr:last-child {
            border-bottom: none;
        }

        .grn-table tbody tr:hover {
            background: var(--surface-2);
        }

    .grn-table td {
        padding: 13px 16px;
        color: var(--text-primary);
        vertical-align: middle;
    }

.grn-company-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

    .grn-company-badge.company-a {
        background: rgba(124,106,247,0.12);
        color: var(--accent);
        border: 1px solid rgba(124,106,247,0.25);
    }

    .grn-company-badge.company-b {
        background: rgba(45,217,143,0.1);
        color: var(--success);
        border: 1px solid rgba(45,217,143,0.25);
    }

.grn-no-badge {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 600;
}

.grn-date {
    color: var(--text-muted);
    font-size: 12px;
}

.grn-supplier {
    font-weight: 500;
    color: var(--text-primary);
}

.grn-item {
    color: var(--text-muted);
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-view {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    background: rgba(124,106,247,0.1);
    border: 1px solid rgba(124,106,247,0.3);
    border-radius: 6px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-body);
    transition: all var(--transition);
}

    .btn-view:hover {
        background: var(--accent);
        color: #fff;
        border-color: var(--accent);
    }

/* ── Clickable table rows ── */
.row-clickable {
    cursor: pointer;
}

.row-clickable:hover td {
    background: rgba(124,106,247,0.06) !important;
}

.row-clickable.row-new:hover td:first-child {
    border-left-color: var(--accent);
}

/* Action badge inside clickable row — replaces btn-view */
.btn-row-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    pointer-events: none;
    transition: all var(--transition);
}

.btn-row-fill {
    background: rgba(124,106,247,0.12);
    color: var(--accent);
    border: 1px solid rgba(124,106,247,0.3);
    font-size: 14px;
}

.row-clickable:hover .btn-row-fill {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.btn-row-view {
    background: rgba(16,185,129,0.1);
    color: #10b981;
    border: 1px solid rgba(16,185,129,0.25);
}

.row-clickable:hover .btn-row-view {
    background: #10b981;
    color: #fff;
    border-color: #10b981;
}

/* ── Update button (shown on existing records) ── */
.btn-update {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 28px;
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font-body);
    transition: all var(--transition);
    box-shadow: 0 4px 14px rgba(14,165,233,0.35);
}

    .btn-update:hover:not(:disabled) {
        background: linear-gradient(135deg, #0284c7, #0369a1);
        box-shadow: 0 6px 20px rgba(14,165,233,0.45);
        transform: translateY(-1px);
    }

    .btn-update:disabled {
        opacity: 0.6;
        cursor: not-allowed;
        transform: none;
    }

.grn-empty {
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

.grn-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
    background: var(--surface-2);
}

.grn-pagination {
    display: flex;
    align-items: center;
    gap: 6px;
}

.page-btn {
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    font-family: var(--font-body);
    transition: all var(--transition);
}

    .page-btn:hover:not(:disabled) {
        border-color: var(--accent);
        color: var(--accent);
    }

    .page-btn.active {
        background: var(--accent);
        color: #fff;
        border-color: var(--accent);
    }

    .page-btn:disabled {
        opacity: 0.4;
        cursor: not-allowed;
    }

/* ── Responsive ── */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        width: 200px !important;
        box-shadow: 4px 0 24px rgba(0,0,0,0.25);
    }

    .app-layout:not(.sidebar-collapsed) .sidebar {
        transform: translateX(0);
    }

    .app-layout:not(.sidebar-collapsed) .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.45);
        z-index: 199;
    }

    .app-layout.sidebar-collapsed .nav-label {
        opacity: 1;
        width: auto;
        pointer-events: auto;
    }

    .app-layout.sidebar-collapsed .brand-full {
        display: block;
    }

    .app-layout.sidebar-collapsed .brand-short {
        display: none;
    }

    .main-content,
    .app-layout.sidebar-collapsed .main-content {
        margin-left: 0;
        padding: 24px 20px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .profile-grid {
        grid-template-columns: 1fr;
    }

    .sidebar-toggle {
        position: fixed;
        top: 14px;
        left: 14px;
        right: auto;
        z-index: 280;
        box-shadow: 0 2px 12px rgba(0,0,0,0.2);
    }

    .app-layout:not(.sidebar-collapsed) .sidebar-toggle {
        left: 204px;
    }
}

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

/* ══════════════════════════════════════════
   PURCHASE DETAIL — IT Inventory Form
   ══════════════════════════════════════════ */

.detail-page {
    padding: 0 48px 56px;
}

/* ── Breadcrumb navigation ── */
.breadcrumb-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    font-size: 13px;
}

.breadcrumb-link {
    color: var(--accent);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: opacity var(--transition);
}

    .breadcrumb-link:hover {
        opacity: 0.75;
        text-decoration: underline;
    }

.breadcrumb-sep {
    color: var(--text-muted, #888);
    font-size: 14px;
    line-height: 1;
}

.breadcrumb-current {
    color: var(--text-muted, #888);
    font-weight: 500;
}

.detail-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
}

.detail-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 32px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}

.detail-title {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 4px;
}

.itgrn-badge {
    font-size: 14px;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 18px;
}

    .itgrn-badge strong {
        color: var(--accent);
    }

/* ── Form sections ── */
.form-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent);
    padding: 20px 32px 10px;
}

.form-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

/* ── Detail rows (label : value) ── */
.detail-grid {
    padding: 4px 32px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.drow {
    display: flex;
    align-items: center;
    gap: 0;
    min-height: 38px;
}

.dlabel {
    width: 200px;
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.dsep {
    width: 24px;
    color: var(--text-subtle);
    font-weight: 600;
    flex-shrink: 0;
}

.dvalue {
    flex: 1;
}

.readonly-val {
    font-size: 13px;
    color: var(--text-primary);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 7px 12px;
    display: inline-block;
    min-width: 200px;
}

.item-desc {
    font-size: 12px;
    max-width: 600px;
    white-space: normal;
    line-height: 1.4;
}

.expired-val {
    color: var(--danger);
    border-color: rgba(239,75,108,0.3);
}

/* ── Form inputs inside detail rows ── */
.dvalue .form-input,
.dvalue .form-select {
    max-width: 360px;
    padding: 8px 12px;
    font-size: 13px;
    background: var(--input-bg, var(--surface-2));
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    outline: none;
    width: 100%;
    font-family: var(--font-body);
    transition: border-color var(--transition);
}

    .dvalue .form-input:focus,
    .dvalue .form-select:focus {
        border-color: var(--border-focus);
        box-shadow: 0 0 0 3px var(--accent-glow);
    }

/* ── Radio group ── */
.radio-group {
    display: flex;
    gap: 24px;
    align-items: center;
    font-size: 13px;
    color: var(--text-primary);
}

    .radio-group label {
        display: flex;
        align-items: center;
        gap: 6px;
        cursor: pointer;
    }

    .radio-group input[type="radio"] {
        accent-color: var(--accent);
        width: 15px;
        height: 15px;
    }

/* ── Search row ── */
.search-row {
    display: flex;
    gap: 10px;
    align-items: center;
    max-width: 440px;
}

    .search-row .form-input {
        flex: 1;
    }

.btn-search {
    padding: 8px 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    font-family: var(--font-body);
    white-space: nowrap;
    transition: all var(--transition);
}

    .btn-search:hover {
        border-color: var(--accent);
        color: var(--accent);
    }

/* ── Sub-item warranty table ── */
.sub-table-wrap {
    margin: 0 32px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.sub-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

    .sub-table thead tr {
        background: var(--surface-2);
        border-bottom: 1px solid var(--border);
    }

    .sub-table th {
        padding: 10px 14px;
        font-size: 11px;
        font-weight: 700;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.5px;
        text-align: left;
    }

    .sub-table tbody tr {
        border-bottom: 1px solid var(--border);
    }

        .sub-table tbody tr:last-child {
            border-bottom: none;
        }

        .sub-table tbody tr:hover {
            background: var(--surface-2);
        }

    .sub-table td {
        padding: 8px 10px;
        vertical-align: middle;
    }

    .sub-table .form-input,
    .sub-table .form-select {
        width: 100%;
        padding: 7px 10px;
        font-size: 12px;
        background: var(--input-bg, var(--surface));
        border: 1px solid var(--border);
        border-radius: 6px;
        color: var(--text-primary);
        outline: none;
        font-family: var(--font-body);
        max-width: unset;
        transition: border-color var(--transition);
    }

        .sub-table .form-input:focus,
        .sub-table .form-select:focus {
            border-color: var(--border-focus);
        }

    .sub-table td.expiry-cell {
        vertical-align: middle;
    }

    .sub-table .readonly-val {
        font-size: 12px;
        border: none;
        background: transparent;
        min-width: 100px;
        padding: 7px 10px;
        display: flex;
        align-items: center;
        min-height: 32px;
        line-height: 1;
    }

.btn-remove-row {
    background: rgba(239,75,108,0.08);
    border: 1px solid rgba(239,75,108,0.25);
    color: var(--danger);
    border-radius: 6px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 12px;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

    .btn-remove-row:hover {
        background: var(--danger);
        color: #fff;
    }

.btn-add-row {
    margin: 0 32px 4px;
    padding: 8px 18px;
    background: rgba(59,130,246,0.1);
    border: 1px solid rgba(59,130,246,0.3);
    border-radius: var(--radius-sm);
    color: #3b82f6;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-body);
    transition: all var(--transition);
}

    .btn-add-row:hover {
        background: #3b82f6;
        color: #fff;
    }

/* ── Bottom action buttons ── */
.detail-btn-group {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 32px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
}

.btn-save {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 28px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity var(--transition), transform var(--transition);
}

    .btn-save:hover:not(:disabled) {
        opacity: 0.88;
        transform: translateY(-1px);
    }

    .btn-save:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

.btn-clear {
    padding: 10px 24px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition);
}

    .btn-clear:hover {
        background: rgba(239,75,108,0.08);
        border-color: rgba(239,75,108,0.3);
        color: var(--danger);
    }

@media (max-width: 900px) {
    .detail-page {
        padding: 0 16px 40px;
    }

    .detail-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .drow {
        flex-wrap: wrap;
    }

    .dlabel {
        width: 140px;
    }

    .dvalue .form-input, .dvalue .form-select {
        max-width: 100%;
    }
}

/* ═══════════════════════════════════════════════════════════════
   DASHBOARD
   ═══════════════════════════════════════════════════════════════ */

.dash-page {
    padding: 0 48px 64px;
    max-width: 1400px;
}

/* ── Section eyebrow label ── */
.section-eyebrow {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin: 0 0 12px;
}

/* ── Per-company summary cards ── */
.company-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.company-summary-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    transition: box-shadow var(--transition);
}

    .company-summary-card:hover {
        box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    }

.company-summary-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.company-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent), #b8a9ff);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    flex-shrink: 0;
}

.company-name-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.company-summary-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.cs-stat {
    text-align: center;
}

.cs-stat-value {
    font-size: clamp(14px, 1.4vw, 20px);
    font-weight: 700;
    font-family: 'Space Grotesk', sans-serif;
    color: var(--text-primary);
    line-height: 1;
    margin: 0 0 4px;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cs-stat-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin: 0;
}

.cs-new {
    color: #f59e0b;
}

.cs-done {
    color: #10b981;
}

.cs-val {
    color: #06b6d4;
    font-size: 18px;
}

/* ── Company tag in notification rows ── */
.notif-company-tag {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(124,106,247,0.12);
    color: var(--accent);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
    vertical-align: middle;
}

.dash-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 28px;
}

.dash-header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-greeting {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 14px;
}

.profile-avatar-sm {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
}

/* ── KPI cards ── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.kpi-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 14px;
    cursor: default;
    transition: transform var(--transition), box-shadow var(--transition);
    overflow: hidden;
}

    .kpi-card::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 4px;
        border-radius: 4px 0 0 4px;
    }

.kpi-new::before {
    background: #f59e0b;
}

.kpi-done::before {
    background: #10b981;
}

.kpi-total::before {
    background: #6366f1;
}

.kpi-value::before {
    background: #06b6d4;
}

.kpi-warranty::before {
    background: #8b5cf6;
}

.kpi-warning::before {
    background: #ef4444;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.kpi-new {
    cursor: pointer;
}

.kpi-icon {
    font-size: 22px;
    flex-shrink: 0;
}

.kpi-body {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.kpi-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kpi-value {
    font-size: clamp(16px, 1.6vw, 22px);
    font-weight: 700;
    color: var(--text);
    font-family: 'Space Grotesk', sans-serif;
    line-height: 1;
    margin: 0 0 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: -0.02em;
}

.kpi-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin: 0;
}

.kpi-alert-dot {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #f59e0b;
    animation: pulse-dot 1.5s infinite;
}

.kpi-alert-warn {
    background: #ef4444;
}

@keyframes pulse-dot {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: .6;
        transform: scale(1.3);
    }
}

/* ── Dashboard loading ── */
.dash-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 80px 0;
    color: var(--text-muted);
}

/* ── Content grid ── */
.dash-content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

.dash-left, .dash-right {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ── Dashboard cards ── */
.dash-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.dash-card-warn {
    border-color: rgba(239,68,68,0.35);
    background: color-mix(in srgb, var(--surface) 96%, #ef4444 4%);
}

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

.dash-card-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dash-link {
    font-size: 12px;
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

    .dash-link:hover {
        text-decoration: underline;
    }

.notif-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #f59e0b;
    color: #000;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
}

/* ── Notification list ── */
.notif-list {
    padding: 8px 0;
    max-height: 360px;
    overflow-y: auto;
}

.notif-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    cursor: pointer;
    transition: background var(--transition);
    border-bottom: 1px solid var(--border);
}

    .notif-item:last-child {
        border-bottom: none;
    }

    .notif-item:hover {
        background: var(--surface-2);
    }

.notif-new {
    border-left: 3px solid #f59e0b;
}

.notif-done {
    border-left: 3px solid #10b981;
}

.notif-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dot-orange {
    background: #f59e0b;
}

.dot-green {
    background: #10b981;
}

.notif-body {
    flex: 1;
    min-width: 0;
}

.notif-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-right {
    flex-shrink: 0;
}

/* ── Status badges ── */
.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
}

.status-new {
    background: rgba(245,158,11,.15);
    color: #f59e0b;
}

.status-done {
    background: rgba(16,185,129,.15);
    color: #10b981;
}

/* ── Warranty list ── */
.warranty-list {
    padding: 8px 0;
}

.warranty-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

    .warranty-item:last-child {
        border-bottom: none;
    }

    .warranty-item:hover {
        background: var(--surface-2);
    }

.warranty-urgent {
    background: rgba(239,68,68,.06);
}

    .warranty-urgent:hover {
        background: rgba(239,68,68,.10);
    }

.warranty-info {
    flex: 1;
    min-width: 0;
}

.warranty-item-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 3px;
}

.warranty-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin: 0;
}

.warranty-expire {
    text-align: right;
    flex-shrink: 0;
    margin-left: 16px;
}

.expire-date {
    font-size: 12px;
    color: var(--text);
    font-weight: 600;
    margin: 0 0 2px;
}

.expire-days {
    font-size: 11px;
    font-weight: 700;
    margin: 0;
}

.days-warn {
    color: #f59e0b;
}

.days-urgent {
    color: #ef4444;
}

/* ── Empty state ── */
.dash-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 32px 20px;
    color: var(--text-muted);
    font-size: 13px;
}

.empty-icon {
    font-size: 32px;
}

.dash-empty {
    padding: 20px;
    color: var(--text-muted);
    font-size: 13px;
}

/* ── Progress bar ── */
.progress-section {
    padding: 16px 20px 20px;
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.dash-progress-bar {
    height: 12px;
    background: var(--surface-2);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.dash-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #06b6d4);
    border-radius: 8px;
    transition: width 0.8s ease;
    min-width: 4px;
}

.progress-pct {
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
    margin: 8px 0 0;
}

/* ── Supplier bar chart ── */
.supplier-chart {
    padding: 12px 20px 16px;
}

.sup-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.sup-name {
    width: 140px;
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.sup-bar-wrap {
    flex: 1;
    height: 10px;
    background: var(--surface-2);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.sup-bar {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    border-radius: 6px;
    transition: width 0.6s ease;
    min-width: 4px;
}

.sup-count {
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    width: 28px;
    text-align: right;
}

/* ── Category chart ── */
.cat-chart {
    padding: 12px 20px 16px;
}

.cat-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.cat-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.cat-name {
    width: 130px;
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.cat-bar-wrap {
    flex: 1;
    height: 10px;
    background: var(--surface-2);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.cat-bar {
    height: 100%;
    border-radius: 6px;
    transition: width 0.6s ease;
    min-width: 4px;
}

.cat-pct {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    width: 32px;
    text-align: right;
}

/* ── Monthly bar chart ── */
.monthly-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    padding: 16px 20px 12px;
    height: 180px;
    gap: 8px;
}

.month-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    height: 100%;
}

.month-val {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.month-bar-wrap {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: flex-end;
}

.month-bar {
    width: 100%;
    background: linear-gradient(180deg, #6366f1, #8b5cf6);
    border-radius: 4px 4px 0 0;
    min-height: 4px;
    transition: height 0.6s ease;
}

.month-label {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 6px;
    white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════
   PURCHASES PAGE — Filter bar + row status styles
   ═══════════════════════════════════════════════════════════════ */

.grn-filter-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}

.filter-toggle-group {
    display: flex;
    gap: 8px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

    .filter-chip:hover {
        border-color: var(--accent);
        color: var(--text);
    }

    .filter-chip.active {
        background: var(--accent);
        border-color: var(--accent);
        color: #fff;
    }

.chip-badge {
    display: inline-block;
    padding: 1px 7px;
    background: #f59e0b;
    color: #000;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 800;
}

.filter-date-range {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-label {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

.grn-date-input {
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text);
    font-size: 13px;
    font-family: var(--font-body);
}

.btn-apply-filter {
    padding: 5px 14px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity var(--transition);
}

    .btn-apply-filter:hover {
        opacity: 0.85;
    }

.btn-clear-filter {
    padding: 5px 14px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition);
}

    .btn-clear-filter:hover {
        border-color: var(--danger);
        color: var(--danger);
    }

/* Row status styling */
.row-completed td {
    opacity: 0.65;
}

    .row-completed td:first-child {
        border-left: 3px solid #10b981;
    }

.row-new td:first-child {
    border-left: 3px solid #f59e0b;
}

.grn-cat {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--surface-2);
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid var(--border);
}

@media (max-width: 1200px) {
    .kpi-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .dash-content-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .dash-page {
        padding: 0 16px 48px;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ── Filter bar fix: keep date range inline ─────────────────────────── */
.grn-filter-bar-inline {
    flex-wrap: nowrap;
    align-items: center;
}

    .grn-filter-bar-inline .filter-toggle-group {
        flex-shrink: 0;
    }

    .grn-filter-bar-inline .filter-date-range {
        flex-shrink: 0;
    }

/* ── Toast notification ──────────────────────────────────────────────── */
.save-toast {
    position: fixed;
    bottom: 32px;
    right: 32px;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 22px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 8px 32px rgba(0,0,0,0.35);
    cursor: pointer;
    animation: toastSlideIn 0.3s ease;
    min-width: 280px;
    max-width: 420px;
}

@keyframes toastSlideIn {
    from {
        transform: translateY(60px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.toast-success {
    background: #10b981;
    color: #fff;
    border: 1px solid #059669;
}

.toast-error {
    background: #ef4444;
    color: #fff;
    border: 1px solid #dc2626;
}

.toast-icon {
    font-size: 18px;
}

.toast-msg {
    flex: 1;
}

.toast-close {
    font-size: 18px;
    opacity: 0.7;
    margin-left: 6px;
}

    .toast-close:hover {
        opacity: 1;
    }

/* ── Mandatory field indicators ──────────────────────────────────────── */
.req-star {
    color: #ef4444;
    font-weight: 800;
    margin-left: 2px;
}

.input-error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 2px rgba(239,68,68,0.2);
}

.field-error {
    display: block;
    color: #ef4444;
    font-size: 11px;
    margin-top: 4px;
    font-weight: 500;
}

/* ── Live inventory search ───────────────────────────────────────────── */
.live-search-wrap {
    position: relative;
    width: 100%;
}

    .live-search-wrap .form-input {
        width: 100%;
    }

.search-spinner {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}

.live-search-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    z-index: 500;
    max-height: 220px;
    overflow-y: auto;
}

.live-search-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

    .live-search-item:last-child {
        border-bottom: none;
    }

    .live-search-item:hover {
        background: var(--surface-2);
    }

.ls-serial {
    font-family: var(--font-mono, monospace);
    font-size: 12px;
    color: var(--accent);
    font-weight: 700;
    white-space: nowrap;
    min-width: 90px;
}

.ls-name {
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.live-search-empty {
    padding: 12px 14px;
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
}

/* ── KPI value: ensure compact formatted values fit cleanly ───── */
.kpi-value {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Collapsed sidebar: icon-only theme toggle button ────────────── */
.theme-icon-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    transition: background 0.15s, border-color 0.15s;
    color: inherit;
}

    .theme-icon-btn:hover {
        background: var(--surface-hover, rgba(255,255,255,0.08));
        border-color: var(--accent);
    }

/* ═══════════════════════════════════════════════════════════════════
   WARRANTY REPLACEMENT PAGE
   ═══════════════════════════════════════════════════════════════════ */

/* ── Page layout ──────────────────────────────────────────────────── */
.warranty-page {
    padding: 0 48px 48px;
}

/* ── Device search bar ────────────────────────────────────────────── */
.warranty-search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 16px;
}

.warranty-search-bar .form-input {
    flex: 1;
    background: transparent;
    border: none;
    box-shadow: none;
    font-size: 14px;
    padding: 4px 0;
}

.warranty-search-bar .form-input:focus {
    outline: none;
    box-shadow: none;
    border: none;
}

.warranty-search-icon {
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

/* ── Device info card ─────────────────────────────────────────────── */
.warranty-device-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 28px;
    margin-bottom: 24px;
}

.warranty-section-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.warranty-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.warranty-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 32px;
}

.warranty-drow {
    display: flex;
    align-items: baseline;
    gap: 0;
    font-size: 13.5px;
}

.warranty-dlabel {
    width: 160px;
    font-weight: 600;
    color: var(--text-muted);
    flex-shrink: 0;
    font-size: 12.5px;
}

.warranty-dsep {
    width: 20px;
    text-align: center;
    color: var(--text-muted);
    flex-shrink: 0;
}

.warranty-dvalue {
    color: var(--text-primary);
    flex: 1;
}

/* ── Linked sub-items strip ────────────────────────────────────────── */
.linked-items-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.linked-item-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition);
    user-select: none;
}

.linked-item-chip:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.linked-item-chip.selected {
    background: rgba(124,106,247,0.12);
    border-color: var(--accent);
    color: var(--accent);
}

.linked-chip-serial {
    font-family: var(--font-mono, monospace);
    font-size: 10px;
    opacity: 0.7;
}

/* ── Replacement form card ─────────────────────────────────────────── */
.warranty-form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 28px;
    margin-bottom: 24px;
}

.warranty-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px 32px;
}

.warranty-form-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.warranty-form-row.full-width {
    grid-column: 1 / -1;
}

.warranty-form-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.warranty-readonly-val {
    font-size: 13.5px;
    color: var(--text-primary);
    padding: 8px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    min-height: 36px;
    display: flex;
    align-items: center;
}

/* ── Warning / expiry badge ────────────────────────────────────────── */
.warranty-expired-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    background: rgba(239,68,68,0.12);
    color: #ef4444;
    border: 1px solid rgba(239,68,68,0.3);
    margin-left: 8px;
}

.warranty-none-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    background: rgba(120,120,140,0.10);
    color: var(--text-muted);
    border: 1px solid rgba(120,120,140,0.25);
}

.warranty-valid-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    background: rgba(16,185,129,0.1);
    color: #10b981;
    border: 1px solid rgba(16,185,129,0.25);
    margin-left: 8px;
}

/* ── Divider ───────────────────────────────────────────────────────── */
.warranty-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 24px 0;
}

/* ── Action buttons ────────────────────────────────────────────────── */
.warranty-btn-group {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
}

/* ── History popup modal ───────────────────────────────────────────── */
.warranty-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.warranty-modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: min(860px, 92vw);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 64px rgba(0,0,0,0.4);
    animation: modalSlideUp 0.25s ease;
}

@keyframes modalSlideUp {
    from { transform: translateY(24px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.warranty-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
}

.warranty-modal-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.warranty-modal-close {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.warranty-modal-close:hover {
    color: var(--text-primary);
    border-color: var(--accent);
}

.warranty-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

/* ── History table ─────────────────────────────────────────────────── */
.warranty-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.warranty-history-table th {
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 9px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.warranty-history-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: middle;
}

.warranty-history-table tr:last-child td {
    border-bottom: none;
}

.warranty-history-table tr:hover td {
    background: var(--surface-2);
}

.wh-reason-pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(239,68,68,0.1);
    color: #ef4444;
    border: 1px solid rgba(239,68,68,0.25);
}

.wh-item-badge {
    font-family: var(--font-mono, monospace);
    font-size: 11px;
    color: var(--accent);
    font-weight: 700;
}

/* ── Empty states ──────────────────────────────────────────────────── */
.warranty-empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
    font-size: 14px;
}

.warranty-placeholder {
    text-align: center;
    padding: 64px 24px;
    color: var(--text-muted);
}

.warranty-placeholder-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.4;
}

.warranty-placeholder p {
    font-size: 14px;
    margin: 0;
}

/* ── History button on search bar ──────────────────────────────────── */
.btn-warranty-history {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 700;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-primary);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition);
}

.btn-warranty-history:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-warranty-history:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════════════════════
   WARRANTY REPLACEMENT — FIXES
   ═══════════════════════════════════════════════════════════════════ */

/* ── Inventory status badges in live-search dropdown ─────────────── */
.inv-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
    border: 1px solid;
    flex-shrink: 0;
}

.inv-status-new {
    background: rgba(45,217,143,0.1);
    color: var(--success, #2dd98f);
    border-color: rgba(45,217,143,0.3);
}

.inv-status-completed {
    background: rgba(124,106,247,0.1);
    color: var(--accent, #7c6af7);
    border-color: rgba(124,106,247,0.28);
}

/* ── Item type label in search results ───────────────────────────── */
.ls-item-type {
    font-size: 11px;
    color: var(--text-muted);
}

/* ── Reason select — fix visual alignment within warranty-form-grid ─ */
.warranty-form-card .form-select {
    width: 100%;
    min-height: 38px;
    padding: 8px 34px 8px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.warranty-form-card .form-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(124,106,247,0.15);
}

.warranty-form-card .form-select.input-error {
    border-color: var(--danger);
}

/* ── Replacement Date — datetime-local field same style as Search Inventory ── */
.warranty-form-card input[type="datetime-local"].form-input {
    width: 100%;
    min-height: 38px;
    padding: 8px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    color-scheme: dark;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.warranty-form-card input[type="datetime-local"].form-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(124,106,247,0.15);
}

.warranty-form-card input[type="datetime-local"].form-input.input-error {
    border-color: var(--danger);
}

/* ── warranty-search-bar used inside live-search-wrap (no bottom margin) ── */
.live-search-wrap .warranty-search-bar {
    margin-bottom: 0 !important;
    border-radius: var(--radius-sm);
}

/* ── Completed item detail panel ─────────────────────────────────── */
.inv-completed-detail-panel {
    background: rgba(124,106,247,0.06);
    border: 1px solid rgba(124,106,247,0.2);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.inv-completed-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(124,106,247,0.15);
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.inv-completed-detail-grid {
    padding: 12px 16px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 24px;
}

/* ═══════════════════════════════════════════════════════════
   SETTINGS PAGE
   ═══════════════════════════════════════════════════════════ */

.settings-page {
    max-width: 720px;
    margin: 0 auto;
    padding: 24px 16px 48px;
}

.settings-header {
    margin-bottom: 28px;
}

.settings-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 4px 0 0;
}

.settings-card {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 10px);
    margin-bottom: 20px;
    overflow: hidden;
}

.settings-card-future {
    opacity: 0.65;
}

.settings-card-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border);
}

.settings-card-icon {
    font-size: 20px;
    line-height: 1;
    margin-top: 2px;
}

.settings-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.settings-card-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.settings-badge-coming {
    margin-left: auto;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: rgba(124,106,247,0.15);
    color: var(--accent);
    border: 1px solid rgba(124,106,247,0.3);
    border-radius: 20px;
    padding: 3px 10px;
    white-space: nowrap;
    align-self: center;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 16px 20px;
}

.settings-row-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.settings-row-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.settings-row-hint {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.settings-future-note {
    padding: 12px 20px 16px;
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
}

/* ── Toggle switch ── */
.settings-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
}

.settings-toggle input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.settings-toggle-track {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--border);
    border-radius: 12px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.settings-toggle input:checked ~ .settings-toggle-track {
    background: var(--accent);
}

.settings-toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}

.settings-toggle input:checked ~ .settings-toggle-track .settings-toggle-thumb {
    transform: translateX(20px);
}

.settings-toggle-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 22px;
}

.settings-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 4px;
}

/* ── Update-disabled notice (PurchaseDetail) ── */
.update-disabled-notice {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--surface-2);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm, 6px);
    padding: 7px 14px;
    cursor: default;
}

/* ── Warranty Expire: match dropdown width ── */
.warranty-expire-val {
    display: block;
    width: 100%;
    max-width: 360px;
    box-sizing: border-box;
    min-width: unset;
}

/* ── Invoice Date: force yyyy-mm-dd display ── */
.invoice-date-input {
    max-width: 180px;
}

/* Force yyyy-mm-dd date format in Chromium/Edge/Safari */
.invoice-date-input::-webkit-datetime-edit-fields-wrapper {
    direction: ltr;
}
.invoice-date-input::-webkit-datetime-edit-year-field,
.invoice-date-input::-webkit-datetime-edit-month-field,
.invoice-date-input::-webkit-datetime-edit-day-field {
    /* reorder via flex — year first */
}
/* Chromium supports reordering the date parts via the pseudo-element order.
   The most reliable cross-browser approach is to set lang on the input
   which is handled via JS below. CSS alone cannot reorder date parts. */

/* ── Settings: number input (session timeout) ── */
.settings-number-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.settings-number-input {
    width: 80px;
    padding: 7px 10px;
    font-size: 13px;
    background: var(--input-bg, var(--surface-2));
    border: 1px solid var(--border);
    border-radius: var(--radius-sm, 6px);
    color: var(--text-primary);
    outline: none;
    text-align: center;
    font-family: var(--font-body);
    transition: border-color var(--transition);
}

.settings-number-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.settings-number-unit {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ── Flatpickr dark-theme overrides ── */
.flatpickr-calendar {
    background: var(--surface-1, #1a1a2e) !important;
    border: 1px solid var(--border, rgba(255,255,255,0.1)) !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5) !important;
    border-radius: var(--radius-md, 10px) !important;
    font-family: var(--font-body) !important;
}

.flatpickr-calendar.arrowTop::before,
.flatpickr-calendar.arrowTop::after {
    border-bottom-color: var(--border, rgba(255,255,255,0.1)) !important;
}

.flatpickr-months .flatpickr-month,
.flatpickr-weekdays,
span.flatpickr-weekday {
    background: transparent !important;
    color: var(--text-secondary, #888) !important;
}

.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year {
    background: transparent !important;
    color: var(--text-primary, #e0e0e0) !important;
    font-weight: 600;
}

.flatpickr-prev-month svg,
.flatpickr-next-month svg {
    fill: var(--text-secondary, #888) !important;
}

.flatpickr-prev-month:hover svg,
.flatpickr-next-month:hover svg {
    fill: var(--accent, #7c6af7) !important;
}

.flatpickr-day {
    color: var(--text-primary, #e0e0e0) !important;
    border-radius: var(--radius-sm, 6px) !important;
}

.flatpickr-day:hover,
.flatpickr-day.prevMonthDay:hover,
.flatpickr-day.nextMonthDay:hover {
    background: var(--surface-2, rgba(255,255,255,0.06)) !important;
    border-color: transparent !important;
}

.flatpickr-day.selected,
.flatpickr-day.selected:hover {
    background: var(--accent, #7c6af7) !important;
    border-color: var(--accent, #7c6af7) !important;
    color: #fff !important;
}

.flatpickr-day.today:not(.selected) {
    border-color: var(--accent, #7c6af7) !important;
    color: var(--accent, #7c6af7) !important;
}

.flatpickr-day.flatpickr-disabled,
.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay {
    color: var(--text-secondary, #555) !important;
    opacity: 0.4;
}

/* ══════════════════════════════════════════════════════════════
   PAGE HELP BUTTON — appears in every data entry page header
   ══════════════════════════════════════════════════════════════ */
.page-help-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 13px;
    border-radius: var(--radius-sm, 6px);
    border: 1px solid var(--accent, #7c6af7);
    background: transparent;
    color: var(--accent, #7c6af7);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.18s, color 0.18s, box-shadow 0.18s;
    white-space: nowrap;
    flex-shrink: 0;
}
.page-help-btn:hover {
    background: var(--accent, #7c6af7);
    color: #fff;
    box-shadow: 0 0 0 3px rgba(124,106,247,0.18);
}
.page-help-btn svg {
    flex-shrink: 0;
    opacity: 0.9;
}

/* ══ Data Sources – new additions ═══════════════════════════════════════════ */

.ds-user-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: .78rem;
    color: var(--text-subtle);
    background: var(--surface-2);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 14px;
    line-height: 1.5;
}
.ds-user-note svg { flex-shrink: 0; margin-top: 1px; }

.ds-key-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    font-size: .72rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: .04em;
    flex-shrink: 0;
}

.ds-remove-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 5px;
    border-radius: 6px;
    color: var(--text-subtle);
    transition: background .15s, color .15s;
    flex-shrink: 0;
    margin-left: auto;
}
.ds-remove-btn:hover { background: rgba(239,68,68,.12); color: #ef4444; }

.ds-admin-row {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    flex-wrap: wrap;
}
.ds-qtype-col { min-width: 180px; }
.ds-qtype-select {
    width: 100%;
    padding: 9px 13px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-primary);
    font-size: .84rem;
    outline: none;
    transition: border-color .15s;
    color-scheme: dark;
}
.ds-qtype-select option { background: #1e1e2e; color: #e2e0ff; }
.ds-qtype-select option:checked { background: #7c6af7; color: #fff; }
.ds-qtype-select:focus { border-color: var(--accent); }

.ds-admin-save-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 0 4px;
    flex-wrap: wrap;
}

/* ── Confirmation / Add-source modal ───────────────────────────────────────*/
.ds-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(3px);
}
.ds-modal {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px 30px;
    max-width: 520px;
    width: 100%;
    box-shadow: 0 24px 60px rgba(0,0,0,.45);
    animation: ds-modal-in .18s ease;
}
@keyframes ds-modal-in {
    from { opacity:0; transform: translateY(10px) scale(.97); }
    to   { opacity:1; transform: translateY(0)   scale(1); }
}
.ds-modal-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px; height: 52px;
    border-radius: 50%;
    background: rgba(239,68,68,.1);
    margin-bottom: 14px;
}
.ds-modal-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.ds-modal-body {
    font-size: .875rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 22px;
}
.ds-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}
.ds-add-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 16px;
}
.ds-add-error {
    color: #ef4444;
    font-size: .8rem;
    margin-bottom: 12px;
}

/* ── Company tab logo pill ─────────────────────────────────────────────── */
.tab-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px; height: 22px;
    border-radius: 6px;
    color: #fff;
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .03em;
    flex-shrink: 0;
    margin-right: 2px;
}

/* ── No-company banner (Purchases) ──────────────────────────────────────── */
.company-tab-disabled-msg {
    font-size: .82rem;
    color: var(--text-subtle);
    padding: 6px 12px;
    font-style: italic;
    align-self: center;
}
.company-tab-disabled-msg a { color: var(--accent); text-decoration: underline; }

/* ══════════════════════════════════════════════════════════════════════════
   COMPANY / DATA SOURCE LOGO
   ══════════════════════════════════════════════════════════════════════════ */

/* Used in Dashboard cards and Purchases tabs */
.company-logo,
.ds-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 10px;
    border-radius: 12px;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    flex-shrink: 0;
    user-select: none;
    position: relative;
    overflow: hidden;
}
/* Shine shimmer overlay */
.company-logo::after,
.ds-logo::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,rgba(255,255,255,.22) 0%,transparent 55%);
    border-radius: inherit;
    pointer-events: none;
}

/* Purchases tab mini logo */
.tab-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    color: #fff;
    font-size: .63rem;
    font-weight: 800;
    letter-spacing: .04em;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}
.tab-logo::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,rgba(255,255,255,.2) 0%,transparent 55%);
    border-radius: inherit;
}


/* ══════════════════════════════════════════════════════════════════════════
   SETTINGS — DATA SOURCES SECTION (full redesign)
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Source card ──────────────────────────────────────────────────────────── */
.ds-card {
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    margin-bottom: 10px;
    overflow: hidden;
    transition: border-color .2s, box-shadow .2s;
}
.ds-card--on {
    border-color: rgba(124,106,247,.3);
    box-shadow: 0 0 0 1px rgba(124,106,247,.08), 0 2px 12px rgba(0,0,0,.18);
}
.ds-card--off {
    opacity: .65;
    border-color: var(--border);
}

/* card top row */
.ds-card-top {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px 10px;
    flex-wrap: wrap;
}
.ds-card-toggle { flex-shrink: 0; }

.ds-logo {
    width: 46px;
    height: 46px;
    border-radius: 13px;
    font-size: 13px;
    font-weight: 900;
    box-shadow: 0 4px 14px rgba(0,0,0,.28);
    flex-shrink: 0;
}

.ds-card-identity {
    flex: 1;
    min-width: 140px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.ds-name-input {
    background: transparent;
    border: none;
    border-bottom: 1px solid transparent;
    color: var(--text-primary);
    font-size: .93rem;
    font-weight: 700;
    padding: 2px 0;
    outline: none;
    width: 100%;
    transition: border-color .15s;
    font-family: var(--font-body, inherit);
}
.ds-name-input:focus { border-bottom-color: var(--accent); }
.ds-name-input::placeholder { color: var(--text-subtle); font-weight: 400; }

.ds-card-meta {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}
.ds-key-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(255,255,255,.06);
    border: 1px solid var(--border);
    font-size: .7rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: .06em;
    text-transform: uppercase;
}
.ds-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 600;
}
.ds-pill--on  {
    background: rgba(52,211,153,.12);
    color: #34d399;
    border: 1px solid rgba(52,211,153,.25);
}
.ds-pill--off {
    background: rgba(255,255,255,.04);
    color: var(--text-subtle);
    border: 1px solid var(--border);
}

.ds-remove-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 7px;
    border-radius: 8px;
    color: var(--text-subtle);
    transition: background .15s, color .15s;
    flex-shrink: 0;
    line-height: 0;
}
.ds-remove-btn:hover {
    background: rgba(239,68,68,.12);
    color: #ef4444;
}

/* card body (admin fields) */
.ds-card-body {
    padding: 0 16px 14px;
    transition: opacity .2s;
}
.ds-card-body--muted { opacity: .45; pointer-events: none; }

.ds-field-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-start;
}
.ds-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.ds-field--grow { flex: 1; min-width: 200px; }
.ds-field--qtype { min-width: 186px; }
.ds-field--full  { grid-column: 1 / -1; }

.ds-field-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: .72rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: .03em;
    text-transform: uppercase;
}
.ds-field-input {
    padding: 8px 12px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--surface-1);
    color: var(--text-primary);
    font-size: .84rem;
    outline: none;
    width: 100%;
    box-sizing: border-box;
    transition: border-color .15s, box-shadow .15s;
    font-family: var(--font-body, inherit);
}
.ds-field-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(124,106,247,.15);
}
.ds-field-mono { font-family: 'Cascadia Code','Fira Code',ui-monospace,monospace; font-size: .8rem; }
.ds-field-select {
    padding: 8px 12px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--surface-1);
    color: var(--text-primary);
    font-size: .84rem;
    outline: none;
    width: 100%;
    box-sizing: border-box;
    cursor: pointer;
    transition: border-color .15s;
    -webkit-appearance: auto;
    appearance: auto;
    color-scheme: dark;           /* tells the browser to render the popup in dark mode */
}
.ds-field-select:focus { border-color: var(--accent); }
/* Force dark popup on browsers that respect option styling */
.ds-field-select option {
    background: #1e1e2e;
    color: #e2e0ff;
}
.ds-field-select option:checked,
.ds-field-select option:hover {
    background: #7c6af7;
    color: #ffffff;
}

/* ── Action bar ──────────────────────────────────────────────────────────── */
.ds-action-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0 10px;
    flex-wrap: wrap;
}
.ds-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    border-radius: 10px;
    border: 1.5px dashed rgba(124,106,247,.45);
    background: rgba(124,106,247,.06);
    color: var(--accent, #7c6af7);
    font-size: .84rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.ds-add-btn:hover {
    background: rgba(124,106,247,.13);
    border-color: var(--accent);
}

/* ── Inline add-source form ──────────────────────────────────────────────── */
.ds-inline-form {
    border-radius: 14px;
    border: 1px solid rgba(124,106,247,.3);
    background: linear-gradient(135deg,rgba(124,106,247,.06) 0%,rgba(184,169,255,.04) 100%);
    padding: 18px 18px 16px;
    margin-top: 4px;
    animation: ds-form-in .18s ease;
}
@keyframes ds-form-in {
    from { opacity:0; transform:translateY(-6px); }
    to   { opacity:1; transform:translateY(0);    }
}
.ds-inline-form-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.ds-inline-form-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: .9rem;
    font-weight: 700;
    color: var(--text-primary);
}
.ds-inline-close {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-subtle);
    padding: 5px;
    border-radius: 6px;
    line-height: 0;
    transition: background .15s, color .15s;
}
.ds-inline-close:hover { background: var(--surface-2); color: var(--text-primary); }

.ds-inline-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}
.ds-inline-error {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #f87171;
    font-size: .8rem;
    margin-bottom: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(239,68,68,.08);
    border: 1px solid rgba(239,68,68,.2);
}
.ds-inline-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ── Remove confirm modal ──────────────────────────────────────────────────── */
.ds-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}
.ds-modal--confirm {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 0;
    max-width: 440px;
    width: 92%;
    box-shadow: 0 28px 70px rgba(0,0,0,.5);
    overflow: hidden;
    animation: ds-modal-in .18s ease;
    display: flex;
}
@keyframes ds-modal-in {
    from { opacity:0; transform:scale(.95) translateY(8px); }
    to   { opacity:1; transform:scale(1)   translateY(0);   }
}
.ds-modal-danger-icon {
    width: 64px;
    flex-shrink: 0;
    background: rgba(239,68,68,.12);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ef4444;
}
.ds-modal-confirm-body {
    padding: 22px 22px 20px;
    flex: 1;
}
.ds-modal-title {
    font-size: .98rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 7px;
}
.ds-modal-body {
    font-size: .85rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 18px;
}
.ds-modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* ══════════════════════════════════════════════════════════════════════════
   DASHBOARD — No-company warning banner
   ══════════════════════════════════════════════════════════════════════════ */
.dash-no-company-banner {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 20px 22px;
    border-radius: 12px;
    background: rgba(251,191,36,.07);
    border: 1px solid rgba(251,191,36,.22);
    color: var(--text-primary);
    margin: 24px 0;
}
.dash-no-company-banner svg  { color: #fbbf24; flex-shrink: 0; margin-top: 2px; }
.dash-no-company-banner strong { display: block; font-size: .95rem; margin-bottom: 4px; }
.dash-no-company-banner p    { font-size: .84rem; color: var(--text-muted); margin: 0; }
.dash-no-company-banner a    { color: var(--accent); text-decoration: underline; }

/* ══════════════════════════════════════════════════════════════════════════
   PURCHASES — disabled-source message
   ══════════════════════════════════════════════════════════════════════════ */
.company-tab-disabled-msg {
    font-size: .82rem;
    color: var(--text-subtle);
    padding: 6px 12px;
    font-style: italic;
    align-self: center;
}
.company-tab-disabled-msg a { color: var(--accent); text-decoration: underline; }

/* ══════════════════════════════════════════════════════════════════════════
   SETTINGS — icon colour tokens (add teal)
   ══════════════════════════════════════════════════════════════════════════ */
.st-icon--teal { background: rgba(45,212,191,.14); color: #2dd4bf; }
