/* Event Hawk Ops — restrained Event Hawk restyle.
   Light, dense ops UI shifted onto the brand palette: deep royal-blue header
   with a gold accent rule, brand-blue links + structure, ONE warm accent
   (hawk rust) kept for primary actions and the current step, gold used
   sparingly as the "money / attention" highlight. Green stays the meaning of
   "done", never decoration. League Spartan (the brand family) is used for
   headings only — body and tables keep system-ui for dense readability.
   Token-based so it stays themeable. No build step, no JS beyond HTMX;
   every pre-existing class name kept. */

@import url('https://fonts.googleapis.com/css2?family=League+Spartan:wght@500;600;700;800&display=swap');

:root {
  /* surfaces — light, very slightly cool so they sit with brand blue */
  --paper: #f4f4fa;
  --surface: #ffffff;
  --ink: #14142e;           /* brand-blue-tinted near-black body ink */
  --muted: #5a5a76;
  --line: #e6e6f0;
  --line-strong: #cdcddf;

  --accent: #9a3412;        /* hawk rust — primary actions, current step */
  --accent-down: #7c2a0e;
  --accent-tint: #f7e8e1;

  /* brand structural colours */
  --brand: #1d1dce;         /* royal blue — links, table refs, structure */
  --brand-deep: #0a0a4d;    /* deepest royal — the ledger header */
  --brand-tint: #e9e9fb;
  --gold: #ffd200;          /* the money / attention colour — used sparingly */
  --gold-deep: #b78f00;
  --gold-tint: #fff6cc;

  --ok: #166534;  --ok-tint: #e7f3ea;
  --warn: #92400e; --warn-tint: #fdf3da;
  --bad: #b91c1c;  --bad-tint: #fdeaea;
  --review: #1e40af; --review-tint: #e8eefc;

  --r-s: 4px; --r-m: 8px;
  --shadow-1: 0 1px 2px rgba(15, 15, 46, .07), 0 1px 1px rgba(15, 15, 46, .04);
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --display: "League Spartan", system-ui, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: system-ui, "Segoe UI", sans-serif;
  font-size: .94rem;
  line-height: 1.45;
}

h1 { font-family: var(--display); font-size: 1.5rem; font-weight: 700; letter-spacing: -.005em;
     margin: 1.4rem 0 .7rem; }
h2 { font-family: var(--display); font-size: 1.18rem; font-weight: 700; letter-spacing: -.005em;
     margin: 0 0 .5rem; }
h3 { font-family: var(--display); font-size: 1.05rem; font-weight: 700; margin: 0 0 .35rem; }

code { font-family: var(--mono); font-size: .85em; background: var(--paper);
       padding: .05rem .3rem; border-radius: var(--r-s); word-break: break-all; }

