/* ---------------------------------------------------------------------------
   WCN Dock Portal — theme layer

   Web Awesome Pro 3.6.0 (vendored at /webawesome), Shoelace theme + palette.
   The <html> element carries:
     class="wa-theme-shoelace wa-palette-shoelace wa-brand-green"

   Brand note: the prototype's navy/orange scheme was invented, not WCN's.
   Since 2026-09-23 this matches the wcnfoods.com rebuild (the website repo's
   DESIGN.md is the source): logo green #38aa30 for marks and rules, deep
   green #1f6b2a for anything that carries text (filled buttons, links), ink
   #17231a, Figtree throughout. The green ramp is re-keyed on those values so
   brand-tinted components inherit them. Leave component internals to the
   theme.
   --------------------------------------------------------------------------- */

@import url('/webawesome/styles/themes/shoelace.css');
@import url('/webawesome/styles/native.css');
@import url('/webawesome/styles/utilities.css');

/* ---------------------------------------------------- WCN brand ramp */

@layer wa-color-palette {
  :root {
    --wa-color-green-95: #f1f7ee;
    --wa-color-green-90: #e4efdf;
    --wa-color-green-80: #bfdcb4;
    --wa-color-green-70: #74c16b;
    --wa-color-green-60: #38aa30; /* WCN logo green — key */
    --wa-color-green-50: #2c8a26;
    --wa-color-green-40: #1f6b2a; /* website deep green */
    --wa-color-green-30: #164f1f;
    --wa-color-green-20: #0f3a15;
    --wa-color-green-10: #08210b;
    --wa-color-green-05: #041306;
    --wa-color-green: var(--wa-color-green-60);
    --wa-color-green-key: 60;
  }
}

:root {
  /* Charcoal matches the logo's own field, so the mark sits on the bar
     without a visible plate behind it. */
  --wcn-ink: #17231a;
  --wcn-ink-2: #3e4c40;
  --wcn-ink-3: #5b695c;
  --wcn-tint: #f1f7ee;
  --wcn-line: #d7e2d2;
  --wcn-paper: #ffffff;

  --wa-color-surface-default: #ffffff;
  --wa-color-surface-lowered: var(--wcn-tint);

  /* White on the ramp's 50 step (the theme's default loud fill) is ~4:1.
     Pin loud fills and brand text to the deep green so both clear 4.5:1. */
  --wa-color-brand-fill-loud: var(--wa-color-green-40);
  --wa-color-brand-on-quiet: var(--wa-color-green-40);
  --wa-color-brand-on-normal: var(--wa-color-green-30);

  /* Figtree, self-hosted (the CSP's font-src only allows our own files and
     Google's). DM Mono stays for data fields, timestamps, and reference
     numbers, where character alignment helps. */
  /* Focus ring in the deep green: the logo green is ~2.9:1 on white, under
     the 3:1 WCAG asks of focus indicators. */
  --wa-color-focus: var(--wa-color-green-40);

  --wa-font-family-body: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --wa-font-family-heading: 'Figtree', system-ui, -apple-system, sans-serif;
  --wa-font-family-code: 'DM Mono', ui-monospace, monospace;
  --wa-font-weight-heading: 700;
}

@font-face {
  font-family: 'Figtree';
  src: url('/assets/fonts/figtree-latin.woff2') format('woff2');
  font-weight: 300 900;
  font-display: swap;
}

::selection { background: var(--wa-color-green-60); color: var(--wcn-ink); }

body {
  margin: 0;
  color: var(--wcn-ink);
  background: var(--wcn-paper);
  min-height: 100vh;
}

/* Skip link: first stop for keyboard users, shown when focused. */
.skip-link {
  position: absolute; left: var(--wa-space-m); top: -4rem; z-index: 100;
  padding: var(--wa-space-xs) var(--wa-space-m);
  background: var(--wcn-ink); color: #fff; border-radius: var(--wa-border-radius-m);
  font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: var(--wa-space-m); outline: 3px solid var(--wa-color-green-40); outline-offset: 2px; }
