/* BROT Estimator — hand-written brand stylesheet. No framework, no build step.
   Design tokens below are locked (frontend-design pass against the committed logo);
   layout/spacing choices beyond the tokens are executional judgment calls. */

:root {
  --navy-900: #16233a; /* masthead */
  --navy-700: #24466e; /* primary buttons, links */
  --navy-50: #eef2f7;  /* hover/selected tint */
  --wheat: #b4ab9e;    /* sampled from logo -- wordmark on navy */
  --gold: #a08536;     /* wheat-gold hairline + active-nav accent */
  --paper: #fafaf9;    /* page background */
  --surface: #ffffff;  /* cards, tables */
  --ink: #1c2127;
  --ink-muted: #5c6572;
  --line: #e3e1dc;
  --amber-bg: #fef3c7; /* TBD cells (used from T4 on) */
  --amber-text: #92400e;
  --red: #b91c1c;      /* NO-RATE / errors */
  --ok: #2e7d4f;        /* won/positive */

  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: 'Iowan Old Style', 'Palatino Linotype', Georgia, 'Times New Roman', serif;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ink);
  background: var(--paper);
}

h1 {
  font-family: var(--font-serif);
  font-weight: normal;
}

a {
  color: var(--navy-700);
}

/* Motion: transitions are brief and limited to background/outline; fully off when requested. */
a, button, input, select, textarea, .btn, .btn-primary, .nav-link, .logout-button {
  transition: background-color 120ms ease, outline-color 120ms ease;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none; }
}

:focus-visible {
  outline: 2px solid var(--navy-700);
  outline-offset: 1px;
}

/* ---------------------------------------------------------------------------
   Masthead
   --------------------------------------------------------------------------- */

.masthead {
  background: var(--navy-900);
  border-bottom: 1px solid var(--gold);
}

.masthead-inner {
  max-width: 1240px;
  margin: 0 auto;
  height: 56px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.wordmark {
  display: flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
  white-space: nowrap;
}

.wordmark-brot {
  font-family: var(--font-serif);
  font-size: 20px;
  color: var(--wheat);
  letter-spacing: .02em;
}

.wordmark-sub {
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--gold);
}

.nav {
  display: flex;
  align-items: center;
  gap: 24px;
  flex: 1;
}

.nav-link {
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--wheat);
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: #fff;
}

.nav-link.is-active {
  color: #fff;
  border-bottom-color: var(--gold);
}

.masthead-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.search-form input[type="search"] {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .18);
  color: #fff;
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 13px;
  width: 200px;
}

.search-form input[type="search"]::placeholder {
  color: rgba(255, 255, 255, .6);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-menu-name {
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--wheat);
}

.logout-form {
  margin: 0;
}

.logout-button {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--wheat);
  cursor: pointer;
}

.logout-button:hover,
.logout-button:focus-visible {
  color: #fff;
}

/* ---------------------------------------------------------------------------
   Content
   --------------------------------------------------------------------------- */

main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px;
}

.empty-state {
  color: var(--ink-muted);
}

/* ---------------------------------------------------------------------------
   Tables (base now; rows/cells extended by T2/T4)
   --------------------------------------------------------------------------- */

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}

th, td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

thead th {
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

tbody tr:hover {
  background: var(--navy-50);
}

.num {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* ---------------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------------- */

.btn, .btn-primary {
  display: inline-block;
  font-family: inherit;
  font-size: 14px;
  line-height: normal;
  border-radius: 4px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}

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

/* ---------------------------------------------------------------------------
   Badges (used from T2 on)
   --------------------------------------------------------------------------- */

.badge {
  display: inline-block;
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  border-radius: 3px;
  padding: 1px 6px;
}

.badge-draft {
  background: transparent;
  border: 1px solid var(--wheat);
  color: var(--ink-muted);
}

.badge-issued {
  background: var(--navy-700);
  border: 1px solid var(--navy-700);
  color: #fff;
}

.badge-void {
  background: transparent;
  border: 1px solid var(--red);
  color: var(--red);
}

/* ---------------------------------------------------------------------------
   Job list toolbar (search + status chips) and pagination
   --------------------------------------------------------------------------- */

.job-list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.job-search-form input[type="search"] {
  width: 280px;
}

.chip-row {
  display: flex;
  gap: 8px;
}

.chip {
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
  color: var(--ink-muted);
}

.chip:hover,
.chip:focus-visible {
  background: var(--navy-50);
}

.chip-active {
  background: var(--navy-700);
  border-color: var(--navy-700);
  color: #fff;
}

.chip-active:hover,
.chip-active:focus-visible {
  background: var(--navy-700);
}

.pagination {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
  font-size: 13px;
  color: var(--ink-muted);
}

/* ---------------------------------------------------------------------------
   Forms
   --------------------------------------------------------------------------- */

label {
  display: block;
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 4px;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="search"],
textarea,
select {
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px 10px;
}

/* Masthead search sits on navy -- overrides the surface input styling above via specificity. */
.masthead .search-form input[type="search"] {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .18);
  color: #fff;
}

.field-hint {
  font-size: 12px;
  color: var(--ink-muted);
  margin: 4px 0 0;
}

/* ---------------------------------------------------------------------------
   Job form -- delivery type / tax % (T3). CSS-only show/hide, no JS. The Pickup
   radio (#fulfillment-pickup) is nested inside its own <label class="radio-option">,
   so it is NOT a direct sibling of .tax-pct-field -- a plain ":checked ~" anchored on
   the input itself can never match. Anchoring on ".radio-option:has(...)" instead
   works: the LABEL (which genuinely is .tax-pct-field's sibling under the shared
   <fieldset> parent) is what the sibling combinator walks from; :has() reaches back
   down into that label's own descendant input to read its :checked state.
   --------------------------------------------------------------------------- */

.delivery-tax-group {
  border: none;
  padding: 0;
  margin: 0 0 16px;
}

.delivery-tax-group legend {
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 4px;
  padding: 0;
}

.radio-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 16px;
  font-size: 15px;
  text-transform: none;
  letter-spacing: normal;
  color: var(--ink);
}

