/* ================================================================
   SIS FIMS - Professional Design System
   Powered by HIIS INVENTIVE CONSULT
   ================================================================ */

/* 1. INTER FONT - */
@font-face {
    font-family: 'Inter';
    src: url('../fonts/inter-400.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Inter';
    src: url('../fonts/inter-500.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Inter';
    src: url('../fonts/inter-600.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Inter';
    src: url('../fonts/inter-700.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* 2. DESIGN TOKENS - */
:root {
    /* Sidebar */
    --sidebar-bg:           #0f172a;
    --sidebar-border:       rgba(255,255,255,0.06);
    --sidebar-text:         #94a3b8;
    --sidebar-text-hover:   #e2e8f0;
    --sidebar-text-active:  #c7d2fe;
    --sidebar-item-hover:   rgba(255,255,255,0.06);
    --sidebar-item-active:  rgba(99,102,241,0.18);
    --sidebar-section:      #475569;
    --sidebar-width:        260px;

    /* Brand / Primary */
    --primary:              #6366f1;
    --primary-hover:        #4f46e5;
    --primary-light:        #eef2ff;
    --primary-border:       #c7d2fe;

    /* Semantic */
    --success:              #10b981;
    --success-light:        #ecfdf5;
    --success-text:         #065f46;
    --success-border:       #a7f3d0;
    --warning:              #f59e0b;
    --warning-light:        #fffbeb;
    --warning-text:         #92400e;
    --warning-border:       #fde68a;
    --danger:               #ef4444;
    --danger-hover:         #dc2626;
    --danger-light:         #fef2f2;
    --danger-text:          #991b1b;
    --danger-border:        #fecaca;
    --info:                 #3b82f6;
    --info-light:           #eff6ff;
    --info-text:            #1e40af;
    --info-border:          #bfdbfe;

    /* Surfaces */
    --bg:                   #f1f5f9;
    --surface:              #ffffff;
    --border:               #e2e8f0;
    --border-strong:        #cbd5e1;

    /* Text */
    --text:                 #0f172a;
    --text-secondary:       #475569;
    --text-muted:           #94a3b8;

    /* Layout */
    --header-height:        64px;

    /* Border Radius */
    --r-xs:  4px;
    --r-sm:  6px;
    --r:     10px;
    --r-lg:  14px;
    --r-xl:  20px;
    --r-full: 9999px;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
    --shadow:    0 4px 6px -1px rgba(0,0,0,0.06), 0 2px 4px -1px rgba(0,0,0,0.03);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.07), 0 4px 6px -2px rgba(0,0,0,0.04);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.08), 0 10px 10px -5px rgba(0,0,0,0.02);

    /* Typography */
    --font:      'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'Consolas', 'Monaco', 'Courier New', monospace;

    /* Transitions */
    --t:      150ms cubic-bezier(0.4,0,0.2,1);
    --t-slow: 300ms cubic-bezier(0.4,0,0.2,1);
}

/* SAS-inspired visual theme */
:root {
    --navy: #0D1B2A;
    --navy-light: #162d44;
    --navy-mid: #1e3d5a;
    --gold: #C9A84C;
    --gold-light: #d4b56a;
    --gold-dark: #a88830;
    --emerald: #1B6B45;
    --emerald-light: #22874f;

    --sidebar-bg: var(--navy);
    --sidebar-border: rgba(255,255,255,0.08);
    --sidebar-text: rgba(255,255,255,0.62);
    --sidebar-text-hover: #ffffff;
    --sidebar-text-active: var(--gold);
    --sidebar-item-hover: rgba(255,255,255,0.06);
    --sidebar-item-active: rgba(201,168,76,0.13);
    --sidebar-section: rgba(255,255,255,0.32);

    --primary: var(--gold);
    --primary-hover: var(--gold-dark);
    --primary-light: rgba(201,168,76,0.14);
    --primary-border: rgba(201,168,76,0.36);
    --success: var(--emerald);
    --success-light: rgba(27,107,69,0.1);
    --success-text: #15573a;
    --success-border: rgba(27,107,69,0.25);

    --bg: #f0f4f8;
    --surface: #ffffff;
    --text: var(--navy);
    --text-secondary: #334155;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;

    --r-sm: 8px;
    --r: 10px;
    --r-lg: 12px;
    --r-xl: 18px;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --shadow-sm: 0 2px 12px rgba(13,27,42,0.08);
    --shadow-md: 0 4px 20px rgba(13,27,42,0.12);
    --shadow-lg: 0 8px 40px rgba(13,27,42,0.16);
}

/* 3. RESET - */
*, *::before, *::after { box-sizing: border-box; }

html { --webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
    --webkit-font-smoothing: antialiased;
    --moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }
input, textarea, select { font-family: inherit; }

h1, h2, h3, h4 { margin: 0 0 8px; font-weight: 600; line-height: 1.3; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; }
p  { margin: 0 0 12px; }

/* 4. APP SHELL - */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* 5. SIDEBAR - */
.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow: hidden;
    transition: transform var(--t-slow);
}

.sidebar-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 18px 16px;
    border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-logo-icon {
    width: 36px; height: 36px;
    background: var(--primary);
    border-radius: var(--r-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; color: #fff;
    flex-shrink: 0;
    letter-spacing: -0.5px;
}

.sidebar-brand {
    overflow: hidden;
}

.sidebar-brand-name {
    font-size: 13px;
    font-weight: 700;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.sidebar-brand-sub {
    font-size: 11px;
    color: var(--sidebar-text);
    white-space: nowrap;
}

/* Nav scroll area */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 10px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.nav-section {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--sidebar-section);
    padding: 14px 8px 6px;
    margin-top: 4px;
}

.nav-section:first-child { padding-top: 4px; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--r-sm);
    color: var(--sidebar-text);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--t), color var(--t);
    white-space: nowrap;
    overflow: hidden;
    position: relative;
    margin-bottom: 1px;
}

.nav-link:hover {
    background: var(--sidebar-item-hover);
    color: var(--sidebar-text-hover);
}

.nav-link.active {
    background: var(--sidebar-item-active);
    color: var(--sidebar-text-active);
}

.nav-link svg {
    width: 17px; height: 17px;
    flex-shrink: 0;
    stroke: currentColor;
    stroke-width: 1.8;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.9;
}

.nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: var(--r-full);
    padding: 1px 6px;
    min-width: 18px;
    text-align: center;
}