main:focus { outline: none; }

/* Fields marked required: say so in words, not just an asterisk. */
.required-note { margin: 0 0 var(--wa-space-m); font-size: 0.875rem; color: var(--wcn-ink-3); }

/* Web Awesome's native layer gives form controls a display value that beats
   the [hidden] attribute, which otherwise leaks the raw file inputs. */
[hidden] { display: none !important; }

/* ---------------------------------------------------- app chrome */

.app-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--wa-space-m);
  padding: 0 var(--wa-space-l);
  min-height: 72px;
  background: #fff;
  border-bottom: 1px solid var(--wcn-line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-bar__brand { display: flex; align-items: center; gap: var(--wa-space-m); }
.app-bar__divider {
  width: 1px; height: 30px; background: var(--wcn-line);
}
.app-bar__logo { height: 40px; width: auto; display: block; }
.app-bar__name {
  font-family: var(--wa-font-family-heading);
  font-weight: 800;
  font-size: 1.0625rem;
  letter-spacing: -0.02em;
  color: var(--wcn-ink);
  line-height: 1.1;
}
.app-bar__sub {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--wcn-ink);
}
.app-bar__actions { display: flex; align-items: center; gap: var(--wa-space-s); }
.app-bar__user {
  font-size: 0.875rem;
  color: var(--wcn-ink-3);
}

.hero {
  background: var(--wcn-tint);
  color: var(--wcn-ink);
  border-bottom: 1px solid var(--wcn-line);
  padding: var(--wa-space-2xl) 0;
}
.hero > * { max-width: 900px; margin-inline: auto; padding-inline: var(--wa-space-l); box-sizing: border-box; }
.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.08;
  margin-top: 0;
  margin-bottom: var(--wa-space-s);
  text-wrap: balance;
}
.hero h1 em { font-style: normal; }
.hero p {
  font-size: 1.125rem;
  line-height: 1.55;
  color: var(--wcn-ink-2);
  margin-top: 0;
  margin-bottom: 0;
}

.page { max-width: 900px; margin: 0 auto; padding: var(--wa-space-xl) var(--wa-space-l) var(--wa-space-2xl); }
.page--wide { max-width: 1200px; }

/* Section heading with the prototype's rule-to-the-right treatment. */
.section-label {
  display: flex;
  align-items: center;
  gap: var(--wa-space-s);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--wa-color-brand-40);
  margin: 0 0 var(--wa-space-m);
}
.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--wa-color-neutral-fill-normal);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: var(--wa-space-m);
}
.field-grid--thirds {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
}
.span-all { grid-column: 1 / -1; }

/* Monospace is reserved for values where character alignment genuinely helps:
   confirmation numbers, lot/BOL numbers, and the access link. Everything else
   — labels, headings, prose, times — uses Figtree. */
.mono {
  font-family: var(--wa-font-family-code);
  font-variant-ligatures: none;
}

/* ---------------------------------------------------- slot picker */

.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: var(--wa-space-xs);
}

