/* OVG Culinary Deadlines — design system (navy/gold "light-glass").
 * Plain CSS, no build step. CSP-safe: every style lives here (the server sends
 * style-src 'self'); zero inline styles anywhere in the HTML. WCAG AA verified —
 * see the contrast table in docs/recursion-logs/phase-1.md / the P1 build report.
 * State colors always ride alongside a text label; gold is accent/CTA-bg only,
 * never text. */

/* Inter, SELF-HOSTED. The design system names Inter as the brand sans, but the
 * token alone did nothing — nothing ever loaded the font, so every browser fell
 * through to Segoe UI / Roboto and the app rendered in whatever the OS had.
 * That single omission is most of why this looked generic rather than designed.
 *
 * Self-hosted rather than Google Fonts because app.ts sends a strict CSP
 * (`default-src 'self'` with no font-src escape hatch), so a fonts.googleapis
 * link is blocked outright — and self-hosting is the better call anyway: no
 * third-party request on every page load, and it works if Google is blocked on
 * the stadium network. Latin subset, four weights, ~100 KB total.
 * Source: @fontsource/inter (SIL Open Font License 1.1). */
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/inter-400.woff2") format("woff2");
}
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/fonts/inter-500.woff2") format("woff2");
}
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/inter-600.woff2") format("woff2");
}
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/inter-700.woff2") format("woff2");
}

:root {
  --navy: #1c355e;
  --navy-dark: #0a1830;
  --gold: #cb9a33;
  --gold-light: #d8a843;
  --gold-dark: #b88420;
  --text-primary: #1c355e;
  --text-secondary: #5a6a85;
  --text-tertiary: #8896ad;
  --success-bg: #e6f7ee;
  --success-text: #0a6e3f;
  --warning-bg: #fef4e6;
  --warning-text: #92400e;
  --danger-bg: #fde9e9;
  --danger-text: #991b1b;
  --page-top: #fafbfd;
  --page-bottom: #f1f3f8;
  --radius-button: 8px;
  --radius-card: 12px;
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Roboto Mono", monospace;
  --border-navy: rgba(28, 53, 94, 0.12);
  --border-navy-strong: rgba(28, 53, 94, 0.25);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-primary);
  background: linear-gradient(180deg, var(--page-top), var(--page-bottom));
  background-attachment: fixed;
}

h1,
h2,
h3 {
  color: var(--text-primary);
  line-height: 1.25;
  margin: 0 0 8px;
}

p {
  margin: 0 0 12px;
}

a {
  color: var(--navy);
}

strong {
  font-weight: 600;
}

/* ---------- layout ---------- */

/* 1120px, not 880. At 880 on a 1280 desktop the board wasted a third of the
 * screen while the actual deadlines sat below the fold behind the filter panel.
 * The design system asks for "generous whitespace", which is about breathing
 * room around content — not about squeezing the content itself. */
.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 20px 56px;
}

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

/* Sign-in is the first thing anyone sees, and it was a text eyebrow reading
 * "OVG Culinary" on a plain card. The mark stays navy here — the auth card is
 * white, so no inversion. */
.auth-logo {
  height: 46px;
  width: auto;
  display: block;
  margin: 0 0 14px;
}

.section {
  margin-top: 20px;
}

.stack > * + * {
  margin-top: 12px;
}

.hidden {
  display: none !important;
}

/* ---------- top bar ---------- */

.topbar {
  background: var(--navy-dark);
  color: #fff;
}

.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* The design system's first brand rule is the tree mark, header left. It was
 * simply missing — the app shipped with a text wordmark, which is why it read
 * as a generic internal tool rather than an OVG one. */
