@charset "UTF-8";

/* =============================================================================
   KIAN MAS | GM COMMAND CENTER — application stylesheet
   Kian Mas Boutique Resort Ciawi — General Manager operations console.

   Hand-written and dependency-free: no framework, no build step, no CDN,
   no web fonts, no external images. Safe for shared cPanel hosting.

   Sections
     1. Design tokens            7. Tables            13. Empty / callout / prose
     2. Reset & base             8. Badges & pills    14. Timeline
     3. Utilities                9. Buttons           15. Departments
     4. App shell & sidebar     10. Forms            16. Day strip
     5. Topbar & chrome         11. Filters & pager  17. Auth screen
     6. Page & cards            12. Tiles & stats    18. Print + error pages
   ============================================================================= */

/* -----------------------------------------------------------------------------
   1. Design tokens
   ----------------------------------------------------------------------------- */
:root {
    /* Brand — forest green and brass/gold from the resort identity. */
    --brand: #1f4d38;
    --brand-700: #16392a;
    --brand-900: #0e2419;
    --brand-400: #4a7b62;
    --brand-100: #d8e6dd;
    --brand-50: #edf4ef;

    --gold: #b08d3f;
    --gold-700: #8a6d27;
    --gold-100: #f2e8d2;
    --gold-50: #faf4e6;

    /* Surfaces — ivory / warm off-white. */
    --ivory: #f5f1e8;
    --surface: #fffdf8;
    --surface-2: #faf6ed;
    --surface-3: #efe9dd;

    /* Text */
    --ink: #172420;
    --ink-2: #35463e;
    --muted: #5c6a63;
    --line: #ddd5c5;
    --line-2: #c9bfab;

    /* Semantic status tones */
    --ok: #2c6e46;
    --ok-bg: #e2efe6;
    --warn: #8f6114;
    --warn-bg: #f8edd4;
    --danger: #9d2f2b;
    --danger-bg: #f8e3e0;
    --info: #26608a;
    --info-bg: #e1edf5;
    --neutral: #5b6762;
    --neutral-bg: #ebe8e1;

    /* Confidential / restricted marker */
    --restricted: #7a2f4a;
    --restricted-bg: #f4e5ec;

    /* Radii, spacing, elevation */
    --r-xs: 4px;
    --r-sm: 8px;
    --r: 12px;
    --r-lg: 18px;
    --r-pill: 999px;

    --sp-1: 0.25rem;
    --sp-2: 0.5rem;
    --sp-3: 0.75rem;
    --sp-4: 1rem;
    --sp-5: 1.5rem;
    --sp-6: 2rem;
    --sp-7: 2.75rem;
    --sp-8: 3.5rem;

    --shadow-sm: 0 1px 2px rgba(15, 36, 25, 0.08);
    --shadow: 0 6px 18px rgba(15, 36, 25, 0.10);
    --shadow-lg: 0 20px 48px rgba(10, 26, 18, 0.26);

    --sidebar-w: 272px;
    --content-max: 1480px;
    --focus: var(--gold);

    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif,
        "Apple Color Emoji", "Segoe UI Emoji";
    --font-num: ui-rounded, "SF Mono", "Segoe UI", Roboto, Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
        "Liberation Mono", monospace;
}

/* Dark mode: remap the variables only — no component work is duplicated. */
@media (prefers-color-scheme: dark) {
    :root {
        --brand: #4c8f6c;
        --brand-700: #63a884;
        --brand-900: #0a1a13;
        --brand-400: #7bb89a;
        --brand-100: #21372c;
        --brand-50: #1a2b23;

        --gold: #cfa955;
        --gold-700: #b9942f;
        --gold-100: #33290f;
        --gold-50: #2a2210;

        --ivory: #0f1613;
        --surface: #16201b;
        --surface-2: #1b2620;
        --surface-3: #232f28;

        --ink: #e9efe9;
        --ink-2: #c8d4cc;
        --muted: #9aa8a0;
        --line: #2c3a33;
        --line-2: #3d4d45;

        --ok: #6fc291;
        --ok-bg: #17301f;
        --warn: #e0b268;
        --warn-bg: #33260d;
        --danger: #e78982;
        --danger-bg: #351715;
        --info: #85b9e0;
        --info-bg: #12283a;
        --neutral: #a8b3ad;
        --neutral-bg: #242b28;

        --restricted: #e2a0c0;
        --restricted-bg: #2f1826;

        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
        --shadow: 0 6px 18px rgba(0, 0, 0, 0.55);
        --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.7);
    }
}

/* -----------------------------------------------------------------------------
   2. Reset & base
   ----------------------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

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

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    line-height: 1.55;
    color: var(--ink);
    background: var(--ivory);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
    margin: 0 0 var(--sp-2);
    line-height: 1.25;
    font-weight: 650;
    color: var(--brand-900);
    letter-spacing: -0.01em;
}
@media (prefers-color-scheme: dark) {
    h1, h2, h3, h4 { color: var(--ink); }
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.1875rem; }
h3 { font-size: 1.0625rem; }

p { margin: 0 0 var(--sp-3); }
p:last-child { margin-bottom: 0; }

ul, ol { margin: 0 0 var(--sp-3); padding: 0; list-style: none; }
li { margin: 0; }

a {
    color: var(--brand);
    text-decoration: none;
    text-underline-offset: 2px;
}
a:hover { text-decoration: underline; }
@media (prefers-color-scheme: dark) { a { color: var(--brand-400); } }

strong { font-weight: 680; }

small { font-size: 0.8125rem; }

code, kbd, .mono {
    font-family: var(--font-mono);
}
code, kbd {
    font-size: 0.875em;
    background: var(--surface-3);
    border-radius: var(--r-xs);
    padding: 0.1em 0.35em;
}
.mono {
    font-size: 0.875em;
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
}

img { max-width: 100%; height: auto; display: block; }

table { border-collapse: collapse; }

[hidden] { display: none !important; }

button { font: inherit; }

/* Visible focus for keyboard users only. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
    border-radius: var(--r-xs);
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

/* -----------------------------------------------------------------------------
   3. Utilities
   ----------------------------------------------------------------------------- */
.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    overflow: hidden;
    white-space: nowrap;
}