/* ---- nav: the deep royal-blue ledger header with a gold accent rule ---- */
nav {
  display: flex; gap: 1.1rem; align-items: center;
  padding: .55rem 1.2rem;
  background: var(--brand-deep); color: #e6e6fa;
  border-bottom: 3px solid var(--gold);
}
nav a { color: #e6e6fa; text-decoration: none; font-size: .9rem; }
nav a:hover { color: #fff; text-decoration: underline; }
nav strong a { font-family: var(--display); font-size: 1.02rem; font-weight: 800;
               letter-spacing: .06em; text-transform: uppercase; }
nav strong a::before { content: "▰ "; color: var(--gold); }
nav .spacer { flex: 1; }
nav .who { color: #b6b6e0; font-size: .85rem; }
nav .env-chip {
  font-family: var(--display);
  font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  background: var(--gold); color: var(--brand-deep);
  padding: .12rem .5rem; border-radius: var(--r-s);
}
nav .btn { background: transparent; color: #e6e6fa; border-color: rgba(255,255,255,.28); }
nav .btn:hover { border-color: #fff; background: rgba(255,255,255,.06); }

main { max-width: 72rem; margin: .6rem auto 3rem; padding: 0 1.2rem; }

/* ---- tables: dense, ruled, tabular ---- */
.table { border-collapse: collapse; width: 100%; background: var(--surface);
         border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden;
         box-shadow: var(--shadow-1); font-size: .88rem; }
.table th {
  text-align: left; padding: .45rem .65rem;
  font-family: var(--display);
  font-size: .76rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); background: var(--paper);
  border-bottom: 1px solid var(--line-strong);
}
.table td { text-align: left; padding: .45rem .65rem; border-bottom: 1px solid var(--line);
            font-variant-numeric: tabular-nums; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--brand-tint); }
.table a { color: var(--brand); font-weight: 600; text-decoration: none; }
.table a:hover { text-decoration: underline; }
.findings td { vertical-align: top; }

/* ---- state badges: soft tint, dark text, leading dot ---- */
.badge {
  display: inline-block; padding: .08rem .55rem .08rem .45rem; border-radius: 999px;
  font-size: .76rem; font-weight: 600; white-space: nowrap;
  background: #ececf2; color: var(--muted);
}
.badge::before { content: "●"; font-size: .6rem; vertical-align: .08em; margin-right: .32rem; }
.badge-done { background: var(--ok-tint); color: var(--ok); }
.badge-failed { background: var(--bad-tint); color: var(--bad); }
.badge-needs_attention { background: var(--warn-tint); color: var(--warn); }
.badge-ready_to_apply, .badge-extract_review, .badge-compose_review
  { background: var(--review-tint); color: var(--review); }
.badge-pending::before, .badge-extracting::before, .badge-composing::before,
.badge-applying::before { animation: workpulse 1.4s ease-in-out infinite; }
@keyframes workpulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) {
  .badge-pending::before, .badge-extracting::before, .badge-composing::before,
  .badge-applying::before { animation: none; }
}

/* ---- stepper: the ledger rail ---- */
.stepper { display: flex; gap: .3rem; list-style: none; padding: 0; flex-wrap: wrap; }
.step { padding: .22rem .7rem; border: 1px solid var(--line-strong); border-radius: 999px;
        font-size: .8rem; color: var(--muted); background: var(--surface); }
.step.done { background: var(--ok-tint); border-color: var(--ok); color: var(--ok); }
.step.current { background: var(--accent); border-color: var(--accent); color: #fff;
                font-weight: 650; }
.halted { color: var(--bad); }

/* ---- buttons ---- */
.btn { padding: .38rem .95rem; border: 1px solid var(--line-strong); border-radius: var(--r-s);
       background: var(--surface); color: var(--ink); cursor: pointer; font-size: .88rem;
       font-weight: 600; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-down); border-color: var(--accent-down); }
.btn.danger { background: var(--surface); border-color: var(--bad); color: var(--bad); }
.btn.danger:hover { background: var(--bad-tint); }
a.btn { display: inline-block; text-decoration: none; }

/* ---- modals ---- */
dialog { border: 1px solid var(--line-strong); border-radius: var(--r-m); max-width: 28rem;
         background: var(--surface); color: var(--ink); padding: 1.1rem 1.2rem;
         box-shadow: 0 18px 50px rgba(10, 10, 77, .28); }
dialog::backdrop { background: rgba(10, 10, 77, .45); }
dialog .scope { background: var(--paper); border-left: 3px solid var(--accent);
                padding: .6rem .8rem; border-radius: var(--r-s); font-size: .9rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1rem; }
/* a modal carrying a plain-language explainer needs a little more room than a bare scope */
dialog:has(.explainer) { max-width: 34rem; }

/* ---- structured explainer: summary + Why / Your options / What happens next ---- */
.explainer { margin: .7rem 0 0; padding: .7rem .85rem; font-size: .88rem; font-weight: 400;
             background: var(--surface); border: 1px solid var(--line);
             border-left: 3px solid var(--brand); border-radius: var(--r-s); }
/* when the explainer sits inside a coloured flash box, keep its own neutral surface */
.flash > p { margin: 0; }
.flash .explainer { color: var(--ink); }
.explainer-summary { margin: 0 0 .5rem; font-weight: 600; color: var(--ink); }
.explainer dl { margin: 0; display: grid; grid-template-columns: max-content 1fr;
                column-gap: .7rem; row-gap: .35rem; }
.explainer dt { color: var(--muted); font-size: .78rem; text-transform: uppercase;
                letter-spacing: .03em; padding-top: .1rem; }
.explainer dd { margin: 0; color: var(--ink); }
.explainer dd ul { margin: 0; padding-left: 1.1rem; }
.explainer dd li { margin: .1rem 0; }
@media (max-width: 32rem) {
  .explainer dl { grid-template-columns: 1fr; row-gap: .1rem; }
  .explainer dt { margin-top: .35rem; }
}

/* ---- live auto-refresh indicator ---- */
.live { color: var(--muted); font-size: .8rem; margin: .5rem 0; display: flex;
        align-items: center; gap: .4rem; }
.live-dot { width: .5rem; height: .5rem; border-radius: 999px; background: var(--accent);
            display: inline-block; animation: workpulse 1.4s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }

/* ---- decision banner: the gate's call-to-action, lifted to the top of the page ---- */
.decision-banner {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  margin: 1rem 0; padding: .7rem 1rem;
  background: var(--review-tint); border: 1px solid var(--review);
  border-left-width: 4px; border-radius: var(--r-m);
}
.decision-banner span { flex: 1; min-width: 14rem; }
.decision-banner a.btn { text-decoration: none; }
.gate-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin: 1rem 0; scroll-margin-top: 1rem; }

