/* =====================================================================
   Fire Assay — Premium Theme (maroon + gold)
   Canonical design system. Loaded on every page via theme_head.php AFTER any
   page-local CSS, so it wins over the legacy :root palettes and polishes the
   shared elements (buttons, cards, tables, inputs, header bar) the app already
   uses by class name.
   ===================================================================== */

:root {
    /* Brand */
    --maroon-900: #4a0e12;
    --maroon-800: #5e121a;
    --maroon-700: #7a1620;
    --maroon-600: #8e1c28;
    --maroon-500: #a31f2c;
    --maroon-400: #c0392b;

    /* Gold */
    --gold-600: #b8860b;
    --gold-500: #c9a227;
    --gold-400: #e8c66a;
    --gold-300: #f3d98b;
    --gold-100: #fbf3e0;

    /* Neutral surface — WHITE background + red(maroon) brand combination */
    --ink-900: #1c1c28;
    --ink-700: #2c2c3a;
    --ink-600: #4a4a5a;
    --ink-400: #8a8a9a;
    --line: #eceaea;
    --line-strong: #ddd6d6;
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-2: #fbf7f7;

    /* Status */
    --success: #1f9d57;
    --danger: #d23b3b;
    --warning: #d98c00;
    --info: #2b6cb0;

    --radius: 14px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 3px rgba(74, 14, 18, .08), 0 1px 2px rgba(74, 14, 18, .06);
    --shadow: 0 12px 30px rgba(74, 14, 18, .12);
    --shadow-lg: 0 24px 60px rgba(74, 14, 18, .18);
    --ring: 0 0 0 4px rgba(163, 31, 44, .15);

    /* Aliases used by legacy inline styles — !important so they beat page-local :root */
    --primary: var(--maroon-500) !important;
    --primary-light: var(--maroon-400) !important;
    --secondary: var(--gold-500) !important;
    --accent: var(--gold-400) !important;
    --dark: var(--ink-900) !important;
    --light: var(--surface-2) !important;
    --gray: var(--ink-400) !important;
    --gray-light: #eceaea !important;
    --border-radius: var(--radius) !important;
    --box-shadow: var(--shadow) !important;
    --box-shadow-hover: var(--shadow-lg) !important;
    --transition: all .25s cubic-bezier(.4, 0, .2, 1) !important;

    --font: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

* { box-sizing: border-box; }

html, body { font-family: var(--font); }

body {
    background: var(--bg) !important;
    color: var(--ink-900);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Top header bar (used by index/associate pages) ---------- */
.header {
    background: linear-gradient(135deg, var(--maroon-800), var(--maroon-600));
    color: #fff;
    border: none !important;
    border-radius: var(--radius) !important;
    border-left: 5px solid var(--gold-400) !important;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}
.header h1 {
    background: none !important;
    -webkit-text-fill-color: #fff !important;
    color: #fff !important;
    font-weight: 800;
}
.header img { height: 46px; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .3)); }

/* ---------- Premium buttons — authoritative over page-local ---------- */
.btn, button.btn, input.btn,
.button, button, input[type="submit"], input[type="button"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    font-size: .95rem;
    font-weight: 700;
    font-family: var(--font);
    border: none;
    border-radius: var(--radius-sm) !important;
    cursor: pointer;
    color: #fff !important;
    background: linear-gradient(135deg, var(--maroon-700), var(--maroon-500)) !important;
    box-shadow: 0 8px 18px rgba(163, 31, 44, .28) !important;
    transition: var(--transition);
    text-decoration: none;
}
.btn:hover, .button:hover, button:hover, input[type="submit"]:hover, input[type="button"]:hover {
    transform: translateY(-2px);
    filter: brightness(1.06);
    box-shadow: 0 12px 24px rgba(163, 31, 44, .34) !important;
}
.btn:active, .button:active, button:active { transform: translateY(0); }
.btn:disabled, button:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.btn-secondary, .btn-gold {
    background: linear-gradient(135deg, var(--gold-500), var(--gold-400)) !important;
    color: #3a2a05 !important;
    box-shadow: 0 8px 18px rgba(201, 162, 39, .3) !important;
}
.btn-outline {
    background: #fff !important;
    color: var(--maroon-600) !important;
    border: 1.5px solid var(--line-strong) !important;
    box-shadow: none !important;
}
.btn-outline:hover { border-color: var(--maroon-500) !important; color: var(--maroon-500) !important; }