.muted { color: var(--muted); }
.small { font-size: 0.8125rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.text-ok { color: var(--ok); font-weight: 650; }
.text-warning, .text-warn { color: var(--warn); font-weight: 650; }
.text-danger { color: var(--danger); font-weight: 650; }
.danger { color: var(--danger); font-weight: 650; }

/* The topbar logout wrapper and the idle-warning inline logout form. */
.inline { display: inline; }

.linklike {
    background: none;
    border: 0;
    padding: 0;
    margin: 0;
    font: inherit;
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}
.linklike:hover { color: var(--gold); }

/* -----------------------------------------------------------------------------
   4. App shell, sidebar, navigation
   ----------------------------------------------------------------------------- */
body.app { background: var(--ivory); }

.app__shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.sidebar {
    background: var(--brand-900);
    color: #eef4ef;
    padding: var(--sp-4) var(--sp-3) var(--sp-4);
    border-bottom: 3px solid var(--gold);
    flex: 0 0 auto;
}

.sidebar__brand {
    display: grid;
    justify-items: center;
    gap: var(--sp-2);
    padding: 0 var(--sp-2) var(--sp-4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    margin-bottom: var(--sp-3);
}
.sidebar__logo {
    display: block;
    width: 100%;
    max-width: 190px;
    height: auto;
}
.sidebar__brand small {
    display: block;
    color: var(--gold);
    letter-spacing: 0.06em;
    font-size: 0.6875rem;
    text-transform: uppercase;
}

.nav { display: grid; gap: var(--sp-4); }
.nav__group { min-width: 0; }
.nav__heading {
    margin: 0 0 var(--sp-2);
    padding: 0 var(--sp-2);
    font-size: 0.6875rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(238, 244, 239, 0.55);
    font-weight: 700;
}
.nav__link {
    display: block;
    padding: 0.5rem var(--sp-3);
    margin: 1px 0;
    border-radius: var(--r-sm);
    color: #dbe7de;
    font-weight: 520;
    border-left: 3px solid transparent;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.nav__link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    text-decoration: none;
}
.nav__link.is-active {
    background: rgba(176, 141, 63, 0.18);
    border-left-color: var(--gold);
    color: #fff;
    font-weight: 680;
}

.sidebar__foot {
    margin-top: var(--sp-5);
    padding: var(--sp-3) var(--sp-2) 0;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}
.sidebar__foot .muted { color: rgba(238, 244, 239, 0.6); }

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

.content {
    flex: 1 0 auto;
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: var(--sp-4) var(--sp-3) var(--sp-7);
}

/* Narrow screens: no JS -> the rail stacks on top and stays fully readable. */
@media (max-width: 1023.98px) {
    .nav {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: var(--sp-3);
    }
}

/* Narrow screens WITH JS -> the sidebar becomes an off-canvas drawer. */
@media (max-width: 1023.98px) {
    html.js .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(88vw, var(--sidebar-w));
        z-index: 60;
        overflow-y: auto;
        transform: translateX(-102%);
        transition: transform 0.22s ease;
        border-bottom: 0;
        border-right: 3px solid var(--gold);
    }
    html.js .sidebar.is-open {
        transform: none;
        box-shadow: var(--shadow-lg);
    }
    html.js .nav {
        grid-template-columns: 1fr;
        gap: var(--sp-4);
    }
    html.js.nav-open .app__shell::after {
        content: "";
        position: fixed;
        inset: 0;
        z-index: 55;
        background: rgba(8, 20, 14, 0.55);
    }
    /* While the drawer is open the page behind it must not scroll away. */
    html.js.nav-open body.app { overflow: hidden; }
}

@media (min-width: 1024px) {
    .app__shell {
        display: grid;
        grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
        align-items: start;
    }
    .sidebar {
        position: sticky;
        top: 0;
        height: 100vh;
        overflow-y: auto;
        padding: var(--sp-4) var(--sp-3);
        border-bottom: 0;
        border-right: 3px solid var(--gold);
    }
    .main { min-height: 100vh; }
    .content { padding: var(--sp-5) var(--sp-5) var(--sp-7); }
}

@media (min-width: 1280px) {
    .content { padding: var(--sp-6) var(--sp-6) var(--sp-8); }
}

/* -----------------------------------------------------------------------------
   5. Topbar, banners, alerts, footer, idle warning
   ----------------------------------------------------------------------------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    flex-wrap: wrap;
    padding: var(--sp-2) var(--sp-3);
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}
@media (min-width: 1024px) {
    .topbar { padding: var(--sp-3) var(--sp-5); }
}

.topbar__toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    font-size: 1.125rem;
    line-height: 1;
    color: var(--surface);
    background: var(--brand);
    border: 1px solid var(--brand-700);
    border-radius: var(--r-sm);
    cursor: pointer;
}
.topbar__toggle:hover { background: var(--brand-700); color: #fff; }
@media (max-width: 1023.98px) {
    html.js .topbar__toggle { display: inline-flex; }
}

.topbar__search {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    flex: 1 1 240px;
    min-width: 0;
}
.topbar__search input[type="search"] {
    flex: 1 1 auto;
    min-width: 0;
    height: 40px;
    padding: 0 var(--sp-3);
    color: var(--ink);
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
}
.topbar__search input[type="search"]:focus {
    border-color: var(--brand);
    outline: 3px solid rgba(176, 141, 63, 0.35);
    outline-offset: 1px;
}

.topbar__actions {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    margin-left: auto;
    min-width: 0;
}

.bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    font-size: 1.0625rem;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
}
.bell:hover { border-color: var(--gold); text-decoration: none; }
.bell__count {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 19px;
    text-align: center;
    color: #fff;
    background: var(--danger);
    border-radius: var(--r-pill);
    box-shadow: 0 0 0 2px var(--surface);
}

.userchip {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    padding-left: var(--sp-3);
    border-left: 1px solid var(--line);
    min-width: 0;
}
.userchip__name {
    font-weight: 650;
    color: var(--brand-900);
    max-width: 15ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.userchip__role {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--gold-700);
}
@media (prefers-color-scheme: dark) {
    .userchip__name { color: var(--ink); }
    .userchip__role { color: var(--gold); }
}
@media (max-width: 575.98px) {
    .userchip { display: none; }
}

/* Full-width informational banners (read-only mode, temporary password). */
.banner {
    padding: 0.6875rem var(--sp-4);
    background: var(--brand-50);
    border-bottom: 1px solid var(--line);
    color: var(--brand-700);
    font-size: 0.875rem;
}
.banner a { color: var(--brand-700); font-weight: 650; text-decoration: underline; }
.banner--warn {
    background: var(--warn-bg);
    border-bottom-color: var(--warn);
    color: var(--warn);
}
.banner--warn a { color: var(--warn); }

/* Flash messages inside the content area. */
.alert {
  padding: 0.75rem var(--sp-4);
  margin: 0 0 var(--sp-4);
  border: 1px solid transparent;
  border-left-width: 4px;
  border-radius: var(--r-sm);
  font-size: 0.875rem;
}
.alert:last-child { margin-bottom: var(--sp-4); }
.alert--success { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); border-left-color: var(--ok); }
.alert--error { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); border-left-color: var(--danger); }
.alert--warning { background: var(--warn-bg); border-color: var(--warn); color: var(--warn); border-left-color: var(--warn); }

