/* Northwest 2026 brand tokens and the Bootstrap 5.3 mapping.
   Livery: slate body, one yellow stripe, white lettering.
   Yellow is a stripe/fill colour only: never use it as text on white (1.5:1). */
:root {
    /* Brand */
    --nw-yellow: #F9CC2A;
    --nw-yellow-600: #E2B414;
    --nw-yellow-100: #FEF4CF;
    --nw-yellow-ink: #5F4A00;      /* text on yellow / yellow-100, >= 7:1 */

    /* Slate ramp, built around the logo panel #434F58 */
    --nw-slate-950: #1C2227;
    --nw-slate-900: #262E34;
    --nw-slate-800: #333C43;
    --nw-slate: #434F58;
    --nw-slate-600: #56636D;
    --nw-slate-500: #66727C;       /* muted text, 4.8:1 on white */
    --nw-slate-400: #8B969F;
    --nw-slate-300: #B9C1C7;
    --nw-slate-200: #D9DEE2;       /* the one rule colour */
    --nw-slate-100: #EBEEF0;
    --nw-slate-50: #F4F6F7;

    /* Roles */
    --nw-ink: var(--nw-slate-950);
    --nw-text: var(--nw-slate-900);
    --nw-muted: var(--nw-slate-500);
    --nw-rule: var(--nw-slate-200);
    --nw-ground: var(--nw-slate-50);
    --nw-surface: #FFFFFF;

    /* Status pairs (text on tint, all >= 4.5:1) */
    --nw-ok: #1C6E3F;      --nw-ok-bg: #E2F2E8;
    --nw-warn: #8A5300;    --nw-warn-bg: #FDF0D5;
    --nw-bad: #A8201A;     --nw-bad-bg: #FBE7E5;
    --nw-info: #2B5680;    --nw-info-bg: #E5EDF5;
    --nw-neutral: var(--nw-slate-600); --nw-neutral-bg: var(--nw-slate-100);

    --nw-radius: 8px;
    --nw-radius-sm: 6px;
    --nw-stripe: 4px;
    --nw-shadow: 0 1px 2px rgba(28, 34, 39, .06), 0 2px 6px rgba(28, 34, 39, .06);
    --nw-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", Arial, sans-serif;

    /* Bootstrap 5.3 globals */
    --bs-body-font-family: var(--nw-font);
    --bs-body-color: var(--nw-text);
    --bs-body-color-rgb: 38, 46, 52;
    --bs-body-bg: var(--nw-surface);
    --bs-secondary-color: var(--nw-muted);
    --bs-border-color: var(--nw-rule);
    --bs-border-radius: var(--nw-radius-sm);
    --bs-border-radius-lg: var(--nw-radius);
    --bs-primary: var(--nw-slate);
    --bs-primary-rgb: 67, 79, 88;
    --bs-link-color: var(--nw-slate-800);
    --bs-link-color-rgb: 51, 60, 67;
    --bs-link-hover-color: var(--nw-ink);
    --bs-link-hover-color-rgb: 28, 34, 39;
    --bs-focus-ring-color: rgba(67, 79, 88, .35);
    --bs-success: var(--nw-ok);
    --bs-success-rgb: 28, 110, 63;
    --bs-danger: var(--nw-bad);
    --bs-danger-rgb: 168, 32, 26;
    --bs-warning: var(--nw-yellow);
    --bs-warning-rgb: 249, 204, 42;
    --bs-dark: var(--nw-slate-900);
    --bs-dark-rgb: 38, 46, 52;
    --bs-light: var(--nw-slate-50);
}

