/* style.css - CHK Premium Style System */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    /* Light Theme (Default) */
    --bg-main: #f3f4f6;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-sidebar: #0f172a;
    --border-color: rgba(229, 231, 235, 0.5);
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --text-light: #ffffff;
    
    /* Accents */
    --accent-blue: #3b82f6;
    --accent-green: #10b981;
    --accent-purple: #8b5cf6;
    --accent-amber: #f59e0b;
    --accent-red: #ef4444;
    --accent-cyan: #06b6d4;

    /* CHK reference theme — white nav, purple/magenta primary accent */
    --nav-bg: #ffffff;
    --accent-primary: #7c3aed;

    /* Categorical chart palette (matches reference bar/line charts) */
    --chart-1: #3b82f6;
    --chart-2: #10b981;
    --chart-3: #f59e0b;
    --chart-4: #ec4899;
    --chart-5: #8b5cf6;
    --chart-6: #06b6d4;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    
    --sidebar-width: 260px;
    --header-height: 70px;
    
    --backdrop-blur: blur(12px);
}

[data-theme="dark"] {
    /* Dark Theme Override */
    --bg-main: #0b0f19;
    --bg-card: rgba(17, 24, 39, 0.8);
    --bg-sidebar: #030712;
    --border-color: rgba(75, 85, 99, 0.2);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-sans);
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: 100%;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(156, 163, 175, 0.3);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(156, 163, 175, 0.5);
}

/* ═══════════════════════════════════════════════════
   LAYOUT FRAMEWORK — Top Navbar Design
═══════════════════════════════════════════════════ */

.app-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── Topnav Wrapper (sticky full-width) ── */
.topnav-wrapper {
    position: sticky;
    top: 0;
    z-index: 200;
    width: 100%;
    box-shadow: 0 2px 12px rgba(0,0,0,0.18);
}

/* ── ROW 1: Primary nav bar ── */
.topnav-primary {
    background: var(--nav-bg);
    display: flex;
    align-items: center;
    padding: 0 16px;
    height: 54px;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

/* Brand */
.topnav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    flex-shrink: 0;
    margin-right: 4px;
}

.topnav-logo {
    height: 32px;
    width: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.topnav-logo-fallback {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-blue));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.topnav-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.topnav-brand-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
    white-space: nowrap;
}

.topnav-brand-sub {
    font-size: 0.62rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 500;
}

/* Portal switcher — plain text links, matching the reference site */
.topnav-portal-keys {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.topnav-portal-keys::-webkit-scrollbar {
    display: none;
}

/* ── Hamburger / Dropdown Nav Toggle Button ── */
.nav-mode-toggle-btn {
    background: none;
    border: 1px solid var(--border-color);
    cursor: pointer;
    color: var(--text-secondary);
    padding: 5px 8px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.18s ease;
    flex-shrink: 0;
    white-space: nowrap;
}
.nav-mode-toggle-btn:hover {
    background: var(--bg-main);
    color: var(--text-primary);
    border-color: var(--accent-primary);
}
.nav-mode-toggle-btn svg, .nav-mode-toggle-btn i {
    width: 14px;
    height: 14px;
}

/* ── Dropdown Nav Panel (hidden by default) ── */
.topnav-portal-dropdown {
    display: none;
    position: relative;
    flex-shrink: 0;
}

.topnav-portal-dropdown-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 6px 10px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.18s ease;
    white-space: nowrap;
    height: 36px;
    border: 1px solid var(--border-color);
}
.topnav-portal-dropdown-btn:hover {
    background: var(--bg-main);
    color: var(--text-primary);
}
.topnav-portal-dropdown-btn svg {
    width: 16px;
    height: 16px;
}

.topnav-portal-dropdown-panel,
.mega-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.20);
    z-index: 500;
    display: none;
    animation: dropdownSlideIn 0.15s ease;
    overflow: hidden;
}
.topnav-portal-dropdown-panel.open,
.mega-panel.open {
    display: flex;
}
@keyframes dropdownSlideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.topnav-portal-dropdown-panel a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.topnav-portal-dropdown-panel a:hover {
    background: var(--bg-main);
    color: var(--text-primary);
}
.topnav-portal-dropdown-panel a.portal-key-active {
    background: rgba(139,92,246,0.08);
    color: var(--accent-primary);
    font-weight: 700;
}
.topnav-portal-dropdown-panel a svg,
.topnav-portal-dropdown-panel a i {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    opacity: 0.7;
}

/* ── D.town Dropdown Mode ── */

/* Portal key wrapper — provides relative positioning for dropdown panel */
.portal-key-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

/* Chevron: hidden by default, shown in dropdown mode */
.portal-key-chevron {
    display: none;
    width: 11px !important;
    height: 11px !important;
    opacity: 0.5;
    transition: transform 0.2s ease;
}

/* The per-portal inline dropdown panel — fixed so it escapes overflow clipping */
.pk-dropdown {
    position: fixed;
    top: 0; left: 0; /* overridden by JS */
    min-width: 210px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 36px rgba(0,0,0,0.18);
    z-index: 9999;
    padding: 6px;
    display: none;
    flex-direction: column;
    gap: 2px;
    animation: dropdownSlideIn 0.15s ease;
}
.pk-dropdown.open {
    display: flex;
}

.pk-drop-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.83rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.pk-drop-item:hover {
    background: var(--bg-main);
    color: var(--text-primary);
}
.pk-drop-active {
    color: var(--accent-primary) !important;
    font-weight: 700;
    background: rgba(139,92,246,0.07);
}
.pk-drop-item svg,
.pk-drop-item i {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0.65;
}

/* ── More Dropdown & Overflow Grouping ── */
.pk-more-wrap {
    display: none;
}

.pk-dropdown-more {
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    width: 260px;
    box-shadow: 0 14px 40px rgba(0,0,0,0.22);
}

.pk-more-group {
    border-bottom: 1px solid var(--border-color);
    padding: 3px 0;
}
.pk-more-group:last-child {
    border-bottom: none;
}

/* ── When dropdown mode is ON ── */
body.nav-dropdown-mode .portal-key-chevron {
    display: inline-flex;
}
/* In dropdown mode, secondary portal submenu is handled via dropdowns */
body.nav-dropdown-mode .topnav-secondary-menu {
    display: none !important;
}
/* CRITICAL: Now that dropdowns use position:fixed, overflow clipping is not a problem.
   Keep mask-image removed so the fade doesn't look odd with chevrons. */