/* ---------- Cards & panels (generic) ---------- */
.card, .panel, .container, .content-box, .box {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--line);
}
.dashboard-card, .stat-card, .recent-activity, .activity-list, .quick-stats {
    background: var(--surface);
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-sm) !important;
    border: 1px solid var(--line) !important;
}
.dashboard-card::before {
    background: linear-gradient(90deg, var(--maroon-600), var(--gold-400)) !important;
}
.dashboard-card .card-icon,
.stat-card .stat-icon,
.activity-icon {
    background: linear-gradient(135deg, var(--maroon-700), var(--maroon-500)) !important;
    flex-shrink: 0 !important;
    box-shadow: 0 8px 16px rgba(74, 14, 18, 0.15) !important;
}
.dashboard-card .card-cta { color: var(--maroon-600) !important; }
.section-title i { color: var(--gold-400) !important; }
.card-icon i { color: #fff !important; }

/* ---------- Tables (data pages) — authoritative over page-local styles ---------- */
table {
    border-collapse: collapse;
    width: 100% !important;
    background: var(--surface);
    border-radius: var(--radius) !important;
    overflow: hidden;
    box-shadow: var(--shadow-sm) !important;
    border: 1px solid var(--line);
}
table th {
    background: linear-gradient(135deg, var(--maroon-800), var(--maroon-600)) !important;
    color: #fff !important;
    font-weight: 600 !important;
    letter-spacing: .02em;
    padding: 12px 14px !important;
    border: none !important;
    text-align: center;
    text-transform: uppercase;
    font-size: .82rem !important;
}
table td {
    padding: 11px 14px !important;
    border-bottom: 1px solid var(--line) !important;
    color: var(--ink-700);
    background: var(--surface) !important;
    font-size: .92rem !important;
    text-align: center;
}
table tbody tr:nth-child(even) td { background: var(--surface-2) !important; }
table tbody tr:hover td { background: var(--gold-100) !important; color: var(--ink-900) !important; }
table tr:hover td { background: var(--gold-100) !important; }

/* ---------- Forms / inputs (data-entry pages) — authoritative ---------- */
input, select, textarea {
    font-family: var(--font);
    font-size: 1rem;
    color: var(--ink-900);
    background: #fff;
    border: 1.5px solid var(--line-strong);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    transition: var(--transition);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--maroon-500);
    box-shadow: var(--ring);
}
label { color: var(--ink-700); }

/* select arrow tinted to brand */
select {
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--maroon-500) 50%),
        linear-gradient(135deg, var(--maroon-500) 50%, transparent 50%);
    background-position:
        calc(100% - 18px) center,
        calc(100% - 13px) center;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-right: 36px;
}