.topbar-brand {
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  text-decoration: none;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-logo {
  height: 34px;
  width: auto;
  display: block;
  /* The mark is navy-on-transparent; on the navy-dark bar it would vanish. */
  filter: brightness(0) invert(1);
  opacity: 0.95;
}

/* Below ~420px the wordmark and the nav can't share a row without the nav
 * wrapping into three lines. Keep the mark, drop the words. */
@media (max-width: 419px) {
  .topbar-brand-text {
    display: none;
  }
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.topbar-user {
  color: rgba(255, 255, 255, 0.85);
  font-size: 14px;
}

.topbar-link {
  color: #fff;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 12px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-button);
}

.topbar-link:hover,
.topbar-link:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  text-decoration: underline;
}

.btn-topbar {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: var(--radius-button);
  padding: 0 14px;
  min-height: 44px;
  cursor: pointer;
}

.btn-topbar:hover,
.btn-topbar:focus-visible {
  background: rgba(255, 255, 255, 0.12);
}

/* ---------- admin email-health banner (SPEC §7) ----------
 * Same danger pair the danger badge already uses (--danger-text on
 * --danger-bg = 7.1:1, well past AA), and the message itself carries the
 * meaning — the color is never the only signal. Full-bleed bar under the top
 * bar, text held to the 880px content column like .topbar-inner. */

.email-banner {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-bottom: 1px solid rgba(153, 27, 27, 0.22);
}

.email-banner-inner {
  /* Tracks .page / .topbar-inner — left as 880 it sat visibly inset from the
     bar above it once the content column widened. */
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
}

/* ---------- cards ---------- */

.card {
  background: #fff;
  border: 1px solid rgba(28, 53, 94, 0.08);
  border-radius: var(--radius-card);
  box-shadow:
    0 1px 2px rgba(28, 53, 94, 0.06),
    0 10px 28px rgba(28, 53, 94, 0.06);
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
}

.auth-title {
  font-size: 22px;
  margin: 4px 0 0;
}

.auth-sub {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 8px;
}

.auth-body {
  color: var(--text-primary);
  margin: 0 0 12px;
}

.page-title {
  font-size: 20px;
  margin: 0;
}

.section-title {
  font-size: 17px;
  margin: 0 0 4px;
}

.placeholder-body {
  color: var(--text-secondary);
  margin: 12px 0 0;
}

.muted {
  color: var(--text-secondary);
}

.help {
  color: var(--text-secondary);
  font-size: 13px;
  margin: 8px 0 0;
}

.field-error {
  color: var(--danger-text);
  font-size: 13px;
  margin: 8px 0 0;
}

.mono {
  font-family: var(--mono);
  font-size: 13px;
  word-break: break-all;
}

/* ---------- eyebrow / rule ---------- */

.label {
  display: block;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--navy);
  margin: 0 0 6px;
}

.gold-rule {
  height: 1px;
  border: 0;
  background: linear-gradient(90deg, var(--gold), rgba(203, 154, 51, 0));
  margin: 14px 0;
}

/* ---------- forms ---------- */

.field {
  margin-bottom: 16px;
}

.input {
  width: 100%;
  font-family: inherit;
  font-size: 16px;
  color: var(--text-primary);
  background: #fff;
  border: 1px solid var(--border-navy-strong);
  border-radius: var(--radius-button);
  padding: 10px 12px;
  min-height: 44px;
}

.input::placeholder {
  color: var(--text-secondary);
}

.input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(203, 154, 51, 0.2);
}

select.input {
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--navy) 50%),
    linear-gradient(135deg, var(--navy) 50%, transparent 50%);
  background-position: calc(100% - 18px) 20px, calc(100% - 12px) 20px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

textarea.input {
  min-height: 120px;
  resize: vertical;
  line-height: 1.45;
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

/* ---------- buttons ---------- */

.btn-primary,
.btn-secondary {
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--radius-button);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: background-color 0.12s ease;
}

.btn-primary {
  color: var(--navy-dark);
  background: var(--gold);
  border: 1px solid var(--gold-dark);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 2px 6px rgba(184, 132, 32, 0.35);
}

.btn-primary:hover {
  background: var(--gold-light);
}

.btn-primary:active {
  background: var(--gold-dark);
}

.btn-secondary {
  color: var(--navy);
  background: #fff;
  border: 1px solid var(--border-navy-strong);
}

.btn-secondary:hover {
  background: #f4f7fc;
}

.btn-block {
  width: 100%;
  display: flex;
}

.btn-block + .btn-block {
  margin-top: 10px;
}

.btn-sm {
  font-size: 13px;
  padding: 0 12px;
}

.btn-primary:disabled,
.btn-secondary:disabled,
.btn-topbar:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-topbar:focus-visible,
.topbar-link:focus-visible,
.input:focus-visible,
.link:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.link {
  color: var(--navy);
  font-weight: 600;
}

/* ---------- badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(28, 53, 94, 0.08);
  color: var(--navy);
  border: 1px solid rgba(28, 53, 94, 0.16);
  white-space: nowrap;
}

.badge-success {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: rgba(10, 110, 63, 0.22);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning-text);
  border-color: rgba(146, 64, 14, 0.22);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: rgba(153, 27, 27, 0.22);
}

/* ---------- roster table (responsive → stacked cards < 640px) ---------- */

.roster-table {
  width: 100%;
  border-collapse: collapse;
}

.roster-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  padding: 10px 12px;
  border-bottom: 2px solid rgba(28, 53, 94, 0.1);
}

.roster-table td {
  padding: 12px;
  border-bottom: 1px solid rgba(28, 53, 94, 0.08);
  vertical-align: middle;
  color: var(--text-primary);
}