/* JS gives click-to-dismiss feedback only when the hook is present. */
.alert[data-autodismiss] { cursor: pointer; position: relative; padding-right: 5.5rem; }
.alert[data-autodismiss]::after {
    content: "click to dismiss";
    position: absolute;
    right: var(--sp-3);
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.6875rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.7;
}
.alert.is-dismissing { opacity: 0; transition: opacity 0.35s ease; }

.footer {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2) var(--sp-4);
    justify-content: space-between;
    align-items: center;
    padding: var(--sp-4) var(--sp-3);
    margin-top: auto;
    border-top: 1px solid var(--line);
    background: var(--surface-2);
    font-size: 0.8125rem;
    color: var(--ink-2);
}
@media (min-width: 1024px) { .footer { padding: var(--sp-4) var(--sp-5); } }

/* Idle session warning (revealed by app.js). */
.idle-warning {
    position: fixed;
    left: var(--sp-3);
    right: var(--sp-3);
    bottom: var(--sp-3);
    z-index: 80;
    max-width: 620px;
    margin: 0 auto;
    padding: var(--sp-4);
    background: var(--warn-bg);
    color: var(--warn);
    border: 1px solid var(--warn);
    border-left: 6px solid var(--warn);
    border-radius: var(--r);
    box-shadow: var(--shadow-lg);
    font-size: 0.875rem;
}
.idle-warning a { color: inherit; font-weight: 700; text-decoration: underline; }
.idle-warning .linklike { color: inherit; font-weight: 700; }
@media (min-width: 640px) {
    .idle-warning {
        left: auto;
        right: var(--sp-5);
        bottom: var(--sp-5);
        margin: 0;
    }
}

/* -----------------------------------------------------------------------------
   6. Page scaffolding & cards
   ----------------------------------------------------------------------------- */
.page { display: grid; gap: var(--sp-4); }
.page--narrow { max-width: 780px; margin: 0 auto; width: 100%; }

.page__head {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-3);
    align-items: flex-start;
    justify-content: space-between;
    padding-bottom: var(--sp-3);
    border-bottom: 1px solid var(--line);
}
.page__title {
    margin: 0 0 var(--sp-1);
    font-size: 1.375rem;
    color: var(--brand-900);
}
@media (prefers-color-scheme: dark) { .page__title { color: var(--ink); } }
.page__head p:last-child { margin-bottom: 0; }
.page__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
    align-items: center;
}

.crumbs {
    margin: 0 0 var(--sp-1);
    font-size: 0.8125rem;
    color: var(--muted);
}
.crumbs a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.crumbs a:hover { color: var(--brand); }

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    min-width: 0;
}
.card__header {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2) var(--sp-4);
    align-items: baseline;
    justify-content: space-between;
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
}
.card__title {
    margin: 0;
    font-size: 1rem;
    letter-spacing: 0.01em;
    color: var(--brand-900);
}
@media (prefers-color-scheme: dark) { .card__title { color: var(--ink); } }
.card__header p { margin: 0; }
.card__body { padding: var(--sp-4); }
.card__foot {
    padding: var(--sp-3) var(--sp-4);
    border-top: 1px solid var(--line);
    background: var(--surface-2);
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-3);
    align-items: center;
    justify-content: space-between;
}

/* Gold accent = "needs the GM's attention". */
.card--accent {
    border-color: var(--gold);
    box-shadow: 0 0 0 1px rgba(176, 141, 63, 0.35), var(--shadow-sm);
}
.card--accent > .card__header {
    background: var(--gold-50);
    border-bottom-color: var(--gold);
}

/* -----------------------------------------------------------------------------
   7. Tables
   ----------------------------------------------------------------------------- */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--surface);
}

.table {
    width: 100%;
    font-size: 0.875rem;
}
.table th,
.table td {
    padding: 0.625rem var(--sp-3);
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--line);
}
.table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface-3);
    color: var(--brand-900);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    white-space: nowrap;
    border-bottom: 2px solid var(--line-2);
}
@media (prefers-color-scheme: dark) { .table thead th { color: var(--ink); } }
.table tbody tr:last-child > td { border-bottom: 0; }
.table tbody tr:hover > td { background: var(--brand-50); }
.table td.num, .table th.num { text-align: right; }
.table td:not(.nowrap) { min-width: 6.5rem; }

/* Wide lists scroll sideways instead of squashing. */
.table--wide { min-width: 780px; }
.table--compact th,
.table--compact td { padding: 0.375rem var(--sp-3); font-size: 0.8125rem; }

.rowlink { font-weight: 620; }
.sortlink {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: inherit;
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    border-bottom: 1px solid transparent;
}
.sortlink:hover { color: var(--brand); text-decoration: none; border-bottom-color: var(--brand); }
.sortlink.is-active { color: var(--gold-700); font-weight: 700; border-bottom-color: var(--gold); }
@media (prefers-color-scheme: dark) { .sortlink.is-active { color: var(--gold); } }

.deptlink { font-weight: 650; }

.linklist { display: grid; gap: var(--sp-2); }
.linklist li {
    padding-bottom: var(--sp-2);
    border-bottom: 1px dashed var(--line);
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
    align-items: baseline;
}
.linklist li:last-child { border-bottom: 0; padding-bottom: 0; }

/* -----------------------------------------------------------------------------
   8. Badges, pills, chips, progress
   ----------------------------------------------------------------------------- */
.badge {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    line-height: 1.5;
    border: 1px solid transparent;
    border-radius: var(--r-pill);
    white-space: nowrap;
    vertical-align: baseline;
}
.badge--success { background: var(--ok-bg); color: var(--ok); border-color: rgba(44, 110, 70, 0.35); }
.badge--danger { background: var(--danger-bg); color: var(--danger); border-color: rgba(157, 47, 43, 0.35); }
.badge--warning { background: var(--warn-bg); color: var(--warn); border-color: rgba(143, 97, 20, 0.35); }
.badge--neutral { background: var(--neutral-bg); color: var(--neutral); border-color: rgba(91, 103, 98, 0.3); }
.badge--info { background: var(--info-bg); color: var(--info); border-color: rgba(38, 96, 138, 0.3); }

/* "Confidential" markers read as visibly restricted, not merely grey. */
.pill {
    display: inline-block;
    padding: 0.075rem 0.45rem;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--restricted);
    background: var(--restricted-bg);
    border: 1px dashed var(--restricted);
    border-radius: var(--r-xs);
    white-space: nowrap;
}
.pill--warn {
    color: var(--warn);
    background: var(--warn-bg);
    border-color: var(--warn);
}