body.nav-dropdown-mode .topnav-portal-keys {
    -webkit-mask-image: none !important;
    mask-image: none !important;
}

/* Active open state: chevron rotates */
.portal-key-wrap.pk-open .portal-key-chevron {
    transform: rotate(180deg);
    opacity: 0.8;
}
.portal-key-wrap.pk-open .portal-key {
    color: var(--accent-primary);
}

.portal-key {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 7px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.80rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    transition: all 0.15s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.portal-key-icon {
    display: none;
}

.portal-key:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.03);
}
[data-theme="dark"] .portal-key:hover {
    background: rgba(255, 255, 255, 0.05);
}

.portal-key-active {
    color: var(--accent-primary) !important;
    font-weight: 700;
    border-bottom-color: var(--accent-primary) !important;
    background: rgba(124, 58, 237, 0.06);
}

.portal-key-shortcut {
    display: none;
}

/* Right-side controls in Primary Topnav */
.topnav-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    margin-left: auto;
}

.topnav-icon-btn {
    background: none;
    border: 1px solid var(--border-color);
    cursor: pointer;
    color: var(--text-secondary);
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s ease;
}

.topnav-icon-btn:hover {
    background: var(--bg-main);
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

.topnav-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 10px;
    border-left: 1px solid var(--border-color);
}

.topnav-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-blue));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.72rem;
    flex-shrink: 0;
    letter-spacing: -0.5px;
}

.topnav-user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.topnav-user-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.topnav-user-role {
    font-size: 0.65rem;
    color: var(--text-muted);
}

/* ── ROW 2: Secondary / Sub-Nav & Action Bar ── */
.topnav-secondary {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 44px;
    box-sizing: border-box;
}

.topnav-secondary-menu {
    display: flex;
    align-items: stretch;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    flex: 1;
    min-width: 0;
}

.topnav-secondary-menu::-webkit-scrollbar {
    display: none;
}

.topnav-sub-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 13px;
    font-size: 0.81rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: all 0.18s ease;
    margin-bottom: -1px;
}

.topnav-sub-item:hover {
    color: var(--text-primary);
    background: var(--bg-main);
}

.topnav-sub-active {
    color: var(--accent-primary) !important;
    border-bottom-color: var(--accent-primary) !important;
    font-weight: 700;
    background: rgba(124, 58, 237, 0.05) !important;
    box-shadow: none !important;
}

.topnav-sub-portal-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 6px;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    white-space: nowrap;
}

/* Secondary Row Right Utilities */
.topnav-secondary-utilities {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-left: auto;
}

/* Nav search trigger button */
.nav-search-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s ease;
    height: 30px;
    box-sizing: border-box;
    white-space: nowrap;
}
.nav-search-trigger:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
    background: var(--bg-card);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.nav-search-kbd {
    font-size: 0.68rem;
    font-weight: 600;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 1px 5px;
    border-radius: 4px;
    color: var(--text-muted);
}

/* Till Balance */
.topnav-till {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.76rem;
    color: var(--text-secondary);
    background: var(--bg-main);
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    height: 30px;
    box-sizing: border-box;
    white-space: nowrap;
}
.topnav-till strong {
    color: var(--accent-green);
    font-weight: 700;
}

/* Stock & Expiry Alert Badges */
.badge-stock-alert {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-decoration: none;
    height: 30px;
    box-sizing: border-box;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    white-space: nowrap;
}
.badge-stock-alert:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.badge-expiring {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fca5a5;
}
[data-theme="dark"] .badge-expiring {
    background: rgba(220, 38, 38, 0.18);
    color: #fca5a5;
    border-color: rgba(220, 38, 38, 0.35);
}
.badge-low-stock {
    background: #fef3c7;
    color: #d97706;
    border: 1px solid #fcd34d;
}
[data-theme="dark"] .badge-low-stock {
    background: rgba(217, 119, 6, 0.18);
    color: #fcd34d;
    border-color: rgba(217, 119, 6, 0.35);
}

/* WhatsApp Quick Button */
.btn-whatsapp-quick {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #25D366;
    color: #ffffff !important;
    text-decoration: none;
    padding: 4px 12px;
    font-size: 0.76rem;
    font-weight: 700;
    border-radius: 6px;
    height: 30px;
    box-sizing: border-box;
    border: none;
    box-shadow: 0 2px 6px rgba(37, 211, 102, 0.25);
    transition: all 0.18s ease;
    white-space: nowrap;
}
.btn-whatsapp-quick:hover {
    background: #20bd5a;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.35);
    transform: translateY(-1px);
}

/* ── Main Content Area ── */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    width: 100%;
    overflow-x: hidden;
}

/* Keep old class names working (backwards compat) */
.header { display: none; }
.sidebar { display: none; }

/* Page Content Body */
.page-body {
    padding: 24px 28px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    box-sizing: border-box;
}

/* Cards & Glassmorphism */
.card {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 22px 24px;
    box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

[data-theme="dark"] .card {
    background-color: #0f172a;
    border-color: rgba(255, 255, 255, 0.08);
}

.card:hover {
    box-shadow: 0 10px 25px -4px rgba(15, 23, 42, 0.08);
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.3px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

[data-theme="dark"] .card-title {
    color: #f8fafc;
}

/* KPI Dashboard Widgets */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.kpi-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.kpi-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.kpi-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-blue { background: rgba(59, 130, 246, 0.1); color: var(--accent-blue); }
.icon-green { background: rgba(16, 185, 129, 0.1); color: var(--accent-green); }
.icon-purple { background: rgba(139, 92, 246, 0.1); color: var(--accent-purple); }
.icon-amber { background: rgba(245, 158, 11, 0.1); color: var(--accent-amber); }
.icon-cyan { background: rgba(6, 182, 212, 0.1); color: var(--accent-cyan); }

/* Forms UI */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

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

label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    letter-spacing: -0.1px;
}

[data-theme="dark"] label {
    color: #94a3b8;
}

input, select, textarea {
    height: 40px;
    padding: 0 14px;
    border: 1px solid #cbd5e1;
    background-color: #ffffff;
    color: #0f172a;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea {
    height: auto;
    padding: 10px 14px;
}

[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea {
    background-color: #1e293b;
    border-color: #334155;
    color: #f8fafc;
}

input:focus, select:focus, textarea:focus {
    border-color: #0284c7;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.18s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #0284c7, #2563eb);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.25);
}
.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.35);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.25);
}
.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(239, 68, 68, 0.35);
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #ffffff;
}