.roster-email {
  color: var(--text-secondary);
  font-size: 14px;
  word-break: break-word;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 639px) {
  .roster-table thead {
    display: none;
  }

  .roster-table,
  .roster-table tbody,
  .roster-table tr,
  .roster-table td {
    display: block;
    width: 100%;
  }

  .roster-table tr {
    border: 1px solid rgba(28, 53, 94, 0.1);
    border-radius: var(--radius-card);
    background: #fff;
    margin-bottom: 12px;
    padding: 6px 14px;
  }

  .roster-table td {
    border: 0;
    border-bottom: 1px solid rgba(28, 53, 94, 0.06);
    padding: 10px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
  }

  .roster-table tr td:last-child {
    border-bottom: 0;
  }

  .roster-table td::before {
    content: attr(data-label);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    flex: 0 0 auto;
  }

  .roster-table td.actions-cell {
    flex-direction: column;
    align-items: stretch;
  }

  .roster-table td.actions-cell::before {
    margin-bottom: 8px;
  }

  .row-actions {
    flex-direction: column;
  }

  .row-actions .btn-secondary,
  .row-actions .btn-primary {
    width: 100%;
  }
}

/* ---------- bulk preview list ---------- */

.preview-list {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
}

.preview-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(28, 53, 94, 0.08);
}

.preview-line {
  color: var(--text-secondary);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  min-width: 28px;
}

.preview-body {
  flex: 1;
}

.preview-name {
  color: var(--text-primary);
  font-weight: 600;
}

.preview-meta {
  color: var(--text-secondary);
  font-size: 13px;
}

.preview-err {
  color: var(--danger-text);
  font-size: 13px;
  margin: 2px 0 0;
}

/* ---------- issued-links audit ---------- */

.audit-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
}

.audit-item {
  padding: 10px 0;
  border-bottom: 1px solid rgba(28, 53, 94, 0.08);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.audit-text {
  color: var(--text-primary);
  font-size: 14px;
}

.audit-when {
  color: var(--text-secondary);
  font-size: 13px;
}

.empty-note {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 12px 0 0;
}

/* ---------- overlay / modal ---------- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 24, 48, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 200;
}

.modal {
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow: auto;
}

.modal-title {
  font-size: 19px;
  margin: 4px 0 0;
}

/* ---------- deactivation handover (roster admin) ---------- */

.ho-list {
  list-style: none;
  padding: 0;
  margin: 6px 0 14px;
  max-height: 160px;
  overflow: auto;
}

.ho-item {
  color: var(--text-primary);
  font-size: 14px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(28, 53, 94, 0.08);
  word-break: break-word;
}

.ho-item:last-child {
  border-bottom: 0;
}

.ho-choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 2px;
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
}

.ho-choice input {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  margin: 0;
  accent-color: var(--navy);
}

/* ---------- toast ---------- */

.toast-host {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 16px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: calc(100% - 32px);
  max-width: 420px;
}

.toast {
  background: var(--navy-dark);
  color: #fff;
  border-radius: var(--radius-button);
  border-left: 4px solid var(--gold);
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: 0 8px 24px rgba(10, 24, 48, 0.35);
}

.toast-danger {
  border-left-color: #f87171;
}

.toast-success {
  border-left-color: #34d399;
}

.toast-msg {
  flex: 1;
  font-size: 14px;
  line-height: 1.4;
}

.toast-close {
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  min-width: 28px;
  min-height: 28px;
  padding: 0;
}

@media (min-width: 640px) {
  .toast-host {
    left: auto;
    right: 16px;
    transform: none;
  }
}

/* ---------- compact phone header (design pass 2026-08-04) ----------
 * On a 390x844 phone the bar was consuming ~380px — 45% of the screen — because
 * the logo, the nav and the user/sign-out block each wrapped onto their own row
 * at full desktop padding. The deadlines are the point of the app; the chrome
 * should not outrank them on the device most chefs will actually open.
 * Target: roughly two tight rows, ~120px. */
@media (max-width: 639px) {
  .topbar-inner {
    padding: 8px 14px;
    gap: 6px 10px;
    row-gap: 6px;
  }

  .topbar-logo {
    height: 26px;
  }

  .topbar-actions {
    gap: 4px 14px;
    /* Nav wraps under the mark and stays left-aligned instead of stretching
       edge to edge, which is what forced the third row. */
    flex: 1 1 100%;
    justify-content: flex-start;
  }

  .topbar-link {
    font-size: 14px;
    padding: 4px 0;
  }

  /* Push the identity + sign-out to the far right of the nav row rather than
     onto a row of their own. */
  .topbar-user {
    margin-left: auto;
    font-size: 13px;
  }

  .btn-topbar {
    padding: 5px 12px;
    font-size: 13px;
  }
}