.chip {
    display: inline-block;
    padding: 0.125rem 0.4rem;
    margin: 0 0.2rem 0.2rem 0;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--r-xs);
    background: var(--surface-3);
    color: var(--ink-2);
    white-space: nowrap;
}
.chip--danger { background: var(--danger-bg); color: var(--danger); font-weight: 700; }

.progress {
    position: relative;
    height: 8px;
    min-width: 84px;
    background: var(--surface-3);
    border: 1px solid var(--line);
    border-radius: var(--r-pill);
    overflow: hidden;
}
.progress__bar {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--brand) 0%, var(--brand-400) 100%);
    border-radius: inherit;
    transition: width 0.4s ease;
}

/* -----------------------------------------------------------------------------
   9. Buttons
   ----------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 40px;
    padding: 0.5rem var(--sp-4);
    font-size: 0.875rem;
    font-weight: 620;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
    color: var(--brand-900);
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
@media (prefers-color-scheme: dark) { .btn { color: var(--ink); } }
.btn:hover { text-decoration: none; border-color: var(--brand); background: var(--brand-50); }

.btn--primary {
    color: #fff;
    background: var(--brand);
    border-color: var(--brand-700);
}
.btn--primary:hover { color: #fff; background: var(--brand-700); border-color: var(--brand-900); }

/* Gold = the resort's signature action (sign in). */
.btn--gold {
    color: #241a05;
    background: linear-gradient(180deg, var(--gold) 0%, var(--gold-700) 100%);
    border-color: var(--gold-700);
    font-weight: 700;
    letter-spacing: 0.02em;
}
.btn--gold:hover { color: #170f02; filter: brightness(1.06); }

.btn--ghost { background: transparent; border-color: var(--line-2); color: var(--ink-2); }
.btn--ghost:hover { background: var(--surface-3); color: var(--brand-900); }
@media (prefers-color-scheme: dark) { .btn--ghost:hover { color: var(--ink); } }

.btn--success { color: #fff; background: var(--ok); border-color: var(--ok); }
.btn--success:hover { color: #fff; filter: brightness(0.94); }

.btn--warning { color: #231703; background: var(--warn-bg); border-color: var(--warn); }
.btn--warning:hover { color: #231703; background: var(--gold-100); }

.btn--danger { color: #fff; background: var(--danger); border-color: var(--danger); }
.btn--danger:hover { color: #fff; filter: brightness(0.94); }

.btn--sm { min-height: 34px; padding: 0.3rem 0.7rem; font-size: 0.8125rem; }
.btn--block { display: flex; width: 100%; }
.btn:disabled,
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

/* -----------------------------------------------------------------------------
   10. Forms
   ----------------------------------------------------------------------------- */
.form { display: grid; gap: var(--sp-4); }
.form.card { padding: var(--sp-4); }

.field { min-width: 0; margin-bottom: var(--sp-4); }
.field:last-child { margin-bottom: 0; }

.label,
.field__label {
    display: block;
    margin-bottom: var(--sp-1);
    font-size: 0.8125rem;
    font-weight: 680;
    letter-spacing: 0.02em;
    color: var(--ink-2);
}

.req { color: var(--danger); font-weight: 700; }
.hint {
    margin: var(--sp-1) 0 0;
    font-size: 0.75rem;
    color: var(--muted);
}
.field__error {
    margin: var(--sp-1) 0 0;
    font-size: 0.75rem;
    font-weight: 650;
    color: var(--danger);
}

.input,
.select,
.textarea {
    display: block;
    width: 100%;
    min-height: 42px;
    padding: 0.5rem var(--sp-3);
    font: inherit;
    font-size: 0.9375rem;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: var(--r-sm);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
.select {
    padding-right: var(--sp-6);
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--brand) 50%),
        linear-gradient(135deg, var(--brand) 50%, transparent 50%);
    background-position: calc(100% - 17px) 19px, calc(100% - 12px) 19px;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
}
.input::placeholder,
.textarea::placeholder { color: var(--muted); opacity: 0.9; }
.input:focus,
.select:focus,
.textarea:focus {
    border-color: var(--brand);
    outline: 3px solid rgba(176, 141, 63, 0.35);
    outline-offset: 1px;
}
.input[readonly],
.input:disabled,
.textarea:disabled {
    background: var(--surface-3);
    color: var(--muted);
    cursor: not-allowed;
}
.input.is-invalid,
.select.is-invalid,
.textarea.is-invalid {
    border-color: var(--danger);
    background: var(--danger-bg);
    box-shadow: inset 0 0 0 1px var(--danger);
}

input[type="date"] { min-width: 9.5rem; }

.fieldset {
    margin: 0;
    padding: var(--sp-4);
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--surface-2);
}
.fieldset__legend {
    padding: 0 var(--sp-2);
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--brand-700);
}
@media (prefers-color-scheme: dark) { .fieldset__legend { color: var(--brand-400); } }

.form__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sp-3);
    padding-top: var(--sp-3);
    border-top: 1px solid var(--line);
}
/* Set by app.js while a form holds unsaved edits. */
.form.is-dirty .form__actions::after {
    content: "Unsaved changes";
    margin-left: auto;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--warn);
    background: var(--warn-bg);
    border: 1px solid var(--warn);
    border-radius: var(--r-pill);
    padding: 0.1rem 0.6rem;
}

.form__grid { display: grid; gap: var(--sp-4); }

/* Choice pills (task priority, severity pickers). */
.radios {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
}
.radio {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    padding: 0.4rem 0.85rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ink-2);
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: var(--r-pill);
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}
.radio:hover { border-color: var(--brand); background: var(--brand-50); }
.radio input[type="radio"] {
    width: 1rem;
    height: 1rem;
    margin: 0;
    accent-color: var(--brand);
    cursor: pointer;
}
.radio input[type="radio"]:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}
/* Checked state; ignored by engines without :has(), where the radio itself still shows it. */
.radio:has(input:checked) {
    color: var(--brand-900);
    background: var(--brand-50);
    border-color: var(--brand);
    box-shadow: inset 0 0 0 1px var(--brand);
}
@media (prefers-color-scheme: dark) {
    .radio:has(input:checked) { color: var(--ink); }
}

/* Severity picker: one option per row, description beside the label. */
.radios--stack {
    flex-direction: column;
    align-items: stretch;
}
.radio--block {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: var(--sp-3);
    padding: var(--sp-3);
    border-radius: var(--r-sm);
    line-height: 1.5;
}
.radio--block > span { font-weight: 500; color: var(--ink-2); }
.radio--block > span strong { display: block; font-size: 0.9375rem; }