.slot {
  /* The native layer makes <button> a flex container, so a block child still
     lays out in a row — stack explicitly rather than relying on display. */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.9375rem;
  font-weight: 600;
  padding: var(--wa-space-s);
  border: 2px solid var(--wa-color-neutral-fill-normal);
  border-radius: var(--wa-border-radius-m);
  background: var(--wa-color-surface-default);
  /* Explicit: a bare <button> inherits the theme's on-loud (white) text
     colour here, which renders invisible on the white surface. */
  color: var(--wa-color-neutral-on-normal, #1f2128);
  cursor: pointer;
  text-align: center;
  line-height: 1.3;
  transition: border-color 0.12s, background 0.12s;
}
.slot:hover:not(:disabled) { border-color: var(--wa-color-brand-60); }
.slot[aria-pressed='true'] {
  border-color: var(--wa-color-brand-60);
  background: var(--wa-color-brand-95);
}
/* Unavailable windows: clearly greyed and inert. The `disabled` attribute is
   what actually prevents selection — this only makes that legible. */
.slot:disabled {
  background: var(--wa-color-neutral-fill-quiet, #eceded);
  border-color: transparent;
  color: var(--wa-color-neutral-on-quiet);
  cursor: not-allowed;
  opacity: 1;
}
.slot:disabled small { color: var(--wa-color-neutral-on-quiet); opacity: 0.8; }
.slot:disabled:hover { border-color: transparent; }
.slot small {
  display: block;
  margin-top: 2px;
  font-size: 0.6875rem;
  font-weight: 400;
  color: var(--wa-color-neutral-on-quiet);
}
.slot:focus-visible {
  outline: var(--wa-focus-ring);
  outline-offset: 2px;
}

/* ---------------------------------------------------- dashboard */

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--wa-space-m);
  margin-bottom: var(--wa-space-l);
}
.stat {
  background: var(--wa-color-surface-default);
  border: 1px solid var(--wa-color-neutral-fill-quiet);
  border-left: 3px solid var(--wa-color-neutral-fill-loud);
  border-radius: var(--wa-border-radius-m);
  padding: var(--wa-space-m);
}
.stat--total     { border-left-color: var(--wa-color-brand-60); }
.stat--pending   { border-left-color: var(--wa-color-warning-fill-loud); }
.stat--confirmed { border-left-color: var(--wa-color-blue-60); }
.stat--completed { border-left-color: var(--wa-color-success-fill-loud); }

.stat__label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--wa-color-neutral-on-quiet);
}
.stat__value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--wcn-ink);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--wa-space-s);
  align-items: end;
  margin-bottom: var(--wa-space-m);
}
.toolbar > .grow { flex: 1 1 220px; }

.appt-list { display: flex; flex-direction: column; gap: var(--wa-space-s); }

.appt-head {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: var(--wa-space-m);
  align-items: center;
  width: 100%;
  text-align: left;
}
.appt-head__conf {
  font-family: var(--wa-font-family-code);
  font-size: 0.75rem;
  color: var(--wa-color-neutral-on-quiet);
}
.appt-head__company { font-weight: 600; }
.appt-head__when {
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  color: var(--wa-color-neutral-on-quiet);
  white-space: nowrap;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: var(--wa-space-m);
  margin-bottom: var(--wa-space-m);
}
/* Full-record dialog. The default dialog width squeezes the detail grid into
   a cramped last row, and the stacked sections need air between them. */
#detail-dialog {
  --width: min(920px, calc(100vw - 2rem));
}
#detail-body .section-label {
  margin-top: var(--wa-space-xl);
}
#detail-body .section-label:first-child {
  margin-top: 0;
}
#detail-body .table-scroll {
  margin-bottom: var(--wa-space-s);
}

.detail dt {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--wa-color-neutral-on-quiet);
  margin-bottom: 2px;
}
.detail dd { margin: 0; font-size: 0.9375rem; }

.empty {
  text-align: center;
  padding: var(--wa-space-2xl) var(--wa-space-l);
  color: var(--wa-color-neutral-on-quiet);
  font-size: 0.9375rem;
}

/* Tables scroll rather than pushing the page sideways. */
.table-scroll { overflow-x: auto; }
.table-scroll table { width: 100%; border-collapse: collapse; min-width: 520px; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--wa-space-l);
  background: var(--wcn-ink);
}
.login-card { width: 100%; max-width: 380px; }

/* Escape hatch to password sign-in. Deliberately unobtrusive — staff use the
   Google button; this is for administering the box when SSO is unavailable.
   The π in the corner is a nod to The Net (1995), where clicking the little pi
   symbol in the bottom-right opened the Praetorian backdoor. This one is
   considerably less consequential: it reveals a password field. */
