/* ─────────────────────────────────────────────────────────────────────────
   Design layer. Loaded after styles.css and overrides it; styles.css still
   owns structure (sticky offsets, scroll panes, column widths, responsive
   breakpoints). Where a styles.css rule uses !important, the override here
   repeats it with higher specificity.

   Direction: a berth plan, not a dashboard. Harbour-ink chrome, cool quay
   neutrals, flat surfaces, one amber signal for "today / act here", one red
   for off days. Location colours (blue / green / orange) are unchanged
   because operators already read the table by them.
   ───────────────────────────────────────────────────────────────────────── */

/* ── Fonts (self-hosted; see assets/fonts/OFL-Barlow.txt) ── */
@font-face {
  font-family: "Barlow";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/barlow-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Barlow";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../assets/fonts/barlow-latin-600-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Barlow Semi Condensed";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../assets/fonts/barlow-semi-condensed-latin-500-normal.woff2")
    format("woff2");
}

@font-face {
  font-family: "Barlow Semi Condensed";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../assets/fonts/barlow-semi-condensed-latin-600-normal.woff2")
    format("woff2");
}

@font-face {
  font-family: "Barlow Semi Condensed";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../assets/fonts/barlow-semi-condensed-latin-700-normal.woff2")
    format("woff2");
}

/* ── Tokens ── */
:root {
  --font-ui: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-num: "Barlow Semi Condensed", "Barlow", system-ui, sans-serif;

  /* Type scale. Page headings (a page title and a dashboard section heading
     are the same rank) share --fs-page; the old pair drifted to 22 and 24. */
  --fs-page: 24px;
  --fs-card: 16px;

  --ink-900: #0a1f2c;
  --ink-800: #0e2a3b;
  --ink-700: #174058;
  --ink-600: #25607f;

  --quay-50: #f7f9f8;
  --quay-100: #eef1ef;
  --quay-200: #dfe5e2;
  --quay-300: #c6cfcb;
  --quay-500: #566560;
  --quay-700: #33423d;

  --signal-500: #f2b01e;
  --signal-600: #d99a0b;
  --signal-700: #7a5200;
  --signal-100: #fff3d1;

  --berth-600: #bb3c35; /* 10% lighter than the original #b3261e */
  --berth-700: #9a342e;
  --berth-100: #fbe4e1;

  --channel-600: #0f766e;
  --channel-700: #0b5d56;
  --channel-100: #dcf2ee;

  /* Figure semantics, shared by the table and the charts: Delivered is the
     blue the total-delivered cell already uses, Received the amber of the
     total-received cell. Keeping them off red leaves red meaning only "off
     day" (or "decrease" inside a chart), never "received". */
  --del-600: #1d4ed8;
  --del-100: #dbeafe;
  --imp-600: #b45309;
  --imp-100: #fbe8cf;

  /* Data Entry table: one off-white for every ordinary cell. Text colours are
     untouched; only off-day, today and total rows differ. */
  --entry-bg: #f7f8f6;

  --focus-ring: 0 0 0 2px var(--quay-50), 0 0 0 4px var(--ink-600);

  --radius-sm: 4px;
  --radius-md: 8px;
  --elev-1: 0 0 0 1px rgba(14, 42, 59, 0.08), 0 1px 2px rgba(14, 42, 59, 0.06);
  --elev-2: 0 0 0 1px rgba(14, 42, 59, 0.1), 0 6px 18px rgba(14, 42, 59, 0.14);

  /* Existing styles.css variables re-pointed at the new palette */
  --navy-900: var(--ink-900);
  --navy-800: var(--ink-800);
  --navy-500: var(--ink-700);
  --gray-100: var(--quay-100);
  --gray-200: var(--quay-200);
  --gray-300: var(--quay-300);
  --topbar-h: 56px;
}

/* ── Base ── */
html,
body {
  font-family: var(--font-ui);
  font-size: 15px;
  background: var(--quay-100);
  color: var(--ink-900);
  -webkit-font-smoothing: antialiased;
}

/* styles.css transitions every property on every element, which makes
   re-rendered tables animate and costs paint time. Opt in per component. */
* {
  transition: none;
}

button,
select,
input,
.tbtn,
.btn,
.ntab,
.bnav-tab,
.mnav-btn,
.loc-chip,
.rpt-preset {
  transition:
    background-color 0.14s ease,
    border-color 0.14s ease,
    color 0.14s ease,
    box-shadow 0.14s ease;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

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

/* ── Topbar ── */
.topbar {
  gap: 16px;
  padding: 8px 20px;
  padding-top: calc(8px + env(safe-area-inset-top, 0px));
  background: var(--ink-800);
  border-bottom: 1px solid var(--ink-900);
  box-shadow: none;
  backdrop-filter: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--ink-900);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-text {
  min-width: 0;
}

.t-brand.brand-name {
  display: block;
  font-family: var(--font-num);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.01em;
  color: #fff;
  text-shadow: none;
  white-space: nowrap;
}

.brand-org {
  margin-top: 2px;
  font-size: 12.5px;
  line-height: 1.2;
  color: #b9cbd6;
  white-space: nowrap;
}

.t-sub.topbar-date {
  display: block;
  margin: 0 auto 0 8px;
  padding: 6px 12px;
  min-width: 0;
  font-family: var(--font-num);
  font-size: 17.25px; /* 15px + 15% */
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--signal-500);
  background: transparent;
  border: 0;
  border-left: 3px solid var(--signal-500);
  border-radius: 0;
  box-shadow: none;
  text-shadow: none;
  white-space: nowrap;
}

.t-right {
  gap: 8px;
}

.sv {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
}

.sv.ok {
  color: #9fe3c2;
  background: rgba(15, 118, 110, 0.28);
  border: 1px solid rgba(159, 227, 194, 0.3);
}

.sv.dirty {
  color: var(--signal-500);
  background: rgba(242, 176, 30, 0.14);
  border: 1px solid rgba(242, 176, 30, 0.45);
  animation: none;
}

.conn-pill {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #b9cbd6;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  white-space: nowrap;
}

/* The connection pill is hidden until the link actually drops (see setConn in
   app.js) — a permanent "Online"/"Local only" chip was just noise beside the
   autosave badge. */
#conn-status {
  display: none;
}

#conn-status.is-alert {
  display: inline-flex;
  align-items: center;
  color: #fca5a5;
  background: rgba(248, 113, 113, 0.14);
  border-color: rgba(248, 113, 113, 0.4);
}

