/* =============================================================================
   Taraba State Government — HR & File Workflow Management System
   Stylesheet. Palette: deep institutional green + gold (seal/authority accent).
   ========================================================================== */

:root {
    --bg: #f1f4f0;
    --surface: #ffffff;
    --surface-2: #e8ede4;
    --border: #d7ded0;
    --ink: #17231c;
    --ink-dim: #56655a;
    --ink-faint: #85958a;

    --forest: #1f5c46;
    --forest-dark: #164434;
    --forest-tint: #e3efe8;

    --gold: #b8873b;
    --gold-dark: #8f6a2c;
    --gold-tint: #f6ecd9;

    --good: #2f7d4f;
    --good-tint: #e5f3ea;
    --warn: #a6741f;
    --warn-tint: #faf0dc;
    --critical: #a6423a;
    --critical-tint: #fbe9e7;
    --info: #35708a;
    --info-tint: #e4f0f4;
    --neutral: #56655a;
    --neutral-tint: #eceee9;

    --radius: 10px;
    --shadow: 0 1px 2px rgba(23, 35, 28, 0.06), 0 4px 16px rgba(23, 35, 28, 0.06);
    --sidebar-w: 248px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "IBM Plex Sans", -apple-system, "Segoe UI", sans-serif;
    font-size: 14.5px;
    line-height: 1.5;
}

h1, h2, h3, h4 {
    font-family: "Fraunces", Georgia, serif;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0 0 4px;
    text-wrap: balance;
}

a { color: var(--forest); text-decoration: none; }
a:hover { text-decoration: underline; }

code, .mono, .num { font-family: "IBM Plex Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------------- */
/* Layout                                                                  */
/* ---------------------------------------------------------------------- */
.shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: var(--forest-dark);
    color: #eef4ef;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar__brand {
    padding: 22px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
}

.sidebar__brand .eyebrow {
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.08em;
    color: var(--gold);
    font-weight: 600;
}

.sidebar__brand h1 {
    color: #fff;
    font-size: 19px;
    margin-top: 4px;
    font-family: "Fraunces", Georgia, serif;
}

.sidebar nav {
    flex: 1;
    padding: 14px 10px;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: #d9e6dd;
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 2px;
}

.sidebar nav a:hover { background: rgba(255,255,255,0.08); text-decoration: none; }

.sidebar nav a.active {
    background: var(--gold);
    color: #241a06;
    font-weight: 600;
}

.sidebar nav a svg { flex: 0 0 auto; width: 18px; height: 18px; }

.sidebar__footer {
    padding: 14px 18px 18px;
    border-top: 1px solid rgba(255,255,255,0.12);
    font-size: 12.5px;
    color: #a9beac;
}

.sidebar__footer .user {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.sidebar__footer a { color: #d9e6dd; }

.main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

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

.topbar h2 {
    font-size: 21px;
    color: var(--ink);
}

.topbar .subtitle {
    color: var(--ink-dim);
    font-size: 13px;
    margin-top: 2px;
}

.content {
    padding: 24px 28px 60px;
    max-width: 1280px;
    width: 100%;
}

/* ---------------------------------------------------------------------- */
/* Buttons                                                                 */
/* ---------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--ink);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    line-height: 1.3;
}

.btn:hover { background: var(--surface-2); text-decoration: none; }

.btn--primary { background: var(--forest); border-color: var(--forest); color: #fff; }
.btn--primary:hover { background: var(--forest-dark); }

.btn--gold { background: var(--gold); border-color: var(--gold); color: #2a1e08; }
.btn--gold:hover { background: var(--gold-dark); color: #fff; }

.btn--danger { background: var(--critical-tint); border-color: var(--critical); color: var(--critical); }
.btn--danger:hover { background: var(--critical); color: #fff; }

.btn--sm { padding: 5px 10px; font-size: 12.5px; }
.btn--ghost { background: transparent; border-color: transparent; }
.btn--ghost:hover { background: var(--surface-2); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------------------------------------------------------------------- */
/* Cards / panels                                                          */
/* ---------------------------------------------------------------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}

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

.card__head h3 { font-size: 16px; }

.grid {
    display: grid;
    gap: 16px;
}

.grid--stats { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }

.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow);
}

.stat .value {
    font-family: "Fraunces", serif;
    font-size: 30px;
    font-weight: 600;
    color: var(--forest-dark);
}

.stat .label {
    color: var(--ink-dim);
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 2px;
}

.stat.accent-gold .value { color: var(--gold-dark); }
.stat.accent-critical .value { color: var(--critical); }

/* ---------------------------------------------------------------------- */
/* Tables                                                                  */
/* ---------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

thead th {
    text-align: left;
    background: var(--surface-2);
    color: var(--ink-dim);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11.5px;
    letter-spacing: 0.04em;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--forest-tint); }

.empty-row td { text-align: center; color: var(--ink-faint); padding: 32px; }

/* ---------------------------------------------------------------------- */
/* Pills / badges                                                          */
/* ---------------------------------------------------------------------- */
.pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}

.pill--good { background: var(--good-tint); color: var(--good); }
.pill--warn { background: var(--warn-tint); color: var(--warn); }
.pill--critical { background: var(--critical-tint); color: var(--critical); }
.pill--info { background: var(--info-tint); color: var(--info); }
.pill--neutral { background: var(--neutral-tint); color: var(--neutral); }

/* ---------------------------------------------------------------------- */
/* Stage / pipeline stepper                                                */
/* ---------------------------------------------------------------------- */
.stage-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 0; margin: 8px 0; }

