/* ===== tokens ============================================================= */
:root {
  --lime: #BBD648;
  --green: #64A845;
  --blue: #0076B4;
  --brown: #644935;
  --black: #000000;

  /* Warm neutrals, tinted toward the brown so the greys don't look blue-cold
     next to an ag-green palette.

     --ink is #221E1F, sampled from the actual wordmark in logo.png rather than
     using pure black. Body text now matches the logo sitting beside it; pure
     black next to that wordmark reads as two different colours. */
  --ink:        #221E1F;
  --ink-soft:   color-mix(in srgb, var(--black) 58%, #ffffff 42%);
  --ink-faint:  color-mix(in srgb, var(--black) 38%, #ffffff 62%);
  --rule:       color-mix(in srgb, var(--brown) 16%, #ffffff 84%);
  --rule-soft:  color-mix(in srgb, var(--brown) 9%, #ffffff 91%);

  /* The page behind the cards. This was 4% brown -- so close to white that
     white cards on it had almost no edge, and every screen read flat.
     At 9% the cards lift off the page without the background becoming a
     colour in its own right. */
  --wash:       color-mix(in srgb, var(--brown) 9%, #ffffff 91%);

  /* A second, paler wash for surfaces that sit INSIDE a card -- table headers,
     card notes -- which still need to separate from white without picking up
     the heavier page tone. */
  --wash-soft:  color-mix(in srgb, var(--brown) 4%, #ffffff 96%);
  --paper:      #ffffff;

  /* Sidebar: near-black warmed toward the brown, so it reads as part of the
     palette rather than as generic dark-mode chrome. */
  --bar:        color-mix(in srgb, var(--black) 88%, var(--brown) 12%);
  --bar-2:      color-mix(in srgb, var(--black) 80%, var(--brown) 20%);
  --bar-ink:    color-mix(in srgb, #ffffff 78%, var(--lime) 22%);
  --bar-ink-dim: color-mix(in srgb, #ffffff 46%, var(--brown) 54%);

  /* Semantic status. --ok is literally the brand green: when a job order is
     healthy it should be AgHires green, not some other green. */
  --ok:    var(--green);
  --warn:  #C98A12;
  --bad:   #C1442E;
  --ok-bg:   color-mix(in srgb, var(--ok) 12%, #ffffff);
  --warn-bg: color-mix(in srgb, var(--warn) 13%, #ffffff);
  --bad-bg:  color-mix(in srgb, var(--bad) 11%, #ffffff);

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 14px -6px rgba(0,0,0,.10);
  --sidebar-w: 264px;
  --header-h: 60px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas,
          "Liberation Mono", monospace;
}

/* ===== reset ============================================================== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--wash);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.011em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: .95rem; }
p { margin: 0 0 .7em; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ===== the brand rule ====================================================
   A 3px lime-to-green bar across the very top of every page. Cheapest
   possible way to make every screen unmistakably AgHires. */
.brandrule {
  position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 100;
  background: linear-gradient(90deg, var(--lime), var(--green) 55%, var(--blue));
}

/* ===== app frame ========================================================== */
.app { display: flex; min-height: 100vh; padding-top: 3px; }

/* ---- sidebar ---- */
.side {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: var(--bar); color: var(--bar-ink);
  display: flex; flex-direction: column;
  position: sticky; top: 3px; height: calc(100vh - 3px);
}
/* The real AgHires logo is a BLACK wordmark, so it cannot sit on the dark
   sidebar. Rather than recreate their typeface in white and get it subtly
   wrong, the top of the sidebar is a white plate and the genuine asset goes on
   it unaltered. */
.side-brand {
  height: var(--header-h); display: flex; align-items: center;
  padding: 0 18px; flex: 0 0 auto;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
.side-brand img { height: 30px; width: auto; display: block; }

.nav { flex: 1 1 auto; overflow-y: auto; padding: 12px 0 24px; }
.nav-group { margin-top: 14px; }
.nav-group:first-child { margin-top: 0; }
.nav-group > .nav-label {
  font-size: .66rem; text-transform: uppercase; letter-spacing: .1em;
  font-weight: 700; color: var(--bar-ink-dim);
  padding: 8px 18px 5px;
}
.nav a {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 18px 7px 15px; margin: 1px 0;
  color: var(--bar-ink); text-decoration: none; font-size: .875rem;
  border-left: 3px solid transparent; line-height: 1.35;
}
.nav a:hover { background: rgba(255,255,255,.055); text-decoration: none; }
.nav a.is-active {
  background: rgba(255,255,255,.085);
  border-left-color: var(--lime);
  color: #fff; font-weight: 600;
}
.nav a.is-nested { padding-left: 15px; }
.nav .nav-icon { flex: 0 0 15px; opacity: .72; }
.nav a.is-active .nav-icon { opacity: 1; color: var(--lime); }
.nav .nav-when {
  margin-left: auto; font-size: .64rem; font-weight: 600;
  color: var(--bar-ink-dim); white-space: nowrap; letter-spacing: .02em;
}

.side-foot {
  flex: 0 0 auto; padding: 12px 18px;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: .72rem; color: var(--bar-ink-dim); line-height: 1.45;
}

/* ---- main column ---- */
.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.head {
  height: var(--header-h); flex: 0 0 auto;
  background: var(--paper); border-bottom: 1px solid var(--rule);
  display: flex; align-items: center; gap: 16px; padding: 0 26px;
  position: sticky; top: 3px; z-index: 20;
}
.head h1 { font-size: 1.06rem; font-weight: 650; }
.head .head-sub { color: var(--ink-faint); font-size: .8rem; }
.head .spacer { flex: 1 1 auto; }
.who { display: flex; align-items: center; gap: 10px; font-size: .82rem; }
.who .avatar {
  width: 29px; height: 29px; border-radius: 50%; flex: 0 0 29px;
  background: linear-gradient(140deg, var(--green), var(--lime));
  color: #14170e; font-weight: 700; font-size: .74rem;
  display: grid; place-items: center; letter-spacing: -.02em;
}
.who .who-name { font-weight: 600; }
.who .who-role {
  color: var(--ink-faint); font-size: .7rem; text-transform: uppercase;
  letter-spacing: .06em; font-weight: 600;
}

.content { padding: 26px; max-width: 1180px; width: 100%; }
.page-lede { color: var(--ink-soft); max-width: 68ch; margin: -4px 0 20px; }

/* ===== cards ============================================================== */
.card {
  background: var(--paper); border: 1px solid var(--rule);
  border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 18px; overflow: hidden;
}
.card-head {
  padding: 14px 18px; border-bottom: 1px solid var(--rule-soft);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.card-head h2 { font-size: .95rem; }
.card-head .spacer { flex: 1 1 auto; }
.card-body { padding: 18px; }
.card-body > :last-child { margin-bottom: 0; }
.card-note {
  padding: 11px 18px; background: var(--wash);
  border-top: 1px solid var(--rule-soft);
  font-size: .8rem; color: var(--ink-soft);
}

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(255px, 1fr)); }
.grid .card { margin-bottom: 0; }

/* ===== stat strip =========================================================
   A row of small tiles across the top of a board, NOT the wide cards .grid
   gives you. Bare .grid has no columns of its own, so a strip of seven tiles
   built on it stacks into seven full-width rows and buries everything below.

   minmax(148px, 1fr) fits seven across a full-width content column and wraps
   to two neat rows when the window narrows, which is the behaviour a summary
   strip wants: never a single column, never a horizontal scroll. */
.statgrid {
  display: grid; gap: 10px; margin-bottom: 18px;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
}
.statgrid .card { margin-bottom: 0; }
.statgrid .stat { padding: 12px 14px; }
.statgrid .stat .stat-value { font-size: 1.6rem; }
.statgrid .stat .stat-verdict { font-size: .75rem; line-height: 1.35; }

/* Traffic lights, in Becky's words: green you are doing great, yellow you are a
   touch behind, red danger.

   Green is a STATE here, not the absence of one -- a tile that is fine says so
   in colour rather than sitting blank. Only genuinely neutral tiles (offers
   out, where a count is neither good nor bad) stay white, so white now means
   "no signal", not "untinted". */
.statgrid .stat-card.is-ok {
  background: var(--ok-bg);
  border-color: color-mix(in srgb, var(--ok) 28%, #ffffff);
}
.statgrid .stat-card.is-warn {
  background: var(--warn-bg);
  border-color: color-mix(in srgb, var(--warn) 32%, #ffffff);
}
.statgrid .stat-card.is-bad {
  background: var(--bad-bg);
  border-color: color-mix(in srgb, var(--bad) 30%, #ffffff);
}
.statgrid .stat.is-ok .stat-label,
.statgrid .stat.is-ok .stat-verdict { color: color-mix(in srgb, var(--ok) 78%, var(--black)); }
.statgrid .stat.is-warn .stat-label,
.statgrid .stat.is-warn .stat-verdict { color: color-mix(in srgb, var(--warn) 82%, var(--black)); }
.statgrid .stat.is-bad .stat-label,
.statgrid .stat.is-bad .stat-verdict { color: var(--bad); }

/* ===== placeholders ======================================================
   A placeholder must be visibly unbuilt. The dashed border and the flat wash
   are load-bearing: nobody should mistake one of these for a working page. */
.ph {
  background: var(--wash); border: 1px dashed color-mix(in srgb, var(--brown) 26%, #ffffff);
  border-radius: var(--radius); padding: 20px; box-shadow: none;
}
.ph h2 { font-size: 1rem; margin-bottom: 6px; }
.ph p { color: var(--ink-soft); margin-bottom: 12px; max-width: 62ch; }
.ph .ph-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ph-big { padding: 30px; }
.ph-big h2 { font-size: 1.15rem; }

/* ===== tags =============================================================== */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .7rem; font-weight: 650; letter-spacing: .03em;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
  border: 1px solid transparent; line-height: 1.5;
}
.tag-scheduled {
  background: color-mix(in srgb, var(--brown) 10%, #ffffff);
  color: var(--brown);
  border-color: color-mix(in srgb, var(--brown) 26%, #ffffff);
}
.tag-notstarted {
  background: var(--wash); color: var(--ink-faint);
  border-color: var(--rule);
}
.tag-live {
  background: var(--ok-bg); color: color-mix(in srgb, var(--ok) 74%, var(--black));
  border-color: color-mix(in srgb, var(--ok) 34%, #ffffff);
}
.tag-ok   { background: var(--ok-bg);   color: color-mix(in srgb, var(--ok) 76%, var(--black)); border-color: color-mix(in srgb, var(--ok) 32%, #fff); }
.tag-warn { background: var(--warn-bg); color: color-mix(in srgb, var(--warn) 82%, var(--black)); border-color: color-mix(in srgb, var(--warn) 32%, #fff); }
.tag-bad  { background: var(--bad-bg);  color: color-mix(in srgb, var(--bad) 82%, var(--black));  border-color: color-mix(in srgb, var(--bad) 32%, #fff); }
.tag-info { background: color-mix(in srgb, var(--blue) 9%, #fff); color: var(--blue); border-color: color-mix(in srgb, var(--blue) 26%, #fff); }
.tag-mono { font-family: var(--mono); font-size: .68rem; letter-spacing: 0; }

/* ===== stats =============================================================
   Every stat carries a verdict line. See components.js -- stat() throws if you
   try to render a number without one. */
.stat { padding: 16px 18px; }
.stat .stat-label {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .08em;
  font-weight: 700; color: var(--ink-faint); margin-bottom: 5px;
}
.stat .stat-value {
  font-size: 1.85rem; font-weight: 700; letter-spacing: -.03em;
  line-height: 1.1; font-variant-numeric: tabular-nums;
}
.stat .stat-verdict {
  margin-top: 5px; font-size: .82rem; font-weight: 550; color: var(--ink-soft);
}
.stat.is-ok   .stat-value { color: color-mix(in srgb, var(--ok) 80%, var(--black)); }
.stat.is-warn .stat-value { color: color-mix(in srgb, var(--warn) 88%, var(--black)); }
.stat.is-bad  .stat-value { color: var(--bad); }
.stat.is-bad  .stat-verdict { color: var(--bad); font-weight: 650; }

/* ===== tables ============================================================= */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: .865rem; }
table.t th {
  text-align: left; font-size: .68rem; text-transform: uppercase;
  letter-spacing: .08em; font-weight: 700; color: var(--ink-faint);
  padding: 9px 14px; border-bottom: 1px solid var(--rule);
  background: var(--wash); white-space: nowrap;
}
table.t td {
  padding: 11px 14px; border-bottom: 1px solid var(--rule-soft);
  vertical-align: middle;
}
table.t tbody tr:last-child td { border-bottom: 0; }
table.t tbody tr:hover { background: var(--wash-soft); }

/* Group subheader inside a table. Lets one table carry several categories
   without repeating the column header for each. */
table.t tr.t-group th {
  text-align: left; background: var(--wash);
  font-size: .68rem; text-transform: uppercase; letter-spacing: .09em;
  font-weight: 700; color: var(--brown);
  padding: 8px 14px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule-soft);
}
table.t tbody tr.t-group:first-child th { border-top: 0; }
table.t tbody tr.t-group:hover { background: var(--wash-soft); }
table.t td.right, table.t th.right { text-align: right; }
table.t td.nowrap { white-space: nowrap; }
.t-strong { font-weight: 600; }
.t-dim { color: var(--ink-faint); }
.t-mono { font-family: var(--mono); font-size: .82rem; }

/* ===== empty states ======================================================
   The honest alternative to fake data. */
.empty {
  padding: 34px 20px; text-align: center; color: var(--ink-faint);
}
.empty .empty-title {
  font-weight: 600; color: var(--ink-soft); margin-bottom: 3px;
  font-size: .92rem;
}
.empty .empty-hint { font-size: .82rem; max-width: 46ch; margin: 0 auto; }

/* ===== banners =========================================================== */
.banner {
  border-radius: var(--radius); padding: 13px 16px; margin-bottom: 18px;
  border: 1px solid; display: flex; gap: 12px; align-items: flex-start;
  font-size: .875rem;
}
.banner .banner-body { flex: 1 1 auto; min-width: 0; }
.banner .banner-title { font-weight: 650; margin-bottom: 2px; }
.banner p:last-child { margin-bottom: 0; }
.banner-ok   { background: var(--ok-bg);   border-color: color-mix(in srgb, var(--ok) 32%, #fff); }
.banner-warn { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 34%, #fff); }
.banner-bad  { background: var(--bad-bg);  border-color: color-mix(in srgb, var(--bad) 32%, #fff); }
.banner-info { background: color-mix(in srgb, var(--blue) 7%, #fff); border-color: color-mix(in srgb, var(--blue) 26%, #fff); }
.banner-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* ===== buttons =========================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 7px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink);
  font-size: .855rem; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: background .12s, border-color .12s;
  white-space: nowrap;
}
.btn:hover { background: var(--wash); text-decoration: none; border-color: color-mix(in srgb, var(--brown) 24%, #fff); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: var(--green); border-color: color-mix(in srgb, var(--green) 82%, var(--black));
  color: #fff;
}
.btn-primary:hover {
  background: color-mix(in srgb, var(--green) 88%, var(--black)); color: #fff;
  border-color: color-mix(in srgb, var(--green) 70%, var(--black));
}
.btn-danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, #fff); }
.btn-danger:hover { background: var(--bad-bg); }
.btn-sm { padding: 4px 10px; font-size: .78rem; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ===== forms ============================================================= */
.field { margin-bottom: 14px; }
.field > label {
  display: block; font-size: .78rem; font-weight: 650; margin-bottom: 4px;
  color: var(--ink-soft);
}
.field .hint { font-size: .76rem; color: var(--ink-faint); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=url],
input[type=date], textarea, select {
  width: 100%; padding: 8px 11px; border: 1px solid var(--rule);
  border-radius: var(--radius-sm); background: var(--paper);
}
input:focus, textarea:focus, select:focus {
  border-color: var(--green);
  outline: 2px solid color-mix(in srgb, var(--green) 28%, #fff);
  outline-offset: 0;
}
textarea { min-height: 76px; resize: vertical; font-family: inherit; }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field-row > .field { flex: 1 1 200px; margin-bottom: 14px; }

/* ===== login / standalone screens ======================================== */
.solo {
  min-height: 100vh; display: grid; place-items: center; padding: 30px 20px;
  background:
    radial-gradient(1100px 460px at 50% -10%, color-mix(in srgb, var(--lime) 16%, transparent), transparent),
    var(--wash);
}
.solo-box { width: 100%; max-width: 396px; }
.solo-brand { text-align: center; margin-bottom: 20px; }
.solo-brand img { height: 46px; width: auto; }
.solo-brand .sub {
  color: var(--ink-faint); font-size: .8rem; margin-top: 3px;
}
.solo .card { margin-bottom: 14px; }
.solo-foot {
  text-align: center; font-size: .76rem; color: var(--ink-faint);
  max-width: 42ch; margin: 0 auto;
}

/* ===== misc ============================================================== */
.muted { color: var(--ink-faint); }
.small { font-size: .8rem; }
.mono { font-family: var(--mono); }
.secret-box {
  font-family: var(--mono); font-size: .85rem; word-break: break-all;
  background: var(--wash); border: 1px solid var(--rule);
  border-radius: var(--radius-sm); padding: 11px 13px; margin-bottom: 10px;
}
hr.rule { border: 0; border-top: 1px solid var(--rule); margin: 20px 0; }
.section-title {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .09em;
  font-weight: 700; color: var(--ink-faint); margin: 26px 0 10px;
}
.section-title:first-child { margin-top: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ===== tabs ===============================================================
   Horizontal tabs across the top of a page, each one a real link to a real
   URL rather than a script toggling visibility. That is deliberate: a tab you
   can bookmark, send to somebody, or land on from an email is worth more than
   one that switches without a page load, and it keeps this codebase's total
   JavaScript at the one clipboard helper.

   The count badge is part of the tab because the point of a tab bar here is
   deciding WHICH view needs you, and a tab reading "Gates" tells you less than
   one reading "Gates 39". */
.tabs {
  display: flex; align-items: stretch; gap: 2px; flex-wrap: wrap;
  border-bottom: 1px solid var(--rule);
  margin: 0 0 18px;
}
.tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 14px; text-decoration: none;
  font-size: .82rem; font-weight: 600; color: var(--ink-soft);
  border: 1px solid transparent; border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  margin-bottom: -1px;                 /* sit on the rule, not above it */
  white-space: nowrap;
}
.tab:hover { background: var(--wash-soft); color: var(--ink); }
.tab.is-active {
  background: var(--paper); color: var(--ink);
  border-color: var(--rule);
  /* Same colour as the tab's own fill, so it punches a gap in the rule
     underneath and the active tab reads as joined to the content below. */
  border-bottom: 1px solid var(--paper);
}
.tab-count {
  font-size: .68rem; font-weight: 700; line-height: 1;
  padding: 3px 6px; border-radius: 999px;
  background: var(--wash); color: var(--ink-faint);
}
.tab.is-active .tab-count { background: var(--wash); color: var(--ink-soft); }
/* A count that means "somebody has to do something" reads red whether or not
   its tab is the active one -- that is the whole reason to put it on a tab.
   Both selectors are needed: the .tab.is-active .tab-count rule above is three
   classes and would otherwise outrank a two-class .tab-count.is-bad no matter
   which came last, quietly greying out the number on the tab you are reading.

   NOTE FOR ANYONE EDITING THIS FILE: never use a backtick in a comment here.
   The whole stylesheet is one JavaScript template literal, so a stray backtick
   ends the string and every page 500s with an error that names a CSS class
   rather than this file. */
.tab-count.is-bad,
.tab.is-active .tab-count.is-bad { background: var(--bad-bg); color: var(--bad); }
@media (max-width: 700px) {
  .tab { padding: 8px 10px; font-size: .76rem; }
}

/* ===== responsive ========================================================
   Under 900px the sidebar becomes a horizontal strip. Not a hamburger menu --
   a strip keeps every destination visible, which matters more than tidiness on
   a dashboard people scan. */
@media (max-width: 900px) {
  .app { flex-direction: column; }
  .side {
    width: 100%; flex: 0 0 auto; height: auto; position: static;
    flex-direction: column;
  }
  .side-brand { height: 52px; }
  .nav { max-height: 232px; padding: 8px 0; }
  .side-foot { display: none; }
  .head { position: static; height: auto; padding: 13px 16px; flex-wrap: wrap; }
  .content { padding: 16px; }
  .who .who-name, .who .who-role { display: none; }
}

@media print {
  .side, .head .who { display: none; }
  .card { box-shadow: none; break-inside: avoid; }
}