/* Sidebar footer */
.sidebar-footer {
    flex-shrink: 0;
    border-top: 1px solid var(--sidebar-border);
    padding: 12px 14px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-avatar {
    width: 34px; height: 34px;
    background: var(--primary);
    border-radius: var(--r-full);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; color: #fff;
    flex-shrink: 0;
}

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

.sidebar-user-name {
    font-size: 13px; font-weight: 600;
    color: #f1f5f9;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    line-height: 1.3;
}

.sidebar-user-role {
    font-size: 11px;
    color: var(--sidebar-text);
}

.sidebar-logout {
    display: flex; align-items: center; justify-content: center;
    width: 30px; height: 30px;
    border-radius: var(--r-sm);
    color: var(--sidebar-text);
    transition: background var(--t), color var(--t);
    cursor: pointer;
    flex-shrink: 0;
}

.sidebar-logout:hover {
    background: rgba(239,68,68,0.15);
    color: #fca5a5;
}

.sidebar-logout svg {
    width: 16px; height: 16px;
    stroke: currentColor; stroke-width: 2; fill: none;
    stroke-linecap: round; stroke-linejoin: round;
}

/* 6. APP BODY - */
.app-body {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
}

/* 7. TOPBAR - */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--header-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    gap: 16px;
    box-shadow: var(--shadow-xs);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.topbar-hamburger {
    display: none;
    align-items: center; justify-content: center;
    width: 36px; height: 36px;
    border: none;
    background: transparent;
    border-radius: var(--r-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background var(--t);
    flex-shrink: 0;
}

.topbar-hamburger:hover { background: var(--bg); }
.topbar-hamburger svg {
    width: 20px; height: 20px;
    stroke: currentColor; stroke-width: 2; fill: none;
    stroke-linecap: round; stroke-linejoin: round;
}

.topbar-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.topbar-icon-btn {
    display: flex; align-items: center; justify-content: center;
    width: 38px; height: 38px;
    border: none;
    background: transparent;
    border-radius: var(--r);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background var(--t), color var(--t);
    position: relative;
    text-decoration: none;
}

.topbar-icon-btn:hover { background: var(--bg); color: var(--text); }
.topbar-icon-btn svg {
    width: 20px; height: 20px;
    stroke: currentColor; stroke-width: 1.8; fill: none;
    stroke-linecap: round; stroke-linejoin: round;
}

.notif-dot {
    position: absolute;
    top: 6px; right: 6px;
    width: 8px; height: 8px;
    background: var(--danger);
    border-radius: var(--r-full);
    border: 2px solid var(--surface);
}

.notif-count {
    position: absolute;
    top: 4px; right: 4px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: var(--r-full);
    padding: 0 4px;
    min-width: 16px;
    height: 16px;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--surface);
    line-height: 1;
}

.topbar-divider {
    width: 1px; height: 22px;
    background: var(--border);
    flex-shrink: 0;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px 4px 4px;
    border-radius: var(--r);
    cursor: pointer;
    transition: background var(--t);
    text-decoration: none;
    color: var(--text);
}

.topbar-user:hover { background: var(--bg); }

.topbar-avatar {
    width: 32px; height: 32px;
    background: var(--primary);
    border-radius: var(--r-full);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; color: #fff;
    flex-shrink: 0;
}

.topbar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}

/* 8. MAIN CONTENT - */
.page-content {
    flex: 1;
    padding: 28px 28px 0;
    animation: fadeIn 0.2s ease;
}

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

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.page-header-left { min-width: 0; }

.page-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.page-subtitle {
    font-size: 13.5px;
    color: var(--text-muted);
    margin-top: 2px;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.data-transfer-actions,
.export-actions,
.import-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.data-transfer-actions {
    justify-content: space-between;
    margin: 10px 0 14px;
}

.file-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--navy);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.file-button input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

/* 9. FLASH MESSAGES - */
.flash {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--r);
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
    animation: slideDown 0.25s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.flash svg {
    width: 18px; height: 18px; flex-shrink: 0;
    stroke: currentColor; stroke-width: 2; fill: none;
    stroke-linecap: round; stroke-linejoin: round;
}

.flash-dismiss {
    margin-left: auto;
    background: none; border: none;
    cursor: pointer; padding: 0;
    color: inherit; opacity: 0.6;
    display: flex; align-items: center;
}

.flash-dismiss:hover { opacity: 1; }
.flash-dismiss svg { width: 16px; height: 16px; }

.flash.success {
    background: var(--success-light);
    color: var(--success-text);
    border: 1px solid var(--success-border);
}

.flash.error {
    background: var(--danger-light);
    color: var(--danger-text);
    border: 1px solid var(--danger-border);
}

.flash.warning {
    background: var(--warning-light);
    color: var(--warning-text);
    border: 1px solid var(--warning-border);
}

.flash.info {
    background: var(--info-light);
    color: var(--info-text);
    border: 1px solid var(--info-border);
}

/* Backward compat */
.alert { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--r); margin-bottom: 20px; font-size: 14px; font-weight: 500; }
.alert.error  { background: var(--danger-light); color: var(--danger-text); border: 1px solid var(--danger-border); }
.alert.success { background: var(--success-light); color: var(--success-text); border: 1px solid var(--success-border); }

/* 10. CARDS / PANELS - */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow var(--t-slow), transform var(--t-slow);
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

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

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

.card-body { padding: 20px; }

/* Legacy panel classes */
.panel, .auth-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin-bottom: 24px;
}

.wide-panel { width: min(100%, 1200px); }

/* 11. DASHBOARD METRICS - */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.metric {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    overflow: hidden;
    transition: box-shadow var(--t), transform var(--t);
}

.metric:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.metric::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--primary);
    border-radius: var(--r-lg) var(--r-lg) 0 0;
}

.metric.m-success::before { background: var(--success); }
.metric.m-warning::before { background: var(--warning); }
.metric.m-danger::before  { background: var(--danger); }
.metric.m-info::before    { background: var(--info); }

.metric-icon {
    width: 40px; height: 40px;
    border-radius: var(--r);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.metric-icon svg {
    width: 20px; height: 20px;
    stroke: currentColor; stroke-width: 1.8; fill: none;
    stroke-linecap: round; stroke-linejoin: round;
}

.metric-icon.primary { background: var(--primary-light); color: var(--primary); }
.metric-icon.success { background: var(--success-light); color: var(--success); }
.metric-icon.warning { background: var(--warning-light); color: var(--warning); }
.metric-icon.danger  { background: var(--danger-light);  color: var(--danger); }
.metric-icon.info    { background: var(--info-light);    color: var(--info); }

.metric span {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.metric strong {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
    display: block;
}

.metric-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* 12. CHARTS - */
.chart-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.chart-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    padding: 20px;
}

.chart-panel h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 16px;
}