.stage-step { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-faint); }
.stage-step .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--border); flex: 0 0 auto; }
.stage-step.done .dot { background: var(--forest); }
.stage-step.done .lbl { color: var(--ink-dim); }
.stage-step.current .dot { background: var(--gold); box-shadow: 0 0 0 3px var(--gold-tint); }
.stage-step.current .lbl { color: var(--ink); font-weight: 600; }
.stage-line { width: 22px; height: 2px; background: var(--border); margin: 0 4px; }
.stage-line.done { background: var(--forest); }

/* ---------------------------------------------------------------------- */
/* Forms                                                                   */
/* ---------------------------------------------------------------------- */
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-dim); margin-bottom: 5px; }

input[type=text], input[type=date], input[type=number], input[type=password],
input[type=email], select, textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 7px;
    font-size: 13.5px;
    font-family: inherit;
    background: var(--surface);
    color: var(--ink);
}

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

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--forest);
    box-shadow: 0 0 0 3px var(--forest-tint);
}

.field { margin-bottom: 14px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 18px; }

.form-actions { display: flex; gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }

.checklist label { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink); margin-bottom: 10px; }
.checklist input[type=checkbox] { width: 17px; height: 17px; }

/* ---------------------------------------------------------------------- */
/* Alerts / flash messages                                                 */
/* ---------------------------------------------------------------------- */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 18px;
    font-size: 13.5px;
    border: 1px solid transparent;
}

.alert--success { background: var(--good-tint); color: var(--good); border-color: #b9dfc4; }
.alert--error { background: var(--critical-tint); color: var(--critical); border-color: #e9bcb7; }
.alert--info { background: var(--info-tint); color: var(--info); border-color: #bcd9e2; }

/* ---------------------------------------------------------------------- */
/* Organogram tree                                                         */
/* ---------------------------------------------------------------------- */
.org-top {
    background: linear-gradient(135deg, var(--forest-dark), var(--forest));
    color: #fff;
    border-radius: var(--radius);
    padding: 20px 22px;
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.org-top .role { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--gold); font-weight: 700; }
.org-top .who { font-family: "Fraunces", serif; font-size: 16px; margin-top: 2px; }

.mda-tree details {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    margin-bottom: 10px;
    box-shadow: var(--shadow);
}

.mda-tree summary {
    cursor: pointer;
    padding: 14px 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    list-style: none;
    gap: 10px;
    flex-wrap: wrap;
}

.mda-tree summary::-webkit-details-marker { display: none; }
.mda-tree summary::before {
    content: "▸";
    color: var(--gold-dark);
    margin-right: 8px;
    transition: transform 0.15s ease;
}
.mda-tree details[open] summary::before { transform: rotate(90deg); }

.mda-tree .mda-meta { font-weight: 400; font-size: 12.5px; color: var(--ink-dim); }
.mda-tree .mda-body { padding: 0 16px 16px; border-top: 1px solid var(--border); }

.directorate-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px dashed var(--border);
    gap: 10px;
    flex-wrap: wrap;
}
.directorate-row:last-child { border-bottom: none; }

/* ---------------------------------------------------------------------- */
/* History timeline                                                        */
/* ---------------------------------------------------------------------- */
.timeline { list-style: none; margin: 10px 0 0; padding: 0; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 0 0 14px 18px; font-size: 13px; }
.timeline li::before {
    content: "";
    position: absolute; left: -6px; top: 3px;
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--forest); border: 2px solid var(--surface);
}
.timeline .t-date { color: var(--ink-faint); font-size: 11.5px; }

/* ---------------------------------------------------------------------- */
/* Login page                                                              */
/* ---------------------------------------------------------------------- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top left, #244f3f, var(--forest-dark) 60%);
    padding: 20px;
}

.login-card {
    background: var(--surface);
    border-radius: 14px;
    padding: 34px 32px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}

.login-card .eyebrow { color: var(--gold-dark); text-transform: uppercase; font-size: 11px; letter-spacing: 0.08em; font-weight: 700; }
.login-card h1 { font-size: 22px; margin: 4px 0 20px; }

/* ---------------------------------------------------------------------- */
/* Misc                                                                    */
/* ---------------------------------------------------------------------- */
.muted { color: var(--ink-dim); }
.faint { color: var(--ink-faint); font-size: 12.5px; }
.flex { display: flex; align-items: center; gap: 8px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; flex-wrap: wrap; }
.tabs a {
    padding: 10px 16px;
    font-weight: 600;
    font-size: 13.5px;
    color: var(--ink-dim);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.tabs a.active { color: var(--forest-dark); border-color: var(--gold); }
.tabs a:hover { text-decoration: none; color: var(--forest-dark); }

.case-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; background: var(--surface); }
.case-card .case-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: flex-start; }
.case-card .case-title { font-weight: 600; font-size: 14.5px; }
.case-card .case-sub { color: var(--ink-dim); font-size: 12.5px; margin-top: 2px; }
.case-card .case-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

.badge-count {
    background: var(--gold);
    color: #2a1e08;
    border-radius: 999px;
    padding: 1px 8px;
    font-size: 11px;
    font-weight: 700;
}

footer.app-footer { text-align: center; color: var(--ink-faint); font-size: 12px; padding: 24px 0 8px; }

@media (max-width: 860px) {
    .shell { flex-direction: column; }
    .sidebar { width: 100%; flex: none; position: relative; height: auto; }
    .sidebar nav { display: flex; flex-wrap: wrap; padding: 8px; }
    .sidebar nav a { flex: 1 1 auto; justify-content: center; }
    .content { padding: 18px; }
}