/* ---- Base ---------------------------------------------------------- */
body { font-family: var(--nw-font); color: var(--nw-text); background: var(--nw-surface); -webkit-font-smoothing: antialiased; }
::selection { background: #FBE184; color: var(--nw-ink); }
h1, h2, h3, h4, h5, h6 { color: var(--nw-ink); letter-spacing: -.01em; text-wrap: balance; }
h2 { font-size: 1.5rem; font-weight: 700; }
h3 { font-size: 1.2rem; font-weight: 650; }

a { text-decoration-color: var(--nw-slate-300); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-color: var(--nw-yellow-600); text-decoration-thickness: 2px; }

:focus-visible { outline: 2px solid var(--nw-slate); outline-offset: 2px; }
.btn:focus-visible, .form-control:focus, .form-select:focus, .form-check-input:focus { box-shadow: 0 0 0 .2rem var(--bs-focus-ring-color); }

* { scrollbar-color: var(--nw-slate-300) transparent; }

/* ---- Buttons ------------------------------------------------------- */
.btn { --bs-btn-font-weight: 500; --bs-btn-border-radius: var(--nw-radius-sm); }
.btn-primary {
    --bs-btn-bg: var(--nw-slate); --bs-btn-border-color: var(--nw-slate);
    --bs-btn-hover-bg: var(--nw-slate-800); --bs-btn-hover-border-color: var(--nw-slate-800);
    --bs-btn-active-bg: var(--nw-slate-900); --bs-btn-active-border-color: var(--nw-slate-900);
    --bs-btn-disabled-bg: var(--nw-slate-400); --bs-btn-disabled-border-color: var(--nw-slate-400);
    --bs-btn-focus-shadow-rgb: 67, 79, 88;
}
.btn-outline-primary {
    --bs-btn-color: var(--nw-slate-800); --bs-btn-border-color: var(--nw-slate-300);
    --bs-btn-hover-color: var(--nw-ink); --bs-btn-hover-bg: var(--nw-slate-50); --bs-btn-hover-border-color: var(--nw-slate-400);
    --bs-btn-active-color: var(--nw-ink); --bs-btn-active-bg: var(--nw-slate-100); --bs-btn-active-border-color: var(--nw-slate-400);
    --bs-btn-focus-shadow-rgb: 67, 79, 88;
}
.btn-secondary, .btn-outline-secondary {
    --bs-btn-color: var(--nw-slate-800); --bs-btn-bg: #fff; --bs-btn-border-color: var(--nw-slate-300);
    --bs-btn-hover-color: var(--nw-ink); --bs-btn-hover-bg: var(--nw-slate-50); --bs-btn-hover-border-color: var(--nw-slate-400);
    --bs-btn-active-color: var(--nw-ink); --bs-btn-active-bg: var(--nw-slate-100); --bs-btn-active-border-color: var(--nw-slate-400);
    --bs-btn-focus-shadow-rgb: 67, 79, 88;
}
.btn-success {
    --bs-btn-bg: var(--nw-ok); --bs-btn-border-color: var(--nw-ok);
    --bs-btn-hover-bg: #165833; --bs-btn-hover-border-color: #165833;
    --bs-btn-active-bg: #12482A; --bs-btn-active-border-color: #12482A;
    --bs-btn-focus-shadow-rgb: 28, 110, 63;
}
.btn-danger {
    --bs-btn-bg: var(--nw-bad); --bs-btn-border-color: var(--nw-bad);
    --bs-btn-hover-bg: #8C1A15; --bs-btn-hover-border-color: #8C1A15;
    --bs-btn-focus-shadow-rgb: 168, 32, 26;
}
/* The livery accent: yellow fill, slate lettering (5.5:1). For the one action that matters most. */
.btn-accent {
    --bs-btn-color: var(--nw-slate-950); --bs-btn-bg: var(--nw-yellow); --bs-btn-border-color: var(--nw-yellow);
    --bs-btn-hover-color: var(--nw-slate-950); --bs-btn-hover-bg: var(--nw-yellow-600); --bs-btn-hover-border-color: var(--nw-yellow-600);
    --bs-btn-active-color: var(--nw-slate-950); --bs-btn-active-bg: #C99F0E; --bs-btn-active-border-color: #C99F0E;
    --bs-btn-focus-shadow-rgb: 67, 79, 88;
    font-weight: 600;
}

/* ---- Forms --------------------------------------------------------- */
.form-control, .form-select { border-color: var(--nw-slate-300); border-radius: var(--nw-radius-sm); }
.form-control:focus, .form-select:focus { border-color: var(--nw-slate); }
.form-control::placeholder { color: var(--nw-slate-400); }
.form-check-input:checked { background-color: var(--nw-slate); border-color: var(--nw-slate); }
label, .form-label { color: var(--nw-slate-800); }

/* ---- Tables (django-tables2 and hand-built) ------------------------ */
.nw-main table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: .9rem; }
.nw-main table th { font-size: .78rem; font-weight: 650; color: var(--nw-slate-600); text-align: left; white-space: nowrap; border-bottom: 1px solid var(--nw-slate-300); padding: .55rem .75rem; background: var(--nw-surface); }
.nw-main table th a { color: inherit; text-decoration: none; }
.nw-main table th a:hover { color: var(--nw-ink); text-decoration: underline; text-decoration-color: var(--nw-yellow-600); }
.nw-main table th.asc a::after { content: " \2191"; }
.nw-main table th.desc a::after { content: " \2193"; }
.nw-main table td { border-bottom: 1px solid var(--nw-rule); padding: .55rem .75rem; vertical-align: top; }
.nw-main table tbody tr:hover > td { background: var(--nw-slate-50); }
/* Wrapper the shell script adds around wide tables: scroll inside, never the page. */
.nw-table-scroll { clear: both; overflow-x: auto; margin-bottom: 1rem; border: 1px solid var(--nw-rule); border-radius: var(--nw-radius); }
/* Scroll cue: edge shadows appear only on the side that has more columns to reveal. */
.nw-table-scroll, .spcc-table-wrap {
    background:
        linear-gradient(to right, #fff 30%, rgba(255, 255, 255, 0)) left center / 40px 100% no-repeat local,
        linear-gradient(to left, #fff 30%, rgba(255, 255, 255, 0)) right center / 40px 100% no-repeat local,
        radial-gradient(farthest-side at 0 50%, rgba(28, 34, 39, .18), rgba(28, 34, 39, 0)) left center / 14px 100% no-repeat scroll,
        radial-gradient(farthest-side at 100% 50%, rgba(28, 34, 39, .18), rgba(28, 34, 39, 0)) right center / 14px 100% no-repeat scroll;
    background-color: var(--nw-surface);
}
/* Cells must stay transparent or they paint over the scroll shadows. */
.nw-main .nw-table-scroll table, .nw-main .spcc-table-wrap table { --bs-table-bg: transparent; background: transparent; }
.nw-main .nw-table-scroll th, .nw-main .spcc-table-wrap th,
.nw-main .nw-table-scroll td, .nw-main .spcc-table-wrap td { background-color: transparent; }
.nw-main .nw-table-scroll tbody tr:hover > td, .nw-main .spcc-table-wrap tbody tr:hover > td { background-color: rgba(67, 79, 88, .05); }
.nw-table-scroll > table { margin-bottom: 0; }
.nw-table-scroll.is-bare { border: 0; border-radius: 0; margin-bottom: 0; }
.nw-table-scroll > table tr:last-child > td { border-bottom: 0; }

/* Pagination (django-tables2 renders Bootstrap markup with these classes) */
.pagination { --bs-pagination-color: var(--nw-slate-800); --bs-pagination-active-bg: var(--nw-slate); --bs-pagination-active-border-color: var(--nw-slate); --bs-pagination-hover-color: var(--nw-ink); --bs-pagination-focus-box-shadow: 0 0 0 .2rem var(--bs-focus-ring-color); }

/* ---- Status pills -------------------------------------------------- */
.nw-pill { display: inline-flex; align-items: center; gap: .35em; padding: .15rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; background: var(--nw-neutral-bg); color: var(--nw-neutral); }
.nw-pill-ok { background: var(--nw-ok-bg); color: var(--nw-ok); }
.nw-pill-warn { background: var(--nw-warn-bg); color: var(--nw-warn); }
.nw-pill-bad { background: var(--nw-bad-bg); color: var(--nw-bad); }
.nw-pill-info { background: var(--nw-info-bg); color: var(--nw-info); }

/* Alerts / messages */
.alert { border-radius: var(--nw-radius); }
.alert-success { --bs-alert-color: var(--nw-ok); --bs-alert-bg: var(--nw-ok-bg); --bs-alert-border-color: #BFE0CB; }
.alert-danger, .alert-error { --bs-alert-color: var(--nw-bad); --bs-alert-bg: var(--nw-bad-bg); --bs-alert-border-color: #F2C3BF; }
.alert-warning { --bs-alert-color: var(--nw-warn); --bs-alert-bg: var(--nw-warn-bg); --bs-alert-border-color: #F4D9A4; }
.alert-info { --bs-alert-color: var(--nw-info); --bs-alert-bg: var(--nw-info-bg); --bs-alert-border-color: #C3D4E6; }
/* Header band as a translucent tint so scroll shadows still read through it. */
.nw-main .nw-table-scroll thead th, .nw-main .spcc-table-wrap thead th { background-color: rgba(67, 79, 88, .05); }

/* Accordions (legacy incident forms) */
.accordion {
    --bs-accordion-active-bg: var(--nw-slate-50);
    --bs-accordion-active-color: var(--nw-ink);
    --bs-accordion-btn-focus-box-shadow: 0 0 0 .2rem var(--bs-focus-ring-color);
    --bs-accordion-border-color: var(--nw-rule);
}