.btn-secondary {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    color: #334155;
    font-weight: 600;
}
.btn-secondary:hover {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #94a3b8;
}

/* Tables Design */
.table-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: left;
}

th {
    background-color: #f8fafc;
    color: #475569;
    padding: 12px 16px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e2e8f0;
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}

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

tr:hover td {
    background-color: #f8fafc;
    color: #0f172a;
}

/* Badge indicators */
.status-pill {
    padding: 3px 10px;
    font-size: 0.68rem;
    font-weight: 700;
    border-radius: 20px;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    display: inline-block;
}

.status-pending { background: rgba(245, 158, 11, 0.12); color: #d97706; }
.status-success { background: rgba(16, 185, 129, 0.12); color: #059669; }
.status-danger { background: rgba(239, 68, 68, 0.12); color: #dc2626; }

/* Interactive tabs selector — flat underline tabs, matching the reference site */
.tab-container {
    display: flex;
    gap: 24px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 2px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.88rem;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    position: relative;
    margin-bottom: -1px;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.tab-btn i,
.tab-btn svg {
    opacity: 0.65;
    transition: opacity 0.18s ease;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
    font-weight: 700;
}

.tab-btn.active i,
.tab-btn.active svg {
    opacity: 1;
}

@media (max-width: 640px) {
    .tab-container { width: 100%; gap: 14px; }
    .tab-btn { padding: 8px 0; font-size: 0.8rem; }
}

/* POS Screen Split Layout */
.pos-container {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 24px;
    height: calc(100vh - var(--header-height) - 100px);
}

.pos-catalog {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.pos-cart-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.cart-items-list {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px;
}

.cart-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
}

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

.checkout-summary {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    font-weight: 500;
}

.summary-total {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* COA Tree Styles */
.coa-tree {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.coa-node {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px dashed var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 500;
}

.coa-level-1 { margin-left: 0; background: rgba(139, 92, 246, 0.08); font-weight: 700; }
.coa-level-2 { margin-left: 24px; background: rgba(139, 92, 246, 0.03); }
.coa-level-3 { margin-left: 48px; background: none; font-size: 0.85rem; }

/* Login Page Styling — matches the CHK reference's light theme */
.login-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-main);
    color: var(--text-primary);
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.login-logo {
    height: 60px;
    margin-bottom: 20px;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.login-subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 32px;
}

.login-card label {
    text-align: left;
    color: var(--text-secondary);
}

.login-card input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary) 15%, transparent);
}

/* Settings Form Special Layout */
.settings-logo-preview {
    width: 140px;
    height: 140px;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.settings-logo-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Notification Toast */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 500;
    margin-bottom: 20px;
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--accent-green);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Charts drawing inside dashboard via custom SVG */
.chart-svg-container {
    height: 240px;
    width: 100%;
    margin-top: 10px;
}

/* Portal Grid Landing Selector Page */
.portal-landing {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 24px 28px;
    gap: 24px;
    box-sizing: border-box;
}

.portal-landing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

.portal-landing-logo-group {
    display: flex;
    align-items: center;
    gap: 16px;
}

.portal-landing-logo-group img {
    height: 54px;
    width: auto;
    object-fit: contain;
}

.portal-landing-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
}

.portal-landing-subtitle {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.portal-welcome-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.portal-welcome-user {
    display: flex;
    align-items: center;
    gap: 16px;
}

.portal-welcome-avatar {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.4rem;
    font-weight: 700;
}

.portal-welcome-text h2 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
}

.portal-welcome-text p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.portal-welcome-actions {
    display: flex;
    gap: 12px;
}

.portal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
}

.portal-item-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}

.portal-item-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-blue);
}

.portal-item-image {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-bottom: 1px solid var(--border-color);
}

.portal-item-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.portal-item-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.portal-item-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.4;
}



/* ═══════════════════════════════════════════════════
   UX OVERHAUL v3.0 — Additional styles
   Sections: Responsive, Utilities, Toast, Autocomplete,
             Tab Groups, Form Enhancements, POS Improvements
═══════════════════════════════════════════════════ */

/* ── CSS Variable Alias (backward compat) ── */
:root {
    --border: var(--border-color);
    --accent-green-dark: #059669;
    --radius-xs: 6px;
}

/* ═══════════════════════════════════════════════════
   UTILITY CLASSES (replaces inline styles)
═══════════════════════════════════════════════════ */
.grid-2col   { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3col   { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4col   { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-auto   { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 20px; }
.grid-form   { display: grid; grid-template-columns: 0.85fr 1.15fr; gap: 24px; }
.grid-form-r { display: grid; grid-template-columns: 0.7fr 1.3fr; gap: 24px; }
.grid-form-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 24px; }

.flex         { display: flex; }
.flex-col     { display: flex; flex-direction: column; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-gap-8   { gap: 8px; }
.flex-gap-12  { gap: 12px; }
.flex-gap-16  { gap: 16px; }
.flex-wrap    { flex-wrap: wrap; }

.mb-0  { margin-bottom: 0; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

.text-sm    { font-size: 0.8rem; }
.text-xs    { font-size: 0.72rem; }
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.text-center{ text-align: center; }
.fw-600     { font-weight: 600; }
.fw-700     { font-weight: 700; }

.w-full   { width: 100%; }
.h-full   { height: 100%; }
.overflow-auto { overflow: auto; }

.form-section {
    background: rgba(156,163,175,0.04);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
}

.form-section-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.info-bar {
    background: rgba(6,182,212,0.07);
    border: 1px solid rgba(6,182,212,0.2);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 0.82rem;
    line-height: 2;
    display: none;
}
.info-bar.visible { display: block; }

/* ═══════════════════════════════════════════════════
   TOAST NOTIFICATION SYSTEM
═══════════════════════════════════════════════════ */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    min-width: 280px;
    max-width: 420px;
    pointer-events: all;
    animation: toastIn 0.3s cubic-bezier(0.4,0,0.2,1);
    position: relative;
    overflow: hidden;
}

.toast::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    height: 3px;
    background: currentColor;
    animation: toastProgress 4s linear forwards;
    border-radius: 0 0 0 10px;
}

@keyframes toastIn {
    from { transform: translateX(110%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

@keyframes toastOut {
    from { transform: translateX(0);    opacity: 1; max-height: 100px; }
    to   { transform: translateX(110%); opacity: 0; max-height: 0; padding: 0; margin: 0; }
}

@keyframes toastProgress {
    from { width: 100%; }
    to   { width: 0%; }
}

.toast-success { color: var(--accent-green); border-left: 4px solid var(--accent-green); }
.toast-error   { color: var(--accent-red);   border-left: 4px solid var(--accent-red); }
.toast-info    { color: var(--accent-blue);  border-left: 4px solid var(--accent-blue); }
.toast-warning { color: var(--accent-amber); border-left: 4px solid var(--accent-amber); }

.toast-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 1px; }
.toast-body { flex: 1; }
.toast-title { font-size: 0.88rem; font-weight: 700; color: var(--text-primary); }
.toast-msg   { font-size: 0.82rem; color: var(--text-secondary); margin-top: 2px; }
.toast-close {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); font-size: 1rem; padding: 0 0 0 8px;
    flex-shrink: 0; transition: color 0.2s;
}
.toast-close:hover { color: var(--text-primary); }

/* ═══════════════════════════════════════════════════
   TOM SELECT AUTOCOMPLETE OVERRIDES
═══════════════════════════════════════════════════ */
.ts-wrapper { width: 100%; }
.ts-control {
    padding: 9px 14px !important;
    border: 1px solid var(--border-color) !important;
    background: rgba(255,255,255,0.1) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-sm) !important;
    font-size: 0.9rem !important;
    min-height: 42px !important;
    box-shadow: none !important;
    transition: border-color 0.2s, box-shadow 0.2s !important;
}
.ts-wrapper.focus .ts-control {
    border-color: var(--accent-blue) !important;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15) !important;
}
.ts-dropdown {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15) !important;
    z-index: 9999 !important;
}
.ts-dropdown .option {
    color: var(--text-primary) !important;
    font-size: 0.88rem !important;
    padding: 10px 14px !important;
}
.ts-dropdown .option:hover,
.ts-dropdown .option.active {
    background: rgba(59,130,246,0.08) !important;
    color: var(--accent-blue) !important;
}
[data-theme="dark"] .ts-control {
    background: rgba(17,24,39,0.8) !important;
}
[data-theme="dark"] .ts-dropdown {
    background: #111827 !important;
}

