/* ============================================================
   TAMS - Elegant Enterprise UI
   Deep navy · warm gold · soft ivory
   Fonts: Inter + Playfair Display
   ============================================================ */

:root {
    --navy-900: #0a1628;
    --navy-800: #0f1e35;
    --navy-700: #142440;
    --navy-600: #1c3054;
    --navy-500: #2a4270;
    --navy-400: #4a6390;

    --gold-500: #c9a961;
    --gold-400: #d4b87a;
    --gold-300: #e0cb9a;
    --gold-200: #ecdcb8;

    --bg: #f7f4ec;
    --surface: #fdfcf8;
    --surface-2: #efe9da;

    --text: #1a2332;
    --text-muted: #6b7789;
    --text-soft: #8b95a5;

    --border: rgba(201, 169, 97, 0.16);
    --border-strong: rgba(201, 169, 97, 0.34);

    --emerald-600: #0d7a5f;
    --emerald-500: #109e79;
    --emerald-100: #d9f2ea;
    --amber-600: #b8760e;
    --amber-500: #d49216;
    --amber-100: #fdf3dc;
    --crimson-600: #a32a3d;
    --crimson-500: #c4384d;
    --crimson-100: #fce4e8;

    --shadow-sm: 0 2px 8px -2px rgba(10, 22, 40, 0.06);
    --shadow-md: 0 8px 24px -8px rgba(10, 22, 40, 0.10);
    --shadow-lg: 0 20px 48px -12px rgba(10, 22, 40, 0.15);
    --shadow-xl: 0 32px 72px -20px rgba(10, 22, 40, 0.22);

    --radius: 20px;
    --radius-sm: 13px;
    --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
    --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

body.dark {
    --bg: #0a1424;
    --surface: #10203a;
    --surface-2: #0d1a2f;
    --text: #fdfcf8;
    --text-muted: #8b95a5;
    --text-soft: #6b7789;
    --border: rgba(201, 169, 97, 0.18);
    --border-strong: rgba(201, 169, 97, 0.34);
    --shadow-sm: 0 2px 8px -2px rgba(0, 0, 0, 0.40);
    --shadow-md: 0 8px 24px -8px rgba(0, 0, 0, 0.50);
    --shadow-lg: 0 20px 48px -12px rgba(0, 0, 0, 0.60);
    --shadow-xl: 0 32px 72px -20px rgba(0, 0, 0, 0.70);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    background-image:
        radial-gradient(ellipse at 0% 0%, rgba(201, 169, 97, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 100% 100%, rgba(20, 36, 64, 0.06) 0%, transparent 50%);
    min-height: 100vh;
    color: var(--text);
    font-size: 14px;
    line-height: 1.55;
    letter-spacing: -0.011em;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--navy-700); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--gold-500); }
h1, h2, h3, h4 { font-weight: 700; color: var(--text); }
.muted { color: var(--text-muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }
small { color: var(--text-soft); }

/* Elegant scrollbars */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(201,169,97,.5), rgba(139,149,165,.5));
    border-radius: 10px; border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, var(--gold-400), var(--gold-500)); }

/* ===== LAYOUT ===== */
.app { display: flex; min-height: 100vh; padding: 24px; gap: 20px; align-items: flex-start; }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 20px; }

/* ===== TOPBAR ===== */
.topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 18px;
    padding: 16px 26px; background: rgba(253, 252, 248, 0.85);
    border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow-md);
    position: sticky; top: 20px; z-index: 100;
    backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
}
body.dark .topbar { background: rgba(16, 32, 58, 0.82); }
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.sidebar-toggle { display: none; background: none; border: none; color: var(--text-muted); font-size: 1.1rem; cursor: pointer; padding: 6px; }
.brand-area { display: flex; align-items: center; gap: 14px; color: inherit; }
.brand-area:hover { color: inherit; }
.logo-mark {
    width: 46px; height: 46px; border-radius: 14px; flex-shrink: 0;
    background: linear-gradient(145deg, var(--navy-900) 0%, var(--navy-600) 100%);
    display: flex; align-items: center; justify-content: center; color: var(--gold-400); font-size: 1.1rem;
    position: relative; overflow: hidden;
    box-shadow: 0 8px 20px -6px rgba(10, 22, 40, 0.4), inset 0 1px 0 rgba(201, 169, 97, 0.3);
}
.logo-mark::after { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, transparent 45%, rgba(201,169,97,.18) 100%); }
.brand-text h1 {
    font-family: var(--font-display); font-size: 1.4rem; font-weight: 800;
    letter-spacing: -0.02em; color: var(--navy-900); line-height: 1;
}
body.dark .brand-text h1 { color: #fdfcf8; }
.brand-text .tagline {
    display: flex; align-items: center; gap: 8px; margin-top: 5px;
    font-size: 0.62rem; font-weight: 600; color: var(--text-muted);
    letter-spacing: 1.8px; text-transform: uppercase; white-space: nowrap;
}
.brand-text .tagline::before { content: ''; width: 18px; height: 1px; background: var(--gold-500); }
.top-actions { display: flex; align-items: center; gap: 14px; }

.search-box {
    display: flex; align-items: center; gap: 10px; width: 320px;
    background: rgba(255, 255, 255, 0.7); border: 1px solid var(--border);
    border-radius: 14px; padding: 10px 16px; color: var(--text-muted); transition: all .25s ease;
}
body.dark .search-box { background: rgba(16, 32, 58, 0.7); }
.search-box:focus-within { background: var(--surface); border-color: var(--gold-500); box-shadow: 0 0 0 4px rgba(201,169,97,.10); }
.search-box i { font-size: 0.85rem; color: var(--text-soft); }
.search-box input { border: none; background: transparent; outline: none; font-size: 0.86rem; width: 100%; color: var(--text); font-family: inherit; }
.search-box input::placeholder { color: var(--text-soft); }
.search-hint { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 2px 7px; font-size: 0.62rem; font-weight: 700; color: var(--text-muted); letter-spacing: .3px; }

.icon-btn, .theme-toggle {
    width: 44px; height: 44px; border-radius: 14px; flex-shrink: 0;
    background: rgba(255, 255, 255, 0.7); border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center; color: var(--text-muted);
    font-size: 1rem; cursor: pointer; transition: all .2s ease; position: relative;
}
body.dark .icon-btn, body.dark .theme-toggle { background: rgba(16, 32, 58, 0.7); }
.icon-btn:hover, .theme-toggle:hover { background: var(--surface); border-color: var(--gold-500); color: var(--navy-800); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
body.dark .icon-btn:hover, body.dark .theme-toggle:hover { color: var(--gold-300); }
.notif-bell { position: relative; color: var(--text-muted); font-size: 1rem; }
.notif-badge {
    position: absolute; top: 10px; right: 11px; min-width: 8px; height: 8px;
    background: var(--crimson-500); border-radius: 50%; border: 2px solid var(--surface);
    font-size: 0; animation: softPulse 2.4s ease-in-out infinite;
}
@keyframes softPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(196,56,77,.4); }
    50% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(196,56,77,0); }
}