/* ---- cards ---- */
.card { border: 1px solid var(--line); border-radius: var(--r-m); padding: 1rem 1.1rem;
        margin: 1rem 0; background: var(--surface); box-shadow: var(--shadow-1); }
.card.attention { border-color: var(--warn); background: var(--warn-tint); }
.card.error { border-color: var(--bad); background: var(--bad-tint); }
.flash { border: 1px solid var(--warn); background: var(--warn-tint); color: var(--warn);
         padding: .5rem .8rem; border-radius: var(--r-s); margin: 1rem 0; font-weight: 600; }
.who { color: var(--muted); font-size: .85rem; }

/* ---- launcher grid ---- */
.launcher-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(26rem, 1fr));
                 gap: 1rem; }  /* 2x2 on desktop, single column on narrow screens */
.launcher { margin: 0; display: flex; flex-direction: column; }
.launcher form { display: flex; flex-direction: column; flex: 1; }
.launcher .blurb { color: var(--muted); font-size: .84rem; margin: 0 0 .6rem; }
.launcher button { margin-top: auto; align-self: flex-start; }
.advanced { margin: 1rem 0; }
.advanced > summary { color: var(--muted); font-size: .85rem; cursor: pointer; }
.filters { display: flex; gap: 1rem; margin: 0 0 .8rem; }
.filters label { margin: 0; font-size: .82rem; color: var(--muted); }
.filters select { width: auto; }

/* ---- draft image preview (compose review) ---- */
.img-grid { display: flex; gap: .6rem; flex-wrap: wrap; margin: .4rem 0 .6rem; }
.img-grid img { width: 9.5rem; height: 7rem; object-fit: cover; display: block;
                border: 1px solid var(--line); border-radius: var(--r-s);
                background: var(--paper); }
.img-grid a:hover img { border-color: var(--brand); }
.img-pick { margin: 0; display: flex; flex-direction: column; gap: .25rem; }
.img-pick .check { font-size: .8rem; color: var(--muted); margin: 0; }

/* ---- sweep chips ---- */
.chips { display: flex; gap: .5rem; list-style: none; padding: 0; flex-wrap: wrap; }
.chips li { border: 1px solid var(--line); border-radius: var(--r-s); padding: .25rem .6rem;
            font-size: .8rem; color: var(--muted); background: var(--paper);
            font-variant-numeric: tabular-nums; }
.chips li strong { color: var(--ink); }
.chips .chip-bad { border-color: var(--bad); background: var(--bad-tint); }
.chips .chip-bad strong { color: var(--bad); }
.chips .chip-warn { border-color: var(--warn); background: var(--warn-tint); }
.chips .chip-warn strong { color: var(--warn); }
.chips .chip-ok { border-color: var(--ok); background: var(--ok-tint); }
.chips .chip-ok strong { color: var(--ok); }

/* ---- forms / misc ---- */
label { display: block; margin: .45rem 0; font-size: .86rem; font-weight: 600; }
label.check { font-weight: 500; color: var(--muted); }
label.check input { width: auto; margin-right: .3rem; }
/* plain-language field help under a launcher input (or after a checkbox) */
.hint { display: block; font-weight: 400; font-size: .78rem; color: var(--muted);
        line-height: 1.35; margin: .2rem 0 .1rem; }