/* All topbar actions share one shape; only Save is filled. */
.tbtn {
  gap: 6px;
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #e6eef3;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius-md);
  box-shadow: none;
}

.tbtn::before {
  display: none;
}

.tbtn:hover,
.tbtn.blue:hover,
.tbtn.purple:hover,
.tbtn.green:hover,
.tbtn.red:hover {
  transform: none;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: none;
}

.tbtn:active {
  background: rgba(255, 255, 255, 0.16);
  transform: none;
}

.tbtn.blue,
.tbtn.purple,
.tbtn.green,
.tbtn.red {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.22);
  color: #e6eef3;
}

.tbtn.gold {
  color: var(--ink-900);
  background: var(--signal-500);
  border-color: var(--signal-500);
}

.tbtn.gold:hover {
  background: var(--signal-600);
  border-color: var(--signal-600);
}

.tbtn:focus-visible {
  box-shadow: 0 0 0 2px var(--ink-800), 0 0 0 4px var(--signal-500);
}

#save-button.dirty-pulse {
  animation: none;
  box-shadow: 0 0 0 2px var(--ink-800), 0 0 0 4px var(--signal-500);
}

.tbtn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ── Primary navigation ── */
.nav {
  gap: 2px;
  padding: 0 20px;
  background: #fff;
  border-bottom: 1px solid var(--quay-300);
}

.ntab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  height: 40px;
  margin-bottom: 0;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  color: var(--quay-500);
  background: none;
  border-radius: 0;
  border-bottom: 3px solid transparent;
}

.ntab::after {
  display: none;
}

.ntab:hover {
  color: var(--ink-800);
  background: var(--quay-100);
}

.ntab.on {
  color: var(--ink-800);
  background: none;
  border-bottom-color: var(--signal-500);
}

.ntab:focus-visible {
  box-shadow: inset 0 0 0 2px var(--ink-600);
  border-radius: 0;
}

/* ── Month bar ── */
.mbar {
  gap: 8px;
  padding: 8px 20px;
  background: var(--quay-50);
  border-bottom: 1px solid var(--quay-200);
}

.mnav-btn,
.mnav-select {
  height: 34px;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-800);
  background: #fff;
  border: 1px solid var(--quay-300);
  border-radius: var(--radius-md);
  box-shadow: none;
}

.mnav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  min-width: 34px;
}

.mnav-select {
  padding: 0 28px 0 12px;
}

.mnav-btn:hover:not(:disabled),
.mnav-select:hover {
  transform: none;
  background: var(--quay-100);
  border-color: var(--ink-600);
  box-shadow: none;
}

.mnav-btn:disabled {
  color: var(--quay-300);
  background: var(--quay-50);
}

.mnav-btn.mnav-today {
  color: var(--ink-900);
  background: var(--signal-500);
  border-color: var(--signal-500);
}

.mnav-btn.mnav-today:hover:not(:disabled) {
  background: var(--signal-600);
  border-color: var(--signal-600);
}

#today-lbl {
  font-family: var(--font-num);
  font-size: 13px !important;
  font-weight: 600 !important;
  color: var(--quay-500) !important;
}

/* ── Narrow screens: actions collapse to icon-only; labels stay in
   aria-label/title so nothing is lost for assistive tech. ── */
@media (max-width: 1180px) {
  .brand-org {
    display: none;
  }

  .tbtn-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .tbtn {
    padding: 0 9px;
  }

  .tbtn.gold {
    padding: 0 12px;
  }

  .tbtn.gold .tbtn-label {
    position: static;
    width: auto;
    height: auto;
    clip: auto;
  }
}

@media (max-width: 700px) {
  .topbar {
    flex-wrap: wrap;
    gap: 8px 12px;
    padding: 8px 12px;
    padding-top: calc(8px + env(safe-area-inset-top, 0px));
  }

  .t-brand.brand-name {
    font-size: 18px;
    white-space: normal;
  }

  /* The month bar below already shows today's date on mobile. */
  .t-sub.topbar-date {
    display: none;
  }

  .t-right {
    order: 2;
    flex: 1 1 100%;
    justify-content: space-between;
    gap: 6px;
  }

  .tbtn.gold .tbtn-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .tbtn.gold {
    padding: 0 9px;
  }

  .conn-pill {
    display: none;
  }

  /* Keep the phone topbar to one row; offline is still surfaced by the
     autosave badge and the reconnect toast. */
  #conn-status.is-alert {
    display: none;
  }

  .mbar {
    padding: 8px 12px;
  }
}

/* ── Daily summary: one ledger band instead of nine boxes ──
   Closing balance is the figure everyone asks for, so it gets the tall cell;
   the other nine sit beside it as hairline-separated readings. */
#sum-cards.cards-row {
  display: grid;
  grid-template-columns: minmax(230px, 1.25fr) repeat(5, minmax(0, 1fr));
  gap: 0;
  margin-bottom: 16px;
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--elev-1);
  overflow: hidden;
}

#sum-cards.cards-row .card {
  padding: 12px 16px;
  background: transparent;
  border: 0;
  border-left: 1px solid var(--quay-200);
  border-bottom: 1px solid var(--quay-200);
  border-radius: 0;
  box-shadow: none;
  transform: none;
}

#sum-cards.cards-row .card:hover {
  transform: none;
  box-shadow: none;
  background: var(--quay-50);
}

#sum-cards.cards-row .card:not(.hl)::before {
  display: none;
}

#sum-cards.cards-row .card.hl {
  grid-column: 1;
  grid-row: 1 / span 2;
  order: -1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-left: 0;
  border-bottom: 0;
  border-top: 0;
  padding: 16px 20px;
  background: #bfe5dd;
  box-shadow: none;
}

/* Signature: the hazard stripe from port safety signage, marking the one
   figure the whole table resolves to. */
#sum-cards.cards-row .card.hl::before {
  content: "";
  display: block;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 10px;
  background: repeating-linear-gradient(
    -45deg,
    var(--signal-500) 0 8px,
    var(--ink-800) 8px 16px
  );
}

#sum-cards.cards-row .card.hl:hover {
  background: #bfe5dd;
}

#sum-cards.cards-row .card.hl .c-val {
  font-size: 54px;
  line-height: 1;
  color: var(--channel-700) !important;
}

#sum-cards.cards-row .card.hl .c-lbl {
  font-size: 14px;
  color: var(--channel-700);
}

#sum-cards.cards-row .card:last-child {
  grid-column: span 2;
}

.c-lbl {
  margin-bottom: 4px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0;
  text-transform: none;
  color: var(--quay-500);
}