/* User chip / dropdown */
.user-menu { position: relative; }
.user-menu-btn, .user-chip {
    display: flex; align-items: center; gap: 12px; padding: 6px 16px 6px 6px;
    background: rgba(255, 255, 255, 0.7); border: 1px solid var(--border); border-radius: 40px;
    cursor: pointer; transition: all .2s ease; color: var(--text);
}
body.dark .user-menu-btn, body.dark .user-chip { background: rgba(16, 32, 58, 0.7); }
.user-menu-btn:hover, .user-chip:hover { background: var(--surface); border-color: var(--gold-500); box-shadow: var(--shadow-sm); }
.user-avatar {
    width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(145deg, var(--navy-700), var(--navy-900));
    display: flex; align-items: center; justify-content: center; color: var(--gold-400);
    font-weight: 700; font-size: 0.78rem; letter-spacing: .5px;
    box-shadow: inset 0 1px 0 rgba(201,169,97,.3);
}
.user-info { display: flex; flex-direction: column; line-height: 1.2; }
.user-name { font-size: 0.83rem; font-weight: 700; color: var(--text); }
.user-role { font-size: 0.68rem; color: var(--text-muted); font-weight: 500; }
.user-menu-btn .fas.fa-chevron-down { font-size: 0.68rem; color: var(--text-soft); }
.dropdown {
    position: absolute; right: 0; top: calc(100% + 8px); min-width: 200px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
    box-shadow: var(--shadow-lg); display: none; overflow: hidden; z-index: 60;
}
.dropdown.open { display: block; }
.dropdown a { display: flex; align-items: center; gap: 10px; padding: 11px 15px; color: var(--text); font-size: 0.83rem; font-weight: 500; }
.dropdown a:hover { background: var(--surface-2); color: var(--navy-900); }
body.dark .dropdown a:hover { color: var(--gold-300); }
.dropdown a i { width: 16px; color: var(--gold-500); text-align: center; }

/* ===== SIDEBAR ===== */
.sidebar {
    width: 268px; flex-shrink: 0;
    background: linear-gradient(180deg, var(--navy-900) 0%, var(--navy-800) 100%);
    border-radius: 24px; padding: 22px 16px 18px; box-shadow: var(--shadow-xl);
    position: sticky; top: 24px; max-height: calc(100vh - 48px); overflow-y: auto;
    border: 1px solid rgba(201, 169, 97, 0.10);
}
.sidebar { scrollbar-width: thin; scrollbar-color: rgba(201, 169, 97, 0.55) rgba(255, 255, 255, 0.04); }
.sidebar::-webkit-scrollbar { width: 9px; }
.sidebar::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.04); border-radius: 10px; }
.sidebar::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(201, 169, 97, 0.70), rgba(201, 169, 97, 0.40));
    border-radius: 10px; border: 2px solid rgba(10, 22, 40, 0.55);
}
.sidebar::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, var(--gold-400), var(--gold-500)); }
.sidebar-menu { list-style: none; margin: 0; padding: 0; }

.menu-section { margin-bottom: 22px; }
.menu-section:last-child { margin-bottom: 0; }
.menu-label {
    font-size: 0.6rem; text-transform: uppercase; letter-spacing: 2px; font-weight: 700;
    color: rgba(201, 169, 97, 0.65); padding: 0 14px 9px;
    display: flex; align-items: center; gap: 10px;
}
.menu-label::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(201,169,97,.25), transparent); }
.menu-toggle { cursor: pointer; user-select: none; }
.menu-arrow { font-size: 0.6rem; opacity: .7; transition: transform .2s ease; flex-shrink: 0; }
.menu-section.has-children.open .menu-arrow { transform: rotate(180deg); }
.menu-section.has-children .submenu-list { display: none; }
.menu-section.has-children.open .submenu-list { display: block; }