.chart-panel canvas {
    width: 100% !important;
    height: 220px !important;
}

.dashboard-summary {
    margin-bottom: 20px;
}

.dashboard-grid.compact {
    margin-bottom: 14px;
}

.stat-row.compact {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
}

.chart-grid.enlarged {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.chart-grid.enlarged .chart-panel canvas {
    height: 320px !important;
}

.chart-grid.enlarged .chart-panel.featured canvas {
    height: 360px !important;
}

.settings-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.settings-tabs a {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid transparent;
    border-bottom: 0;
    border-radius: var(--r-sm) var(--r-sm) 0 0;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 13px;
}

.settings-tabs a.active {
    background: var(--surface);
    border-color: var(--border);
    color: var(--primary);
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.settings-grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 18px;
}

.settings-table {
    margin-top: 16px;
    max-height: 320px;
}

.settings-logo {
    max-height: 82px;
    margin-bottom: 14px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
}

.settings-upload {
    margin-bottom: 20px;
    align-items: end;
}

.mini-list {
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    background: var(--surface);
    overflow: hidden;
}

.mini-list h3 {
    margin: 0;
    padding: 12px 14px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}

.mini-list > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}

.mini-list > div:last-child {
    border-bottom: 0;
}

.profile-layout {
    width: min(100%, 980px);
    display: grid;
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
    gap: 18px;
}

.profile-summary {
    text-align: center;
    align-self: start;
}

.profile-avatar {
    width: 72px;
    height: 72px;
    margin: 0 auto 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #fff;
    font-size: 28px;
    font-weight: 800;
}

.profile-summary h2 {
    margin: 0 0 4px;
}

.profile-summary p {
    margin: 0 0 14px;
    color: var(--text-muted);
    font-size: 13px;
}

.profile-meta {
    display: grid;
    gap: 8px;
    color: var(--text-muted);
    font-size: 13px;
}

/* 13. TABLES - */
.table-wrap {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--r-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.table-search {
    position: relative;
    flex: 1;
    max-width: 320px;
}

.table-search-icon {
    position: absolute;
    left: 10px; top: 50%;
    transform: translateY(-50%);
    width: 15px; height: 15px;
    color: var(--text-muted);
    stroke: currentColor; stroke-width: 2; fill: none;
    stroke-linecap: round; stroke-linejoin: round;
    pointer-events: none;
}

.table-search input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 8px 10px 8px 32px;
    font-size: 13.5px;
    background: var(--bg);
    color: var(--text);
    transition: border-color var(--t), box-shadow var(--t);
}

.table-search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
    background: var(--surface);
}

table {
    width: 100%;
    min-width: 600px;
    border-collapse: collapse;
    background: var(--surface);
}

thead { background: #f8fafc; }

th {
    padding: 11px 14px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    text-align: left;
}

td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
    vertical-align: middle;
    color: var(--text);
}

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

tbody tr {
    transition: background var(--t);
}

tbody tr:hover { background: #fafbfc; }

.table-empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.table-empty svg {
    width: 40px; height: 40px;
    stroke: var(--border-strong); stroke-width: 1.5;
    fill: none; margin: 0 auto 12px;
    stroke-linecap: round; stroke-linejoin: round;
    display: block;
}

/* 14. BADGES - */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border-radius: var(--r-full);
    padding: 3px 10px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.badge-dot {
    width: 6px; height: 6px;
    border-radius: var(--r-full);
    background: currentColor;
    flex-shrink: 0;
}

.badge.ok,    .badge.success,    .badge-success   { background: var(--success-light); color: var(--success-text); }
.badge.warn,  .badge.warning,    .badge-warning   { background: var(--warning-light); color: var(--warning-text); }
.badge.danger,.badge.error,      .badge-danger    { background: var(--danger-light);  color: var(--danger-text);  }
.badge.info,                     .badge-info      { background: var(--info-light);    color: var(--info-text);    }
.badge.neutral,                  .badge-neutral   { background: #f1f5f9; color: var(--text-secondary); }
.badge.primary,                  .badge-primary   { background: var(--primary-light); color: var(--primary); }

/* 15. BUTTONS - */
.button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid transparent;
    border-radius: var(--r-sm);
    padding: 9px 16px;
    font-family: var(--font);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--t), box-shadow var(--t), transform var(--t), border-color var(--t);
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.4;
}

.button:active, .btn:active { transform: scale(0.98); }

.button svg, .btn svg {
    width: 16px; height: 16px;
    stroke: currentColor; stroke-width: 2; fill: none;
    stroke-linecap: round; stroke-linejoin: round;
    flex-shrink: 0;
}