/* Single checkbox rows ("A guest was affected"). */
.checkrow {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-2);
    margin: 0;
    padding: var(--sp-3);
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: var(--r-sm);
    cursor: pointer;
}
.checkrow:hover { border-color: var(--brand); }
.checkrow input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    margin: 0.1rem 0 0;
    accent-color: var(--brand);
    cursor: pointer;
}

/* Compact workflow forms parked inside a card (CAPA progress / verification). */
.form.form--inline {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--sp-2) var(--sp-3);
    padding: var(--sp-3);
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
}
.form--inline > .label { margin: 0; flex: 0 0 auto; }
.form--inline > .input,
.form--inline > .select { flex: 1 1 9rem; width: auto; min-width: 0; }
.form--inline > .textarea { flex: 4 1 16rem; width: auto; min-width: 0; }
.form--inline > .btn { flex: 0 0 auto; }

/* Layout helpers used by the forms and cards */
.grid { display: grid; gap: var(--sp-4); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); }

/* dashboard pairs two cards side by side */
.grid-2 { display: grid; gap: var(--sp-4); }
@media (min-width: 900px) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.cols { display: grid; gap: var(--sp-4); align-items: start; }
@media (min-width: 1080px) {
    .cols--main { grid-template-columns: minmax(0, 1fr) minmax(290px, 350px); }
    .cols--main > aside { display: grid; gap: var(--sp-4); }
    .card--sticky { position: sticky; top: 5.5rem; }
}
@media (max-width: 1079.98px) {
    .cols > aside { display: grid; gap: var(--sp-4); }
}

.stack { display: grid; gap: var(--sp-4); align-content: start; }
.stack-sm { display: grid; gap: var(--sp-2); align-content: start; }

/* -----------------------------------------------------------------------------
   11. Filters & pagination
   ----------------------------------------------------------------------------- */
.filters {
    padding: var(--sp-3) var(--sp-4);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--shadow-sm);
}
.filters__row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--sp-3);
}
.filters__row > .input,
.filters__row > .select { flex: 1 1 10rem; width: auto; min-width: 0; }
.filters__row > .input[type="search"] { flex-grow: 3; }
.filters__date {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    font-size: 0.75rem;
    font-weight: 680;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
    flex: 0 0 auto;
}
.filters__date .input { min-height: 40px; }
.filters .btn { flex: 0 0 auto; }

.pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem;
}
.pager__info { margin-right: var(--sp-2); font-size: 0.8125rem; color: var(--muted); }
.pager__item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 0.5rem;
    font-size: 0.8125rem;
    font-weight: 620;
    color: var(--ink-2);
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: var(--r-sm);
}
.pager__item:hover { color: var(--brand-900); border-color: var(--brand); text-decoration: none; }
@media (prefers-color-scheme: dark) { .pager__item:hover { color: var(--ink); } }
.pager__item.is-active {
    color: #fff;
    background: var(--brand);
    border-color: var(--brand-700);
    font-weight: 700;
}
.pager__gap { padding: 0 0.25rem; color: var(--muted); }

/* -----------------------------------------------------------------------------
   12. Tiles & stat strips
   ----------------------------------------------------------------------------- */
.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
    gap: var(--sp-3);
}
.tile-grid--sm { grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr)); }

.tile {
    display: grid;
    gap: 0.15rem;
    align-content: start;
    padding: var(--sp-3) var(--sp-4);
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 5px solid var(--neutral);
    border-radius: var(--r);
    box-shadow: var(--shadow-sm);
    color: var(--ink);
    min-width: 0;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}
a.tile:hover {
    text-decoration: none;
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}
.tile__value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
    color: var(--brand-900);
}
@media (prefers-color-scheme: dark) { .tile__value { color: var(--ink); } }
.tile__label {
    font-size: 0.8125rem;
    font-weight: 650;
    color: var(--ink-2);
}
.tile__hint { font-size: 0.75rem; color: var(--muted); }

.tile--ok { border-left-color: var(--ok); }
.tile--ok .tile__value { color: var(--ok); }
.tile--warning { border-left-color: var(--warn); background: linear-gradient(180deg, var(--warn-bg) 0%, var(--surface) 62%); }
.tile--warning .tile__value { color: var(--warn); }
.tile--danger { border-left-color: var(--danger); background: linear-gradient(180deg, var(--danger-bg) 0%, var(--surface) 62%); }
.tile--danger .tile__value { color: var(--danger); }
.tile--info { border-left-color: var(--info); }
.tile--info .tile__value { color: var(--info); }

.stat-strip {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
}
.statstat {
    display: grid;
    gap: 0.1rem;
    flex: 1 1 8.5rem;
    min-width: 0;
    padding: var(--sp-2) var(--sp-3);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    color: var(--ink);
    text-align: center;
}
a.statstat:hover { border-color: var(--brand); text-decoration: none; background: var(--brand-50); }
.statstat.is-active {
    background: var(--brand);
    border-color: var(--brand-700);
    color: #fff;
}
.statstat.is-active .statstat__label { color: rgba(255, 255, 255, 0.85); }
.statstat__value {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    color: var(--brand-900);
}
@media (prefers-color-scheme: dark) { .statstat__value { color: var(--ink); } }
.statstat.is-active .statstat__value { color: #fff; }
.statstat__label {
    font-size: 0.6875rem;
    font-weight: 680;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--muted);
}

/* Dashboard "list" panels (overdue tasks, critical issues, latest reports). */
.list { display: grid; }
.list__item {
    display: grid;
    gap: 0.25rem;
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--line);
}
.list__item:last-child { border-bottom: 0; }
.list__item > a { font-weight: 620; }
.list__item:hover { background: var(--brand-50); }
.list__meta { font-size: 0.75rem; color: var(--muted); }

/* -----------------------------------------------------------------------------
   13. Empty states, callouts, prose, key/value
   ----------------------------------------------------------------------------- */
.empty {
    padding: var(--sp-6) var(--sp-4);
    text-align: center;
    color: var(--muted);
    background: var(--surface-2);
    border: 1px dashed var(--line-2);
    border-radius: var(--r);
}
.empty p { margin: 0 0 var(--sp-3); }
.empty .btn { margin-top: var(--sp-1); }

.callout {
    padding: var(--sp-3) var(--sp-4);
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 5px solid var(--brand);
    border-radius: var(--r-sm);
}
.callout strong { display: block; margin-bottom: var(--sp-1); }
.callout p { margin: 0; }
.callout--warning {
    background: var(--warn-bg);
    border-color: var(--warn);
    border-left-color: var(--warn);
    color: var(--warn);
}
.callout--warning strong { color: var(--warn); }