.c-val {
  font-family: var(--font-num);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.c-sub {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--quay-500);
}

@media (max-width: 1100px) {
  #sum-cards.cards-row {
    grid-template-columns: minmax(200px, 1.1fr) repeat(3, minmax(0, 1fr));
  }

  #sum-cards.cards-row .card.hl {
    grid-row: 1 / span 3;
  }

  #sum-cards.cards-row .card:last-child {
    grid-column: auto;
  }
}

@media (max-width: 700px) {
  #sum-cards.cards-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #sum-cards.cards-row .card.hl {
    grid-column: 1 / -1;
    grid-row: auto;
    padding: 14px 16px;
  }

  #sum-cards.cards-row .card.hl .c-val {
    font-size: 46px;
  }

  #sum-cards.cards-row .card:nth-child(odd):not(.hl) {
    border-left: 0;
  }
}

/* ── Location groups ── */
.location-summary-header {
  margin: 0 0 8px;
  font-family: var(--font-num);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink-800);
}

.grp3 {
  gap: 12px;
  margin-bottom: 16px;
}

.gc {
  padding: 12px 14px 8px;
  background: #fff;
  border: 0;
  border-radius: var(--radius-md);
  box-shadow: var(--elev-1);
}

.gc-ttl {
  margin-bottom: 8px;
  padding-bottom: 6px;
  font-family: var(--font-num);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
  border-bottom-width: 3px;
}

.loc-blk {
  margin-bottom: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
}

.loc-name {
  margin-bottom: 6px;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.ls-lbl {
  font-size: 12px;
  color: var(--quay-500);
}

.ls-val {
  font-family: var(--font-num);
  font-size: 17px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.loc-blk > div:last-child {
  margin-top: 4px !important;
  font-size: 12px !important;
}

/* ── Legend & location filter ── */
.legend {
  gap: 16px;
  margin-bottom: 8px;
}

.leg {
  gap: 6px;
  font-size: 13px;
  color: var(--quay-700);
}

.lbox {
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

#lock-info {
  font-size: 13px !important;
  /* No !important on the colour: the #id already outranks .u15.u15. */
  color: var(--quay-500);
}

.loc-filter-row {
  gap: 8px;
  margin-bottom: 12px;
}

.loc-filter-lbl {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--quay-500);
}

.loc-chip {
  padding: 5px 12px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  border-width: 1px;
}

.loc-chip.off {
  opacity: 1;
  color: var(--quay-500) !important;
  background: var(--quay-100) !important;
  border-color: var(--quay-300) !important;
}

/* ── Daily table: the berth plan ── */
.tbl-wrap {
  margin-bottom: 24px;
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: var(--elev-1);
}

.tbl-wrap::before,
.tbl-wrap::after {
  display: none;
}

.tbl-scroll {
  border-radius: var(--radius-md);
}

/* The default 15px vertical scrollbar (square arrow buttons and all) covered
   the table's right corners while the left side showed the rounded header.
   Hide only the vertical bar so both sides are clipped by the same radius; the
   table still scrolls with wheel, trackpad, touch and keyboard. The horizontal
   bar stays, slim and rounded. */
.tbl-scroll::-webkit-scrollbar {
  width: 0;
  height: 10px;
}

.tbl-scroll::-webkit-scrollbar-track,
.tbl-scroll::-webkit-scrollbar-corner {
  background: transparent;
}

.tbl-scroll::-webkit-scrollbar-thumb {
  background: var(--quay-300);
  background-clip: padding-box;
  border: 2px solid transparent;
  border-radius: 6px;
}

.tbl-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--quay-500);
  background-clip: padding-box;
}

/* Firefox has no per-axis control, so it gets a thin bar on both axes. */
@supports not selector(::-webkit-scrollbar) {
  .tbl-scroll {
    scrollbar-width: thin;
    scrollbar-color: var(--quay-300) transparent;
  }
}

table.dt {
  border-radius: 0;
  font-family: var(--font-num);
}

table.dt th {
  padding: 7px 5px;
  font-family: var(--font-num);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.15;
  text-shadow: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.22);
}

table.dt th.hsub {
  padding: 5px 3px;
  font-size: 12px;
  font-weight: 500;
  opacity: 1;
}

/* Location header colours follow LOC_CFG in formula.js, the same palette the
   summary blocks use (the old header shades drifted: sheds were pink here
   but orange everywhere else). */