/* ---------- Welcome / hero band ---------- */
.welcome-section {
    background: linear-gradient(135deg, var(--maroon-800), var(--maroon-600)) !important;
    color: #fff;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow);
    border-left: 5px solid var(--gold-400) !important;
}
.welcome-section h2 { color: #fff !important; }

/* ---------- Links ---------- */
a { color: var(--maroon-600); }
a:hover { color: var(--maroon-400); }

.section-title { color: var(--ink-900); font-weight: 700; }

/* ---------- Footer ---------- */
.site-footer {
    background: linear-gradient(135deg, #1c0a0c, var(--maroon-900)) !important;
    color: #e9d9da;
}
.site-footer h3 { color: #fff !important; }
.site-footer h3::after { background: var(--gold-400) !important; }
.site-footer a { color: #cbb9ba !important; }
.site-footer a:hover { color: var(--gold-300) !important; }

/* ---------- Pills / badges ---------- */
.pill, .badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 12px; border-radius: 999px;
    background: var(--maroon-600); color: #fff; font-size: .8rem; font-weight: 600;
}
.card-1 .card-icon, .stat-1 .stat-icon { background: linear-gradient(135deg, var(--maroon-700), var(--maroon-500)) !important; }
.card-2 .card-icon, .stat-2 .stat-icon { background: linear-gradient(135deg, var(--gold-600), var(--gold-400)) !important; }
.card-3 .card-icon, .stat-3 .stat-icon { background: linear-gradient(135deg, #7a1620, #c0392b) !important; }
.card-4 .card-icon, .stat-4 .stat-icon { background: linear-gradient(135deg, var(--gold-500), #e8c66a) !important; }
.card-5 .card-icon, .stat-5 .stat-icon { background: linear-gradient(135deg, #5e121a, var(--maroon-400)) !important; }
.card-6 .card-icon, .stat-6 .stat-icon { background: linear-gradient(135deg, var(--success), #2d7d46) !important; }
.card-2 .card-icon i, .card-4 .card-icon i, .stat-2 .stat-icon i, .stat-4 .stat-icon i { color: #3a2a05 !important; }

/* ---------- Smooth entrance ---------- */
@keyframes fa-fade-up {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}
.dashboard-card, .stat-card, .welcome-section {
    animation: fa-fade-up .5s ease-out both;
}

/* ---------- Brand utility ---------- */
.brand-accent { color: var(--gold-400); }
.brand-bar { height: 4px; background: linear-gradient(90deg, var(--maroon-600), var(--gold-400)); border-radius: 4px; }

/* ---------- Premium page frame (full width, sits right of sidebar) ---------- */
body > .content {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 22px 26px 48px;
}
@media (max-width: 820px) { body > .content { padding: 16px 14px 40px; } }

/* ---------- Left sidebar (replaces the floating toggle menu) ---------- */
.fa-sidebar {
    position: fixed;
    top: 0; left: 0;
    width: 250px;
    height: 100vh;
    background: linear-gradient(180deg, var(--maroon-900), var(--maroon-700));
    color: #f3e6e7;
    display: flex;
    flex-direction: column;
    z-index: 100;
    box-shadow: 6px 0 24px rgba(74, 14, 18, .25);
    overflow-y: auto;
}
.fa-sidebar .fa-sb-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
}
.fa-sidebar .fa-sb-brand img { height: 38px; }
.fa-sidebar .fa-sb-brand b { font-size: 1.15rem; color: #fff; line-height: 1.1; display: block; }
.fa-sidebar .fa-sb-brand small { font-size: .55rem; letter-spacing: .3em; color: var(--gold-300); }
.fa-sidebar .fa-sb-brand small.fa-sb-company { font-size: .62rem; letter-spacing: .12em; color: #f3d9a0; margin-top: 3px; display: block; }
.fa-sidebar .fa-sb-section {
    padding: 18px 18px 6px;
    font-size: .68rem; letter-spacing: .18em; text-transform: uppercase;
    color: var(--gold-300); opacity: .85;
}
.fa-sidebar nav { display: flex; flex-direction: column; gap: 4px; padding: 0 10px; }
.fa-sidebar nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px; border-radius: 10px;
    color: rgba(255, 255, 255, .82); text-decoration: none;
    font-size: .92rem; font-weight: 600; transition: var(--transition);
}
.fa-sidebar nav a span { white-space: nowrap; }
.fa-sidebar nav a i {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--gold-400);
    font-size: 1.05rem;
    transition: var(--transition);
}
.fa-sidebar nav a:hover { background: rgba(255, 255, 255, .10); color: #fff; }
.fa-sidebar nav a:hover i {
    background: linear-gradient(135deg, var(--gold-500), var(--gold-400));
    color: var(--maroon-900);
    transform: scale(1.1);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.fa-sidebar nav a.active { background: linear-gradient(90deg, rgba(232, 198, 106, 0.15), transparent); border-left: 4px solid var(--gold-400); color: #fff; }
.fa-sidebar nav a.active i {
    background: linear-gradient(135deg, var(--gold-500), var(--gold-400));
    color: var(--maroon-900);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.fa-sidebar .fa-sb-foot {
    margin-top: auto; padding: 14px 16px;
    border-top: 1px solid rgba(255, 255, 255, .12);
    font-size: .82rem; color: rgba(255, 255, 255, .7);
    display: flex; align-items: center; gap: 10px;
}
.fa-sidebar .fa-sb-foot i { color: var(--gold-300); }
.fa-sb-logout { margin-left: auto; color: var(--gold-300); font-size: 1rem; text-decoration: none; transition: var(--transition); }
.fa-sb-logout:hover { color: #fff; transform: scale(1.15); }

/* ---------- Remove per-page top header bar (sidebar now carries branding) ---------- */
.header { display: none !important; }

/* ---------- Custom alert (replaces browser alert across themed pages) ---------- */
.fa-alert-backdrop {
    position: fixed; inset: 0; z-index: 99999;
    background: rgba(40, 8, 12, 0.45);
    display: none; align-items: center; justify-content: center;
    font-family: var(--font);
}
.fa-alert-backdrop.show { display: flex; animation: faAlertFade .18s ease-out; }
@keyframes faAlertFade { from { opacity: 0; } to { opacity: 1; } }

.fa-alert {
    min-width: 320px; max-width: 90vw; width: 420px;
    background: #fff; border-radius: 14px; overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,.30);
    border-top: 5px solid var(--maroon-500);
    animation: faAlertPop .2s ease-out;
}
@keyframes faAlertPop { from { transform: translateY(-12px) scale(.98); } to { transform: none; } }

.fa-alert-head {
    display: flex; align-items: center; gap: 10px;
    padding: 16px 20px 8px; font-weight: 700; font-size: 1.05rem; color: var(--maroon-600);
}
.fa-alert-head i { font-size: 1.2rem; }
.fa-alert-body { padding: 4px 20px 16px; color: #2c2c3a; font-size: .98rem; line-height: 1.5; word-break: break-word; }
.fa-alert-foot { padding: 0 20px 18px; display: flex; justify-content: flex-end; }
.fa-alert-ok {
    background: linear-gradient(135deg, #7a1620, #a31f2c);
    color: #fff; border: none; border-radius: 8px;
    padding: 10px 26px; font-size: .95rem; font-weight: 600; cursor: pointer;
    transition: background-color .2s ease;
}
.fa-alert-ok:hover { background: linear-gradient(135deg, #8e1c28, #b3263a); }
.fa-alert.is-error { border-top-color: #c0392b; }
.fa-alert.is-error .fa-alert-head { color: #c0392b; }

@media (max-width: 820px) { .fa-alert { width: 90vw; } }

/* ---------- Unified, professional typography for content pages ----------
   Beats the scattered inline font-size:20px on table inputs and the
   page-local 20px rules so every element reads at one consistent size.
   Covers both the standard .content wrapper and search.php's own
   .document-container / .search-bar / .common-fields structure. */
.document-container,
.container,
.search-bar,
.common-fields,
.button-row,
table,
.content {
    font-size: 15px;
    line-height: 1.55;
}

.document-container input,
.document-container select,
.document-container textarea,
.document-container button,
.document-container label,
.document-container .save-button,
.document-container .copy-toggle,
.document-container th,
.document-container td,
.document-container .search-bar input,
.document-container .search-bar select,
.document-container .common-fields input,
.search-bar input,
.search-bar select,
.common-fields input,
.common-fields label,
.content input,
.content select,
.content textarea,
.content button,
.content label,
.content .save-button,
.content .copy-toggle,
.content th,
.content td {
    font-size: 14px !important;
    font-family: var(--font) !important;
}

@media (max-width: 820px) {
    .fa-sidebar { position: static; width: 100%; height: auto; flex-direction: column; }
    .fa-sidebar nav { flex-direction: row; flex-wrap: wrap; }
    .fa-sidebar nav a { flex: 1 1 auto; }
}

/* Sticky top bar used by inner pages via topnav.php */
.fa-topbar {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; padding: 12px 22px;
    background: linear-gradient(135deg, var(--maroon-800), var(--maroon-600));
    color: #fff; box-shadow: var(--shadow);
}
.fa-topbar .fa-brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 1.05rem; }
.fa-topbar .fa-brand img { height: 34px; filter: drop-shadow(0 3px 8px rgba(0,0,0,.3)); }
.fa-topbar .fa-brand small { display:block; font-size:.6rem; letter-spacing:.34em; color: var(--gold-300); font-weight:600; }
.fa-topbar nav { display: flex; gap: 6px; flex-wrap: wrap; }
.fa-topbar nav a {
    color: rgba(255,255,255,.82); text-decoration: none; font-size: .85rem; font-weight: 600;
    padding: 8px 12px; border-radius: 8px; transition: var(--transition);
}
.fa-topbar nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.fa-topbar nav a.active { background: var(--gold-400); color: #3a2a05; }
.fa-topbar .fa-user { display:flex; align-items:center; gap:8px; font-size:.85rem; }
.fa-topbar .fa-user i { color: var(--gold-300); }

/* Page title block */
.fa-page-head { margin-bottom: 22px; }
.fa-page-head h1 {
    font-size: 1.7rem; font-weight: 800; color: var(--ink-900);
    display: flex; align-items: center; gap: 12px;
}
.fa-page-head h1::before {
    content: ''; width: 6px; height: 26px; border-radius: 4px;
    background: linear-gradient(var(--maroon-600), var(--gold-400));
}
.fa-page-head p { color: var(--ink-400); margin-top: 4px; padding-left: 18px; }

/* Card hover lift for any .card/.panel/.container without breaking layout */
.card:hover, .panel:hover, .box:hover { box-shadow: var(--shadow) !important; transform: translateY(-2px); transition: var(--transition); }