/* SOP exposure row */
.kv-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
    align-items: baseline;
    justify-content: space-between;
    padding-bottom: var(--sp-2);
    margin-bottom: var(--sp-2);
    border-bottom: 1px dashed var(--line);
}
.kv__term { font-size: 0.8125rem; font-weight: 650; color: var(--ink-2); }
.kv__desc { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--brand-900); }
@media (prefers-color-scheme: dark) { .kv__desc { color: var(--ink); } }

/* Definition lists used by the report detail panel */
.kv { display: grid; gap: 0; margin: 0; }
.kv--grid {
    grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr));
    gap: var(--sp-3);
}
.kv__pair {
    display: grid;
    gap: 0.1rem;
    padding: var(--sp-2) 0;
    border-bottom: 1px solid var(--line);
}
.kv--grid .kv__pair { padding: var(--sp-2) var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); }

/* Department report sheets (e.g. Front Office night audit). */
.sheet__group {
    margin: var(--sp-4) 0 var(--sp-2);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--brand-700);
}
.sheet__group:first-child { margin-top: 0; }
.kv--sheet { grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); }
.sheet__figure {
    font-family: var(--font-num);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}
.table--compact .input { width: 100%; min-width: 8ch; }
.kv__key {
    margin: 0;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--muted);
}
.kv__value {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 620;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

/* Narrative blocks */
.prose { padding-bottom: var(--sp-3); margin-bottom: var(--sp-3); border-bottom: 1px solid var(--line); }
.prose:last-child { padding-bottom: 0; margin-bottom: 0; border-bottom: 0; }
.prose__title {
    margin: 0 0 var(--sp-1);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--gold-700);
}
@media (prefers-color-scheme: dark) { .prose__title { color: var(--gold); } }
.prose__body {
    color: var(--ink-2);
    font-size: 0.9375rem;
    line-height: 1.65;
    overflow-wrap: break-word;
}

/* -----------------------------------------------------------------------------
   14. Timeline & disclosure
   ----------------------------------------------------------------------------- */
.timeline {
    position: relative;
    display: grid;
    gap: var(--sp-4);
    margin: 0;
    padding-left: var(--sp-5);
}
.timeline::before {
    content: "";
    position: absolute;
    left: 5px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: var(--line-2);
}
.timeline__item { position: relative; min-width: 0; }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__dot {
    position: absolute;
    left: calc(-1 * var(--sp-5) + 1px);
    top: 0.35rem;
    width: 10px;
    height: 10px;
    border-radius: var(--r-pill);
    background: var(--brand);
    box-shadow: 0 0 0 3px var(--surface);
}
.timeline__title {
    margin: 0 0 0.15rem;
    font-size: 0.875rem;
    font-weight: 650;
    color: var(--ink);
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: baseline;
}
.timeline__body { min-width: 0; }
.timeline__body > p { margin: 0 0 0.15rem; }
.timeline__note {
    margin: var(--sp-1) 0 0;
    padding: var(--sp-2) var(--sp-3);
    font-size: 0.8125rem;
    color: var(--ink-2);
    background: var(--surface-2);
    border-left: 3px solid var(--gold);
    border-radius: 0 var(--r-xs) var(--r-xs) 0;
    overflow-wrap: break-word;
}

.disclose { min-width: 0; }
.disclose > summary {
    cursor: pointer;
    list-style: none;
    color: var(--brand);
    font-weight: 620;
}
.disclose > summary::-webkit-details-marker { display: none; }
.disclose > summary::before { content: "▸ "; color: var(--gold); }
.disclose[open] > summary::before { content: "▾ "; }
.disclose > summary:hover { text-decoration: underline; }
.disclose__body {
    margin-top: var(--sp-2);
    padding: var(--sp-3);
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    font-size: 0.8125rem;
}
.disclose__body p { margin: 0 0 var(--sp-2); overflow-wrap: break-word; }
.disclose__body p:last-child { margin-bottom: 0; }

/* Long histories scroll instead of pushing the rest of the page away. */
.timeline-wrap {
    max-height: 26rem;
    overflow-y: auto;
    padding-right: var(--sp-2);
}

/* Issue handling stage rail (issues/show.php). */
.stepper {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
    align-items: center;
    padding: var(--sp-2) var(--sp-3);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--shadow-sm);
}
.stepper__step {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.8rem;
    font-size: 0.6875rem;
    font-weight: 650;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--muted);
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-pill);
}
.stepper__step.is-done {
    color: var(--ok);
    background: var(--ok-bg);
    border-color: rgba(44, 110, 70, 0.35);
}
.stepper__step.is-done::after { content: "\2713"; font-weight: 700; }
.stepper__step.is-current {
    color: #fff;
    background: var(--brand);
    border-color: var(--brand-700);
    font-weight: 700;
    box-shadow: 0 0 0 2px rgba(176, 141, 63, 0.5);
}

/* Corrective action (CAPA) blocks. */
.action {
    display: grid;
    gap: var(--sp-2);
    align-content: start;
    padding: var(--sp-3) var(--sp-4);
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-left: 4px solid var(--info);
    border-radius: var(--r-sm);
    min-width: 0;
}
.action.is-overdue {
    border-left-color: var(--danger);
    background: var(--danger-bg);
}
.action__head {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
    align-items: baseline;
    justify-content: space-between;
}
.action__text {
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.4;
    min-width: 0;
}
.action__forms {
    display: grid;
    gap: var(--sp-2);
    padding-top: var(--sp-2);
    border-top: 1px dashed var(--line);
}

/* -----------------------------------------------------------------------------
   15. Evidence lists & gallery
   ----------------------------------------------------------------------------- */
.filelist { display: grid; gap: 0; }
.filelist__item {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-2) 0;
    border-bottom: 1px solid var(--line);
    min-width: 0;
}
.filelist__item:last-child { border-bottom: 0; }
.filelist__item > span { min-width: 0; }
.thumb {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: var(--r-xs);
    background: var(--surface-3);
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(132px, 100%), 1fr));
    gap: var(--sp-3);
}
.gallery__item { min-width: 0; display: grid; gap: 0.25rem; align-content: start; }
.gallery__item img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--surface-3);
}
.gallery__item a:hover img { border-color: var(--gold); }
.gallery__item p { margin: 0; overflow-wrap: anywhere; }
.gallery__doc {
    display: grid;
    gap: 0.25rem;
    align-content: start;
    padding: var(--sp-3);
    min-height: 4.5rem;
    font-size: 0.8125rem;
    font-weight: 620;
    color: var(--ink-2);
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    overflow-wrap: anywhere;
}
.gallery__doc:hover { border-color: var(--gold); text-decoration: none; }
.gallery__kind {
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--gold-700);
}
@media (prefers-color-scheme: dark) { .gallery__kind { color: var(--gold); } }