/* Primary */
.button, .btn { background: var(--primary); color: #fff; }
.button:hover, .btn:hover { background: var(--primary-hover); box-shadow: 0 0 0 3px rgba(99,102,241,0.2); }

/* Ghost */
.button.ghost, .btn-ghost {
    background: var(--surface); color: var(--text-secondary);
    border-color: var(--border);
}
.button.ghost:hover, .btn-ghost:hover { background: var(--bg); color: var(--text); border-color: var(--border-strong); }

/* Danger */
.button.danger, .btn-danger { background: var(--danger); color: #fff; }
.button.danger:hover, .btn-danger:hover { background: var(--danger-hover); box-shadow: 0 0 0 3px rgba(239,68,68,0.2); }

/* Success */
.button.success, .btn-success { background: var(--success); color: #fff; }
.button.success:hover, .btn-success:hover { background: #059669; }

/* Warning */
.button.warning, .btn-warning { background: var(--warning); color: #fff; }

/* Sizes */
.button.small, .btn-sm { padding: 6px 12px; font-size: 12.5px; }
.button.large, .btn-lg { padding: 12px 22px; font-size: 15px; }

/* 16. FORMS - */
.form-grid {
    display: grid;
    gap: 18px;
}

.form-grid .field {
    display: grid;
    gap: 6px;
}

.form-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.full { grid-column: 1 / -1; }

label {
    display: grid;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.label-optional {
    font-size: 11px;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 4px;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
textarea,
select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 10px 12px;
    font: inherit;
    font-size: 14px;
    background: var(--surface);
    color: var(--text);
    transition: border-color var(--t), box-shadow var(--t);
    appearance: none;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

input:disabled, textarea:disabled, select:disabled {
    background: var(--bg);
    color: var(--text-muted);
    cursor: not-allowed;
}

textarea { min-height: 90px; resize: vertical; }

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: -10px;
}

.form-error {
    font-size: 12px;
    color: var(--danger-text);
    margin-top: -10px;
}

/* Password toggle */
.input-wrapper {
    position: relative;
}

.input-wrapper input { padding-right: 40px; }

.password-toggle {
    position: absolute;
    right: 0; top: 0; bottom: 0;
    padding: 0 12px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--text-muted);
    display: flex; align-items: center;
    transition: color var(--t);
    font-size: 12px;
    font-weight: 600;
}

.password-toggle:hover { color: var(--primary); }

/* Checkboxes */
.check-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
}

.check-label input[type="checkbox"],
.check-label input[type="radio"] {
    width: 16px; height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}

/* Permission grid */
.permission-form { display: grid; gap: 16px; }
.permission-grid { display: flex; flex-wrap: wrap; gap: 10px 20px; }

/* Inline form */
.inline-form {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 2px;
}

.inline-form select,
.inline-form input {
    min-width: 120px;
    padding: 7px 10px;
    width: auto;
}

/* 17. REPORT TABS - */
.report-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px;
    background: var(--bg);
    border-radius: var(--r);
    margin-bottom: 20px;
    width: fit-content;
}

.report-tabs a, .report-tabs .tab-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--r-sm);
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: background var(--t), color var(--t);
    white-space: nowrap;
}

.report-tabs a:hover, .report-tabs .tab-link:hover {
    background: var(--surface);
    color: var(--text);
}

.report-tabs a.active, .report-tabs .tab-link.active {
    background: var(--surface);
    color: var(--primary);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

/* 18. MODALS / OVERLAYS - */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(15,23,42,0.5);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.15s ease;
}

.modal {
    background: var(--surface);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    animation: scaleIn 0.2s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

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

.modal-title { font-size: 16px; font-weight: 600; margin: 0; }

.modal-close {
    width: 32px; height: 32px;
    border: none; background: none;
    border-radius: var(--r-sm);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
    transition: background var(--t), color var(--t);
}

.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-close svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }

.modal-body { padding: 20px; }

.modal-footer {
    display: flex; align-items: center; justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
}

/* 19. STATS / SUMMARY ROWS - */
.stat-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.stat-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 14px 18px;
    flex: 1;
    min-width: 140px;
}

.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-size: 20px; font-weight: 700; color: var(--text); margin-top: 4px; }

/* 20. UTILITY HELPERS - */
.muted     { color: var(--text-muted); }
.text-sm   { font-size: 12.5px; }
.text-xs   { font-size: 11px; }
.fw-600    { font-weight: 600; }
.fw-700    { font-weight: 700; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.nowrap { white-space: nowrap; }
.monospace { font-family: var(--font-mono); }

/* 21. APP FOOTER - */
.app-footer {
    padding: 16px 28px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--surface);
    margin-top: 24px;
}

/* 22. AUTH LAYOUT - */
.auth-shell {
    min-height: 100vh;
    display: flex;
}

.auth-left {
    flex: 0 0 440px;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 40px;
    position: relative;
    overflow: hidden;
}

.auth-left::before {
    content: '';
    position: absolute;
    bottom: -80px; right: -80px;
    width: 360px; height: 360px;
    background: radial-gradient(circle, rgba(99,102,241,0.25) 0%, transparent 65%);
    border-radius: 50%;
}

.auth-left::after {
    content: '';
    position: absolute;
    top: -60px; left: -60px;
    width: 280px; height: 280px;
    background: radial-gradient(circle, rgba(99,102,241,0.12) 0%, transparent 65%);
    border-radius: 50%;
}

.auth-brand {
    position: relative;
    z-index: 1;
    text-align: center;
}

.auth-brand-logo {
    width: 64px; height: 64px;
    background: var(--primary);
    border-radius: var(--r-lg);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: 800; color: #fff;
    margin: 0 auto 20px;
    box-shadow: 0 8px 24px rgba(99,102,241,0.4);
}

.auth-brand h1 {
    font-size: 20px;
    font-weight: 700;
    color: #f1f5f9;
    line-height: 1.3;
    margin-bottom: 10px;
}

.auth-brand p {
    font-size: 14px;
    color: var(--sidebar-text);
    line-height: 1.6;
    margin: 0;
}

.auth-illustration {
    position: relative;
    z-index: 1;
    margin-top: 40px;
    opacity: 0.85;
}

.auth-illustration svg { width: 220px; height: auto; }

.auth-left-footer {
    position: absolute;
    bottom: 24px;
    font-size: 12px;
    color: var(--sidebar-section);
    z-index: 1;
}

.auth-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 40px;
    background: var(--bg);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 36px;
    box-shadow: var(--shadow-md);
}

.auth-card h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.auth-card .subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 28px;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* 23. INSTALL LAYOUT - */
.install-shell {
    min-height: 100vh;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
}