/* ═══════════════════════════════════════════════════
   TAB GROUP NAVIGATION (2-level tabs for reception)
═══════════════════════════════════════════════════ */
.tab-group-nav {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 24px;
}

.tab-group-pills {
    display: inline-flex;
    gap: 4px;
    background: #f1f5f9;
    padding: 5px;
    border-radius: 30px;
    border: 1px solid #e2e8f0;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.tab-group-pill {
    padding: 7px 18px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    background: transparent;
    color: #64748b;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.tab-group-pill:hover {
    color: #0f172a;
    background: rgba(255,255,255,0.6);
}
.tab-group-pill.active {
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    font-weight: 700;
}
.tab-group-pill.group-billing.active  { color: #0284c7; }
.tab-group-pill.group-diag.active     { color: #0d9488; }
.tab-group-pill.group-admin.active    { color: #7c3aed; }

.tab-sub-row {
    display: flex;
    gap: 6px;
    padding: 4px 0;
    flex-wrap: wrap;
}

.tab-sub-btn {
    padding: 8px 16px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    font-size: 0.82rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.18s ease;
    white-space: nowrap;
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}
.tab-sub-btn:hover { color: #0f172a; background: #f8fafc; border-color: #cbd5e1; }
.tab-sub-btn.active {
    color: #ffffff !important;
    background: linear-gradient(135deg, #0284c7, #2563eb) !important;
    border-color: transparent !important;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3) !important;
}
.tab-sub-btn.active::after {
    content: '';
    position: absolute;
    bottom: -7px; left: 0;
    width: 100%; height: 3px;
    background: var(--accent-blue);
    border-radius: 50px;
}
.tab-sub-btn .tab-count {
    background: rgba(59,130,246,0.12);
    color: var(--accent-blue);
    font-size: 0.68rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}
.tab-sub-btn.active .tab-count {
    background: var(--accent-blue);
    color: #fff;
}

/* ═══════════════════════════════════════════════════
   OPD TOKEN PREVIEW CARD
═══════════════════════════════════════════════════ */
.token-preview {
    background: linear-gradient(135deg, rgba(59,130,246,0.08), rgba(6,182,212,0.08));
    border: 1px dashed rgba(59,130,246,0.3);
    border-radius: 10px;
    padding: 14px 16px;
    display: none;
    gap: 12px;
    align-items: center;
    margin-top: 8px;
}
.token-preview.visible { display: flex; }
.token-preview-number {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--accent-blue);
    letter-spacing: -1px;
    line-height: 1;
    flex-shrink: 0;
}
.token-preview-details { flex: 1; }
.token-preview-details strong { font-size: 0.9rem; color: var(--text-primary); display: block; }
.token-preview-details span   { font-size: 0.78rem; color: var(--text-muted); }

/* ═══════════════════════════════════════════════════
   LAB STATUS BADGES IN BOOKING LIST
═══════════════════════════════════════════════════ */
.lab-status-pending  { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-amber); display: inline-block; }
.lab-status-complete { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-green); display: inline-block; }

/* ═══════════════════════════════════════════════════
   IPD DISCHARGE — BALANCE PROGRESS BAR
═══════════════════════════════════════════════════ */
.bill-summary-box {
    background: rgba(59,130,246,0.06);
    border: 1px solid rgba(59,130,246,0.2);
    border-radius: 10px;
    padding: 16px;
}
.bill-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    font-size: 0.85rem;
    border-bottom: 1px dashed var(--border-color);
}
.bill-summary-row:last-child { border-bottom: none; }
.bill-summary-total {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    padding: 8px 0 4px;
}
.bill-balance-bar {
    height: 8px;
    border-radius: 4px;
    background: var(--border-color);
    margin-top: 10px;
    overflow: hidden;
}
.bill-balance-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease, background-color 0.3s ease;
}
.bill-balance-fill.paid      { background: var(--accent-green); }
.bill-balance-fill.partial   { background: var(--accent-amber); }
.bill-balance-fill.unpaid    { background: var(--accent-red); }
.bill-balance-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
    text-align: right;
}

/* ═══════════════════════════════════════════════════
   POS IMPROVEMENTS
═══════════════════════════════════════════════════ */
.pos-search-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 4px;
}
.pos-count-bar {
    font-size: 0.78rem;
    color: var(--text-muted);
    padding: 4px 0;
}
.stock-low-badge {
    font-size: 0.65rem;
    font-weight: 700;
    background: rgba(239,68,68,0.12);
    color: var(--accent-red);
    padding: 2px 6px;
    border-radius: 4px;
}