.menu-item { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px; color: rgba(253, 252, 248, 0.72); font-weight: 500; font-size: 0.87rem; transition: all .2s ease; margin-bottom: 3px; cursor: pointer; position: relative; list-style: none; }
.menu-item > .menu-link { display: flex; align-items: center; gap: 12px; flex: 1; color: inherit; font-weight: 500; }
.menu-item:hover { background: rgba(201, 169, 97, 0.08); color: var(--ivory-100, #fdfcf8); }
.menu-item:hover .menu-link { color: #fdfcf8; }
.menu-icon { width: 20px; text-align: center; flex-shrink: 0; font-size: 0.95rem; color: rgba(201, 169, 97, 0.75); transition: all .2s; }
.menu-item:hover .menu-icon { color: var(--gold-400); }
.menu-text { flex: 1; }
.menu-arrow { font-size: 0.6rem; opacity: .7; margin-left: auto; }
.menu-badge {
    margin-left: auto; background: rgba(201, 169, 97, 0.16); color: var(--gold-300);
    font-size: 0.62rem; font-weight: 700; padding: 2px 8px; border-radius: 20px; letter-spacing: .3px;
}
.menu-badge.alert { background: rgba(196, 56, 77, 0.18); color: #f0a0ad; }

.menu-item.active {
    background: linear-gradient(135deg, rgba(201, 169, 97, 0.18), rgba(201, 169, 97, 0.06));
    color: #fdfcf8; box-shadow: inset 0 1px 0 rgba(201, 169, 97, 0.2), 0 4px 16px -4px rgba(0, 0, 0, 0.2);
}
.menu-item.active > .menu-link { color: #fdfcf8; }
.menu-item.active .menu-icon { color: var(--gold-400); }
.menu-item.active::before {
    content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
    width: 3px; height: 20px; background: var(--gold-500); border-radius: 0 4px 4px 0;
    box-shadow: 0 0 12px rgba(201, 169, 97, 0.6);
}

/* Collapsible submenu (kept for parent groups) */
.submenu { list-style: none; margin: 2px 0 6px; padding: 0 0 0 22px; display: none; }
.menu-item.open .submenu { display: block; }
.submenu-link { display: block; padding: 7px 12px; border-radius: 8px; color: rgba(253, 252, 248, 0.6); font-size: 0.82rem; font-weight: 500; }
.submenu-link:hover { color: #fdfcf8; background: rgba(201, 169, 97, 0.08); }
.submenu-link.active { color: var(--gold-300); background: rgba(201, 169, 97, 0.14); }

/* Sidebar footer / storage */
.sidebar-footer { margin-top: 22px; padding-top: 18px; border-top: 1px solid rgba(201, 169, 97, 0.12); }
.storage-card { background: rgba(201, 169, 97, 0.05); border: 1px solid rgba(201, 169, 97, 0.14); border-radius: 14px; padding: 14px 16px; }
.storage-head { display: flex; justify-content: space-between; font-size: 0.62rem; font-weight: 700; color: rgba(253, 252, 248, 0.6); letter-spacing: .5px; text-transform: uppercase; margin-bottom: 10px; }
.storage-head .val { color: var(--gold-300); }
.storage-bar { height: 5px; background: rgba(255, 255, 255, 0.06); border-radius: 6px; overflow: hidden; margin-bottom: 8px; }
.storage-fill { height: 100%; width: 60%; background: linear-gradient(90deg, var(--gold-500), var(--gold-300)); border-radius: 6px; box-shadow: 0 0 10px rgba(201, 169, 97, 0.4); }
.storage-note { font-size: 0.64rem; color: rgba(253, 252, 248, 0.4); font-weight: 500; }

/* ===== PAGE HEADER ===== */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding: 4px 4px 0; }
.page-head .heading { min-width: 0; }
.page-title {
    font-family: var(--font-display); font-size: 2rem; font-weight: 800; letter-spacing: -0.025em;
    color: var(--navy-900); line-height: 1.1; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
body.dark .page-title { color: #fdfcf8; }
.page-head h1 { font-family: var(--font-display); font-size: 1.9rem; font-weight: 800; letter-spacing: -0.02em; margin: 0; }
.live-pill {
    display: inline-flex; align-items: center; gap: 7px; background: var(--emerald-100); color: var(--emerald-600);
    font-size: 0.62rem; font-weight: 700; padding: 5px 12px; border-radius: 20px;
    letter-spacing: .5px; text-transform: uppercase; font-family: var(--font-body);
}
.live-dot { width: 6px; height: 6px; background: var(--emerald-500); border-radius: 50%; animation: softPulse 2s infinite; }
.page-subtitle { display: flex; align-items: center; gap: 22px; margin-top: 10px; font-size: 0.83rem; color: var(--text-muted); font-weight: 500; flex-wrap: wrap; }
.page-subtitle span { display: flex; align-items: center; gap: 7px; }
.page-subtitle i { font-size: 0.72rem; color: var(--gold-500); }
.page-actions { display: flex; gap: 10px; }

/* ===== CARDS & PANELS ===== */
.card, .panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); transition: box-shadow .25s ease, border-color .25s ease; }
.card:hover, .panel:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.card { margin-bottom: 20px; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 14px; }
.card-head h3, .card-title { font-size: 0.95rem; font-weight: 700; color: var(--text); margin: 0; display: flex; align-items: center; gap: 10px; }
.card-head h3 i, .card-title i { color: var(--gold-500); font-size: 0.85rem; }
.card-body { padding: 8px 22px 22px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-actions { margin: 20px 0; display: flex; gap: 10px; }
.panel { padding: 22px; }
.panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.panel-title { font-size: 0.93rem; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 10px; letter-spacing: -0.01em; }
.panel-title i { color: var(--gold-500); font-size: 0.85rem; }
.panel-chip { font-size: 0.63rem; font-weight: 700; padding: 4px 10px; border-radius: 20px; background: var(--emerald-100); color: var(--emerald-600); letter-spacing: .3px; }
.panel-tools { display: flex; gap: 4px; }
.tool-btn { width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--text-soft); font-size: 0.72rem; cursor: pointer; background: transparent; transition: all .15s; border: none; }
.tool-btn:hover { background: var(--surface-2); color: var(--gold-500); }

/* ===== KPI CARDS ===== */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.kpi-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 22px; position: relative; overflow: hidden; transition: all .3s cubic-bezier(.4,0,.2,1); cursor: pointer;
}
.kpi-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--gold-500), transparent); opacity: 0; transition: opacity .3s; }
.kpi-card::after { content: ''; position: absolute; top: -50%; right: -30%; width: 200px; height: 200px; background: radial-gradient(circle, rgba(201,169,97,.06) 0%, transparent 70%); pointer-events: none; }
.kpi-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.kpi-card:hover::before { opacity: 1; }
.kpi-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.kpi-icon {
    width: 46px; height: 46px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
    font-size: 1.05rem; position: relative; flex-shrink: 0;
}
.kpi-icon.navy { background: linear-gradient(145deg, var(--navy-700), var(--navy-900)); color: var(--gold-400); box-shadow: 0 6px 16px -6px rgba(10,22,40,.35); }
.kpi-icon.gold { background: linear-gradient(145deg, var(--gold-400), var(--gold-500)); color: var(--navy-900); box-shadow: 0 6px 16px -6px rgba(201,169,97,.45); }
.kpi-icon.emerald { background: linear-gradient(145deg, var(--emerald-500), var(--emerald-600)); color: #fff; box-shadow: 0 6px 16px -6px rgba(16,158,121,.4); }
.kpi-icon.crimson { background: linear-gradient(145deg, var(--crimson-500), var(--crimson-600)); color: #fff; box-shadow: 0 6px 16px -6px rgba(196,56,77,.4); }
.kpi-icon.blue, .kpi-icon.indigo, .kpi-icon.teal { background: linear-gradient(145deg, var(--navy-700), var(--navy-900)); color: var(--gold-400); box-shadow: 0 6px 16px -6px rgba(10,22,40,.35); }
.kpi-icon.green, .kpi-icon.cyan { background: linear-gradient(145deg, var(--emerald-500), var(--emerald-600)); color: #fff; box-shadow: 0 6px 16px -6px rgba(16,158,121,.4); }
.kpi-icon.amber, .kpi-icon.orange, .kpi-icon.violet, .kpi-icon.rose { background: linear-gradient(145deg, var(--gold-400), var(--gold-500)); color: var(--navy-900); box-shadow: 0 6px 16px -6px rgba(201,169,97,.45); }
.kpi-trend { display: inline-flex; align-items: center; gap: 4px; font-size: 0.68rem; font-weight: 700; padding: 4px 9px; border-radius: 20px; letter-spacing: .2px; }
.kpi-trend.up { background: var(--emerald-100); color: var(--emerald-600); }
.kpi-trend.down { background: var(--crimson-100); color: var(--crimson-600); }
.kpi-trend.warn { background: var(--amber-100); color: var(--amber-600); }
.kpi-meta { flex: 1; min-width: 0; }
.kpi-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 8px; }
.kpi-value { font-family: var(--font-display); font-size: 2.4rem; font-weight: 800; color: var(--navy-900); letter-spacing: -0.03em; line-height: 1; }
body.dark .kpi-value { color: #fdfcf8; }
.kpi-value small { font-family: var(--font-body); font-size: 1.05rem; font-weight: 600; color: var(--text-soft); margin-left: 3px; }
.kpi-footer { font-size: 0.73rem; color: var(--text-muted); font-weight: 500; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 6px; }
.kpi-footer i { color: var(--gold-500); font-size: 0.7rem; }

/* ===== CHART ROW ===== */
.chart-row { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 18px; }
.bar-chart { display: flex; align-items: flex-end; justify-content: space-between; height: 150px; gap: 10px; padding: 4px 0 0; }
.bar-group { flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.bar {
    width: 100%; border-radius: 8px 8px 4px 4px; min-height: 12px; position: relative;
    background: linear-gradient(180deg, var(--navy-600) 0%, var(--navy-900) 100%);
    transition: all .3s ease; cursor: pointer; box-shadow: 0 4px 12px -4px rgba(10,22,40,.3);
}
.bar::before { content: ''; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(180deg, rgba(201,169,97,.15), transparent); }
.bar:hover { filter: brightness(1.15); transform: scaleY(1.02); box-shadow: 0 8px 20px -6px rgba(10,22,40,.5); }
.bar[data-tip]:hover::after {
    content: attr(data-tip); position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%);
    background: var(--navy-900); color: var(--gold-300); padding: 6px 11px; border-radius: 8px; font-size: 0.68rem;
    font-weight: 700; white-space: nowrap; z-index: 10; border: 1px solid rgba(201,169,97,.25); box-shadow: 0 8px 20px -4px rgba(10,22,40,.3);
}
.bar-labels { display: flex; justify-content: space-between; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.bar-labels span { flex: 1; text-align: center; font-size: 0.68rem; font-weight: 600; color: var(--text-muted); letter-spacing: .3px; }

.donut-wrap { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.donut {
    width: 140px; height: 140px; border-radius: 50%; position: relative;
    background: conic-gradient(var(--navy-800) 0deg 245deg, var(--gold-500) 245deg 342deg, #b4bcc7 342deg 360deg);
    box-shadow: 0 12px 32px -8px rgba(10,22,40,.25), inset 0 0 0 1px rgba(201,169,97,.15);
}
.donut::after { content: ''; position: absolute; inset: 34px; background: var(--surface); border-radius: 50%; box-shadow: inset 0 2px 8px rgba(10,22,40,.06); }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 2; }
.donut-value { font-family: var(--font-display); font-size: 1.55rem; font-weight: 800; color: var(--navy-900); line-height: 1; }
body.dark .donut-value { color: #fdfcf8; }
.donut-label { font-size: 0.6rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .8px; margin-top: 4px; }
.legend { width: 100%; display: flex; flex-direction: column; gap: 11px; }
.legend-row { display: flex; align-items: center; justify-content: space-between; font-size: 0.78rem; font-weight: 600; color: var(--text-muted); }
.legend-left { display: flex; align-items: center; gap: 9px; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.legend-val { font-family: var(--font-display); font-weight: 800; color: var(--navy-900); font-size: 0.88rem; }
body.dark .legend-val { color: #fdfcf8; }

.branch-list { display: flex; flex-direction: column; gap: 16px; }
.branch-row { display: flex; flex-direction: column; gap: 8px; }
.branch-head { display: flex; justify-content: space-between; align-items: center; font-size: 0.8rem; font-weight: 600; color: var(--text-muted); }
.branch-val { font-family: var(--font-display); font-weight: 800; color: var(--navy-900); font-size: 0.9rem; }
body.dark .branch-val { color: #fdfcf8; }
.branch-track { height: 6px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.branch-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--navy-800), var(--navy-500)); box-shadow: 0 0 10px rgba(20,36,64,.25); position: relative; }
.branch-fill.gold { background: linear-gradient(90deg, var(--gold-500), var(--gold-300)); box-shadow: 0 0 10px rgba(201,169,97,.4); }

/* ===== TABLES ===== */
.table-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: border-color .25s ease, box-shadow .25s ease; }
.table-panel:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.table-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 16px; }
.table-title { font-size: 0.93rem; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 10px; }
.table-title i { color: var(--gold-500); font-size: 0.85rem; }
.table-link { font-size: 0.73rem; font-weight: 700; color: var(--navy-700); display: flex; align-items: center; gap: 5px; transition: all .15s; letter-spacing: .2px; }
body.dark .table-link { color: var(--gold-300); }
.table-link:hover { color: var(--gold-500); gap: 8px; }
.table { width: 100%; border-collapse: collapse; font-size: 0.83rem; }
.table th, .table td { padding: 11px 16px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--border); }
.table th { background: linear-gradient(180deg, transparent, rgba(201,169,97,.05)); color: var(--text-muted); font-weight: 700; font-size: 0.63rem; text-transform: uppercase; letter-spacing: 1px; border-top: 1px solid var(--border); }
.table tbody tr { transition: background .2s; }
.table tbody tr:hover { background: rgba(201, 169, 97, 0.04); }
.table tbody tr:last-child td { border-bottom: none; }
.table-responsive { overflow-x: auto; }
.user-cell { display: flex; align-items: center; gap: 10px; }
.actions { white-space: nowrap; }
.inline-form { display: inline; }

.employee-cell { display: flex; align-items: center; gap: 12px; }
.employee-avatar { width: 36px; height: 36px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.72rem; color: #fff; flex-shrink: 0; letter-spacing: .5px; box-shadow: 0 4px 10px -3px rgba(0,0,0,.2); }
.av-1 { background: linear-gradient(145deg, #2a4270, #0a1628); }
.av-2 { background: linear-gradient(145deg, #c9a961, #a08340); }
.av-3 { background: linear-gradient(145deg, #109e79, #0d7a5f); }
.av-4 { background: linear-gradient(145deg, #c4384d, #a32a3d); }
.av-5 { background: linear-gradient(145deg, #6b7789, #3d4a5c); }
.employee-name { font-weight: 700; color: var(--text); font-size: 0.85rem; }
.employee-id { font-size: 0.68rem; color: var(--text-soft); font-weight: 500; margin-top: 2px; letter-spacing: .3px; }

.rank-pill { display: inline-flex; align-items: center; gap: 5px; font-weight: 800; padding: 5px 11px; border-radius: 20px; font-size: 0.68rem; letter-spacing: .3px; }
.rank-pill.gold { background: linear-gradient(135deg, #fdf3dc, #f5e3b3); color: #8a6410; box-shadow: 0 2px 8px -2px rgba(201,169,97,.3); }
.rank-pill.silver { background: linear-gradient(135deg, #eef1f5, #d8dde3); color: #4a5568; }
.rank-pill.bronze { background: linear-gradient(135deg, #fdf3dc, #e8d4a8); color: #8a6410; }
.rank-pill.plain { background: var(--surface-2); color: #4a5568; }

.score-cell { display: flex; align-items: center; gap: 10px; }
.score-track { width: 54px; height: 6px; background: var(--surface-2); border-radius: 6px; overflow: hidden; flex-shrink: 0; }
.score-fill { height: 100%; border-radius: 6px; }
.score-fill.high { background: linear-gradient(90deg, var(--emerald-500), var(--emerald-600)); }
.score-fill.mid { background: linear-gradient(90deg, var(--gold-500), var(--gold-400)); }
.score-fill.low { background: linear-gradient(90deg, var(--crimson-500), var(--crimson-600)); }
.score-val { font-family: var(--font-display); font-weight: 800; font-size: 0.9rem; color: var(--navy-900); width: 40px; }
body.dark .score-val { color: #fdfcf8; }

.status-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 0.7rem; font-weight: 700; padding: 5px 12px; border-radius: 20px; letter-spacing: .2px; white-space: nowrap; }
.status-pill .dot { width: 6px; height: 6px; border-radius: 50%; }
.status-pill.success { background: var(--emerald-100); color: var(--emerald-600); }
.status-pill.success .dot { background: var(--emerald-600); }
.status-pill.warning { background: var(--amber-100); color: var(--amber-600); }
.status-pill.warning .dot { background: var(--amber-600); }
.status-pill.danger { background: var(--crimson-100); color: var(--crimson-600); }
.status-pill.danger .dot { background: var(--crimson-600); }
.status-pill.info { background: var(--navy-700); color: var(--gold-300); }
.status-pill.info .dot { background: var(--gold-400); }

/* ===== BADGES & ALERTS ===== */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.68rem; font-weight: 700; letter-spacing: .2px; }
.badge-success { background: var(--emerald-100); color: var(--emerald-600); }
.badge-danger { background: var(--crimson-100); color: var(--crimson-600); }
.badge-warning { background: var(--amber-100); color: var(--amber-600); }
.badge-info { background: var(--navy-700); color: var(--gold-300); }
.badge-muted { background: var(--surface-2); color: var(--text-muted); }
.alert { padding: 12px 40px 12px 15px; border-radius: 14px; margin-bottom: 12px; font-size: 0.85rem; position: relative; border: 1px solid var(--border); }
.alert-success { background: var(--emerald-100); color: var(--emerald-600); }
.alert-danger { background: var(--crimson-100); color: var(--crimson-600); }
.alert-warning { background: var(--amber-100); color: var(--amber-600); }
.alert-info { background: var(--surface-2); color: var(--navy-700); }
.alert-close { position: absolute; right: 12px; top: 9px; background: none; border: none; font-size: 18px; cursor: pointer; color: inherit; opacity: .7; }
.alert-close:hover { opacity: 1; }
.flash-stack { margin-bottom: 4px; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 600; font-size: 0.8rem; color: var(--text); }
.form-control {
    width: 100%; padding: 10px 13px; border: 1px solid var(--border); border-radius: 12px;
    font-size: 0.88rem; background: var(--surface); color: var(--text); font-family: inherit; transition: border-color .2s ease, box-shadow .2s ease;
}
.form-control:focus { outline: none; border-color: var(--gold-500); box-shadow: 0 0 0 4px rgba(201,169,97,.12); }
.form-control:disabled { background: var(--surface-2); color: var(--text-soft); }
select.form-control { appearance: auto; }
textarea.form-control { min-height: 90px; resize: vertical; }
.form-row { display: flex; gap: 14px; }
.form-row .form-group { flex: 1; }
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filter-bar .form-control { width: auto; min-width: 160px; flex: 0 1 auto; }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; margin-bottom: 8px; cursor: pointer; color: var(--text); }
.checkbox.small { font-size: 0.76rem; margin-bottom: 4px; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 11px 20px;
    border-radius: 13px; font-weight: 600; font-size: 0.84rem; cursor: pointer; transition: all .2s ease;
    border: 1px solid transparent; font-family: inherit; letter-spacing: -0.005em; line-height: 1.2;
}
.btn i { font-size: 0.82rem; }
.btn-primary {
    background: linear-gradient(145deg, var(--navy-800), var(--navy-900)); color: var(--gold-300);
    box-shadow: 0 10px 24px -8px rgba(10,22,40,.4), inset 0 1px 0 rgba(201,169,97,.2);
    border-color: rgba(201,169,97,.2);
}
.btn-primary:hover { transform: translateY(-2px); color: var(--gold-200); box-shadow: 0 16px 32px -10px rgba(10,22,40,.5), inset 0 1px 0 rgba(201,169,97,.3); }
.btn-success { background: linear-gradient(145deg, var(--emerald-500), var(--emerald-600)); color: #fff; box-shadow: 0 10px 24px -8px rgba(16,158,121,.4); }
.btn-success:hover { transform: translateY(-2px); color: #fff; }
.btn-danger { background: linear-gradient(145deg, var(--crimson-500), var(--crimson-600)); color: #fff; box-shadow: 0 10px 24px -8px rgba(196,56,77,.4); }
.btn-danger:hover { transform: translateY(-2px); color: #fff; }
.btn-ghost, .btn-light { background: rgba(255,255,255,.7); border-color: var(--border); color: var(--text-muted); }
body.dark .btn-ghost, body.dark .btn-light { background: rgba(16,32,58,.7); }
.btn-ghost:hover, .btn-light:hover { background: var(--surface); border-color: var(--gold-500); color: var(--navy-900); transform: translateY(-1px); }
body.dark .btn-ghost:hover, body.dark .btn-light:hover { color: var(--gold-300); }
.btn-block { display: flex; width: 100%; justify-content: center; }
.btn:active { transform: translateY(1px); }
.btn-icon {
    display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px;
    border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); cursor: pointer; transition: all .15s ease; font-size: 0.8rem;
}
.btn-icon:hover { background: var(--surface-2); color: var(--gold-500); border-color: var(--gold-500); }
.btn-icon.danger { color: var(--crimson-500); border-color: rgba(196,56,77,.3); }

/* ===== PAGINATION ===== */
.pagination { display: flex; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.page-link { padding: 7px 13px; border: 1px solid var(--border); border-radius: 9px; color: var(--text-muted); font-size: 0.8rem; background: var(--surface); transition: all .15s ease; }
.page-link:hover { background: var(--surface-2); border-color: var(--gold-500); }
.page-link.active { background: linear-gradient(145deg, var(--navy-800), var(--navy-900)); border-color: var(--navy-900); color: var(--gold-300); }

/* ===== PERMISSION GRID ===== */
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.perm-module { border: 1px solid var(--border); border-radius: 14px; padding: 14px; background: var(--surface); }
.perm-module-name { font-weight: 700; margin-bottom: 8px; font-size: 0.86rem; color: var(--text); }
.perm-actions { display: flex; flex-wrap: wrap; gap: 5px; }

/* ===== PROGRESS BARS ===== */
.progress { background: var(--surface-2); border-radius: 999px; height: 8px; overflow: hidden; margin-bottom: 4px; }
.progress-bar { background: linear-gradient(90deg, var(--navy-800), var(--navy-500)); height: 100%; border-radius: 999px; transition: width .3s; }

/* ===== ACTIVITY & UPCOMING ===== */
.activity-item { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); position: relative; }
.activity-item:last-child { border-bottom: none; padding-bottom: 0; }
.activity-item:first-child { padding-top: 0; }
.activity-icon {
    width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
    font-size: 0.82rem; flex-shrink: 0; box-shadow: 0 4px 10px -3px rgba(10,22,40,.15);
}
.activity-icon.navy { background: linear-gradient(145deg, var(--navy-700), var(--navy-900)); color: var(--gold-400); }
.activity-icon.emerald { background: linear-gradient(145deg, var(--emerald-500), var(--emerald-600)); color: #fff; }
.activity-icon.gold { background: linear-gradient(145deg, var(--gold-400), var(--gold-500)); color: var(--navy-900); }
.activity-icon.crimson { background: linear-gradient(145deg, var(--crimson-500), var(--crimson-600)); color: #fff; }
.activity-body { flex: 1; min-width: 0; }
.activity-text { font-size: 0.82rem; color: var(--text-muted); font-weight: 500; line-height: 1.5; }
.activity-text strong { color: var(--text); font-weight: 700; }
.activity-time { display: flex; align-items: center; gap: 6px; font-size: 0.68rem; color: var(--text-soft); font-weight: 600; margin-top: 5px; }
.activity-time i { font-size: 0.62rem; }

.upcoming-item {
    display: flex; align-items: center; gap: 16px; padding: 14px 16px;
    border: 1px solid var(--border); border-radius: 16px; margin-bottom: 10px; transition: all .2s ease; cursor: pointer;
    background: linear-gradient(180deg, transparent, rgba(201,169,97,.02));
}
.upcoming-item:last-child { margin-bottom: 0; }
.upcoming-item:hover { border-color: var(--gold-500); background: var(--surface); transform: translateX(3px); box-shadow: var(--shadow-sm); }
.date-chip {
    width: 52px; height: 52px; border-radius: 14px; flex-shrink: 0;
    background: linear-gradient(145deg, var(--navy-800), var(--navy-900)); color: var(--gold-300);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    box-shadow: 0 6px 16px -6px rgba(10,22,40,.4); position: relative; overflow: hidden;
}
.date-chip::after { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, transparent 50%, rgba(201,169,97,.15)); }
.date-chip .day { font-family: var(--font-display); font-size: 1.15rem; font-weight: 800; line-height: 1; z-index: 1; }
.date-chip .month { font-size: 0.58rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px; margin-top: 3px; z-index: 1; color: var(--gold-400); }
.upcoming-body { flex: 1; min-width: 0; }
.upcoming-title { font-size: 0.85rem; font-weight: 700; color: var(--text); margin-bottom: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upcoming-meta { display: flex; align-items: center; gap: 14px; font-size: 0.72rem; color: var(--text-soft); font-weight: 500; }
.upcoming-meta span { display: flex; align-items: center; gap: 5px; }
.upcoming-meta i { font-size: 0.65rem; color: var(--gold-500); }
.upcoming-tag { font-size: 0.64rem; font-weight: 700; padding: 4px 10px; border-radius: 20px; letter-spacing: .3px; white-space: nowrap; }
.upcoming-tag.confirmed { background: var(--emerald-100); color: var(--emerald-600); }
.upcoming-tag.pending { background: var(--amber-100); color: var(--amber-600); }

/* ===== FOOTER ===== */
.app-footer {
    display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
    padding: 18px 26px; background: rgba(253, 252, 248, 0.7); border: 1px solid var(--border);
    border-radius: 18px; font-size: 0.73rem; color: var(--text-muted); font-weight: 500;
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
body.dark .app-footer { background: rgba(16, 32, 58, 0.7); }
.footer-group { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.footer-group span { display: flex; align-items: center; gap: 7px; }
.app-footer i { color: var(--gold-500); font-size: 0.7rem; }
.status-live { display: inline-flex; align-items: center; gap: 6px; }
.status-live::before { content: ''; width: 6px; height: 6px; background: var(--emerald-500); border-radius: 50%; box-shadow: 0 0 0 3px rgba(16,158,121,.15); }

/* ===== CERTIFICATE ===== */
.cert-page { max-width: 1000px; margin: 0 auto; }
.certificate {
    position: relative; width: 100%; min-height: 600px; padding: 40px 60px;
    background: #fff; color: #1e293b; text-align: center;
    background-size: cover; background-position: center;
    border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
}
.cert-inner { position: relative; z-index: 2; }
.cert-logo { max-height: 70px; margin-bottom: 6px; }
.cert-company { font-size: 22px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: #0f172a; }
.cert-title { font-size: 34px; font-weight: 800; letter-spacing: 2px; text-transform: uppercase; margin: 14px 0 4px; color: #b8860b; }
.cert-subtitle { font-size: 14px; color: #64748b; margin-bottom: 26px; }
.cert-body { font-size: 15px; color: #475569; }
.cert-name { font-family: 'Segoe Script', 'Brush Script MT', cursive; font-size: 52px; color: #0f172a; margin: 6px 0 2px; }
.cert-empno { font-size: 13px; color: #64748b; }
.cert-line { font-size: 15px; color: #475569; margin-top: 16px; }
.cert-training { font-size: 26px; font-weight: 700; color: #b8860b; margin: 6px 0 10px; text-transform: uppercase; }
.cert-meta { font-size: 14px; color: #475569; }
.cert-footer { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 40px; padding: 0 40px; }
.cert-sig { text-align: center; }
.cert-sig img { max-height: 50px; display: block; margin: 0 auto 4px; }
.cert-sig .line { border-top: 1px solid #94a3b8; width: 180px; margin-top: 6px; padding-top: 4px; font-size: 12px; color: #64748b; }
.cert-seal img { max-height: 90px; }
.cert-no { font-size: 11px; color: #94a3b8; margin-top: 20px; }
.cert-actions { margin: 16px 0; display: flex; gap: 10px; justify-content: center; }
@media print {
    body * { visibility: hidden; }
    .cert-page, .cert-page * { visibility: visible; }
    .cert-page { position: absolute; left: 0; top: 0; width: 100%; max-width: 100%; }
    .certificate { border: none; border-radius: 0; min-height: 100vh; }
    .cert-actions { display: none; }
}

/* ===== AUTH (LOGIN) ===== */
.auth-body {
    display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px;
    background:
        radial-gradient(1200px 600px at 50% -10%, rgba(201, 169, 97, 0.25), transparent 60%),
        radial-gradient(900px 500px at 100% 100%, rgba(42, 66, 112, 0.45), transparent 60%),
        linear-gradient(160deg, #0a1628 0%, #142440 55%, #0f1e35 100%);
}
.auth-wrap { width: 100%; max-width: 420px; }
.auth-card {
    background: #fdfcf8; color: #1a2332; border-radius: 22px; padding: 36px 32px 30px;
    box-shadow: 0 32px 72px -20px rgba(10, 22, 40, 0.5); border: 1px solid rgba(201, 169, 97, 0.35);
}
.auth-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.auth-brand .brand-icon, .auth-brand .logo-mark { width: 46px; height: 46px; border-radius: 14px; background: linear-gradient(145deg, #0a1628, #1c3054); display: flex; align-items: center; justify-content: center; color: #d4b87a; font-size: 1.1rem; box-shadow: 0 8px 20px -6px rgba(10,22,40,.4), inset 0 1px 0 rgba(201,169,97,.3); }
.auth-brand h1 { font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; color: #0a1628; margin: 0; line-height: 1; }
.auth-sub { color: #6b7789; margin: 0 0 22px; font-size: 0.9rem; }
.auth-tagline { display: flex; align-items: center; gap: 8px; font-size: 0.62rem; font-weight: 600; color: #6b7789; letter-spacing: 1.6px; text-transform: uppercase; margin-top: 5px; }
.auth-tagline::before { content: ''; width: 16px; height: 1px; background: #c9a961; }
.auth-card .alert { margin-bottom: 16px; }
.auth-card .btn { width: 100%; margin-top: 6px; }

/* ===== GRID CONTAINERS ===== */
.table-row { display: grid; grid-template-columns: 1.45fr 1fr; gap: 18px; }
.bottom-grid { display: grid; grid-template-columns: 1fr 1.15fr; gap: 18px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1320px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .chart-row { grid-template-columns: 1fr 1fr; }
    .chart-row .panel:last-child { grid-column: span 2; }
    .table-row { grid-template-columns: 1fr; }
    .bottom-grid { grid-template-columns: 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 1050px) {
    .sidebar { width: 76px; padding: 22px 10px 18px; }
    .menu-label { display: none; }
    .menu-text, .menu-arrow, .menu-badge { display: none; }
    .menu-item { justify-content: center; padding: 13px; }
    .menu-item > .menu-link { justify-content: center; }
    .sidebar-footer { display: none; }
    .submenu { display: none !important; }
    .search-box { width: 220px; }
}

@media (max-width: 820px) {
    .app { padding: 14px 12px; flex-direction: column; }
    .sidebar {
        position: fixed; left: 0; top: 0; bottom: 0; width: 268px; border-radius: 0;
        transform: translateX(-100%); transition: transform .25s ease; z-index: 200; max-height: none;
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-toggle { display: inline-flex; }
    .topbar { padding: 14px 18px; border-radius: 18px; top: 14px; }
    .search-box { display: none; }
    .user-info { display: none; }
    .user-menu-btn, .user-chip { padding: 5px; }
    .chart-row { grid-template-columns: 1fr; }
    .chart-row .panel:last-child { grid-column: span 1; }
    .page-head h1, .page-title { font-size: 1.5rem; }
    .kpi-value { font-size: 2rem; }
}

@media (max-width: 600px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .page-head { flex-direction: column; }
    .page-actions { width: 100%; }
    .page-actions .btn { flex: 1; justify-content: center; }
    .panel, .card { padding: 18px; }
    .card-body { padding: 6px 16px 18px; }
    .table th, .table td { padding: 11px 14px; }
    .app-footer { flex-direction: column; align-items: flex-start; }
    .top-actions { gap: 8px; }
    .icon-btn, .theme-toggle { width: 40px; height: 40px; }
    .brand-text .tagline { display: none; }
}

/* ===== Greeting, live clock, avatars, branding ===== */
.topbar-greet { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); padding: 8px 16px; border-left: 1px solid var(--border); white-space: nowrap; }
.live-clock {
    display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-display);
    font-size: 0.95rem; font-weight: 700; color: var(--navy-900); padding: 7px 13px;
    border: 1px solid var(--border); border-radius: 10px; background: rgba(255, 255, 255, 0.5);
    letter-spacing: .5px; white-space: nowrap;
}
body.dark .live-clock { color: var(--gold-300); background: rgba(16, 32, 58, 0.5); }
.live-clock i { color: var(--gold-500); font-size: 0.8rem; }
.logo-mark img { width: 100%; height: 100%; object-fit: contain; border-radius: 14px; }
.user-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.profile-avatar-large {
    width: 88px; height: 88px; border-radius: 50%; flex-shrink: 0; overflow: hidden;
    background: linear-gradient(145deg, var(--navy-700), var(--navy-900)); color: var(--gold-400);
    display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.5rem;
}
.profile-avatar-large img { width: 100%; height: 100%; object-fit: cover; }
.brand-preview { margin-top: 8px; }
.brand-preview img { max-width: 90px; max-height: 60px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); padding: 4px; display: block; }
.btn-sm { padding: 6px 12px; font-size: 0.76rem; }
input.form-control[type="range"] { height: auto; padding: 6px 0; border: none; background: transparent; box-shadow: none; cursor: pointer; accent-color: var(--gold-500); }
@media (max-width: 1050px) { .topbar-greet { display: none; } }
@media (max-width: 600px) { .live-clock { display: none; } }

/* ===== Spreadsheet grid ===== */
.sheet-grid { border-collapse: separate; border-spacing: 0; }
.sheet-grid td { padding: 0 !important; border: 1px solid var(--border) !important; }
.cell-head { background: var(--surface-2); color: var(--text-muted); font-weight: 700; font-size: 0.72rem; text-align: center; padding: 4px 8px !important; min-width: 40px; border: 1px solid var(--border); position: sticky; }
.cell-td { min-width: 100px; height: 30px; padding: 3px 8px; font-size: 0.85rem; cursor: cell; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; user-select: none; }
.cell-td.selected { outline: 2px solid var(--gold-500); outline-offset: -2px; }
.cell-input { width: 100%; min-width: 96px; border: 1px solid var(--border); border-radius: 6px; padding: 7px 9px; font-size: 0.85rem; background: var(--surface); color: var(--text); font-family: inherit; }
.cell-input:focus { outline: none; border-color: var(--gold-500); box-shadow: 0 0 0 3px rgba(201,169,97,.12); }

/* ===== Certificate signatories ===== */
.cert-footer { display: flex; justify-content: space-around; flex-wrap: wrap; gap: 24px; }

/* ===== Auth links ===== */
.auth-links { margin-top: 16px; text-align: center; }
.auth-links a { font-size: 0.83rem; font-weight: 600; color: #0a1628; }
.auth-links a:hover { color: #c9a961; }

/* ===== Calendar ===== */
.calendar-grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
.calendar-grid th { padding: 8px; text-align: center; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); border: 1px solid var(--border); background: var(--surface-2); }
.calendar-grid td { border: 1px solid var(--border); vertical-align: top; height: 96px; padding: 4px; background: var(--surface); }
.cal-empty { background: var(--surface-2) !important; }
.cal-today { background: rgba(201, 169, 97, 0.08); }
.cal-today .cal-daynum { background: var(--gold-500); color: #fff; }
.cal-daynum { display: inline-block; width: 22px; height: 22px; line-height: 22px; text-align: center; border-radius: 6px; font-size: 0.75rem; font-weight: 700; color: var(--text-muted); margin-bottom: 4px; }
.cal-event { display: block; font-size: 0.7rem; color: #fff; padding: 2px 6px; border-radius: 5px; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event:hover { opacity: .85; color: #fff; }
@media (max-width: 768px) { .calendar-grid td { height: 60px; } }

/* User Guide accordion */
.guide-item { border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; margin-bottom: 10px; background: var(--card); }
.guide-item summary { cursor: pointer; font-weight: 600; display: flex; align-items: center; justify-content: space-between; list-style: none; }
.guide-item summary::-webkit-details-marker { display: none; }
.guide-item summary::after { content: '\f078'; font-family: 'Font Awesome 6 Free'; font-weight: 900; color: var(--muted); transition: transform .2s ease; }
.guide-item[open] summary::after { transform: rotate(180deg); }
.guide-content { margin-top: 10px; color: var(--text-muted); line-height: 1.7; white-space: normal; }
.guide-item summary .btn-icon { flex-shrink: 0; }

/* Skill management helper styles */
.q-row .form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.q-row .form-row .form-group { flex: 1; min-width: 120px; }

/* End of TAMS theme */