table.dt th.wha { background: #1e4d7b; }
table.dt th.whb { background: #1a5f9e; }
table.dt th.y1 { background: #1a5c3a; }
table.dt th.y7 { background: #1c6d42; }
table.dt th.s5 { background: #7c3c1a; }
table.dt th.s6 { background: #923f15; }
table.dt th.s7 { background: #99420f; }
table.dt th.s8 { background: #9d4006; }

table.dt th.hdate,
table.dt th.hday {
  background: var(--ink-800);
  color: #fff;
}

table.dt th.thd { background: #1d4ed8; }
table.dt th.tha { background: #6d28d9; }
table.dt th.thcb { background: var(--channel-700); }
table.dt th.thi { background: #b45309; }
table.dt th.thrn { background: var(--ink-700); }

table.dt td {
  padding: 3px 4px;
  font-family: var(--font-num);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  background: var(--entry-bg);
  border-bottom: 1px solid var(--quay-200);
  border-right: 0;
  box-shadow: none;
  transform: none;
}

table.dt tbody tr:nth-child(odd),
table.dt tbody tr:nth-child(even) {
  background: none;
}

/* Off-day, today and total rows keep their own colour on hover: the hover tint
   would otherwise fade the red/amber that marks them. */
table.dt tbody tr:not(.red):not(.tod):not(.foot):hover td {
  background: #e6eef2 !important;
  transform: none;
  box-shadow: none;
}

table.dt td.ddate {
  font-weight: 600;
  color: var(--ink-800);
  background: var(--entry-bg);
  border-right: 0;
}

table.dt td.dday {
  font-weight: 500;
  color: var(--quay-700);
  background: var(--entry-bg);
  border-right: 1px solid var(--quay-300);
}

table.dt td.dbal {
  font-weight: 600;
  color: var(--ink-900);
  background: var(--entry-bg);
}

table.dt td.ddel {
  font-weight: 600;
  color: #1d4ed8;
  background: var(--entry-bg);
  border-right: 0;
}

table.dt td.dimp {
  font-weight: 600;
  color: #9a4507;
  background: var(--entry-bg);
}

table.dt td.tdel,
table.dt td.tcb,
table.dt td.timp {
  font-weight: 600;
  border-right: 0;
  box-shadow: none;
}

table.dt td.tdel { background: var(--entry-bg); color: #173fa8; }
table.dt td.tcb { background: var(--entry-bg); color: var(--channel-700); }
table.dt td.timp { background: var(--entry-bg); color: #8a3f06; }

table.dt td.dauc {
  color: #6d28d9;
  font-size: 13px;
  font-style: normal;
  font-weight: 600;
}

table.dt td.trn {
  background: var(--entry-bg);
  box-shadow: none;
}

table.dt td.trn:hover {
  background: #e6eef2;
}

.rn-text {
  font-family: var(--font-num);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-700);
}

.rn-dash {
  color: var(--quay-300);
}

/* Row states. Off days are solid berth red with white figures; today is
   solid signal amber. Strong enough to read from across a desk, which is how
   the table is actually used. */
table.dt tr.red td {
  background: var(--berth-600) !important;
  color: #fff !important;
  text-shadow: none;
}

/* Every figure in an off-day row is white. The entry inputs carry their own
   black (!important in styles.css), so they need the same weight here; while
   one is hovered or focused it turns white-on-white, so it flips back to dark. */
table.dt tr.red td,
table.dt tr.red td *,
table.dt tr.red input.ci {
  color: #fff !important;
  caret-color: #fff;
}

table.dt tr.red input.ci::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

table.dt tr.red input.ci:hover,
table.dt tr.red input.ci:focus {
  color: var(--ink-900) !important;
  caret-color: var(--ink-900);
}

/* The rotation-number editor is its own white field (not a transparent entry
   input), so the blanket white above would hide what is being typed. It needs
   a heavier selector than `tr.red td *` to stay black on an off-day row. */
table.dt tr.red input.rot-edit {
  color: var(--ink-900) !important;
  caret-color: var(--ink-900);
}

table.dt tr.red input.rot-edit::placeholder {
  color: var(--quay-300);
}

/* Today's label — a word so the "current day" row is not signalled by the
   amber fill alone. Off days keep their red fill with no added word. */
.row-tag {
  display: block;
  margin-top: 2px;
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Today's word stays dark on the amber fill. */
table.dt tr.tod .row-tag {
  color: var(--ink-900);
}

table.dt tr.red td.ddate {
  font-weight: 700 !important;
  box-shadow: inset 6px 0 0 var(--berth-700);
}

table.dt tr.red td.dday {
  font-weight: 600 !important;
}

table.dt tr.red td.tdel,
table.dt tr.red td.tcb,
table.dt tr.red td.timp {
  background: var(--berth-700) !important;
}

table.dt tr.tod td {
  background: var(--signal-500) !important;
  color: var(--ink-900) !important;
  font-weight: 700 !important;
}

table.dt tr.tod td.ddate {
  box-shadow: inset 6px 0 0 var(--ink-800);
}

table.dt tr.tod td.tdel,
table.dt tr.tod td.tcb,
table.dt tr.tod td.timp {
  background: var(--signal-600) !important;
}

table.dt tr.foot td {
  background: var(--ink-800) !important;
  color: #fff !important;
  font-size: 14.5px !important;
  font-weight: 600 !important;
  border-top: 0 !important;
  text-shadow: none;
  box-shadow: none;
}

/* Entry cells */
input.ci {
  padding: 3px 2px;
  font-family: var(--font-num);
  font-size: 13.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: #fff;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  box-shadow: none;
  transform: none;
}

input.ci:hover {
  background: #fff;
  border-color: var(--quay-300);
  box-shadow: none;
  transform: none;
}

input.ci:focus {
  background: #fff;
  border-color: var(--ink-600);
  box-shadow: 0 0 0 2px rgba(37, 96, 127, 0.25);
  transform: none;
}

input.ci.auc {
  font-style: normal;
}

/* Diff-from-yesterday marker keeps the amber signal */
td.chg {
  box-shadow: inset 3px 0 0 var(--signal-500);
}

/* Legend swatches mirror the row states above */
.legend .leg:nth-child(1) .lbox {
  background: var(--berth-600);
  border: 1px solid var(--berth-700);
}

.legend .leg:nth-child(2) .lbox {
  background: var(--signal-500);
  border: 1px solid var(--signal-600);
}

.legend .leg:nth-child(3) .lbox {
  background: var(--entry-bg);
  border: 1px solid var(--quay-300);
}

/* Header cells: styles.css paints every .no-gap header with a dark gradient
   (!important) and adds a hover shimmer. Replace with flat location colour. */
table.dt thead th.hdate::before,
table.dt thead th.hday::before,
table.dt thead th.no-gap::before {
  display: none;
}

/* Frozen Date/Day headers must sit above the scrolling location headers:
   styles.css asks for z-index 30 but a more specific rule pins them at 20, so
   headers scrolled underneath painted over them. */
table.dt thead th.hdate,
table.dt thead th.hday {
  z-index: 30;
  background: var(--ink-800) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.22) !important;
  text-shadow: none;
}

table.dt thead th.no-gap {
  text-shadow: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.22) !important;
}

table.dt thead th.no-gap.wha { background: #1e4d7b !important; }
table.dt thead th.no-gap.whb { background: #1a5f9e !important; }
table.dt thead th.no-gap.y1 { background: #1a5c3a !important; }
table.dt thead th.no-gap.y7 { background: #1c6d42 !important; }
table.dt thead th.no-gap.s5 { background: #7c3c1a !important; }
table.dt thead th.no-gap.s6 { background: #923f15 !important; }
table.dt thead th.no-gap.s7 { background: #99420f !important; }
table.dt thead th.no-gap.s8 { background: #9d4006 !important; }

/* Location boundaries: one clear hairline instead of a heavy 2px bar */
table.dt th.col-sep {
  border-right: 1px solid rgba(255, 255, 255, 0.5) !important;
  box-shadow: none;
}

table.dt td.col-sep {
  border-right: 1px solid var(--quay-500) !important;
  box-shadow: none;
}

table.dt td.col-sep:hover {
  border-right: 1px solid var(--quay-500) !important;
  box-shadow: none;
}

/* Entry cells read as plain numbers until hovered or focused, so tinted
   rows (off days, today) are not patched with white boxes. */
input.ci {
  background: transparent;
}

input.ci:hover {
  background: #fff;
}

input.ci:focus {
  background: #fff;
}

/* ── Chart cards ── */
.ch-card,
.ch-full {
  padding: 16px 18px;
  border: 0;
  border-radius: var(--radius-md);
  box-shadow: var(--elev-1);
}

.ch-card:hover {
  transform: none;
  box-shadow: var(--elev-1);
}

.ch-ttl {
  margin-bottom: 12px;
  padding-bottom: 10px;
  font-family: var(--font-num);
  font-size: var(--fs-card);
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--ink-800);
  border-bottom: 1px solid var(--quay-200);
}

.ch-ttl .ic {
  color: var(--quay-500);
}

/* ── Empty states ──
   One shared placeholder (see emptyState() in app.js) for any panel with
   nothing to show, so a bare report section matches a bare chart instead of
   a loose grey paragraph. */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 28px 16px;
  text-align: center;
}

.empty-state-icon {
  color: var(--quay-300);
}

.empty-state-msg {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--quay-700);
}

.empty-state-hint {
  margin: 0;
  font-size: 12px;
  color: var(--quay-500);
}

/* ── Reports ── */
.rpt-filter-panel {
  padding: 14px 18px;
  margin-bottom: 16px;
  background: #fff;
  border: 0;
  border-radius: var(--radius-md);
  box-shadow: var(--elev-1);
}

.rpt-filter-header {
  margin-bottom: 12px;
  padding-bottom: 10px;
  font-family: var(--font-num);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink-800);
  border-bottom: 1px solid var(--quay-200);
}

.rpt-filter-badge {
  padding: 3px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: var(--ink-700);
  border-radius: 999px;
  box-shadow: none;
}

.rpt-filter-row {
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.rpt-filter-lbl {
  min-width: 96px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--quay-500);
}

.rpt-preset,
.rpt-radio-lbl {
  height: 32px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--quay-700);
  background: #fff;
  border: 1px solid var(--quay-300);
  border-radius: var(--radius-md);
}

.rpt-preset:hover,
.rpt-radio-lbl:hover {
  color: var(--ink-800);
  background: var(--quay-100);
  border-color: var(--ink-600);
}

.rpt-preset.active,
.rpt-radio-lbl:has(input:checked) {
  color: #fff;
  background: var(--ink-800);
  border-color: var(--ink-800);
  box-shadow: none;
}

.rpt-sec {
  margin-bottom: 12px;
  border: 0;
  border-radius: var(--radius-md);
  box-shadow: var(--elev-1);
}

.rpt-sec-hdr {
  padding: 12px 18px;
}

.rpt-sec-hdr:hover {
  background: var(--quay-50);
}

.rpt-sec-hdr:focus-visible {
  box-shadow: inset 0 0 0 2px var(--ink-600);
}

.rpt-sec-hdr-l {
  font-family: var(--font-num);
  font-size: var(--fs-card);
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink-800);
}

.rpt-sec-arrow {
  color: var(--quay-500);
}

.rpt-sec-body {
  padding: 0 18px 18px;
}

.rpt-kpi-grid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0;
  padding: 0;
  border-top: 1px solid var(--quay-200);
}

.rpt-kpi-card {
  padding: 14px 16px;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--quay-200);
  border-radius: 0;
  box-shadow: inset 3px 0 0 var(--kpi, var(--ink-600));
  transform: none;
}

.rpt-kpi-card:hover {
  background: var(--quay-50);
  box-shadow: inset 3px 0 0 var(--kpi, var(--ink-600));
  transform: none;
}

.rpt-kpi-icon {
  margin-bottom: 4px;
  font-size: 20px;
}

.rpt-kpi-val {
  font-family: var(--font-num);
  font-size: 28px;
  font-weight: 600;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.rpt-kpi-lbl {
  margin-top: 4px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--quay-700);
}

.rpt-kpi-sub {
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--quay-500);
}

.rt {
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}

.rt th {
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-800);
  background: var(--quay-100);
  border-bottom: 1px solid var(--quay-300);
}

.rt td {
  padding: 8px 12px;
  font-family: var(--font-num);
  font-weight: 500;
  border-bottom: 1px solid var(--quay-200);
}

.rt tr:hover td {
  background: var(--quay-50);
}

.rt tr.cur td {
  background: var(--signal-100) !important;
}

.rt tr.cur td:first-child {
  border-left: 3px solid var(--signal-500);
}

.pu,
.pd,
.pe {
  font-size: 12px;
}

.bu,
.bd,
.be {
  font-size: 12px;
}

.simple-table th {
  font-size: 13px;
}

.simple-table td {
  font-family: var(--font-num);
  font-size: 13.5px;
}

/* ── Settings ── */
.rpt-hdr {
  padding: 12px 18px;
  font-family: var(--font-num);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-align: left;
  text-transform: none;
  color: var(--ink-800);
  background: var(--quay-100);
  border-bottom: 1px solid var(--quay-200);
}

.set-card {
  border: 0;
  border-radius: var(--radius-md);
  box-shadow: var(--elev-1);
}

.htag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  margin: 3px;
  font-family: var(--font-num);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #fff;
  background: var(--berth-600);
  border: 0;
  border-radius: var(--radius-sm);
}

.htag-g {
  color: #fff;
  background: var(--channel-600);
}

/* The remove (x) is an inline-coloured span; force it legible on solid tags */
.htag > span {
  color: #fff !important;
  opacity: 0.85;
}

.htag > span:hover {
  opacity: 1;
}

/* ── Forms, buttons, dialogs ── */
.mf {
  height: 38px;
  padding: 0 12px;
  font-family: var(--font-ui);
  font-size: 14.5px;
  color: var(--ink-900);
  background: #fff;
  border: 1px solid var(--quay-300);
  border-radius: var(--radius-md);
}

select.mf {
  padding-right: 28px;
}

.mf:hover {
  border-color: var(--quay-500);
}

.mf:focus {
  outline: none;
  border-color: var(--ink-600);
  box-shadow: 0 0 0 3px rgba(37, 96, 127, 0.2);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-800);
  background: #fff;
  border: 1px solid var(--quay-300);
  border-radius: var(--radius-md);
}

.btn:hover {
  opacity: 1;
  background: var(--quay-100);
  border-color: var(--ink-600);
}

.btn.pri {
  color: #fff;
  background: var(--ink-800);
  border-color: var(--ink-800);
}

.btn.pri:hover {
  background: var(--ink-700);
  border-color: var(--ink-700);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ov,
.overlay {
  background: rgba(10, 31, 44, 0.55);
}

.mbox {
  padding: 22px 24px;
  width: 400px;
  border-radius: var(--radius-md);
  box-shadow: var(--elev-2);
}

.mbox h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-family: var(--font-num);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink-800);
}

.mbox p {
  font-size: 14px;
  color: var(--quay-700);
}

.merr {
  font-size: 13px;
  color: var(--berth-700);
}

.mbtns {
  gap: 8px;
  margin-top: 12px;
}

/* ── Car transfer ── */
.transfer-form-card,
.transfer-list-card {
  border: 0;
  border-radius: var(--radius-md);
  box-shadow: var(--elev-1);
}

.transfer-form-title,
.transfer-list-title {
  font-family: var(--font-num);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink-800);
  border-bottom: 1px solid var(--quay-200);
}

.transfer-submit-btn {
  height: 42px;
  padding: 0 16px;
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--ink-900);
  background: var(--signal-500);
  border-radius: var(--radius-md);
}

.transfer-submit-btn:hover {
  background: var(--signal-600);
  box-shadow: none;
}

/* ── Install banner ── */
.install-banner {
  color: var(--ink-900);
  background: var(--signal-100);
  border-bottom: 1px solid var(--signal-500);
}

.install-banner-btn {
  color: #fff;
  background: var(--ink-800);
  border-radius: var(--radius-md);
}

#page-settings select,
#page-report select {
  height: 36px;
  padding: 0 28px 0 10px;
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--ink-900);
  background-color: #fff;
  border: 1px solid var(--quay-300);
  border-radius: var(--radius-md);
}

#page-settings select:hover,
#page-report select:hover {
  border-color: var(--quay-500);
}

#page-settings input[type="checkbox"],
#page-settings input[type="radio"],
#ov-export input[type="radio"] {
  accent-color: var(--ink-700);
}