.install-card {
    width: 100%;
    max-width: 640px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.install-header {
    background: var(--sidebar-bg);
    padding: 28px 32px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.install-logo {
    width: 48px; height: 48px;
    background: var(--primary);
    border-radius: var(--r);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 800; color: #fff;
    flex-shrink: 0;
}

.install-header-text h1 {
    font-size: 18px; font-weight: 700; color: #f1f5f9; margin: 0 0 2px;
}

.install-header-text p {
    font-size: 13px; color: var(--sidebar-text); margin: 0;
}

.install-progress {
    background: #1e293b;
    padding: 14px 32px;
    display: flex;
    align-items: center;
    gap: 0;
}

.install-step {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.install-step-num {
    width: 26px; height: 26px;
    border-radius: var(--r-full);
    border: 2px solid #334155;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; color: #64748b;
    flex-shrink: 0;
    transition: all var(--t);
}

.install-step.done .install-step-num {
    background: var(--success); border-color: var(--success); color: #fff;
}

.install-step.active .install-step-num {
    background: var(--primary); border-color: var(--primary); color: #fff;
}

.install-step-label {
    font-size: 11px; color: #64748b; font-weight: 500;
}

.install-step.active .install-step-label { color: #e2e8f0; }

.install-step-divider {
    height: 1px; background: #334155; flex: 1; margin: 0 8px;
}

.install-body { padding: 28px 32px; }

.install-footer {
    padding: 16px 32px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

/* 24. PARENT PORTAL - */
.parent-shell { min-height: 100vh; display: flex; flex-direction: column; }

.parent-header {
    background: var(--sidebar-bg);
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.parent-brand {
    display: flex; align-items: center; gap: 10px;
    color: #f1f5f9;
    font-weight: 700; font-size: 15px;
}

.parent-brand-icon {
    width: 32px; height: 32px;
    background: var(--primary);
    border-radius: var(--r-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 800; color: #fff;
}

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

.parent-nav a {
    padding: 6px 14px;
    border-radius: var(--r-sm);
    font-size: 13.5px;
    font-weight: 500;
    color: var(--sidebar-text);
    transition: background var(--t), color var(--t);
}

.parent-nav a:hover { background: rgba(255,255,255,0.08); color: #f1f5f9; }
.parent-nav a.active { background: rgba(99,102,241,0.2); color: var(--sidebar-text-active); }

.parent-content {
    flex: 1;
    padding: 28px;
    max-width: 960px;
    width: 100%;
    margin: 0 auto;
}

.parent-footer {
    padding: 14px 24px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
}

/* 25. PRINT STYLES - */
.print-body { background: #fff; }

.print-page {
    width: min(100%, 900px);
    margin: 0 auto;
    padding: 32px;
    color: #111827;
    font-family: var(--font);
}

.print-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding-bottom: 18px;
    margin-bottom: 24px;
    border-bottom: 2px solid #111827;
}

.print-header img {
    width: 72px; height: 72px;
    object-fit: contain;
    border-radius: 6px;
}

.print-logo-placeholder {
    width: 72px; height: 72px;
    background: var(--primary);
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: 800; color: #fff;
    flex-shrink: 0;
}

.print-school-name { font-size: 20px; font-weight: 700; margin: 0 0 4px; }
.print-school-info { font-size: 13px; color: #4b5563; margin: 2px 0; }

.print-footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    border-top: 1px solid #d1d5db;
    margin-top: 32px;
    padding-top: 12px;
    font-size: 12px;
    color: #6b7280;
}

/* 26. SIDEBAR OVERLAY (mobile) - */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.5);
    z-index: 99;
    animation: fadeIn 0.2s ease;
}

/* 27. RESPONSIVE - */
@media (max-width: 1024px) {
    .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

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

    .app-body { margin-left: 0; }

    .topbar-hamburger { display: flex; }

    .topbar-user-name { display: none; }

    .page-content { padding: 20px 16px 0; }

    .app-footer { padding: 14px 16px; }

    .auth-left { display: none; }

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

    .chart-grid { grid-template-columns: 1fr; }
    .chart-grid.enlarged { grid-template-columns: 1fr; }
    .settings-grid, .settings-grid.three, .profile-layout { grid-template-columns: 1fr; }

    .form-grid.two, .form-grid.three { grid-template-columns: 1fr; }

    .install-progress { overflow-x: auto; }
}

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

    .topbar { padding: 0 14px; }

    .page-header { flex-direction: column; }
}

/* 28. PRINT MEDIA - */
@media print {
    .sidebar, .topbar, .app-footer, .button, .btn, .flash, .alert,
    .page-actions, .table-toolbar, .no-print { display: none !important; }

    .app-body { margin-left: 0 !important; }
    .page-content { padding: 0 !important; animation: none !important; }

    body { background: #fff; }

    table { page-break-inside: auto; }
    tr { page-break-inside: avoid; }
}

/* 29. SCROLLBAR POLISH - */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* 30. FOCUS RING - */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* - File Upload Button - */
.file-upload-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    background: var(--primary);
    color: #fff;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .18s, transform .1s;
    border: none;
    line-height: 1.4;
    white-space: nowrap;
}
.file-upload-label:hover  { background: var(--primary-dark, #4f46e5); transform: translateY(-1px); }
.file-upload-label:active { transform: translateY(0); }
.file-upload-label svg    { width:16px;height:16px;flex-shrink:0; }
.file-upload-label input[type="file"] { display:none; }

.file-upload-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.file-upload-name {
    font-size: 13px;
    color: var(--text-muted);
    font-style: italic;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* - Sidebar school logo - */
.sidebar-school-logo {
    width: 42px;
    height: 42px;
    object-fit: contain;
    border-radius: 8px;
    background: rgba(255,255,255,.12);
    padding: 3px;
    flex-shrink: 0;
}

/* - Auth page school logo - */
.auth-school-logo {
    max-width: 120px;
    max-height: 80px;
    object-fit: contain;
    margin-bottom: 16px;
    border-radius: 8px;
    background: rgba(255,255,255,.15);
    padding: 8px;
}

/* 31. SAS THEME OVERRIDES --------------------------------------- */
body {
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
}

h1, h2, h3, h4 {
    color: var(--navy);
    font-weight: 700;
}

.sidebar {
    background: var(--navy);
}

.sidebar-header {
    min-height: 80px;
    padding: 20px 16px 18px;
}

.sidebar-logo-icon,
.sidebar-avatar,
.topbar-avatar,
.parent-brand-icon,
.auth-brand-logo,
.install-logo,
.profile-avatar {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: var(--navy);
}

.nav-link {
    border-left: 3px solid transparent;
    border-radius: 0;
    margin-bottom: 0;
    padding: 10px 17px;
}

.nav-link:hover {
    border-left-color: rgba(201,168,76,0.55);
}

.nav-link.active {
    border-left-color: var(--gold);
    background: rgba(201,168,76,0.13);
    color: var(--gold);
}

.nav-section {
    color: rgba(255,255,255,0.32);
    padding-left: 20px;
}

.topbar {
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.page-content {
    padding: 28px 24px 0;
}

.panel,
.card,
.chart-panel,
.metric,
.stat-item,
.mini-list,
.auth-card,
.install-card {
    border: 1px solid rgba(0,0,0,0.04);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
}

.panel {
    padding: 24px;
}

.metric {
    padding: 22px;
    transition: var(--t-slow);
}

.metric:hover,
.chart-panel:hover,
.panel:hover {
    box-shadow: var(--shadow-md);
}

.metric::before {
    height: 4px;
    background: linear-gradient(90deg, var(--navy), var(--navy-mid));
}

.metric.m-success::before { background: linear-gradient(90deg, var(--emerald), var(--emerald-light)); }
.metric.m-warning::before { background: linear-gradient(90deg, var(--gold), var(--gold-light)); }
.metric.m-danger::before  { background: linear-gradient(90deg, var(--danger), #ef4444); }
.metric.m-info::before    { background: linear-gradient(90deg, var(--navy-mid), #3b82f6); }

.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
}

.metric-icon.primary,
.metric-icon.warning {
    background: rgba(201,168,76,0.14);
    color: var(--gold-dark);
}

.metric-icon.success {
    background: rgba(27,107,69,0.11);
    color: var(--emerald);
}

.metric-icon.info {
    background: rgba(13,27,42,0.08);
    color: var(--navy-mid);
}

.metric strong {
    color: var(--navy);
    font-size: 28px;
    font-weight: 800;
}

.button,
.btn {
    border-radius: var(--r-sm);
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: var(--navy);
    border: none;
    box-shadow: none;
}

.button:hover,
.btn:hover {
    background: linear-gradient(135deg, var(--gold-light), var(--gold));
    color: var(--navy);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(201,168,76,0.36);
}

.button.ghost,
.btn-ghost {
    background: #fff;
    color: var(--navy);
    border: 1.5px solid var(--border);
}

.button.ghost:hover,
.btn-ghost:hover {
    border-color: var(--gold);
    color: var(--gold-dark);
    box-shadow: none;
}

.button.danger,
.btn-danger {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    color: #fff;
}

.button.success,
.btn-success {
    background: linear-gradient(135deg, var(--emerald), var(--emerald-light));
    color: #fff;
}

label {
    color: var(--navy);
    font-size: 13px;
    font-weight: 700;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
textarea,
select {
    border: 1.5px solid var(--border);
    border-radius: var(--r-sm);
    padding: 10px 14px;
    background-color: #fff;
    color: var(--text);
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201,168,76,0.16);
}

textarea {
    min-height: 110px;
}

input[type="file"] {
    width: 100%;
    border: 2px dashed var(--border);
    border-radius: var(--r);
    padding: 14px;
    background: #f8fafc;
    color: var(--text-muted);
    cursor: pointer;
}

input[type="file"]:hover {
    border-color: var(--gold);
    background: rgba(201,168,76,0.05);
}

.file-upload-label {
    background: linear-gradient(135deg, var(--navy), var(--navy-light));
    border: 2px dashed var(--gold);
    color: #fff;
    border-radius: var(--r);
}

.file-upload-label:hover {
    background: linear-gradient(135deg, var(--navy-light), var(--navy-mid));
    border-color: var(--gold-light);
}

.table-wrap {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--r);
    box-shadow: var(--shadow-sm);
}

table th {
    background: var(--bg);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

table td {
    color: var(--text-secondary);
}

tbody tr {
    transition: background 0.18s ease;
}

tbody tr:hover {
    background: rgba(201,168,76,0.045);
}

.badge,
.nav-badge {
    border-radius: 999px;
    font-weight: 700;
}

.settings-tabs,
.report-tabs {
    background: var(--bg);
    border: 0;
    border-radius: var(--r);
    padding: 4px;
    width: fit-content;
}

.settings-tabs a,
.report-tabs a,
.report-tabs .tab-link {
    border: 0;
    border-radius: var(--r-sm);
    color: var(--text-secondary);
}

.settings-tabs a.active,
.report-tabs a.active,
.report-tabs .tab-link.active {
    background: #fff;
    color: var(--gold-dark);
    box-shadow: var(--shadow-sm);
}

.chart-panel {
    padding: 24px;
}

.chart-panel h3 {
    color: var(--navy);
    font-size: 15px;
    font-weight: 800;
}

.chart-panel h3::before {
    content: "";
    display: inline-block;
    width: 9px;
    height: 9px;
    margin-right: 8px;
    border-radius: 50%;
    background: var(--gold);
    vertical-align: 1px;
}

.chart-empty-state {
    min-height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-muted);
    text-align: center;
    border: 1px dashed var(--border);
    border-radius: var(--r);
    background: linear-gradient(180deg, #fff, #f8fafc);
}

.chart-empty-state strong {
    color: var(--navy);
    font-size: 14px;
}

.chart-empty-state span {
    font-size: 12px;
}

.chart-empty-icon {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background:
        conic-gradient(var(--gold) 0 35%, var(--emerald) 35% 70%, var(--border) 70% 100%);
    position: relative;
}

.chart-empty-icon::after {
    content: '';
    position: absolute;
    inset: 13px;
    border-radius: 50%;
    background: #fff;
}

.inline-edit-row {
    display: grid;
    grid-template-columns: 150px 110px minmax(160px, 1fr) minmax(180px, 1.5fr) 130px auto;
    gap: 8px;
    align-items: center;
}

.inline-edit-row input,
.inline-edit-row select {
    min-height: 36px;
    padding: 7px 10px;
}

.inline-readonly {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 7px 10px;
    border-radius: var(--r-sm);
    background: var(--bg);
    color: var(--navy);
    font-weight: 700;
}

@media (max-width: 900px) {
    .inline-edit-row {
        grid-template-columns: 1fr;
    }
}

.chart-grid.enlarged .chart-panel.featured {
    border-top: 4px solid var(--gold);
}

.chart-grid.enlarged .chart-panel canvas {
    height: 330px !important;
}

.stat-row.compact .stat-item {
    border-top: 3px solid rgba(201,168,76,0.8);
}

.stat-value {
    color: var(--navy);
    font-weight: 800;
}

.auth-left,
.install-header,
.parent-header {
    background: var(--navy);
}

.auth-left::before,
.auth-left::after {
    background: radial-gradient(circle, rgba(201,168,76,0.2) 0%, transparent 65%);
}

.auth-brand h1,
.install-header-text h1 {
    color: #fff;
}

.auth-brand p,
.install-header-text p {
    color: rgba(255,255,255,0.62);
}

.parent-nav a.active {
    background: rgba(201,168,76,0.14);
    color: var(--gold);
}

.app-footer {
    background: #07111b;
    color: rgba(255,255,255,0.78);
    border-top: 1px solid rgba(255,255,255,0.08);
}

:focus-visible {
    outline-color: var(--gold);
}

/* ================================================================
   DASHBOARD (modern layout)
   ================================================================ */
.dash-page {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.dash-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.dash-title {
    margin: 0;
    font-size: 28px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
}

.dash-welcome {
    margin: 6px 0 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.dash-date {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    box-shadow: var(--shadow-xs);
}

.dash-date svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.dash-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.dash-kpi {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 18px 18px 12px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dash-kpi-top {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.dash-kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.dash-kpi-icon svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.dash-kpi-icon.blue   { background: #eff6ff; color: #3b82f6; }
.dash-kpi-icon.green  { background: #ecfdf5; color: #10b981; }
.dash-kpi-icon.orange { background: #fff7ed; color: #f97316; }
.dash-kpi-icon.purple { background: #f5f3ff; color: #8b5cf6; }

.dash-kpi-meta {
    min-width: 0;
}

.dash-kpi-label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.dash-kpi-value {
    display: block;
    font-size: 24px;
    line-height: 1.1;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
}

.dash-kpi-change {
    display: inline-block;
    margin-top: 6px;
    font-size: 12px;
    font-weight: 600;
}

.dash-kpi-change.up   { color: #10b981; }
.dash-kpi-change.down { color: #ef4444; }
.dash-kpi-change.warn { color: #f97316; }

.dash-sparkline-wrap {
    height: 42px;
    margin-top: 2px;
}

.dash-sparkline-wrap canvas {
    width: 100% !important;
    height: 42px !important;
}

.dash-row {
    display: grid;
    gap: 16px;
}

.dash-row-main {
    grid-template-columns: 1.35fr 1fr 1fr;
}

.dash-row-bottom {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dash-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    min-width: 0;
}

.dash-card-wide {
    min-height: 380px;
}

.dash-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.dash-card-head h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.dash-filter {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: #f8fafc;
}

.dash-link {
    font-size: 12px;
    font-weight: 700;
    color: #3b82f6;
    text-decoration: none;
}

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

.dash-revenue-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.dash-revenue-summary strong {
    display: block;
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
}

.dash-revenue-summary span {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.dash-tag {
    font-size: 12px;
    font-weight: 700;
    padding: 6px 10px;
    border-radius: var(--r-full);
    white-space: nowrap;
}

.dash-tag.up {
    color: #059669;
    background: #ecfdf5;
}

.chart-wrap {
    position: relative;
    width: 100%;
}

.chart-wrap canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

.chart-wrap-lg {
    height: 260px;
}

.chart-wrap-donut,
.chart-wrap-ring {
    height: 240px;
}

.chart-wrap-bar {
    height: 260px;
}

.dash-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dash-list-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
}

.dash-list-item:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.dash-list-item.compact {
    grid-template-columns: auto 1fr auto;
}

.dash-list-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: grid;
    place-items: center;
}

.dash-list-icon svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.5;
}

.dash-list-icon.income  { background: #ecfdf5; color: #10b981; }
.dash-list-icon.expense { background: #fef2f2; color: #ef4444; }
.dash-list-icon.warn    { background: #fff7ed; color: #f97316; }

.dash-list-body strong {
    display: block;
    font-size: 13px;
    color: var(--text);
}

.dash-list-body span {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.dash-list-meta {
    text-align: right;
}

.dash-list-meta strong {
    display: block;
    font-size: 13px;
}

.dash-list-meta span {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.dash-list-empty {
    padding: 24px 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.dash-fee-layout {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 16px;
    align-items: center;
}

.dash-fee-stats {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.dash-fee-stats li {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dash-fee-stats span {
    font-size: 12px;
    color: var(--text-muted);
}

.dash-fee-stats strong {
    font-size: 16px;
    font-weight: 800;
    color: var(--text);
}

.dash-fee-stats li.collected strong { color: #10b981; }
.dash-fee-stats li.outstanding strong { color: #ef4444; }

.text-success { color: #10b981 !important; }
.text-danger  { color: #ef4444 !important; }

@media (max-width: 1200px) {
    .dash-kpi-grid,
    .dash-row-main,
    .dash-row-bottom {
        grid-template-columns: 1fr 1fr;
    }

    .dash-row-main .dash-card-wide {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .dash-kpi-grid,
    .dash-row-main,
    .dash-row-bottom {
        grid-template-columns: 1fr;
    }

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

/* ================================================================
   13. SFMS UPGRADE STYLES
   ================================================================ */

/* Tabs Component */
.sfms-tabs {
    display: flex;
    gap: 20px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
}
.sfms-tab {
    padding: 12px 16px;
    font-size: 14.5px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s ease;
}
.sfms-tab:hover {
    color: var(--text);
}
.sfms-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Tab Content */
.sfms-tab-content {
    display: none;
    animation: fadeInTab 0.3s ease;
}
.sfms-tab-content.active {
    display: block;
}
@keyframes fadeInTab {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Skeleton Loading */
.skeleton {
    background: #e2e8f0;
    background: linear-gradient(110deg, #ececec 8%, #f5f5f5 18%, #ececec 33%);
    border-radius: 5px;
    background-size: 200% 100%;
    animation: 1.5s shine linear infinite;
}
@keyframes shine {
    to { background-position-x: -200%; }
}

/* Enterprise Data Tables */
.table-wrap.enterprise {
    max-height: 600px;
    overflow-y: auto;
}
.table-wrap.enterprise table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg);
    border-bottom: 2px solid var(--border-strong);
    box-shadow: 0 1px 0 rgba(0,0,0,0.05);
}
.table-wrap.enterprise tbody tr {
    transition: background-color 0.15s ease;
}
.table-wrap.enterprise tbody tr:hover {
    background-color: var(--primary-light) !important;
}
.table-wrap.enterprise th.checkbox-col,
.table-wrap.enterprise td.checkbox-col {
    width: 40px;
    text-align: center;
}

/* Floating Form Hints & Input Groups */
.input-group {
    display: flex;
    align-items: stretch;
}
.input-group-text {
    padding: 8px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-right: none;
    border-radius: var(--r-sm) 0 0 var(--r-sm);
    color: var(--text-muted);
    font-weight: 500;
    display: flex;
    align-items: center;
}
.input-group input, 
.input-group select {
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
    flex: 1;
}

/* Print Optimization */
@media print {
    body {
        background: #fff;
    }
    .sidebar, .topbar, .page-header, .page-actions, .card-header form, .sfms-tabs, .button {
        display: none !important;
    }
    .app-body {
        margin-left: 0;
    }
    .page-content {
        padding: 0;
    }
    .card, .panel {
        border: none !important;
        box-shadow: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }
}

/* ================================================================
   ENTERPRISE UI UPGRADES (Added Phase 2)
   ================================================================ */

/* Enhanced Cards */
.card, .panel, .auth-panel {
    border-radius: var(--r-xl, 16px);
    box-shadow: 0 4px 16px rgba(13, 27, 42, 0.04), 0 1px 3px rgba(13, 27, 42, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease;
}
.card:hover, .panel:hover {
    box-shadow: 0 10px 25px rgba(13, 27, 42, 0.08), 0 4px 10px rgba(13, 27, 42, 0.03);
    transform: translateY(-2px);
}
.card-header {
    padding: 20px 24px;
    background: linear-gradient(180deg, #fff 0%, #f9fafb 100%);
    border-bottom: 1px solid rgba(0,0,0,0.04);
}
.card-body {
    padding: 24px;
}

/* Enhanced Buttons */
.btn, .button {
    border-radius: 8px;
    padding: 10px 20px;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-primary, .button.primary {
    background: var(--primary);
    color: #fff;
    border: none;
    box-shadow: 0 2px 4px rgba(201, 168, 76, 0.2);
}
.btn-primary:hover, .button.primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 8px rgba(201, 168, 76, 0.3);
    transform: translateY(-1px);
}

/* Enhanced Forms */
.form-control, input[type="text"], input[type="email"], input[type="password"], select, textarea {
    border-radius: 8px;
    border: 1px solid var(--border-strong);
    padding: 12px 16px;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: #fff;
    color: var(--text);
}
.form-control:focus, input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    outline: none;
}
.form-group label {
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: block;
    font-size: 13px;
}

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* Empty States */
.empty-state {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-muted);
}
.empty-state svg {
    width: 48px;
    height: 48px;
    opacity: 0.5;
    margin-bottom: 16px;
}
.empty-state h3 {
    color: var(--text);
    margin-bottom: 8px;
}
/* ----------------------------------------------------------------
   FIMS Data Table Styles (Added for Enterprise Upgrade)
   ---------------------------------------------------------------- */
.fims-datatable-wrapper {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 24px;
}
.fims-dt-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    gap: 16px;
    flex-wrap: wrap;
}
.fims-dt-search input {
    min-width: 250px;
    padding: 8px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-xs);
    font-size: 14px;
}
.fims-dt-length select {
    padding: 8px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-xs);
    font-size: 14px;
    background: #fff;
}
.fims-dt-container {
    overflow-x: auto;
}
.fims-dt-container table {
    width: 100%;
    border-collapse: collapse;
}
.fims-dt-container th {
    background: var(--bg);
    padding: 12px 20px;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: left;
    border-bottom: 1px solid var(--border-strong);
    white-space: nowrap;
    position: relative;
    user-select: none;
}
.fims-dt-container td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}
.fims-dt-container tr:last-child td {
    border-bottom: none;
}
.fims-dt-container tr:hover td {
    background: var(--bg);
}
th.sortable::after {
    content: '\2195';
    margin-left: 8px;
    opacity: 0.3;
}
th.sortable.asc::after {
    content: '\2191';
    opacity: 1;
    color: var(--primary);
}
th.sortable.desc::after {
    content: '\2193';
    opacity: 1;
    color: var(--primary);
}
.fims-dt-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    gap: 16px;
    flex-wrap: wrap;
    background: var(--surface);
}
.fims-dt-info {
    font-size: 13px;
    color: var(--text-muted);
}
.fims-dt-pagination {
    display: flex;
    gap: 4px;
}
.fims-dt-pagination button {
    padding: 6px 12px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-secondary);
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}
.fims-dt-pagination button:hover:not(:disabled) {
    background: var(--bg);
    color: var(--text);
}
/* ----------------------------------------------------------------
   FIMS Data Table Styles (Added for Enterprise Upgrade)
   ---------------------------------------------------------------- */
.fims-datatable-wrapper {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 24px;
}
.fims-dt-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    gap: 16px;
    flex-wrap: wrap;
}
.fims-dt-search input {
    min-width: 250px;
    padding: 8px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-xs);
    font-size: 14px;
}
.fims-dt-length select {
    padding: 8px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-xs);
    font-size: 14px;
    background: #fff;
}
.fims-dt-container {
    overflow-x: auto;
}
.fims-dt-container table {
    width: 100%;
    border-collapse: collapse;
}
.fims-dt-container th {
    background: var(--bg);
    padding: 12px 20px;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: left;
    border-bottom: 1px solid var(--border-strong);
    white-space: nowrap;
    position: relative;
    user-select: none;
}
.fims-dt-container td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}
.fims-dt-container tr:last-child td {
    border-bottom: none;
}
.fims-dt-container tr:hover td {
    background: var(--bg);
}
th.sortable::after {
    content: '\2195';
    margin-left: 8px;
    opacity: 0.3;
}
th.sortable.asc::after {
    content: '\2191';
    opacity: 1;
    color: var(--primary);
}
th.sortable.desc::after {
    content: '\2193';
    opacity: 1;
    color: var(--primary);
}
.fims-dt-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    gap: 16px;
    flex-wrap: wrap;
    background: var(--surface);
}
.fims-dt-info {
    font-size: 13px;
    color: var(--text-muted);
}
.fims-dt-pagination {
    display: flex;
    gap: 4px;
}
.fims-dt-pagination button {
    padding: 6px 12px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-secondary);
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}
.fims-dt-pagination button:hover:not(:disabled) {
    background: var(--bg);
    color: var(--text);
}
.fims-dt-pagination button.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.fims-dt-pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ----------------------------------------------------------------
   Responsive Layout & Grids
   ---------------------------------------------------------------- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}
.form-grid.single {
    grid-template-columns: 1fr;
}
.form-grid .form-group {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .chart-grid {
        grid-template-columns: 1fr;
    }
}

/* 14. DROPDOWN */
.dropdown {
    position: relative;
    display: inline-block;
}
.dropdown-menu {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    background: #fff;
    min-width: 160px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-md);
    display: none;
    z-index: 1000;
}
.dropdown-menu.show {
    display: block;
}
.dropdown-item {
    display: block;
    padding: 10px 16px;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    transition: background 0.2s;
}
.dropdown-item:hover {
    background: var(--surface-alt);
}
.dropdown-item.text-danger {
    color: var(--danger-color);
}
.dropdown-item.text-danger:hover {
    background: #fef2f2;
}

/* 15. CHARTS */
.chart-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

/* 16. SPLIT GRIDS */
.split-grid {
    display: grid;
    gap: 24px;
    align-items: start;
}
.split-grid.sidebar-right {
    grid-template-columns: 1fr 350px;
}
.split-grid.sidebar-left {
    grid-template-columns: 350px 1fr;
}
.split-grid.profile {
    grid-template-columns: 300px 1fr;
}
.split-grid.profile-wide {
    grid-template-columns: 1fr 2fr;
}
@media (max-width: 992px) {
    .split-grid.sidebar-right,
    .split-grid.sidebar-left,
    .split-grid.profile,
    .split-grid.profile-wide {
        grid-template-columns: 1fr;
    }
    
    /* Ensure charts stack on tablet portrait too */
    .chart-grid {
        grid-template-columns: 1fr;
    }
}

