/* ============================================================
   AWBGuru design system — tokens + component idioms
   Ported from design/awbguru.html so the app UI matches the brand.
   Fonts: Instrument Sans / Newsreader / Martian Mono. Vendoring the
   actual webfonts is a follow-up; system fallbacks are used until then
   (no CDN — CSP/offline safe).
   ============================================================ */
:root {
  --bg: #f6f7f3; --bg2: #eef0e9; --surface: #ffffff; --surface2: #f3f5ee; --surface3: #e9ece2;
  --line: rgba(18, 30, 12, .09); --line2: rgba(18, 30, 12, .15);
  --fg: #13170e; --muted: #575d51; --dim: #868c7d; --faint: #b6bbac;
  --c-blue: #3f7cf0; --c-lime: #8ed24e;
  --grad: linear-gradient(100deg, #3f7cf0 0%, #8ed24e 100%);
  --grad-soft: linear-gradient(100deg, rgba(63, 124, 240, .13), rgba(142, 210, 78, .13));
  --glow-b: rgba(63, 124, 240, .28); --glow-g: rgba(142, 210, 78, .34);
  --good: #5aa62a; --good-bg: rgba(142, 210, 78, .18); --good-line: rgba(142, 210, 78, .55);
  --warn: #bb8a1c; --warn-bg: rgba(224, 169, 46, .15); --warn-line: rgba(224, 169, 46, .42);
  --bad: #c0492b; --bad-bg: rgba(192, 73, 43, .12); --bad-line: rgba(192, 73, 43, .4);
  --shadow: 0 26px 60px -36px rgba(24, 44, 16, .4), 0 2px 8px -3px rgba(24, 44, 16, .08);
  --sans: 'Instrument Sans', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --mono: 'Martian Mono', ui-monospace, 'SF Mono', Consolas, monospace;
}

body {
  font-family: var(--sans); color: var(--fg);
  background:
    radial-gradient(rgba(18, 30, 12, .045) 1px, transparent 1px) 0 0/30px 30px,
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

.display { font-family: var(--serif); font-weight: 500; letter-spacing: -.02em; line-height: 1.1; }
.kicker {
  font-family: var(--mono); font-weight: 500; font-size: 11px;
  text-transform: uppercase; letter-spacing: .14em;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  display: inline-block;
}
.grad-word { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.mono { font-family: var(--mono); }

/* ---- page header — uniform across app pages (Exceptions / History / Activity) ----
   Single source so the three top-of-page headers never drift apart again. Optional
   .head-row lets a page seat a badge/action inline beside the serif title. */
.page-head { padding: 8px 0 18px; }
.page-head .head-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--serif); font-weight: 500; font-size: clamp(28px, 4vw, 40px);
  letter-spacing: -.02em; line-height: 1.1; margin: 0; color: var(--fg); }
.page-head p { color: var(--muted); font-size: 15px; margin-top: 8px; max-width: 66ch; }

/* ---- buttons ---------------------------------------------------- */
.awb-btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 20px; border-radius: 10px; border: none;
  font: 600 14.5px/1 var(--sans); cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform .18s ease, box-shadow .25s ease, filter .18s ease, background .2s ease, color .2s ease;
}
.awb-btn:disabled { opacity: .55; cursor: not-allowed; }
/* HYBRID primary (ported from prototypes settings.html) — white/surface fill + gradient
   hairline border (padding-box/border-box layering) + depth shadow at rest; on hover a
   soft gradient wash fades in behind the label. The label stays crisp #0e1e07 at full
   opacity above the wash — wrap it in a positioned child (z-index:1) so it never dims. */