.transfer-field label {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--quay-700);
}

.transfer-field select,
.transfer-field input[type="date"],
.transfer-field input[type="number"],
.transfer-field input[type="text"] {
  height: 38px;
  padding: 0 12px;
  font-family: var(--font-ui);
  font-size: 14.5px;
  background: #fff;
  border: 1px solid var(--quay-300);
}

.transfer-field select:focus,
.transfer-field input:focus {
  border-color: var(--ink-600);
  box-shadow: 0 0 0 3px rgba(37, 96, 127, 0.2);
}

.transfer-date-label {
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--quay-700);
  background: var(--quay-100);
}

/* ── Mobile day cards (Daily tab below the table breakpoint) ── */
.day-card {
  border: 0;
  border-radius: var(--radius-md);
  box-shadow: var(--elev-1);
}

.day-card.red {
  background: var(--berth-100);
  box-shadow: var(--elev-1), inset 4px 0 0 var(--berth-600);
}

.day-card.tod {
  background: var(--signal-100);
  box-shadow: var(--elev-1), inset 4px 0 0 var(--signal-500);
}

.day-card-date {
  font-family: var(--font-num);
  font-size: 16px;
  font-weight: 600;
  color: var(--ink-800);
}

.day-card-dow {
  font-size: 13px;
  font-weight: 500;
}

