/* =========================================================================
   D&A Hauliers Ltd — Operations Management System
   Look & feel: soft cool-grey canvas, floating translucent white cards,
   a deep "operations" green for actions and active states, navy text, and
   the D&A gear emblem enlarged and faded behind the workspace.
   ========================================================================= */

:root {
  --green: #0AA34F;
  --green-deep: #067A3A;
  --green-dark: #088A43;
  --green-wash: #E8F5ED;
  --green-line: #A9DCBD;
  --black: #0B1B2B;
  --white: #FFFFFF;

  --bg: #F1F5F8;
  --bg-2: #EDF2F3;
  --surface: rgba(255,255,255,.82);
  --surface-solid: #FFFFFF;
  --surface-2: #F3F7FA;
  --text: #000000;
  --text-muted: #1F2933;
  --border: #E4EAEF;
  --border-strong: #D3DCE3;
  --shadow: 0 1px 2px rgba(16,42,67,.04), 0 10px 28px rgba(16,42,67,.06);
  --shadow-sm: 0 1px 2px rgba(16,42,67,.05);

  --danger: #C62828;
  --danger-wash: #FDEDED;
  --warn: #B85E00;
  --warn-wash: #FDEBCB;
  --info: #14507A;
  --info-wash: #E3EFFA;

  --sidebar-bg: linear-gradient(180deg, #FBFCFC 0%, #F6F9F9 100%);
  --topbar-bg: rgba(241,245,248,.72);
  --wm-image: url("../img/logo-emblem.0715d8120326.png");
  --wm-opacity: .07;

  --radius: 10px;
  --radius-lg: 16px;
  --gap: 18px;

  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

html[data-theme="dark"] {
  --green-wash: #0F2A1C;
  --green-line: #1E6B3F;
  --green-deep: #3DD17C;
  --bg: #0A100E;
  --bg-2: #0C1411;
  --surface: rgba(18,27,23,.86);
  --surface-solid: #131C18;
  --surface-2: #17211D;
  --text: #FFFFFF;
  --text-muted: #D5E0DB;
  --border: #1F2C26;
  --border-strong: #2B3A33;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 28px rgba(0,0,0,.28);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --danger-wash: #2A1414;
  --warn: #F0A548;
  --warn-wash: #2B2113;
  --info: #7DB8E6;
  --info-wash: #101F2B;
  --sidebar-bg: linear-gradient(180deg, #0E1512 0%, #0B120F 100%);
  --topbar-bg: rgba(10,16,14,.72);
  --wm-image: url("../img/logo-emblem-dark.1c7e55310fc1.png");
  --wm-opacity: .06;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: env(safe-area-inset-top, 0px); background: var(--bg); }

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", "Inter", -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text);
  background: linear-gradient(160deg, var(--bg) 0%, var(--bg-2) 100%) fixed;
  -webkit-font-smoothing: antialiased;
}

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

/* --------------------------------------------------------------- shell */
.app-shell { display: flex; min-height: 100vh; align-items: stretch; }

.sidebar {
  width: 264px; flex-shrink: 0; background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  padding: 16px 14px calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
}

/* The brand mark is the first thing on the page: big, uncropped, crisp. */
.sidebar-brand {
  display: block; padding: 4px 6px 22px; flex-shrink: 0; text-align: center;
}
.sidebar-brand img { display: block; width: 100%; max-width: 232px; height: auto; margin: 0 auto; }
html[data-theme="light"] .sidebar-brand .logo-dark { display: none; }
html[data-theme="dark"]  .sidebar-brand .logo-light { display: none; }

.nav-group { margin-bottom: 22px; }
.nav-group-label {
  font-size: 11.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-muted); margin: 0 14px 8px;
}
.nav-link {
  display: flex; align-items: center; gap: 13px;
  padding: 11px 14px; border-radius: 12px;
  font-weight: 700; font-size: 14.5px; color: var(--text);
  margin-bottom: 3px;
}
.nav-link svg { flex-shrink: 0; }
.nav-link:hover { background: rgba(10,163,79,.06); text-decoration: none; }
.nav-link.active { background: var(--green-wash); color: var(--green-deep); font-weight: 800; }
.sidebar-footer {
  margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-footer .nav-link { width: 100%; background: none; border: none;
  font: inherit; font-weight: 700; font-size: 14.5px; cursor: pointer; text-align: left; }
.sidebar-footer .nav-link:hover { background: rgba(10,163,79,.06); }

.sidebar-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(8,20,32,.4); z-index: 55;
}
.sidebar-backdrop.show { display: block; }

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

/* Enlarged, faded gear emblem behind the workspace. Fixed to the viewport so
   it stays put while the cards scroll over it; pointer-events off so it can
   never intercept a click. */
.watermark {
  position: fixed; top: -7vh; right: 1vw;
  width: min(66vw, 1100px); height: 116vh;
  background: var(--wm-image) no-repeat right center / contain;
  opacity: var(--wm-opacity);
  pointer-events: none; z-index: 0;
}

.sidebar-toggle {
  display: none; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 12px;
  background: var(--surface-solid); border: 1px solid var(--border); color: var(--text);
  flex-shrink: 0; cursor: pointer; box-shadow: var(--shadow-sm);
}

/* ---------------------------------------------------------------- topbar */
.topbar {
  display: flex; align-items: center; gap: var(--gap);
  padding: 18px 32px 6px;
  padding-top: calc(18px + env(safe-area-inset-top, 0px));
  background: transparent;
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 40;
  flex-wrap: wrap; transition: background .15s ease, box-shadow .15s ease;
}
/* Floats free like the design; only gains a frosted backing once content
   scrolls underneath it (class toggled in app.js). */
.topbar.scrolled {
  background: var(--topbar-bg);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  box-shadow: 0 1px 0 var(--border);
}
.topbar-right { display: flex; align-items: center; gap: 18px; }

.topsearch {
  flex: 1; min-width: 180px; max-width: 520px; height: 42px;
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-solid); border: 1px solid transparent;
  border-radius: 999px; padding: 0 18px; color: var(--text-muted);
  box-shadow: var(--shadow-sm), 0 6px 18px rgba(16,42,67,.05);
}
.topsearch:focus-within { border-color: var(--green-line); }
.topsearch svg { flex-shrink: 0; }
.topsearch input {
  border: none; background: none; outline: none; width: 100%;
  font-size: 13.5px; font-family: inherit; color: var(--text);
}
.topsearch input::placeholder { color: var(--text-muted); }

