/* Shared styles for the staff admin, sign-up and set-password pages. Colours and fonts come from
   tokens.css and fonts.css (SMTY-06-ST2); this file holds no brand values of its own. */
:root {
  /* Values come from tokens.css (SMTY-06-ST2), loaded before this file. */
  --red: var(--smty-red-strong);
  --red-dark: var(--smty-red-hover);
  --black: var(--smty-ink);
  --bg: var(--smty-page);
  --card: var(--smty-surface);
  --border: var(--smty-line);
  --muted: var(--smty-muted);
  --ok: var(--smty-ok);
  --ok-bg: var(--smty-ok-tint);
  --warn: var(--smty-warn);
  --warn-bg: var(--smty-warn-tint);
  --off: var(--smty-muted);
  --off-bg: var(--smty-panel);
  --focus: var(--smty-focus);
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  font-family: var(--smty-font-body);
  background: var(--bg);
  color: var(--black);
  line-height: 1.5;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.08);
}

[hidden] { display: none !important; }

h1, h2, h3 { font-family: var(--smty-font-head); }

/* Header: charcoal with Smitty's red stripe on top, like smittystireandtruckservice.com. */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
  padding: 8px 20px;
  background: var(--smty-charcoal);
  color: var(--smty-surface);
  border-top: 4px solid var(--smty-red);
}
.topbar h1 { display: flex; align-items: center; gap: 12px; margin: 0; font-size: 1.2rem; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; }
.topbar .logo { display: block; width: 69px; height: 40px; }
.topbar .tag { padding: 2px 8px; border: 1px solid rgba(255, 255, 255, 0.45); border-radius: var(--smty-radius); font-family: var(--smty-font-body); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; }
.topbar .who { display: flex; align-items: center; gap: 12px; min-width: 0; color: rgba(255, 255, 255, 0.75); font-size: 0.9rem; }
.topbar .who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar :focus-visible { outline-color: var(--smty-surface); }

main { flex: 1 0 auto; width: 100%; max-width: 1140px; margin: 28px auto; padding: 0 16px; }

.card { padding: 26px; background: var(--card); border: 1px solid var(--border); border-radius: var(--smty-radius-card); }
.narrow { max-width: 440px; margin: 48px auto; }
.card h2 { margin: 0 0 16px; font-size: 1.6rem; text-transform: uppercase; text-wrap: balance; }
.card h2::after, .section-title::after { content: ""; display: block; width: 40px; height: 4px; margin-top: 8px; background: var(--smty-red); }

label { display: block; margin: 14px 0 6px; font-weight: 600; font-size: 0.875rem; }
input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  font: inherit;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: var(--smty-radius);
  background: var(--smty-surface);
  color: var(--black);
}
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
textarea { resize: vertical; }
.hint { margin: 6px 0 0; color: var(--muted); font-size: 0.875rem; }
.hint.privacy { margin-top: 12px; }

button {
  min-height: 40px;
  padding: 9px 18px;
  font: inherit;
  font-weight: 700;
  border: 1.5px solid transparent;
  border-radius: var(--smty-radius);
  cursor: pointer;
  touch-action: manipulation;
}
button.primary { background: var(--red); color: var(--smty-surface); }
button.primary:hover { background: var(--red-dark); }
button.secondary { background: var(--smty-surface); color: var(--black); border-color: var(--smty-charcoal); }
button.secondary:hover { background: var(--smty-panel); }
button.link { min-height: 0; padding: 4px 6px; background: none; color: var(--smty-surface); text-decoration: underline; }
button.link:hover { background: rgba(255, 255, 255, 0.12); }
button.small { min-height: 36px; padding: 6px 12px; font-size: 0.875rem; }
button:disabled { opacity: 0.55; cursor: not-allowed; }