.day-card-bal {
  font-family: var(--font-num);
  font-size: 18px;
  font-weight: 600;
  color: var(--channel-700);
}

/* ── Contrast fixes (measured against WCAG AA: 4.5:1 text, 3:1 large) ── */
.rn-dash {
  color: var(--quay-500);
}

table.dt td.timp {
  color: #96420a;
}

.simple-table .efficiency.excellent,
.metric-value.excellent {
  color: #15803d;
}

.simple-table .efficiency.poor,
.metric-value.poor {
  color: #b91c1c;
}

.simple-table .balance,
.rt td.balance {
  color: #047857;
}

.auc-kpi-tag,
.auc-loc-share-pill,
.auc-day-tag.is-weekend {
  color: #c2410c;
}

.rt td {
  color: var(--quay-700);
}

/* Mid widths: styles.css makes the topbar a non-wrapping scroller below 900px;
   let it wrap instead so no action is ever clipped, and drop the date (the
   month bar shows it) once space is tight. */
@media (max-width: 1000px) {
  .t-sub.topbar-date {
    display: none;
  }

  .t-right {
    margin-left: auto;
  }
}

@media (max-width: 900px) {
  .topbar {
    flex-wrap: wrap;
    overflow: visible;
  }

  .brand {
    flex: 1 1 auto;
  }
}

/* ── Dashboard ── */
.page-title {
  margin: 0 0 12px;
  font-family: var(--font-num);
  font-size: var(--fs-page);
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--ink-800);
}

.dash-glance {
  margin-bottom: 24px;
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--elev-1);
  overflow: hidden;
}

.glance-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--quay-200);
}

.glance-head h3 {
  margin: 0;
  font-family: var(--font-num);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink-800);
}

.glance-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.glance-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
}

@media (max-width: 1000px) {
  .glance-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Hairlines on the right and bottom edge of every cell; the grid's own
   overflow clips the outermost ones, so a partly filled last row stays clean. */
.glance-item {
  padding: 12px 18px;
  background: #fff;
  box-shadow: inset -1px 0 0 var(--quay-200), inset 0 -1px 0 var(--quay-200);
}

.glance-lbl {
  font-size: 13px;
  font-weight: 600;
  color: var(--quay-500);
}

.glance-val {
  margin-top: 2px;
  font-family: var(--font-num);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.15;
  color: var(--ink-900);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.glance-sub {
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--quay-500);
}

/* ── Mobile bottom nav: five tabs on one row ──
   Five is the ceiling for a bottom bar, so every destination stays a single
   tap; labels are abbreviated on the narrowest phones only (see the
   max-width:700px block below). */
.bnav {
  border-top: 1px solid var(--quay-300);
  box-shadow: 0 -2px 10px rgba(14, 42, 59, 0.08);
}

.bnav-tab {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  color: var(--quay-500);
  border-radius: var(--radius-md);
}

.bnav-tab.on {
  color: var(--ink-800);
  background: var(--signal-100);
  box-shadow: inset 0 3px 0 var(--signal-500);
}

/* ── Dashboard: section chips ── */
#page-dashboard {
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}

.dash-nav {
  position: sticky;
  top: calc(var(--topbar-h) + var(--nav-h) + var(--mbar-h, 52px));
  z-index: 290;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 -2px 16px;
  padding: 8px 2px;
  background: var(--quay-100);
  border-bottom: 1px solid var(--quay-300);
}