.tax-pct-field {
  display: none;
  margin-top: 12px;
}

.radio-option:has(#fulfillment-pickup:checked) ~ .tax-pct-field {
  display: block;
}

/* ---------------------------------------------------------------------------
   Error pages (404 uses these classes; 500.html is fully self-contained and
   duplicates this subset inline since it cannot depend on this file loading)
   --------------------------------------------------------------------------- */

.error-page {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.error-wordmark {
  font-family: var(--font-serif);
  font-size: 22px;
  letter-spacing: .04em;
  color: var(--navy-900);
}

.error-hairline {
  width: 64px;
  height: 1px;
  background: var(--gold);
  margin: 16px auto;
}

.error-code {
  font-family: var(--font-serif);
  font-size: 96px;
  line-height: 1;
  margin: 0;
  color: var(--navy-900);
}

.error-explanation {
  color: var(--ink-muted);
  margin: 16px 0 24px;
}

/* ---------------------------------------------------------------------------
   Takeoff grid (T4) -- a quiet worksheet, not a dashboard. Read-only in M2;
   M3's grid JS addresses cells by the data-cell-key/data-room-id/data-category-id
   attributes below, so those are spec, not decoration -- don't rename casually.
   --------------------------------------------------------------------------- */

.takeoff-header {
  margin-bottom: 20px;
}

.takeoff-job-line {
  color: var(--ink-muted);
  margin: 4px 0 12px;
}

.takeoff-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.takeoff-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.takeoff-table {
  font-size: 13px;
  white-space: nowrap;
  /* Sticky cells + border-collapse (the base table rule) mis-paint in Chromium -- borders detach
     from the stuck cell while it scrolls. separate/0 renders identically here (this table only
     ever sets bottom borders, so there is nothing to collapse). */
  border-collapse: separate;
  border-spacing: 0;
}

.takeoff-table th,
.takeoff-table td {
  padding: 6px 10px;
}

.room-name {
  font-weight: 600;
}

.room-chips {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

/* Mini chips beneath a room name -- same shape as .chip, tighter to stay quiet in a table row. */
.room-chips .chip {
  padding: 1px 8px;
  font-size: 10px;
}

.chip-override {
  background: var(--navy-50);
  border-color: var(--line);
  color: var(--ink-muted);
}

.chip-tbd {
  background: var(--amber-bg);
  border-color: transparent;
  color: var(--amber-text);
}

.cell-tbd {
  background: var(--amber-bg);
  color: var(--amber-text);
}

.stack-indicator {
  color: var(--ink-muted);
  font-size: 11px;
}

.tbd-suffix {
  color: var(--amber-text);
  font-size: 11px;
  text-transform: uppercase;
}

.badge-no-rate {
  background: transparent;
  border: 1px solid var(--red);
  color: var(--red);
}

.badge-override {
  background: var(--navy-50);
  border: 1px solid var(--line);
  color: var(--ink-muted);
}

.strike {
  text-decoration: line-through;
  color: var(--ink-muted);
}

.misc-cell {
  color: var(--ink-muted);
  font-size: 12px;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-total-cell {
  font-weight: 600;
}

/* The grid scrolls wider than the viewport, and ROOM TOTAL (the money) was the first thing to
   leave it -- pin the column to the scroll container's right edge instead. The opaque background
   is load-bearing (cells are transparent by default, so the catalog columns would show through as
   they scroll underneath); the shadow draws the 1px separation line in --line's style without
   relying on sticky-cell border painting. */
.room-total-header,
.room-total-cell {
  position: sticky;
  right: 0;
  background: var(--surface);
  box-shadow: -1px 0 0 var(--line);
}

/* The sticky cell paints over its row, so it must adopt the hover tint itself or it stays white
   while the rest of the row highlights. */
.takeoff-table tbody tr:hover .room-total-cell {
  background: var(--navy-50);
}

.takeoff-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 16px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 13px;
  color: var(--ink-muted);
}

.job-total {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.tbd-count-flag {
  color: var(--amber-text);
  font-weight: 600;
}

/* ---------------------------------------------------------------------------
   Login page
   --------------------------------------------------------------------------- */

.login-page {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 40px;
  text-align: center;
}

.login-wordmark {
  margin-bottom: 24px;
}

.login-wordmark-brot {
  display: block;
  font-family: var(--font-serif);
  font-size: 28px;
  letter-spacing: .02em;
  color: var(--navy-900);
}

.login-wordmark-sub {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--gold);
}

.login-card form {
  text-align: left;
}

.login-card .field {
  margin-bottom: 16px;
}

.login-card input {
  width: 100%;
}

.login-card .btn-primary {
  width: 100%;
  margin-top: 8px;
}

.form-errors {
  color: var(--red);
  font-size: 13px;
  margin-bottom: 16px;
}