/* Links, and links styled as buttons (used where the action is navigation). */
a { color: var(--smty-red-strong); font-weight: 600; }
a:hover { color: var(--red-dark); }
a.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 22px; border-radius: var(--smty-radius); font-weight: 700; text-decoration: none; }
a.button.primary { background: var(--red); color: var(--smty-surface); }
a.button.primary:hover { background: var(--red-dark); color: var(--smty-surface); }
/* Smitty's exact red only at large, bold sizes (white on it is 4.40:1, enough for large text). */
.button.large.primary, button.large.primary { min-height: 52px; padding: 0 30px; background: var(--smty-red); font-size: 19px; text-transform: uppercase; letter-spacing: 0.02em; }
.button.large.primary:hover, button.large.primary:hover { background: var(--smty-red-strong); color: var(--smty-surface); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.message { margin: 14px 0 0; padding: 11px 14px; border-left: 4px solid transparent; border-radius: var(--smty-radius-card); font-size: 0.9rem; }
.message.error { background: var(--smty-error-tint); color: var(--smty-error); border-left-color: var(--smty-error); }
.message.success { background: var(--ok-bg); color: var(--ok); border-left-color: var(--ok); }
.message.warn { background: var(--warn-bg); color: var(--warn); border-left-color: var(--warn); }
.message:empty { display: none; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.toolbar .search { flex: 1 1 220px; }
.more { margin: 10px 0 0; text-align: center; }
.more:has(> [hidden]) { display: none; }
.filters { display: flex; flex-wrap: wrap; gap: 4px; }
.filters button { min-height: 38px; padding: 7px 13px; background: var(--smty-surface); border-color: var(--border); font-size: 0.875rem; }
.filters button:hover { border-color: var(--black); }
.filters button[aria-pressed="true"] { background: var(--smty-charcoal); color: var(--smty-surface); border-color: var(--smty-charcoal); }
.count { display: inline-block; min-width: 20px; margin-left: 6px; padding: 0 6px; border-radius: 10px; background: var(--smty-red-strong); color: var(--smty-surface); font-size: 0.75rem; line-height: 20px; text-align: center; }

table { width: 100%; border-collapse: collapse; background: var(--card); }
th { padding: 10px 12px; text-align: left; background: var(--smty-panel); border-bottom: 1px solid var(--border); color: var(--muted); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
td { padding: 14px 12px; border-bottom: 1px solid var(--smty-line); vertical-align: top; font-size: 0.925rem; }
tbody tr:last-child td { border-bottom: none; }
td .sub { color: var(--muted); font-size: 0.85rem; }
td .email { overflow-wrap: anywhere; }
td.when { font-variant-numeric: tabular-nums; }
td.actions { white-space: nowrap; }
td.actions button + button { margin-left: 6px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow: hidden; background: var(--card); border: 1px solid var(--border); border-radius: var(--smty-radius-card); }
.empty { padding: 32px; color: var(--muted); text-align: center; }
.skip { position: absolute; top: 8px; left: -9999px; z-index: 10; padding: 8px 12px; background: var(--smty-surface); color: var(--black); }
.skip:focus { left: 8px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Sections */
.section-title { margin: 0 12px 0 0; font-size: 1.5rem; text-transform: uppercase; }
.orders { margin-bottom: 40px; }
.orders > .hint { margin: 0 0 14px; }
.accounts-title { margin-bottom: 14px; }

/* Orders queue: fixed columns so long emails and descriptions wrap instead of squeezing others. */
.orders-table { table-layout: fixed; }
.orders-table .c-order { width: 20%; }
.orders-table .c-customer { width: 23%; }
.orders-table .c-items { width: 31%; }
.orders-table .c-total { width: 10%; }
.orders-table .c-actions { width: 16%; }
/* Never truncated: staff copy the reference into D&K. */
.ref { font-weight: 700; overflow-wrap: anywhere; }
.age { color: var(--black); font-size: 0.85rem; font-weight: 600; }
.company { font-weight: 700; }
.lines { margin: 0; padding: 0; list-style: none; }
.lines li + li { margin-top: 8px; }
.lines strong { display: block; }
.note { margin-top: 8px; padding: 6px 9px; border-radius: var(--smty-radius); background: var(--warn-bg); color: var(--warn); font-size: 0.85rem; overflow-wrap: anywhere; }
.total { font-size: 1.05rem; font-weight: 700; }
.orders-table td.actions { white-space: normal; }
.orders-table td.actions button { width: 100%; }
.orders-table td.actions button + button { margin: 8px 0 0; }

/* Accounts: pending sign-ups stand out with an amber edge. */
tr.pending td:first-child { box-shadow: inset 4px 0 var(--warn); }

.activity { margin-top: 32px; }
.activity h2 { margin: 0 0 10px; color: var(--muted); font-size: 1.1rem; text-transform: uppercase; }
.activity ol { margin: 0; padding: 0; list-style: none; background: var(--card); border: 1px solid var(--border); border-radius: var(--smty-radius-card); }
.activity li { padding: 9px 14px; border-bottom: 1px solid var(--smty-line); font-size: 0.9rem; overflow-wrap: anywhere; }
.activity li:last-child { border-bottom: none; }
.activity time { display: inline-block; min-width: 96px; margin-right: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; }
.badge.active, .badge.approved, .badge.submitted { background: var(--ok-bg); color: var(--ok); }
.badge.pending, .badge.submitting, .badge.submission_unknown { background: var(--warn-bg); color: var(--warn); }
.badge.deactivated, .badge.declined, .badge.cancelled { background: var(--off-bg); color: var(--off); }
.badge.admin { margin-left: 6px; background: var(--smty-charcoal); color: var(--smty-surface); }

/* Review dialog */
td .problem { color: var(--smty-error); font-weight: 700; }
td .changed { color: var(--warn); font-weight: 700; }
td .diff { display: block; color: var(--warn); font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.totals { margin: 14px 0 0; font-size: 1rem; font-variant-numeric: tabular-nums; }

dialog { width: min(480px, calc(100vw - 32px)); padding: 26px; border: none; border-top: 4px solid var(--smty-red); border-radius: var(--smty-radius-card); overscroll-behavior: contain; color: var(--black); }
dialog.wide { width: min(780px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0, 0, 0, 0.55); }
dialog h3 { margin: 0 0 8px; font-size: 1.35rem; text-transform: uppercase; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.copy-row { display: flex; gap: 8px; margin-top: 12px; }
.copy-row input { font-family: ui-monospace, Menlo, monospace; font-size: 0.8rem; }

@media (max-width: 720px) {
  .topbar { padding: 8px 12px; }
  .topbar h1 { gap: 8px; font-size: 1rem; }
  .topbar .logo { width: 52px; height: 30px; }
  .topbar .who #who-name { display: none; }
  .topbar .who button { white-space: nowrap; }
  main { margin-top: 18px; }
  .section-title { font-size: 1.3rem; }
  thead { display: none; }
  table, tbody, tr, td { display: block; width: 100%; }
  .orders-table { table-layout: auto; }
  tr { padding: 10px 0; border-bottom: 1px solid var(--border); }
  tbody tr:last-child { border-bottom: none; }
  td { padding: 5px 14px; border: none; }
  td.actions { white-space: normal; }
  td.actions button { margin: 4px 6px 0 0; }
  td.actions button + button { margin-left: 0; }
  .orders-table td.actions { display: flex; gap: 8px; }
  .orders-table td.actions button { width: auto; flex: 1; }
  .orders-table td.actions button + button { margin: 4px 0 0; }
  td.num { text-align: left; }
  td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); }
  tr.pending td:first-child { box-shadow: none; }
  tr.pending { box-shadow: inset 4px 0 var(--warn); }
}

/* Site footer, after the one on smittystireandtruckservice.com: logo, contact, dark bar. */
.site-footer { margin-top: 56px; background: var(--smty-surface); border-top: 1px solid var(--border); }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 20px 48px; max-width: 1140px; margin: 0 auto; padding: 26px 16px; }
.footer-logo { display: block; width: 104px; height: 60px; }
.footer-title { margin: 0 0 4px; font-size: 1.05rem; text-transform: uppercase; }
.footer-inner p { margin: 0; line-height: 1.7; }
.footer-inner .footer-site { margin-left: auto; }
.footer-bar { padding: 10px 16px; background: var(--smty-charcoal); color: rgba(255, 255, 255, 0.85); font-size: 0.85rem; text-align: center; }

/* Password rules that tick as the person types (set-password page). */
.rules { margin: 10px 0 0; padding: 0; list-style: none; color: var(--muted); font-size: 0.875rem; }
.rules li { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.rules li::before { content: ""; flex: none; width: 10px; height: 10px; border: 2px solid var(--muted); border-radius: 50%; }
.rules li.met { color: var(--ok); font-weight: 600; }
.rules li.met::before { background: var(--ok); border-color: var(--ok); }

/* Front page */
.landing .hero { max-width: 640px; margin: 56px auto; text-align: center; }
.landing .hero h2 { font-size: 2rem; }
.landing .hero h2::after { margin-right: auto; margin-left: auto; }
.landing .hero .lead { margin: 0 0 24px; font-size: 1.05rem; }
.landing .hero .hint { margin-top: 22px; }

@media (max-width: 720px) {
  .footer-inner .footer-site { margin-left: 0; }
  .landing .hero { margin: 24px auto; }
  .landing .hero h2 { font-size: 1.6rem; }
}