/* -----------------------------------------------------------------------------
   16. Department directory & workspace
   ----------------------------------------------------------------------------- */
.dept-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
    gap: var(--sp-4);
}
.deptcard {
    display: grid;
    gap: var(--sp-3);
    align-content: start;
    padding: var(--sp-4);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--shadow-sm);
    min-width: 0;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.deptcard:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.deptcard.is-alert {
    border-color: var(--danger);
    box-shadow: 0 0 0 1px rgba(157, 47, 43, 0.3), var(--shadow-sm);
}
.deptcard__head {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
    align-items: baseline;
    justify-content: space-between;
    padding-bottom: var(--sp-2);
    border-bottom: 2px solid var(--gold-100);
}
.deptcard__name { font-size: 1.0625rem; font-weight: 700; color: var(--brand-900); }
@media (prefers-color-scheme: dark) { .deptcard__name { color: var(--ink); } }
.deptcard__name:hover { color: var(--gold-700); text-decoration: none; }
.deptcard__code {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--muted);
    background: var(--surface-3);
    border-radius: var(--r-xs);
    padding: 0.1rem 0.4rem;
}
.deptcard__focus { margin: 0; font-size: 0.875rem; color: var(--ink-2); }
.deptcard__stats {
    display: grid;
    gap: 0;
    margin: 0;
    font-size: 0.8125rem;
}
.deptcard__stats > div {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
    align-items: baseline;
    justify-content: space-between;
    padding: 0.3rem 0;
    border-bottom: 1px dashed var(--line);
}
.deptcard__stats > div:last-child { border-bottom: 0; }
.deptcard__stats dt { margin: 0; color: var(--muted); font-weight: 500; }
.deptcard__stats dd { margin: 0; font-weight: 650; text-align: right; }
.deptcard__foot {
    display: grid;
    gap: var(--sp-2);
    padding-top: var(--sp-3);
    border-top: 1px solid var(--line);
}
.deptcard__foot p { margin: 0; }

/* Week day-strip */
.daystrip {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: var(--sp-1);
}
.daystrip__cell {
    display: grid;
    gap: 0.05rem;
    justify-items: center;
    align-content: center;
    padding: 0.4rem 0.15rem;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-bottom-width: 3px;
    border-radius: var(--r-sm);
    color: var(--ink-2);
    text-align: center;
}
a.daystrip__cell:hover { border-color: var(--brand); text-decoration: none; transform: translateY(-1px); }
.daystrip__dow {
    font-size: 0.5625rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    color: var(--muted);
}
.daystrip__num { font-size: 1.0625rem; font-weight: 700; line-height: 1.15; color: var(--brand-900); font-variant-numeric: tabular-nums; }
@media (prefers-color-scheme: dark) { .daystrip__num { color: var(--ink); } }
.daystrip__occ { font-size: 0.6875rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.daystrip__cell--success { background: var(--ok-bg); border-bottom-color: var(--ok); }
.daystrip__cell--success .daystrip__num { color: var(--ok); }
.daystrip__cell--warning { background: var(--warn-bg); border-bottom-color: var(--warn); }
.daystrip__cell--warning .daystrip__num { color: var(--warn); }
.daystrip__cell--danger { background: var(--danger-bg); border-bottom-color: var(--danger); }
.daystrip__cell--danger .daystrip__num { color: var(--danger); }
.daystrip__cell--info { background: var(--info-bg); border-bottom-color: var(--info); }
.daystrip__cell--info .daystrip__num { color: var(--info); }
.daystrip__cell--neutral { background: var(--neutral-bg); border-bottom-color: var(--neutral); }
.daystrip__cell--neutral .daystrip__num { color: var(--neutral); }
.daystrip__cell--none { background: var(--surface-2); border-bottom-color: var(--line-2); border-style: dashed; }
.daystrip__cell--none .daystrip__num { color: var(--muted); font-weight: 500; }

@media (max-width: 479.98px) {
    .daystrip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* -----------------------------------------------------------------------------
   17. Sign-in screen
   ----------------------------------------------------------------------------- */
body.auth {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: var(--sp-4);
    background:
        radial-gradient(1100px 620px at 12% -10%, rgba(31, 77, 56, 0.16), transparent 60%),
        radial-gradient(900px 520px at 110% 110%, rgba(176, 141, 63, 0.16), transparent 60%),
        var(--ivory);
}
.auth__shell { width: 100%; max-width: 420px; display: grid; gap: var(--sp-5); }
.auth__brand { text-align: center; }
.auth__logo {
    display: block;
    width: 100%;
    max-width: 320px;
    height: auto;
    margin: 0 auto;
}

.auth__card {
    padding: var(--sp-5);
    background: var(--surface);
    border: 1px solid var(--line);
    border-top: 3px solid var(--gold);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
}
.auth__title {
    margin: 0 0 var(--sp-1);
    font-size: 1.0625rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--brand);
}
.auth__card .form { margin-top: var(--sp-4); }
.auth__note {
    margin: var(--sp-4) 0 0;
    padding-top: var(--sp-3);
    border-top: 1px dashed var(--line);
    font-size: 0.75rem;
    color: var(--muted);
}

/* -----------------------------------------------------------------------------
   18. Error / maintenance pages and print layout
   ----------------------------------------------------------------------------- */
.error-page {
    max-width: 640px;
    margin: var(--sp-7) auto;
    padding: var(--sp-5);
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-top: 4px solid var(--danger);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
}
.error-page__code {
    margin: 0;
    font-size: 3.25rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.04em;
    font-variant-numeric: tabular-nums;
    color: var(--danger);
}
.error-page h1 { margin: var(--sp-2) 0 var(--sp-3); }
.error-page__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
    justify-content: center;
    margin-top: var(--sp-4);
}

/* Print layout (layouts/print.php) — also the bare document for PDF export. */
.print-body {
    background: #fff;
    color: #111;
    padding: var(--sp-4);
    font-size: 0.875rem;
}
.print-head {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-3);
    align-items: flex-start;
    justify-content: space-between;
    padding-bottom: var(--sp-3);
    margin-bottom: var(--sp-4);
    border-bottom: 2px solid var(--brand);
}
.print-head__logo {
    display: block;
    width: auto;
    height: 52px;
    margin-bottom: var(--sp-2);
}
.print-head strong { letter-spacing: 0.14em; }
.print-head p { margin: 0; }
.print-head__right { text-align: right; }
.print-foot {
    margin-top: var(--sp-5);
    padding-top: var(--sp-3);
    border-top: 1px solid var(--line-2);
    font-size: 0.75rem;
    color: var(--muted);
    text-align: center;
}