label.check + .hint { margin-top: 0; margin-bottom: .5rem; }
input[type=text], input[type=url], select, textarea {
  width: 100%; padding: .4rem .5rem; margin-top: .15rem;
  border: 1px solid var(--line-strong); border-radius: var(--r-s);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 400;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand);
}
.btn:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 1px;
}
form.inline { display: inline; }
details { margin: .6rem 0; }
details pre { background: var(--surface); border: 1px solid var(--line); padding: .6rem .8rem;
              overflow-x: auto; border-radius: var(--r-s); font-size: .8rem;
              font-family: var(--mono); }
details > summary { cursor: pointer; }
ul { margin: .4rem 0; padding-left: 1.3rem; }

/* ===== non-technical UX pass ===== */

/* bigger, comfier targets */
input[type=text], input[type=url], select, textarea { padding: .5rem .6rem; }
.btn { padding: .45rem 1rem; }

/* required-field marker */
.req { color: var(--accent); font-weight: 700; margin-left: .15rem; }
label .req-note { color: var(--muted); font-weight: 400; font-size: .8em; }

/* "More options" disclosure inside a launcher card — quieter than the fields above it */
.more-options { margin: .2rem 0 .4rem; border-top: 1px dashed var(--line-strong); padding-top: .4rem; }
.more-options > summary { color: var(--muted); font-size: .85rem; cursor: pointer; font-weight: 600; }
.more-options[open] > summary { margin-bottom: .3rem; }

/* microsite block: hidden until the "uses a microsite" box is ticked (pure CSS) */
.microsite-fields { display: none; }
form:has(input[name="microsite"]:checked) .microsite-fields { display: block; }

/* lead launcher card (Full pipeline) sits full-width above the "Other tools" grid */
.launcher.lead { margin: 0 0 1.2rem; }
.launcher.lead .blurb { font-size: .9rem; }
.use-when { color: var(--muted); font-size: .82rem; margin: -.2rem 0 .6rem; }

/* on-blur field validation hint + disabled-submit reason */
.field-error { display: block; color: var(--bad); font-size: .78rem; margin: .2rem 0 .1rem; }
.gate-reason { display: block; margin-top: .4rem; }
.btn:disabled, .btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn.primary:disabled:hover { background: var(--accent); border-color: var(--accent); }

/* success flash (green) — distinct from the warn-tinted error .flash */
.flash.ok { border-color: var(--ok); background: var(--ok-tint); color: var(--ok); }

/* plain "Step N of M" status line under the stepper */
.stage-status { color: var(--muted); font-size: .9rem; margin: .1rem 0 .6rem; }
.stage-status strong { color: var(--ink); }

/* done-job outcome banner at the top of the job page (created vs nothing-created) */
.result-banner { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
                 margin: 1rem 0; padding: .7rem 1rem; border: 1px solid var(--line-strong);
                 border-left-width: 4px; border-radius: var(--r-m); background: var(--surface); }
.result-banner span { flex: 1; min-width: 14rem; }
.result-banner a.btn { text-decoration: none; }
.result-banner.ok { background: var(--ok-tint); border-color: var(--ok); }
.result-banner.note { background: var(--warn-tint); border-color: var(--warn); }

/* draft image preview: make the business logo obvious among the unit photos */
.img-pick { position: relative; }
.img-tag { position: absolute; top: .25rem; left: .25rem; z-index: 1;
           background: var(--accent); color: #fff; font-size: .66rem; font-weight: 700;
           letter-spacing: .04em; text-transform: uppercase; padding: .08rem .4rem;
           border-radius: var(--r-s); }
.img-pick.logo img { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-tint); }

/* jobs list: an obvious Open/Review button in the number column + highlighted rows */
.open-btn { display: inline-block; padding: .22rem .6rem; border: 1px solid var(--line-strong);
            border-radius: var(--r-s); background: var(--surface); color: var(--brand);
            font-weight: 600; text-decoration: none; white-space: nowrap; }
.open-btn:hover { border-color: var(--brand); background: var(--brand-tint); text-decoration: none; }
.table tr.reviewable td { background: var(--review-tint); }
.table tr.reviewable td:first-child { border-left: 3px solid var(--review); }
/* the row's action is primary, so the button is the warm accent (one action colour) */
.table tr.reviewable .open-btn { background: var(--accent); border-color: var(--accent); color: #fff; }
.table tr.reviewable .open-btn:hover { background: var(--accent-down); border-color: var(--accent-down); }