.pi-toggle {
  position: fixed;
  right: 10px;
  bottom: 6px;
  padding: 4px 8px;
  border: 0;
  background: none;
  font-family: var(--wa-font-family-code);
  font-size: 13px;
  line-height: 1;
  color: rgba(255, 255, 255, 0.16);
  cursor: pointer;
  transition: color 0.15s;
}
.pi-toggle:hover { color: rgba(255, 255, 255, 0.55); }
.pi-toggle:focus-visible {
  outline: var(--wa-focus-ring);
  outline-offset: 2px;
  color: rgba(255, 255, 255, 0.55);
}

/* Print: a dock sheet should be legible on paper. */
@media print {
  .app-bar, .toolbar, .site-footer, .status-bar, wa-button { display: none !important; }
  body { background: #fff; }
  .page { max-width: none; padding: 0; }
}

/* ---------------------------------------------------- staff status bar */

/* One quiet line under the dashboard. Every state carries a word as well as a
   dot, so colour is never the only cue. */
/* Sits at the bottom of the window even when the page is short. */
body:has(> .status-bar) { display: flex; flex-direction: column; }
body:has(> .status-bar) > main { flex: 1 0 auto; width: 100%; box-sizing: border-box; }
.status-bar {
  border-top: 1px solid var(--wcn-line);
  background: var(--wcn-tint);
  color: var(--wcn-ink-3);
  font-size: 0.875rem;
}
.status-bar__inner {
  max-width: 1200px; margin: 0 auto;
  padding: var(--wa-space-s) var(--wa-space-l);
  display: flex; flex-wrap: wrap; align-items: baseline;
  gap: var(--wa-space-xs) var(--wa-space-l);
}
.status-bar__label { font-weight: 700; color: var(--wcn-ink-2); }
.status-bar__items { display: contents; }
.status-bar__time { margin-left: auto; }
.status-item { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--wa-space-2xs); }
.status-item strong { color: var(--wcn-ink); font-weight: 600; }
.status-item__dot {
  width: 0.625rem; height: 0.625rem; border-radius: 50%;
  align-self: center; background: var(--wa-color-green-60);
}
.status-item--warn .status-item__dot { background: var(--wa-color-warning-fill-loud); }
.status-item--down .status-item__dot { background: var(--wa-color-danger-fill-loud); }
.status-item__detail { flex-basis: 100%; }
.status-item--warn .status-item__detail { color: var(--wa-color-warning-on-quiet); }
.status-item--down .status-item__detail { color: var(--wa-color-danger-on-quiet); font-weight: 600; }

/* ---------------------------------------------------- bot check */

.turnstile { margin-top: var(--wa-space-m); }
.turnstile:empty { margin-top: 0; }
.link-button {
  padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; font-weight: 600; color: inherit;
  text-decoration: underline; text-underline-offset: 0.2em;
}

/* ---------------------------------------------------- footer (matches wcnfoods.com) */

.site-footer {
  background: var(--wcn-ink);
  color: #c9d4c6;
  font-size: 0.9375rem;
  line-height: 1.6;
}
.site-footer__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--wa-space-2xl) var(--wa-space-l);
  display: flex;
  flex-wrap: wrap;
  gap: var(--wa-space-xl) var(--wa-space-3xl);
  align-items: flex-start;
}
.site-footer__brand { flex: 1 1 260px; }
.site-footer__brand img { width: 56px; height: auto; display: block; }
.site-footer__brand p { margin: var(--wa-space-s) 0 0; color: #e6ede4; font-weight: 600; max-width: 22rem; }
.site-footer address { font-style: normal; }
.site-footer a { color: #e6ede4; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.site-footer a:focus-visible { outline: 3px solid #fff; outline-offset: 3px; border-radius: 2px; }
.site-footer h2 { font-size: 0.9375rem; font-weight: 700; color: #fff; margin: 0 0 var(--wa-space-xs); }
.site-footer__bottom {
  max-width: 1200px; margin: 0 auto;
  padding: var(--wa-space-m) var(--wa-space-l) var(--wa-space-l);
  border-top: 1px solid #2f3d32; color: #a9b8a6; font-size: 0.875rem;
}