.dash-tabs {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.dash-tabs::-webkit-scrollbar {
  display: none;
}

.dash-chip {
  flex: none;
  height: 32px;
  padding: 0 14px;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  color: var(--quay-700);
  background: #fff;
  border: 1px solid var(--quay-300);
  border-radius: 999px;
  cursor: pointer;
}

.dash-chip:hover {
  border-color: var(--ink-600);
  background: var(--quay-50);
}

.dash-chip.on {
  color: #fff;
  background: var(--ink-800);
  border-color: var(--ink-800);
}

.dash-sec {
  margin-bottom: 28px;
}

.dash-ledger {
  margin-bottom: 20px;
}

.dash-sec[hidden] {
  display: none;
}

.dash-h-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 10px;
}

.dash-h {
  margin: 0 0 10px;
  font-family: var(--font-num);
  font-size: var(--fs-page);
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--ink-800);
}

.dash-h-row .dash-h {
  margin: 0;
}

.dash-h-note {
  font-size: 13px;
  color: var(--quay-500);
}

.dash-sub {
  margin: 18px 0 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--quay-700);
}

.dash-loc-grid {
  display: grid;
  grid-template-columns: 1.1fr 1.3fr 1fr;
  gap: 12px;
  margin: 12px 0;
}

@media (max-width: 1000px) {
  .dash-loc-grid {
    grid-template-columns: 1fr;
  }
}

/* ── KPI sparklines ── */
.c-spark {
  margin-top: 8px;
  line-height: 0;
}

.spark {
  display: block;
  max-width: 100%;
}

#sum-cards.cards-row .card.hl .c-spark {
  margin-top: 12px;
}

/* ── Segmented control ── */
.seg {
  display: inline-flex;
  border: 1px solid var(--quay-300);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #fff;
}

.seg-btn {
  height: 32px;
  padding: 0 14px;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  color: var(--quay-700);
  background: #fff;
  border: 0;
  border-left: 1px solid var(--quay-300);
  cursor: pointer;
}

.seg-btn:first-child {
  border-left: 0;
}

.seg-btn:hover {
  background: var(--quay-100);
}

.seg-btn.on {
  color: #fff;
  background: var(--ink-800);
}

/* ── Daily calendar heatmap ── */
.dash-cal {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  padding: 12px;
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--elev-1);
}

.cal-dow {
  padding-bottom: 4px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  color: var(--quay-500);
}

.cal-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 66px;
  padding: 6px 8px;
  color: #000;
  border-radius: var(--radius-sm);
}

.cal-blank {
  background: none;
}

.cal-d {
  font-size: 13px;
  font-weight: 600;
  opacity: 0.85;
}

.cal-v {
  font-family: var(--font-num);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.1;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.cal-dark {
  color: #fff;
}

.cal-off {
  box-shadow: inset 0 4px 0 var(--berth-600);
}

.cal-today {
  outline: 3px solid var(--signal-500);
  outline-offset: -2px;
  z-index: 1;
}

.cal-empty {
  color: var(--quay-500);
  background: repeating-linear-gradient(45deg, var(--quay-100) 0 6px, #fff 6px 12px);
}

.cal-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--quay-700);
}

.cal-scale {
  width: 96px;
  height: 12px;
  border-radius: 2px;
}

.cal-key {
  width: 14px;
  height: 14px;
  margin-left: 8px;
  border-radius: 2px;
}

.cal-key-off {
  background: var(--quay-100);
  box-shadow: inset 0 4px 0 var(--berth-600);
}

.cal-key-today {
  background: #fff;
  outline: 3px solid var(--signal-500);
  outline-offset: -2px;
}

.cal-key-empty {
  background: repeating-linear-gradient(45deg, var(--quay-100) 0 4px, #fff 4px 8px);
  border: 1px solid var(--quay-300);
}

@media (max-width: 700px) {
  .dash-h {
    font-size: 21px;
  }

  .dash-cal {
    gap: 3px;
    padding: 8px;
  }

  .cal-cell {
    min-height: 50px;
    padding: 4px 5px;
  }

  .cal-v {
    font-size: 14px;
  }

  .cal-d {
    font-size: 11.5px;
  }
}

/* ── Dashboard: focus select, range, day panel ── */
.dash-focus {
  display: inline-flex;
  align-items: center;
  flex: none;
  gap: 8px;
  margin-left: auto;
  padding-left: 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--quay-700);
}

.dash-focus select {
  height: 32px;
  padding: 0 28px 0 10px;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-900);
  background-color: #fff;
  border: 1px solid var(--quay-300);
  border-radius: var(--radius-md);
}

.dash-focus select:hover {
  border-color: var(--ink-600);
}

.scope-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 10px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  color: #fff;
  vertical-align: middle;
  background: var(--ink-700);
  border-radius: 999px;
}

.dash-h-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.loc-blk {
  transition: opacity 0.14s ease;
}

.loc-blk.dim {
  opacity: 0.3;
}

.cal-cell[role="gridcell"][tabindex] {
  cursor: pointer;
}

.cal-cell[role="gridcell"][tabindex]:hover {
  filter: brightness(0.94);
}

.cal-cell:focus-visible {
  outline: 3px solid var(--ink-600);
  outline-offset: 1px;
  z-index: 2;
}

.cal-sel {
  outline: 3px solid var(--ink-800);
  outline-offset: -1px;
  z-index: 1;
}

.cal-hint {
  margin-left: auto;
  color: var(--quay-500);
}

.dash-day {
  margin-top: 12px;
  padding: 14px 18px;
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--elev-2);
}

.dash-day[hidden] {
  display: none;
}

.day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 10px;
}

.day-head h3 {
  margin: 0;
  font-family: var(--font-num);
  font-size: 20px;
  font-weight: 600;
  color: var(--ink-800);
}

.day-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 10px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  vertical-align: middle;
  border-radius: 999px;
}

.day-tag.off {
  color: #fff;
  background: var(--berth-600);
}

.day-tag.today {
  color: var(--ink-900);
  background: var(--signal-500);
}

.day-actions {
  display: flex;
  gap: 8px;
}

.day-table-wrap {
  overflow-x: auto;
}

.day-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.day-table th,
.day-table td {
  padding: 7px 12px;
  text-align: right;
  border-bottom: 1px solid var(--quay-200);
}

.day-table thead th {
  font-size: 13px;
  font-weight: 600;
  color: var(--quay-500);
  white-space: nowrap;
}

.day-table th:first-child,
.day-table td:first-child {
  text-align: left;
}