/* Sun/moon switch: a green thumb slides over the active icon. */
.theme-switch {
  position: relative; display: flex; align-items: center;
  width: 74px; height: 34px; padding: 0; border-radius: 999px; cursor: pointer;
  background: var(--surface-solid); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm); flex-shrink: 0;
}
.theme-switch .ts-thumb {
  position: absolute; top: 2px; left: 2px; width: calc(50% + 2px); height: 28px;
  border-radius: 999px; background: var(--green);
  transition: transform .2s ease;
}
html[data-theme="dark"] .theme-switch .ts-thumb { transform: translateX(calc(100% - 6px)); }
.theme-switch .ts-icon {
  position: relative; z-index: 1; flex: 1; display: flex;
  align-items: center; justify-content: center; color: var(--text-muted);
}
html[data-theme="light"] .theme-switch .ts-sun,
html[data-theme="dark"]  .theme-switch .ts-moon { color: #fff; }

.bell {
  position: relative; display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 50%; color: var(--text); flex-shrink: 0;
}
.bell:hover { background: rgba(10,163,79,.08); text-decoration: none; }
.bell-badge {
  position: absolute; top: 1px; right: 1px; min-width: 16px; height: 16px;
  padding: 0 4px; border-radius: 999px; background: var(--green);
  color: #fff; font-size: 9.5px; font-weight: 800; line-height: 16px;
  text-align: center; border: 2px solid var(--bg);
}

.who { display: flex; align-items: center; gap: 11px; flex-shrink: 0; }
.who:hover { text-decoration: none; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; background: var(--green);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px; flex-shrink: 0;
}
.who-text { display: flex; flex-direction: column; line-height: 1.2; }
.who-text strong { font-size: 14px; font-weight: 700; color: var(--text); }
.who-text small { color: var(--text-muted); font-size: 12px; }
.who-caret { color: var(--text-muted); flex-shrink: 0; }
.inline { display: inline; }

/* ------------------------------------------------------------------ page */
.page {
  width: 100%; max-width: 1720px; margin: 0 auto;
  padding: 18px 32px 60px; position: relative; z-index: 1;
}

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--gap); flex-wrap: wrap; margin-bottom: 22px;
}
.page-head h1 {
  margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2;
}
.page-head h1::after {
  content: ""; display: block; width: 42px; height: 3px; margin-top: 8px;
  background: var(--green); border-radius: 999px;
}
.page-head p { margin: 10px 0 0; color: var(--text-muted); font-size: 14px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

h2 { font-size: 16px; font-weight: 700; margin: 0 0 12px; }
h3 { font-size: 12.5px; margin: 0 0 8px; text-transform: uppercase;
     letter-spacing: .07em; color: var(--text-muted); }

/* ----------------------------------------------------------------- cards */
.card {
  background: var(--surface);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: var(--gap);
  overflow: hidden;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 16px 22px;
}
.card-head h2, .card-head h3 { margin: 0; }
.card-head h2 { font-size: 16px; font-weight: 700; }
.card-head-title { display: flex; align-items: center; gap: 14px; }
.panel-icon {
  width: 26px; height: 26px; color: var(--text);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.card-body { padding: 18px 22px; }
.card-body.tight { padding: 0; }

.grid { display: grid; gap: var(--gap); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; padding: 12px 16px; background: var(--surface-2);
  border-bottom: 1px solid var(--border); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted);
  white-space: nowrap;
}
table.data td { padding: 14px 16px; border-bottom: 1px solid var(--border);
                vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data td:first-child { white-space: nowrap; }
table.data tbody tr:hover { background: rgba(10,163,79,.035); }
table.data td.num, table.data th.num { text-align: right;
  font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Report totals: plain and bold, like the exports — no colour block. */
table.data tr.total-row td {
  background: var(--surface-2); color: var(--text); font-weight: 800;
  border-top: 2px solid var(--text);
}
.empty { padding: 30px; text-align: center; color: var(--text-muted); }

/* --------------------------------------------------------- key/value list */
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
      gap: 14px 22px; }
.kv > div { min-width: 0; }
.kv dt, .kv .k { font-size: 11px; font-weight: 600; text-transform: uppercase;
                 letter-spacing: .07em; color: var(--text-muted); margin-bottom: 2px; }
.kv dd, .kv .v { margin: 0; font-weight: 600; word-break: break-word; }
.kv .v.muted { font-weight: 600; color: var(--text-muted); }

/* --------------------------------------------------------------- stat box */
.kpi-grid { display: grid; gap: var(--gap); margin-bottom: var(--gap);
            grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.kpi {
  position: relative;
  display: grid; grid-template-columns: auto 1fr; column-gap: 16px; align-items: center;
  background: var(--surface);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  border: 1px solid var(--border);
  border-radius: 18px; padding: 22px 20px 20px; box-shadow: var(--shadow);
  text-decoration: none; color: var(--text);
  transition: transform .15s ease, box-shadow .15s ease;
}
a.kpi:hover { transform: translateY(-2px); text-decoration: none;
  box-shadow: 0 2px 4px rgba(16,42,67,.05), 0 16px 34px rgba(16,42,67,.09); }
.kpi-icon {
  width: 58px; height: 58px; border-radius: 50%; background: var(--green-wash);
  color: var(--green-deep); display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.kpi-main { min-width: 0; }
.kpi-arrow {
  position: absolute; top: 16px; right: 16px; width: 26px; height: 26px;
  border-radius: 50%; background: var(--surface-2); color: var(--text);
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
}
.kpi-label { font-size: 12.5px; font-weight: 700; text-transform: uppercase;
             letter-spacing: .04em; color: var(--text); }
.kpi-value { font-size: 32px; font-weight: 800; line-height: 1.15;
             font-variant-numeric: tabular-nums; margin: 2px 0 6px; }
.kpi-trend { font-size: 12px; color: var(--text-muted); display: flex;
             align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.kpi-trend .pill {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px;
  border-radius: 999px; font-weight: 700; font-size: 11.5px; white-space: nowrap;
}
.kpi-trend .pill.up { background: var(--green-wash); color: var(--green-deep); }
.kpi-trend .pill.down { background: var(--danger-wash); color: var(--danger); }
.kpi-trend .pill.flat { background: var(--green-wash); color: var(--green-deep); }

.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 15px 18px; box-shadow: var(--shadow-sm);
}
.stat .label { font-size: 11px; font-weight: 600; text-transform: uppercase;
               letter-spacing: .07em; color: var(--text-muted); }
.stat .value { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat.accent { border-left: 3px solid var(--green); }
.stat .value.pos { color: var(--green-deep); }
.stat .value.neg { color: var(--danger); }

.summary-grid { display: grid; gap: var(--gap); margin-bottom: var(--gap);
                grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.summary-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 15px 18px; box-shadow: var(--shadow-sm);
}
.summary-card .label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.summary-card .value { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------- buttons */
.btn, button.btn, a.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 11px; border: 1px solid var(--border-strong);
  background: var(--surface-solid); color: var(--text); font-weight: 700; font-size: 13.5px;
  font-family: inherit; cursor: pointer; text-decoration: none; line-height: 1.3;
  box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.btn-primary, a.btn.btn-primary, button.btn.btn-primary {
  background: var(--green); border-color: var(--green); color: #fff;
  box-shadow: 0 6px 16px rgba(10,163,79,.28);
}
.btn.btn-primary:hover { background: var(--green-dark); border-color: var(--green-dark); color: #fff; }
.btn.btn-dark { background: var(--black); border-color: var(--black); color: #fff; }
.btn.btn-dark:hover { background: #1B2E42; color: #fff; }
.btn.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }
/* Outline-green secondary action ("View all drafts →"). */
.ghost {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-solid); border: 1px solid var(--green-line);
  border-radius: 10px; padding: 7px 14px; font-size: 12.5px; font-weight: 700;
  font-family: inherit; cursor: pointer; color: var(--green-deep);
}
.ghost:hover { background: var(--green-wash); text-decoration: none; }
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface-solid);
  color: var(--text); flex-shrink: 0;
}
.btn-icon:hover { background: var(--surface-2); text-decoration: none; }
.btn.btn-outline-danger {
  background: var(--surface-solid); border: 1px solid var(--danger); color: var(--danger);
}
.btn.btn-outline-danger:hover { background: var(--danger-wash); }
.report-divider { height: 3px; background: var(--green); border: none;
                  border-radius: 999px; margin: 20px 0; width: 42px; }
.section-label { font-size: 11.5px; font-weight: 700; text-transform: uppercase;
                 letter-spacing: .08em; color: var(--text-muted); margin: 0 0 12px; }

/* ---------------------------------------------------------------- badges */
.badge {
  display: inline-block; padding: 5px 13px; border-radius: 999px;
  font-size: 12px; font-weight: 700; letter-spacing: .01em;
  border: 1px solid transparent; background: #DDE6EF; color: #0F2740;
  white-space: nowrap;
}
html[data-theme="dark"] .badge { background: #22303A; color: #D5E2EC; }
.badge.st-DRAFT { background: #DDE6EF; color: #0F2740; }
.badge.st-READY_FOR_DISPATCH,
.badge.st-DISPATCHED, .badge.st-IN_TRANSIT { background: var(--info-wash); color: var(--info); }
.badge.st-OFFLOADED, .badge.st-AWAITING_COO, .badge.st-COO_REVIEW {
  background: var(--warn-wash); color: var(--warn);
}
.badge.st-COMPLETED { background: #D5F1DF; color: #0B6B33; }
html[data-theme="dark"] .badge.st-COMPLETED { background: #123321; color: #5FE39A; }
.badge.st-CANCELLED { background: var(--danger-wash); color: var(--danger); }
.badge.yes { background: var(--green-wash); border-color: var(--green-line); color: var(--green-deep); }
.badge.no  { background: #EBF1F6; color: #0F2740; }
html[data-theme="dark"] .badge.no { background: #22303A; color: #B7C6D0; }

/* ----------------------------------------------------------------- forms */
.form-control {
  width: 100%; padding: 10px 13px; border: 1px solid var(--border-strong);
  border-radius: 11px; background: var(--surface-solid); color: var(--text);
  font-size: 13.5px; font-family: inherit;
}
.form-control:focus {
  outline: none; border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(10,163,79,.16);
}
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 12.5px; font-weight: 600;
                  margin-bottom: 5px; color: var(--text-muted); }
.form-row .help { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }
.form-row .errors { color: var(--danger); font-size: 12px; margin-top: 4px; }
.form-row.check { display: flex; align-items: center; gap: 8px; }
.form-row.check label { margin: 0; }
.form-check { width: 16px; height: 16px; accent-color: var(--green); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
             gap: 0 20px; }
.required::after { content: " *"; color: var(--danger); }

fieldset.section {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px 20px; margin: 0 0 var(--gap); background: var(--surface);
  box-shadow: var(--shadow-sm);
}
fieldset.section > legend {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; padding: 4px 12px; background: var(--green-wash);
  color: var(--green-deep); border-radius: 999px;
}

.form-actions {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 14px 0 0; border-top: 1px solid var(--border); margin-top: 8px;
}

/* --------------------------------------------------------------- filters */
.filters {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px 14px; align-items: end;
}
.filters .wide { grid-column: 1 / -1; }

/* --------------------------------------------------------------- alerts */
.messages { margin-bottom: var(--gap); display: grid; gap: 8px; }
.alert {
  padding: 12px 16px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface-solid); font-size: 13px; box-shadow: var(--shadow-sm);
}
.alert-success { background: var(--green-wash); border-color: var(--green-line); }
.alert-error { background: var(--danger-wash); border-color: var(--danger); color: var(--danger); }
.alert-warning { background: var(--warn-wash); border-color: var(--warn); color: var(--warn); }
.alert-info { background: var(--info-wash); border-color: var(--info); color: var(--info); }

.notice {
  border-left: 3px solid var(--warn); background: var(--warn-wash);
  padding: 11px 16px; border-radius: 12px; font-size: 13px;
  margin-bottom: var(--gap); color: var(--text);
}
.notice ul { margin: 6px 0 0; padding-left: 20px; }

/* -------------------------------------------------------------- workflow */
.workflow { display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
            font-size: 11.5px; margin-bottom: var(--gap); }
.workflow .step {
  padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border);
  color: var(--text-muted); background: var(--surface-solid); white-space: nowrap;
}
.workflow .step.done { background: var(--green-wash); color: var(--green-deep); border-color: var(--green-line); }
.workflow .step.current { background: var(--green); border-color: var(--green);
                          color: #fff; font-weight: 700; }
.workflow .arrow { color: var(--border-strong); }

/* ---------------------------------------------------------------- login */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px; position: relative; overflow: hidden;
}
.login-wrap .watermark { z-index: 0; }
.login-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 420px; background: var(--surface);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  border: 1px solid var(--border);
  border-radius: 22px; padding: 34px 34px 30px; box-shadow: 0 24px 60px rgba(16,42,67,.14);
}
.login-card .logo { width: 100%; max-width: 300px; height: auto; display: block; margin: 0 auto 20px; }
.login-card h1 { font-size: 19px; font-weight: 800; text-align: center; margin: 0 0 4px; }
.login-card .sub { text-align: center; color: var(--text-muted);
                   font-size: 13px; margin-bottom: 22px; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 6px; padding: 12px 18px; }
html[data-theme="light"] .login-card .logo-dark { display: none; }
html[data-theme="dark"]  .login-card .logo-light { display: none; }

/* --------------------------------------------------------------- footer */
.footer {
  text-align: center; color: var(--text-muted); font-size: 11.5px;
  padding: 18px; position: relative; z-index: 1;
}

/* --------------------------------------------------------------- misc */
.muted { color: var(--text-muted); }
.small { font-size: 12px; }
.mono { font-variant-numeric: tabular-nums; }
.pos { color: var(--green-deep); font-weight: 700; }
.neg { color: var(--danger); font-weight: 700; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.pagination { display: flex; gap: 8px; align-items: center; justify-content: center;
              padding: 14px; font-size: 13px; }
.tag-list { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------------------------------------------------------- report cards */
.breadcrumb { font-size: 12.5px; color: var(--text-muted); margin-bottom: 4px; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--text); }
.report-section { margin: 26px 0 14px; }
.report-section:first-child { margin-top: 0; }
.report-section h3 { margin-bottom: 12px; }
.report-grid { display: grid; gap: var(--gap);
               grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.report-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 10px;
}
.report-card h4 { margin: 0; font-size: 15px; font-weight: 700; }
.report-card p { margin: 0; color: var(--text-muted); font-size: 12.5px; flex: 1; }
.report-card .btn { width: 100%; justify-content: center; }

details.open-questions { margin-top: var(--gap); }
details.open-questions summary { cursor: pointer; font-weight: 600; font-size: 13px; }
details.open-questions li { margin-bottom: 8px; }

@media (max-width: 1100px) {
  .who-text { display: none; }
}
@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: 0; top: 0; height: 100vh;
    transform: translateX(-100%); transition: transform .18s ease;
    box-shadow: 0 0 0 rgba(0,0,0,0);
  }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 34px rgba(8,20,32,.28); }
  .sidebar-toggle { display: inline-flex; }
  .topbar { padding: 12px 14px 4px; }
  .topsearch { display: none; }
  .page { padding: 14px 14px 48px; }
  .page-head h1 { font-size: 25px; }
  .watermark { width: 120vw; opacity: calc(var(--wm-opacity) * .8); }
}

@media print {
  .sidebar, .sidebar-toggle, .sidebar-backdrop, .watermark { display: none !important; }
  .app-shell { display: block; }
  .topbar, .footer, .page-actions, .filters, .form-actions, .topsearch { display: none !important; }
  .card { box-shadow: none; border: 1px solid #999; background: #fff; }
  body { background: #fff; }
}

/* =========================================================================
   High-contrast text: bold, black (white in dark mode) for readability.
   Kept in one block so it is easy to tune or remove.
   ========================================================================= */
.nav-group-label { font-weight: 800; }
.page-head h1 { font-weight: 800; }
.page-head p { font-weight: 600; color: var(--text); }

table.data th { font-weight: 800; color: var(--text); font-size: 11.5px; }
table.data td { font-weight: 600; color: var(--text); }
table.data td:first-child { font-weight: 800; }
table.data td .muted, table.data td small { font-weight: 600; color: var(--text-muted); }
.empty { font-weight: 700; color: var(--text); }

.kpi-label { font-weight: 800; }
.kpi-trend { font-weight: 600; color: var(--text); font-size: 11.5px; }
.kpi-trend .pill { font-size: 11px; padding: 3px 8px; }
.kpi-value { font-weight: 800; }

.card-head h2, .card-head h3 { font-weight: 800; }
h2 { font-weight: 800; }
h3 { font-weight: 800; color: var(--text); }

.kv dt, .kv .k { font-weight: 800; color: var(--text); }
.kv dd, .kv .v { font-weight: 700; color: var(--text); }
.stat .label, .summary-card .label { font-weight: 800; color: var(--text); }
.section-label, .breadcrumb, .breadcrumb a { font-weight: 700; color: var(--text); }

.form-row label { font-weight: 800; color: var(--text); }
.form-row .help { font-weight: 600; color: var(--text-muted); }
.form-control { font-weight: 600; color: var(--text); }
.form-control::placeholder, .topsearch input::placeholder { font-weight: 500; color: var(--text-muted); opacity: .75; }
.topsearch input { font-weight: 600; }

.who-text strong { font-weight: 800; }
.who-text small { font-weight: 600; color: var(--text-muted); }
.workflow .step { font-weight: 600; color: var(--text); }
.alert, .notice { font-weight: 600; }
.pagination { font-weight: 700; }
.footer { font-weight: 600; color: var(--text-muted); }
.login-card .sub { font-weight: 600; color: var(--text); }
.muted, .small { font-weight: 600; }
.badge { font-weight: 800; }
.btn, .ghost { font-weight: 800; }