/* ═══════════════════════════════════════════════════
   TABLE ROW QUICK ACTIONS (hover reveal)
═══════════════════════════════════════════════════ */
.table-row-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.18s ease;
}
tr:hover .table-row-actions { opacity: 1; }

/* ═══════════════════════════════════════════════════
   KPI QUICK STATS BAR (Dashboard top)
═══════════════════════════════════════════════════ */
.kpi-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.kpi-bar-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
}
.kpi-bar-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.kpi-bar-icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.kpi-bar-value { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.5px; line-height: 1; }
.kpi-bar-label { font-size: 0.75rem; color: var(--text-muted); margin-top: 3px; }

/* ═══════════════════════════════════════════════════
   BREADCRUMB
═══════════════════════════════════════════════════ */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    padding: 8px 0;
}
.breadcrumb a { color: var(--text-muted); text-decoration: none; transition: color 0.15s; }
.breadcrumb a:hover { color: var(--accent-blue); }
.breadcrumb .sep { opacity: 0.4; }
.breadcrumb .current { color: var(--text-primary); font-weight: 600; }

/* ═══════════════════════════════════════════════════
   KEYBOARD SHORTCUTS MODAL
═══════════════════════════════════════════════════ */
#shortcuts-modal {
    display: none;
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99998;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
#shortcuts-modal.open { display: flex; }
#shortcuts-modal .modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 32px;
    max-width: 520px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
#shortcuts-modal .modal-title {
    font-size: 1.1rem; font-weight: 700; margin-bottom: 20px;
    display: flex; align-items: center; gap: 8px;
}
.shortcut-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.shortcut-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(156,163,175,0.05);
    font-size: 0.82rem;
}
.shortcut-key {
    background: rgba(156,163,175,0.15);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 2px 8px;
    font-family: monospace;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-primary);
    min-width: 36px;
    text-align: center;
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════
   UNSAVED CHANGES INDICATOR
═══════════════════════════════════════════════════ */
.form-dirty-indicator {
    display: none;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--accent-amber);
    padding: 4px 10px;
    background: rgba(245,158,11,0.08);
    border-radius: 6px;
    border: 1px solid rgba(245,158,11,0.2);
}
.form-dirty-indicator.visible { display: flex; }

/* ═══════════════════════════════════════════════════
   BUTTON LOADING STATE
═══════════════════════════════════════════════════ */
.btn[data-loading] {
    opacity: 0.8;
    cursor: wait;
    pointer-events: none;
}
.btn[data-loading]::after {
    content: " ⏳";
    font-size: 0.85em;
}

/* ═══════════════════════════════════════════════════
   FOOTER ENHANCEMENT
═══════════════════════════════════════════════════ */
.page-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 32px;
    border-top: 1px solid var(--border-color);
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-card);
    margin-top: auto;
}
.page-footer a { color: var(--text-muted); text-decoration: none; }
.page-footer a:hover { color: var(--accent-blue); }

/* ═══════════════════════════════════════════════════
   INLINE FORM STYLE HELPERS (used across portals)
═══════════════════════════════════════════════════ */
.form-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 3px;
    display: block;
    line-height: 1.4;
}
.label-required::after {
    content: ' *';
    color: var(--accent-red);
}
.input-group {
    display: flex;
    gap: 0;
}
.input-group input {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    flex: 1;
}
.input-group .input-addon {
    background: rgba(156,163,175,0.1);
    border: 1px solid var(--border-color);
    border-left: none;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding: 10px 14px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex; align-items: center;
    white-space: nowrap;
}