.day-table tbody th {
  font-weight: 600;
  color: var(--ink-800);
  white-space: nowrap;
}

.day-table .dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 8px;
  border-radius: 50%;
}

.day-table tr.focus {
  background: var(--signal-100);
}

.day-table tfoot th,
.day-table tfoot td {
  font-weight: 600;
  background: var(--quay-100);
  border-bottom: 0;
}

.day-extra {
  margin: 10px 0 0;
  font-size: 14.5px;
  color: var(--quay-700);
}

tr.flash td,
.day-card.flash {
  animation: flash-row 1.8s ease-out;
}

@keyframes flash-row {
  0%, 35% { outline: 3px solid var(--ink-600); outline-offset: -3px; filter: brightness(1.15); }
  100% { outline: 3px solid transparent; filter: none; }
}

@media (max-width: 700px) {
  .dash-focus span {
    display: none;
  }

  .dash-focus {
    padding-left: 8px;
  }

  .cal-hint {
    margin-left: 0;
    width: 100%;
  }

  .day-table th,
  .day-table td {
    padding: 6px 8px;
    font-size: 14px;
  }
}

/* Day panel table: styles.css gives every <th> white text, so set colours
   explicitly, and let headers wrap so five columns fit a phone. */
.day-table th {
  font-size: 13px;
  background: transparent;
  border-bottom: 1px solid var(--quay-200);
}

.day-table thead th {
  color: var(--quay-500);
  white-space: normal;
  vertical-align: bottom;
}

.day-table tbody th,
.day-table tfoot th {
  color: var(--ink-800);
  font-size: 15px;
}

.day-table tfoot th {
  background: var(--quay-100);
}

@media (max-width: 700px) {
  .day-table th,
  .day-table td {
    padding: 6px 4px;
    font-size: 13.5px;
  }

  .day-table thead th {
    font-size: 12px;
    line-height: 1.2;
  }

  .day-table tbody th,
  .day-table tfoot th {
    font-size: 13.5px;
  }

  .day-table .dot {
    margin-right: 5px;
  }

  .dash-day {
    padding: 12px;
  }
}

/* Phones: four tabs on one row, the location menu on its own row below, and
   the bar scrolls away with the page (the sections are short now). */
@media (max-width: 700px) {
  .dash-nav {
    position: static;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 0 8px;
    margin: 0 0 12px;
  }

  .dash-tabs {
    flex: 1 1 100%;
    gap: 6px;
  }

  .dash-chip {
    flex: 1 1 0;
    padding: 0 8px;
  }

  .dash-focus {
    flex: 1 1 100%;
    margin-left: 0;
    padding-left: 0;
  }

  .dash-focus span {
    display: inline;
  }

  .dash-focus select {
    flex: 1;
    min-width: 0;
  }
}

/* Grid items default to min-width:auto, so a chart canvas (or a nowrap table)
   inside one props the card wider than its column. On phones the Locations
   cards ended up 387px wide in a 355px grid and were clipped. */
.ch-card,
.dash-loc-grid > * {
  min-width: 0;
}

#loc-summary-table {
  overflow-x: auto;
}

/* Car Transfer: the remove button was 32x24, too small to hit reliably */
.transfer-item-del {
  min-width: 36px;
  min-height: 36px;
}

/* ── Contrast and accessibility fixes found in the full audit ── */
.ls-lbl {
  color: var(--quay-700);
}

.pd {
  color: #9f1818;
}

/* Today's row is amber: its placeholder dash must be dark, not the grey used elsewhere */
table.dt tr.tod .rn-dash {
  color: var(--ink-900);
}

/* Report header dates sat at 4.2:1 */
#report-period-display,
#report-generated {
  color: var(--quay-700);
}

/* ── Report masthead ──
   A document header: who the report is from, what it covers, when it was
   produced. Replaces the plain "Analytics Report" heading that used the old
   #1a3a5c navy. */
.rpt-masthead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding-bottom: 12px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--ink-800);
}

.rpt-masthead-org {
  display: block;
  font-family: var(--font-ui);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--quay-500);
}

.rpt-masthead-title {
  margin: 3px 0 0;
  font-family: var(--font-ui);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--ink-900);
}

.rpt-masthead-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.rpt-masthead-meta #report-period-display {
  font-family: var(--font-num);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-800);
}

.rpt-masthead-meta #report-generated {
  font-family: var(--font-num);
  font-size: 12px;
  color: var(--quay-500);
}

/* Auction report: #cbd5e1 on white was 1.5:1, effectively invisible */
.auc-kpi-sub {
  color: var(--quay-500);
}

.auc-day-tag,
.auc-loc-chip {
  color: var(--quay-700);
}

.auc-day-tag.is-weekend {
  color: #9a3412;
}

/* Cloud status text (green on pale green) */
#gs-status,
#gs-status span {
  color: #047857 !important;
}

/* ── Print ──
   Backgrounds are not printed by default, so white-on-red text would vanish on
   paper. Printed rows use light tints with dark text instead, and the
   screen-only controls are dropped. The Dashboard prints the section that is
   open on screen (hidden sections have no charts drawn). */
@media print {
  .dash-nav,
  .seg,
  .glance-links,
  .day-actions,
  .cal-hint,
  .dash-focus,
  .skip-link {
    display: none !important;
  }

  table.dt td,
  table.dt th {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  table.dt tr.red td,
  table.dt tr.red td *,
  table.dt tr.red input.ci,
  table.dt tr.tod td,
  table.dt tr.tod td *,
  table.dt tr.foot td {
    color: #000 !important;
  }

  table.dt tr.red td {
    background: #f6cfcb !important;
  }

  table.dt tr.tod td {
    background: #fde9b0 !important;
  }

  table.dt tr.foot td {
    background: #e5e7eb !important;
  }

  table.dt td {
    background: #fff;
  }

  input.ci {
    border: 0 !important;
    background: transparent !important;
  }

  .cards-row,
  .dash-glance,
  .dash-cal,
  .gc,
  .ch-card {
    box-shadow: none !important;
    border: 1px solid #ccc;
  }
}

/* Rotation-number cells are keyboard-focusable now; the cell clips overflow, so
   draw the ring inside it. */
table.dt td.trn:focus-visible {
  outline: 2px solid var(--ink-600);
  outline-offset: -2px;
  box-shadow: none;
}

/* No dark variant, on purpose: the off-white canvas (--quay-100) and the
   light surfaces are the designed look, so an OS dark setting is ignored
   rather than half-applied (a dark canvas behind white cards read badly). */