.awb-btn-primary {
  background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--grad) border-box;
  border: 1.5px solid transparent; color: #0e1e07; font-size: 16px;
  box-shadow: 0 1px 2px rgba(24,44,16,.09), 0 6px 16px -6px rgba(24,44,16,.16);
}
.awb-btn-primary > * { position: relative; z-index: 1; }
.awb-btn-primary:not(:disabled):hover {
  background: linear-gradient(100deg, #b2cbf9 0%, #d2edb8 100%) padding-box, var(--grad) border-box;
  color: #0e1e07; transform: translateY(-1px);
  box-shadow: 0 10px 24px -8px var(--glow-b), 0 10px 24px -8px var(--glow-g);
}
.awb-btn-primary:not(:disabled):active { transform: translateY(0); }
.awb-btn-ghost { background: var(--surface); color: var(--fg); box-shadow: inset 0 0 0 1px var(--line2); }
.awb-btn-ghost:not(:disabled):hover { background: var(--surface2); }
/* Danger follows the ghost pattern — hairline, not filled (W1 mockup:
   duplicate-awb-reject-placement.html). Used by destructive row/detail actions. */
.awb-btn-danger { background: var(--surface); color: var(--bad); box-shadow: inset 0 0 0 1px var(--bad-line); }
.awb-btn-danger:not(:disabled):hover { background: var(--bad-bg); }
.awb-btn-sm { height: 36px; padding: 0 14px; font-size: 13.5px; border-radius: 9px; }

/* ---- .go-btn — up-right-arrow row action (ported from dashboard/exceptions prototypes)
   Replaces a "Review" text button in tables. SVG arrow path: M7 17L17 7M9 7h8v8.
   Hover: soft bright gradient wash, same inset hairline, nudge up-right. -------- */
.go-btn {
  width: 34px; height: 34px; border: none; border-radius: 9px; padding: 0; flex: none;
  display: inline-grid; place-items: center;
  background: var(--surface); color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--line); cursor: pointer;
  transition: color .15s, background .15s, box-shadow .15s, transform .15s;
}
.go-btn:hover { color: var(--fg); background: linear-gradient(100deg, rgba(63,124,240,.32), rgba(142,210,78,.38)); box-shadow: inset 0 0 0 1px var(--line); transform: translate(1px, -1px); }
.go-btn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--c-blue); }

/* ---- pills (confidence / validation status) -------------------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 11.5px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
  padding: 5px 10px; border-radius: 999px; white-space: nowrap;
}
.pill-pass { color: var(--good); background: var(--good-bg); box-shadow: inset 0 0 0 1px var(--good-line); }
.pill-warn { color: var(--warn); background: var(--warn-bg); box-shadow: inset 0 0 0 1px var(--warn-line); }
.pill-bad  { color: var(--bad);  background: var(--bad-bg);  box-shadow: inset 0 0 0 1px var(--bad-line); }
/* Neutral: not a verdict on a MAWB (e.g. a non-MAWB upload the doc-type guard skipped) —
   deliberately unalarming so it reads differently from a REJECT. */
.pill-skip { color: var(--dim);  background: var(--surface2); box-shadow: inset 0 0 0 1px var(--line2); }
/* In-progress (e.g. a document still extracting) — blue, distinct from the verdict pills. */
.pill-work { color: var(--c-blue); background: rgba(63, 124, 240, .12); box-shadow: inset 0 0 0 1px rgba(63, 124, 240, .4); }
.pill-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex: none; }

/* ---- chips ------------------------------------------------------ */
.awb-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 11.5px; font-weight: 500; letter-spacing: .06em;
  padding: 6px 11px; border-radius: 999px; background: var(--surface2); color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--line); white-space: nowrap;
}

/* ---- cards ------------------------------------------------------ */
.awb-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow); padding: 24px; position: relative;
}

/* ---- mono key-value rows --------------------------------------- */
.kv { display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  font-family: var(--mono); font-size: 11.5px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--dim); font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; font-weight: 500; }
.kv .v { font-weight: 600; text-align: right; color: var(--fg); }

/* ---- confidence bar -------------------------------------------- */
.conf-bar { position: relative; height: 6px; width: 68px; border-radius: 999px; background: var(--surface3); overflow: hidden; }
.conf-bar > span { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--grad); }
.conf-num { font-family: var(--mono); font-weight: 600; font-size: 11px; }