/* Formula display for discharge */
.formula-hint {
    font-size: 0.72rem;
    color: var(--accent-cyan);
    padding: 4px 8px;
    background: rgba(6,182,212,0.06);
    border-radius: 4px;
    margin-top: 4px;
    display: block;
    font-family: monospace;
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
═══════════════════════════════════════════════════ */
@media (max-width: 1440px) {
    .topnav-portal-keys { gap: 8px; }
    .portal-key { font-size: 0.80rem; padding: 4px 6px; }
    .pk-secondary { display: none !important; }
    .pk-more-wrap { display: inline-flex !important; }
    .nav-search-trigger { padding: 5px 8px; font-size: 0.74rem; }
}

@media (max-width: 1200px) {
    .grid-4col   { grid-template-columns: 1fr 1fr; }
    .kpi-bar     { grid-template-columns: 1fr 1fr; }
    .pos-container { grid-template-columns: 1fr; height: auto; }
    .pos-cart-panel { height: auto; min-height: 400px; }
    .topnav-portal-keys { gap: 4px; }
    .portal-key { font-size: 0.76rem; padding: 3px 5px; }
    .topnav-till { font-size: 0.75rem; padding: 4px 8px; }
}

@media (max-width: 1024px) {
    .page-body { padding: 20px 20px; }
    .grid-2col, .grid-form, .grid-form-r, .grid-form-3 { grid-template-columns: 1fr; }
    .topnav-portal-keys { gap: 3px; }
    .portal-key-shortcut { display: none; }
    .charts-grid-professional { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .page-body { padding: 16px 14px; gap: 16px; }
    .grid-2col, .grid-3col, .grid-4col, .grid-form, .grid-form-r,
    .grid-form-3, .grid-auto, .kpi-bar { grid-template-columns: 1fr; }
    .topnav-primary { padding: 0 12px; gap: 8px; }
    .topnav-brand-text { display: none; }
    .topnav-user-info { display: none; }
    .topnav-portal-keys { gap: 2px; }
    .portal-key { padding: 4px 8px; font-size: 0.72rem; }
    .topnav-till { display: none; }
    .card { padding: 16px; }
    .tab-sub-btn { font-size: 0.78rem; padding: 6px 10px; }
    table { font-size: 0.8rem; }
    th, td { padding: 10px 10px; }
    .shortcut-grid { grid-template-columns: 1fr; }
    .pos-container { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .page-body { padding: 12px 10px; }
    .tab-group-pills { gap: 5px; }
    .tab-group-pill { padding: 5px 12px; font-size: 0.75rem; }
    .kpi-bar-value { font-size: 1.2rem; }
    .btn { padding: 9px 14px; font-size: 0.84rem; }
}

/* ── Print media ── */
@media print {
    .topnav-wrapper, .page-footer, .btn, #toast-container, #shortcuts-modal { display: none !important; }
    .card { box-shadow: none; border: 1px solid #e5e7eb; }
    thead { display: table-header-group; }
    tr { page-break-inside: avoid; }
    .page-body { padding: 0; }
}

/* ═══════════════════════════════════════════════════
   PORTAL LANDING — Icon-based cards (replaces images)
═══════════════════════════════════════════════════ */
.portal-item-icon {
    width: 100%;
    height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--border-color);
    transition: transform 0.3s ease;
}

.portal-item-card:hover .portal-item-icon {
    transform: scale(1.05);
}

.portal-item-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    margin-top: 6px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* ─── Improved portal grid for landing ──────────── */
.portal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

@media (max-width: 768px) {
    .portal-grid { grid-template-columns: 1fr 1fr; gap: 14px; }
    .portal-item-icon { height: 90px; }
    .portal-item-body { padding: 14px; }
    .portal-item-title { font-size: 0.9rem; }
}

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

/* ─── Tab count badge (used in tab nav) ─────────── */
.tab-btn .tab-count {
    background: rgba(148,163,184,0.18);
    color: var(--text-secondary);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 10px;
    margin-left: 2px;
    transition: background 0.18s ease, color 0.18s ease;
}

.tab-btn.active .tab-count {
    background: rgba(59,130,246,0.15);
    color: var(--accent-blue);
}

/* ─── Accounts mini KPI row ─────────────────────── */
.accounts-kpi-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.accounts-kpi-item {
    flex: 1;
    min-width: 140px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ─── Form label with required marker ───────────── */
label.required::after,
label .req::after {
    content: ' *';
    color: var(--accent-red);
}

/* ─── Input focus glow for dark theme ───────────── */
[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
    background-color: rgba(17, 24, 39, 0.9) !important;
}

/* ─── Better table alternating rows ─────────────── */
tbody tr:nth-child(even) td {
    background-color: rgba(156,163,175,0.025);
}

/* ─── Quick action column on table rows ─────────── */
td .action-group {
    display: flex;
    gap: 4px;
    flex-wrap: nowrap;
}

/* ─── Status pill improvements ───────────────────── */
.status-pill {
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ─── Card title icon alignment ─────────────────── */
.card-title i[data-lucide] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ─── Improve alert animations ──────────────────── */
.alert {
    animation: alertSlideIn 0.25s ease;
}
@keyframes alertSlideIn {
    from { transform: translateY(-8px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* ─── Better scrollbar for dark theme ───────────── */

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: rgba(75,85,99,0.5);
}
[data-theme="dark"] ::-webkit-scrollbar-track {
    background: rgba(17,24,39,0.3);
}

/* ═══════════════════════════════════════════════════
   UX UPGRADE v4.0 — SUPER COOL & EASY
   Login Animations, Smart Forms, Instant Search,
   Command Palette, Count-Up, Micro-animations
═══════════════════════════════════════════════════ */

/* ── 1. LOGIN PAGE — ANIMATED WOW FACTOR ── */
.login-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background: linear-gradient(135deg, #f0f4ff 0%, #faf5ff 50%, #f0fdf4 100%);
    overflow: hidden;
}
.login-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    animation: blobFloat 8s ease-in-out infinite alternate;
    opacity: 0.55;
}
.login-blob-1 { width: 520px; height: 520px; background: radial-gradient(circle, rgba(124,58,237,0.3), transparent); top: -120px; left: -100px; animation-delay: 0s; }
.login-blob-2 { width: 420px; height: 420px; background: radial-gradient(circle, rgba(59,130,246,0.25), transparent); bottom: -80px; right: -80px; animation-delay: -3s; }
.login-blob-3 { width: 300px; height: 300px; background: radial-gradient(circle, rgba(16,185,129,0.2), transparent); bottom: 20%; left: 15%; animation-delay: -5s; }
.login-blob-4 { width: 200px; height: 200px; background: radial-gradient(circle, rgba(245,158,11,0.2), transparent); top: 30%; right: 10%; animation-delay: -2s; }

@keyframes blobFloat {
    0%   { transform: translate(0, 0) scale(1); }
    50%  { transform: translate(30px, -20px) scale(1.05); }
    100% { transform: translate(-20px, 30px) scale(0.95); }
}

.login-wrap {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.login-glass-card {
    width: 100%;
    max-width: 440px;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255,255,255,0.6);
    border-radius: 24px;
    padding: 48px 40px 36px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.1), 0 0 0 1px rgba(255,255,255,0.5) inset;
    animation: loginCardIn 0.6s cubic-bezier(0.34,1.56,0.64,1) both;
}

@keyframes loginCardIn {
    from { opacity: 0; transform: translateY(32px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.login-logo-ring,
.login-logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px;
    animation: fadeUp 0.6s cubic-bezier(0.34,1.56,0.64,1) both;
    animation-delay: 0.15s;
}

.login-logo-container img,
.login-logo-ring img {
    height: 64px;
    max-width: 220px;
    object-fit: contain;
    filter: drop-shadow(0 6px 16px rgba(99, 102, 241, 0.12));
    transition: transform 0.3s ease;
}

.login-logo-container img:hover,
.login-logo-ring img:hover {
    transform: scale(1.04);
}

.login-title-new {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.6px;
    color: #0f172a;
    text-align: center;
    margin-bottom: 4px;
    animation: fadeUp 0.5s ease both;
    animation-delay: 0.25s;
}

.login-subtitle-new {
    font-size: 0.82rem;
    color: #64748b;
    text-align: center;
    margin-bottom: 28px;
    animation: fadeUp 0.5s ease both;
    animation-delay: 0.3s;
}

.login-clock {
    text-align: center;
    font-size: 0.75rem;
    color: #94a3b8;
    margin-bottom: 24px;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.3px;
    animation: fadeUp 0.5s ease both;
    animation-delay: 0.35s;
}

.login-field {
    position: relative;
    margin-bottom: 16px;
    animation: fadeUp 0.5s ease both;
}
.login-field:nth-child(1) { animation-delay: 0.4s; }
.login-field:nth-child(2) { animation-delay: 0.45s; }

.login-field label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    color: #475569;
    margin-bottom: 6px;
    letter-spacing: 0.1px;
}

.login-field .field-icon {
    position: absolute;
    left: 12px;
    bottom: 11px;
    width: 16px;
    height: 16px;
    color: #94a3b8;
    pointer-events: none;
}

.login-field input {
    width: 100%;
    height: 44px;
    padding: 0 40px 0 38px;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    background: rgba(255,255,255,0.9);
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.login-field input:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 0 4px rgba(124,58,237,0.12);
    background: #fff;
    outline: none;
}

.login-pw-toggle {
    position: absolute;
    right: 10px;
    bottom: 10px;
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    padding: 4px;
    border-radius: 6px;
    transition: color 0.2s;
}
.login-pw-toggle:hover { color: #475569; }

.login-btn {
    width: 100%;
    height: 46px;
    background: linear-gradient(135deg, #7c3aed, #3b82f6);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
    box-shadow: 0 6px 20px rgba(124,58,237,0.3);
    margin-top: 8px;
    letter-spacing: 0.2px;
    animation: fadeUp 0.5s ease both;
    animation-delay: 0.5s;
}
.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(124,58,237,0.4);
}
.login-btn:active { transform: translateY(0); }
.login-btn:disabled { opacity: 0.7; cursor: wait; }

.login-error {
    background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.25);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.82rem;
    color: #dc2626;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: shakeError 0.4s ease;
}

@keyframes shakeError {
    0%,100% { transform: translateX(0); }
    20%      { transform: translateX(-8px); }
    40%      { transform: translateX(8px); }
    60%      { transform: translateX(-6px); }
    80%      { transform: translateX(4px); }
}

.login-footer-note {
    text-align: center;
    font-size: 0.72rem;
    color: #94a3b8;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid rgba(226,232,240,0.6);
    animation: fadeUp 0.5s ease both;
    animation-delay: 0.55s;
}

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

/* ── 2. SMART FORM — LIVE BALANCE INDICATOR ── */
.live-balance-box {
    display: none;
    border-radius: 10px;
    padding: 12px 16px;
    margin-top: 12px;
    border: 1px solid;
    transition: all 0.3s ease;
    animation: fadeUp 0.25s ease;
}
.live-balance-box.show { display: block; }
.live-balance-box.paid    { background: rgba(16,185,129,0.08);  border-color: rgba(16,185,129,0.3);  color: #059669; }
.live-balance-box.partial { background: rgba(245,158,11,0.08);  border-color: rgba(245,158,11,0.3);  color: #d97706; }
.live-balance-box.unpaid  { background: rgba(239,68,68,0.08);   border-color: rgba(239,68,68,0.3);   color: #dc2626; }
.live-balance-box .lb-title { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.live-balance-box .lb-row   { display: flex; justify-content: space-between; font-size: 0.82rem; padding: 2px 0; }
.live-balance-box .lb-total { font-size: 1rem; font-weight: 800; padding-top: 6px; border-top: 1px dashed currentColor; margin-top: 4px; }

/* ── 3. COMMAND PALETTE (Ctrl+K) ── */
#cmd-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(6px);
    align-items: flex-start;
    justify-content: center;
    padding-top: 80px;
}
#cmd-overlay.open { display: flex; animation: cmdFadeIn 0.15s ease; }
@keyframes cmdFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

#cmd-box {
    width: 100%;
    max-width: 560px;
    background: #fff;
    border-radius: 18px;
    border: 1px solid rgba(226,232,240,0.8);
    box-shadow: 0 24px 80px rgba(0,0,0,0.25);
    overflow: hidden;
    animation: cmdSlideIn 0.2s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes cmdSlideIn {
    from { opacity: 0; transform: scale(0.92) translateY(-16px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

#cmd-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-bottom: 1px solid #f1f5f9;
}
#cmd-input-wrap .cmd-search-icon { color: #94a3b8; flex-shrink: 0; }
#cmd-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1rem;
    color: #0f172a;
    background: transparent;
    font-family: var(--font-sans);
}
#cmd-hint {
    font-size: 0.72rem;
    color: #94a3b8;
    background: #f8fafc;
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    white-space: nowrap;
    font-family: monospace;
}

#cmd-results {
    max-height: 360px;
    overflow-y: auto;
    padding: 8px;
}
.cmd-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}
.cmd-result-item:hover, .cmd-result-item.active {
    background: rgba(59,130,246,0.08);
}
.cmd-result-icon {
    width: 34px; height: 34px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
}
.cmd-result-name  { font-size: 0.88rem; font-weight: 600; color: #0f172a; }
.cmd-result-sub   { font-size: 0.75rem; color: #64748b; }
.cmd-result-type  { margin-left: auto; font-size: 0.68rem; color: #94a3b8; background: #f1f5f9; padding: 2px 7px; border-radius: 4px; white-space: nowrap; }
.cmd-empty { text-align: center; padding: 32px; color: #94a3b8; font-size: 0.85rem; }
.cmd-section-label { font-size: 0.68rem; font-weight: 700; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.5px; padding: 6px 12px 4px; }

#cmd-footer {
    padding: 8px 16px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    gap: 16px;
    font-size: 0.72rem;
    color: #94a3b8;
}
#cmd-footer span { display: flex; align-items: center; gap: 5px; }
.cmd-key { background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 4px; padding: 1px 6px; font-family: monospace; font-size: 0.7rem; color: #475569; }

/* Ctrl+K trigger button in navbar */
.nav-search-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.78rem;
    color: #64748b;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
}
.nav-search-trigger:hover { border-color: #7c3aed; color: #7c3aed; background: rgba(124,58,237,0.04); }
.nav-search-trigger .nav-search-kbd { background: #e2e8f0; border-radius: 4px; padding: 1px 5px; font-family: monospace; font-size: 0.68rem; color: #475569; }

/* ── 4. INSTANT TABLE SEARCH ── */
.instant-search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    position: relative;
}
.instant-search-bar input {
    flex: 1;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    padding: 7px 12px 7px 34px;
    font-size: 0.84rem;
    height: 36px;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.instant-search-bar input:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124,58,237,0.1);
    outline: none;
}
.instant-search-bar .is-icon {
    position: absolute;
    left: 24px;
    color: #94a3b8;
    pointer-events: none;
}
.instant-search-bar .is-count {
    font-size: 0.72rem;
    color: #94a3b8;
    white-space: nowrap;
    background: #e2e8f0;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 600;
}
.instant-search-bar .is-clear {
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    font-size: 1rem;
    padding: 2px 4px;
    display: none;
    transition: color 0.2s;
}
.instant-search-bar .is-clear:hover { color: #ef4444; }
.instant-search-bar.has-value .is-clear { display: block; }

/* Highlighted match text */
mark.search-hl {
    background: rgba(124,58,237,0.2);
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
}

/* Sortable column header */
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable::after { content: ' ↕'; opacity: 0.35; font-size: 0.7em; }
th.sort-asc::after  { content: ' ↑'; opacity: 1; color: #7c3aed; }
th.sort-desc::after { content: ' ↓'; opacity: 1; color: #7c3aed; }
th.sortable:hover { background: rgba(124,58,237,0.06); color: #7c3aed; }

/* Empty search state */
.table-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
}
.table-empty-state .tes-icon { font-size: 2.5rem; margin-bottom: 12px; }
.table-empty-state .tes-msg  { font-size: 0.88rem; }

/* ── 5. COUNT-UP KPI ANIMATION ── */
.count-up { display: inline-block; }

/* ── 6. PAGE ENTRY ANIMATIONS ── */
.card {
    animation: cardEntrance 0.4s ease both;
}
.card:nth-child(1) { animation-delay: 0.02s; }
.card:nth-child(2) { animation-delay: 0.06s; }
.card:nth-child(3) { animation-delay: 0.10s; }
.card:nth-child(4) { animation-delay: 0.14s; }
.card:nth-child(5) { animation-delay: 0.18s; }
.card:nth-child(n+6) { animation-delay: 0.22s; }

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

.kpi-card { animation: kpiEntrance 0.45s cubic-bezier(0.34,1.56,0.64,1) both; }
.kpi-card:nth-child(1) { animation-delay: 0.05s; }
.kpi-card:nth-child(2) { animation-delay: 0.10s; }
.kpi-card:nth-child(3) { animation-delay: 0.15s; }
.kpi-card:nth-child(4) { animation-delay: 0.20s; }
@keyframes kpiEntrance {
    from { opacity: 0; transform: scale(0.9) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── 7. PORTAL GRID — BETTER HOVER CARDS ── */
.portal-item-card {
    transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.25s ease, border-color 0.2s ease;
}
.portal-item-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 16px 40px rgba(0,0,0,0.1);
}

/* ── 8. TABLE ROW — SMOOTH HOVER ── */
tr { transition: background 0.12s ease; }

/* ── 9. BUTTON RIPPLE EFFECT ── */
.btn {
    position: relative;
    overflow: hidden;
}
.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.15);
    transform: scale(0);
    border-radius: inherit;
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
}
.btn:active::before { transform: scale(2); opacity: 1; transition: none; }

/* ── 10. TOPNAV — ACTIVE TAB SLIDE INDICATOR ── */
.portal-key {
    position: relative;
    transition: color 0.18s ease;
}
.portal-key-active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0; right: 0;
    height: 3px;
    background: var(--accent-primary);
    border-radius: 2px 2px 0 0;
    animation: tabIndicatorIn 0.25s ease;
}
@keyframes tabIndicatorIn {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
}

/* ── DARK MODE COMMAND PALETTE ── */
[data-theme="dark"] #cmd-box {
    background: #1e293b;
    border-color: rgba(75,85,99,0.4);
}
[data-theme="dark"] #cmd-input { color: #f1f5f9; }
[data-theme="dark"] #cmd-input-wrap { border-bottom-color: rgba(75,85,99,0.3); }
[data-theme="dark"] .cmd-result-item:hover, [data-theme="dark"] .cmd-result-item.active { background: rgba(59,130,246,0.12); }
[data-theme="dark"] .cmd-result-name { color: #f1f5f9; }
[data-theme="dark"] #cmd-footer, [data-theme="dark"] .cmd-result-type, [data-theme="dark"] .cmd-section-label { color: #64748b; }
[data-theme="dark"] .cmd-result-type, [data-theme="dark"] #cmd-hint, [data-theme="dark"] .cmd-key { background: #0f172a; border-color: #334155; color: #94a3b8; }
[data-theme="dark"] #cmd-footer { border-top-color: rgba(75,85,99,0.3); }
[data-theme="dark"] .instant-search-bar { background: #0f172a; border-bottom-color: rgba(75,85,99,0.3); }
[data-theme="dark"] .instant-search-bar input { background: #1e293b; border-color: #334155; color: #f1f5f9; }
[data-theme="dark"] .is-count { background: #334155; color: #94a3b8; }
[data-theme="dark"] .nav-search-trigger { background: #1e293b; border-color: #334155; color: #94a3b8; }
[data-theme="dark"] .nav-search-trigger .nav-search-kbd { background: #0f172a; border-color: #475569; }

/* ── 11. ULTRA-PREMIUM RECEPTION & CLINICAL PORTAL STYLES ── */
.mr-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    background: rgba(59, 130, 246, 0.08);
    color: #2563eb;
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace, sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
}
[data-theme="dark"] .mr-pill {
    background: rgba(56, 189, 248, 0.12);
    color: #38bdf8;
    border-color: rgba(56, 189, 248, 0.25);
}

.live-calc-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: linear-gradient(135deg, rgba(241, 245, 249, 0.7), rgba(248, 250, 252, 0.9));
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 8px;
    margin-top: 4px;
}
[data-theme="dark"] .live-calc-box {
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(51, 65, 85, 0.6);
}

.scan-type-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: rgba(124, 58, 237, 0.08);
    color: #7c3aed;
    border-radius: 6px;
    font-size: 0.76rem;
    font-weight: 600;
}
[data-theme="dark"] .scan-type-pill {
    background: rgba(167, 139, 250, 0.15);
    color: #c4b5fd;
}

.btn-gradient-primary {
    background: linear-gradient(135deg, #0284c7, #2563eb) !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    border: none !important;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25) !important;
    transition: all 0.2s ease !important;
}
.btn-gradient-primary:hover {
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35) !important;
    transform: translateY(-1px);
}

.table-search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(248, 250, 252, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 12px;
    margin-bottom: 12px;
}
[data-theme="dark"] .table-search-bar {
    background: rgba(15, 23, 42, 0.6);
}
.table-search-bar input {
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    font-size: 0.84rem !important;
    outline: none !important;
    box-shadow: none !important;
    flex: 1;
}

/* Secondary Navigation Active Pill Glow */
.topnav-sub-active {
    background: linear-gradient(135deg, #7c3aed, #6366f1) !important;
    color: #ffffff !important;
    border-radius: 6px !important;
    border-bottom: 2px solid transparent !important;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3) !important;
    margin-bottom: 0 !important;
}
.topnav-sub-active i {
    color: #ffffff !important;
}