@media screen and (min-width: 900px) {
    .print-body { max-width: 1100px; margin: 0 auto; padding: var(--sp-6); }
}

/* -----------------------------------------------------------------------------
   19. Print output for every view
   ----------------------------------------------------------------------------- */
@media print {
    @page { margin: 14mm; }

    :root {
        --ivory: #fff;
        --surface: #fff;
        --surface-2: #fff;
        --surface-3: #f2f2f0;
        --ink: #000;
        --ink-2: #111;
        --muted: #444;
        --line: #bbb;
        --line-2: #999;
        --shadow: none;
        --shadow-sm: none;
        --shadow-lg: none;
    }

    html, body { background: #fff !important; color: #000 !important; font-size: 10.5pt; }

    /* Never print chrome, controls or overlays. */
    .sidebar,
    .topbar,
    .footer,
    .idle-warning,
    .filters,
    .pager,
    .btn,
    .page__actions,
    .form__actions,
    .alert[data-autodismiss]::after,
    nav[aria-label="Main navigation"],
    nav[aria-label="Pagination"] {
        display: none !important;
    }

    .app__shell,
    .main,
    .content,
    .page {
        display: block !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .card,
    .tile,
    .deptcard,
    .callout,
    .action,
    .radio,
    .checkrow,
    .stepper__step,
    .timeline__item,
    .prose,
    .disclose__body {
        box-shadow: none !important;
        border-color: #bbb !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }
    .timeline-wrap { max-height: none !important; overflow: visible !important; }
    .action { background: #fff !important; }
    .card__header { background: #fff !important; }
    .card__foot { background: #fff !important; }
    .cols--main { display: block !important; }
    .grid-2 { display: block !important; }
    .grid-2 > .card { margin-bottom: 10mm; }

    .table-wrap { overflow: visible !important; }
    .table,
    .table--wide { min-width: 0 !important; width: 100% !important; font-size: 9pt; }
    .table thead th {
        position: static !important;
        background: #f0f0ee !important;
        color: #000 !important;
    }
    .table tbody tr:hover > td { background: transparent !important; }
    .table tr { break-inside: avoid; page-break-inside: avoid; }
    .table thead { display: table-header-group; }

    /* Keep status legible without colour reliance. */
    .badge,
    .pill,
    .chip {
        background: #fff !important;
        color: #000 !important;
        border: 1px solid #777 !important;
    }
    .tile--warning,
    .tile--danger,
    .banner--warn,
    .callout--warning,
    .alert { background: #fff !important; color: #000 !important; border-color: #777 !important; }
    .tile--ok,
    .tile--info { background: #fff !important; color: #000 !important; }
    .text-danger, .danger, .text-warning, .text-ok { color: #000 !important; }

    a { color: #000 !important; text-decoration: none !important; }
    .disclose > summary::before { content: "" !important; }
    .disclose { display: block; }
    .disclose > .disclose__body { display: block; }
}

/* -----------------------------------------------------------------------------
   20. Tab bars, unread rows, MarComm calendar and content entries
   ----------------------------------------------------------------------------- */
.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-1);
    margin-bottom: var(--sp-4);
    border-bottom: 1px solid var(--line);
}
.tabs__item {
    padding: 0.4rem 0.8rem;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: var(--r-sm) var(--r-sm) 0 0;
    color: var(--ink-2);
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
}
.tabs__item:hover { color: var(--brand); text-decoration: none; }
.tabs__item.is-active {
    background: var(--surface);
    border-color: var(--line);
    border-bottom-color: var(--surface);
    color: var(--brand-900);
}
@media (prefers-color-scheme: dark) {
    .tabs__item.is-active { background: var(--surface-2); border-bottom-color: var(--surface-2); }
}

tr.is-unread > td { background: var(--gold-50); }
tr.is-unread > td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
@media (prefers-color-scheme: dark) { tr.is-unread > td { background: var(--brand-50); } }

/* Month grid */
.monthgrid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: var(--sp-1);
}
.monthgrid__dow {
    padding: 0.25rem 0.4rem;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--muted);
    text-transform: uppercase;
}
.monthgrid__cell {
    display: grid;
    gap: 0.15rem;
    align-content: start;
    min-height: 92px;
    padding: 0.35rem;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
}
.monthgrid__cell--blank { border-style: dashed; opacity: 0.45; }
.monthgrid__num { font-size: 0.75rem; font-weight: 700; color: var(--brand-900); font-variant-numeric: tabular-nums; }
@media (prefers-color-scheme: dark) { .monthgrid__num { color: var(--ink); } }
.monthgrid__item {
    display: block;
    padding: 0.1rem 0.3rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-left-width: 3px;
    border-radius: var(--r-xs);
    color: var(--ink-2);
    font-size: 0.6875rem;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.monthgrid__item:hover { border-color: var(--brand); text-decoration: none; color: var(--brand); }
.monthgrid__cell--info { border-color: var(--info); background: var(--info-bg); }
.monthgrid__cell--success { border-color: var(--ok); }
.monthgrid__cell--success .monthgrid__num { color: var(--ok); }
.monthgrid__cell--danger { border-color: var(--danger); background: var(--danger-bg); }
.monthgrid__cell--danger .monthgrid__num { color: var(--danger); }
.monthgrid__cell--none { border-bottom-color: var(--line-2); }
@media (max-width: 719.98px) {
    .monthgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .monthgrid__cell { min-height: 76px; }
}

/* Content entry rows */
.entry {
    display: grid;
    gap: var(--sp-2);
    padding: var(--sp-3);
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r);
}
.entry:target { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-100); }
.entry__head {
    display: flex;
    gap: var(--sp-3);
    align-items: flex-start;
    justify-content: space-between;
}
.entry__title { margin: 0 0 0.15rem; font-size: 0.9375rem; font-weight: 700; color: var(--brand-900); }
@media (prefers-color-scheme: dark) { .entry__title { color: var(--ink); } }
.field--end { display: flex; align-items: flex-end; }
.table tfoot td { background: var(--surface-3); font-weight: 700; }

@media print {
    .monthgrid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
    .monthgrid__cell, .entry { break-inside: avoid; page-break-inside: avoid; }
}

/* Language choice: ID | EN. The two labels are language names, so they are never translated. */
.langswitch {
    display: flex;
    gap: 2px;
    padding: 2px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
}
.langswitch__option {
    font: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--ink-2);
    background: none;
    border: 0;
    border-radius: calc(var(--r-sm) - 2px);
    padding: 0.3rem 0.5rem;
    cursor: pointer;
}
.langswitch__option:hover { color: var(--gold-700); }
.langswitch__option.is-active { background: var(--gold); color: #fff; }
.auth__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
}
@media print { .langswitch { display: none; } }

