/* ==========================================================================
   BrandCop — core design system.
   Single brand voltage = BrandCop orange-red (#ff4b26). White canvas, ink text, soft radii,
   one shadow tier. Inter is self-hosted so the UI renders consistently on Render.
   Token NAMES are retained from the prior system so component CSS resolves;
   every VALUE is remapped to the Airbnb tokens. No inline styles anywhere —
   dynamic values arrive through CSS custom properties via the CSSOM.
   ========================================================================== */

@font-face {
  font-family: "BrandCop Inter";
  src: url("/static/fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* type */
  --display: "BrandCop Inter", Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --text:    "BrandCop Inter", Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono:    ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* surfaces */
  --canvas: #ffffff;
  --parchment: #f7f7f7;     /* surface-soft */
  --parchment-2: #f2f2f2;   /* surface-strong */

  /* ink ramp */
  --ink: #222222;
  --body: #3f3f3f;
  --muted: #6a6a6a;
  --muted-soft: #929292;
  --faint: #6a6a6a;         /* AA-safe tertiary on white */

  /* hairlines */
  --hairline: #dddddd;
  --hairline-strong: #c1c1c1;

  /* brand voltage — BrandCop wordmark */
  --accent: #ff4b26;
  --accent-active: #df3517;
  --accent-disabled: #ffd5ca;
  --accent-focus: #222222;  /* focus = ink */
  --ring: rgba(34,34,34,.16);
  --accent-dim: rgba(255,75,38,.08);

  /* severity — drawn ONLY from documented Airbnb tokens.
     text = token colour, bg = dim tint, border = hairline tint. */
  --high: #c13515; --high-dim: rgba(193,53,21,.07);  --high-line: rgba(193,53,21,.20);   /* off-brand / critical */
  --med:  #222222; --med-dim:  #f7f7f7;              --med-line:  #c1c1c1;               /* needs review (neutral) */
  --low:  #6a6a6a; --low-dim:  #f7f7f7;              --low-line:  #dddddd;               /* scheduled (neutral)   */
  --ok:   #222222; --ok-dim:   #f7f7f7;              --ok-line:   #dddddd;               /* on-brand (neutral ink)*/
  --ai:   #460479; --ai-dim:   rgba(70,4,121,.06);   --ai-line:   rgba(70,4,121,.18);    /* likely AI (Luxe)      */
  --copy: #92174d; --copy-dim: rgba(146,23,77,.06);  --copy-line: rgba(146,23,77,.18);   /* copy risk (Plus)      */
  --error: #c13515; --error-hover: #b32505;
  --legal: #428bff;

  /* radii (Airbnb shape language) */
  --radius-card: 14px;      /* rounded.md — cards            */
  --radius-input: 8px;      /* rounded.sm — buttons & inputs */
  --radius-wizard: 20px;    /* rounded.lg — marquee surfaces */
  --radius-pill: 9999px;    /* rounded.full                  */

  /* elevation — flat baseline + ONE shadow tier */
  --shadow-1: 0 0 0 1px rgba(0,0,0,.03);
  --shadow-2: rgba(0,0,0,.02) 0 0 0 1px, rgba(0,0,0,.04) 0 2px 6px 0, rgba(0,0,0,.1) 0 4px 8px 0;
  --shadow-3: rgba(0,0,0,.02) 0 0 0 1px, rgba(0,0,0,.04) 0 2px 6px 0, rgba(0,0,0,.1) 0 4px 8px 0;

  --maxw: 1280px;
  --gap: 16px;

  --chevron: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' stroke='%236a6a6a' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  --cal-ico: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 18 18' fill='none'><rect x='2.5' y='3.5' width='13' height='12' rx='2.5' stroke='%236a6a6a' stroke-width='1.4'/><path d='M2.5 7h13M6 2v3M12 2v3' stroke='%236a6a6a' stroke-width='1.4' stroke-linecap='round'/></svg>");
  --ph-stripe: repeating-linear-gradient(45deg, #f2f2f2 0 8px, #ebebeb 8px 16px);
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--text);
  color: var(--ink);
  background: var(--canvas);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { font-family: var(--display); margin: 0; line-height: 1.2; letter-spacing: -0.01em; font-weight: 600; }
p { margin: 0; }
button { font: inherit; color: inherit; }
a { color: var(--ink); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
ol, ul { margin: 0; padding: 0; list-style: none; }
input, textarea, select { font: inherit; color: inherit; }

/* ---------- accessibility ---------- */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
  border-radius: 4px;
}
.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 200;
  background: var(--canvas); color: var(--ink); padding: 10px 16px;
  border-radius: var(--radius-input); box-shadow: var(--shadow-2);
  transition: top .16s ease;
}
.skip-link:focus { top: 12px; text-decoration: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- layout primitives ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 40px; }
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--mono); }
.eyebrow {
  font-size: 13px; font-weight: 600; letter-spacing: 0; text-transform: none;
  color: var(--muted);
}
.hidden, [hidden] { display: none !important; }

/* ---------- brandmark ---------- */
.brandmark { display: inline-flex; align-items: center; gap: 8px; color: var(--accent); flex: 0 0 auto; }
.brandmark:hover { text-decoration: none; }
.brandmark .mark {
  width: 148px; height: 32px; flex: 0 0 auto;
  object-fit: contain; object-position: center;
}
.brandmark .word {
  font-family: var(--display); font-weight: 700; font-size: 22px;
  letter-spacing: -0.02em; color: var(--accent);
}

/* ---------- topbar / nav (Airbnb: 80px white, bottom hairline) ---------- */
.topbar {
  position: sticky; top: 0; z-index: 60;
  background: var(--canvas);
  border-bottom: 1px solid var(--hairline);
}
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; min-width: 0; gap: 16px; }
.topnav {
  display: flex; align-items: center; justify-content: flex-end; gap: 6px;
  flex: 1 1 auto; min-width: 0; overflow-x: auto; overscroll-behavior-inline: contain;
  scrollbar-width: none;
}
.topnav::-webkit-scrollbar { display: none; }
.topnav a {
  white-space: nowrap;
  color: var(--ink); padding: 10px 12px; border-radius: var(--radius-pill);
  font-size: 16px; font-weight: 600; transition: background .12s ease;
}
.topnav a:hover { background: var(--parchment); text-decoration: none; }
.topnav a[aria-current="page"] { color: var(--ink); position: relative; }
.topnav a[aria-current="page"]::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px;
  background: var(--ink); border-radius: 2px;
}
/* account pill — Airbnb hamburger+avatar capsule */
.topnav .op {
  display: inline-flex; align-items: center; gap: 8px; margin-left: 8px;
  padding: 5px 6px 5px 14px; border-radius: var(--radius-pill);
  background: var(--canvas); border: 1px solid var(--hairline); font-size: 14px; font-weight: 500;
  transition: box-shadow .14s ease;
}
.topnav .op:hover { box-shadow: var(--shadow-2); }
.topnav .op .avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--ink);
  color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 12px;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: var(--radius-input);
  border: 1px solid var(--hairline); background: var(--canvas); color: var(--ink);
  font-weight: 500; font-size: 16px; cursor: pointer; line-height: 1.25;
  transition: background .12s ease, border-color .12s ease, box-shadow .14s ease, color .12s ease;
}
.btn:hover { background: var(--parchment); border-color: var(--hairline-strong); text-decoration: none; }
.btn, .btn:hover, .btn:focus { text-decoration: none; }
.btn .ico { width: 16px; height: 16px; flex: 0 0 auto; }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-active); border-color: var(--accent-active); }
.btn.ghost { background: var(--canvas); border-color: var(--ink); }
.btn.ghost:hover { background: var(--parchment); border-color: var(--ink); }
.btn.quiet { background: transparent; border-color: transparent; color: var(--ink); padding: 10px 12px; }
.btn.quiet:hover { background: var(--parchment); text-decoration: none; }
.btn.danger { color: var(--error); background: var(--canvas); border-color: var(--high-line); }
.btn.danger:hover { background: var(--high-dim); border-color: var(--error); }
.btn.lg { padding: 14px 26px; font-size: 16px; height: 48px; }
.btn.sm { padding: 9px 15px; font-size: 14px; }
.btn[disabled] { background: var(--accent-disabled); border-color: var(--accent-disabled); color: #fff; pointer-events: none; }
.btn.ghost[disabled], .btn:not(.primary)[disabled] { background: var(--canvas); color: var(--muted-soft, #929292); border-color: var(--hairline); opacity: 1; }
.btn-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* press / "down" state — darkens beyond hover (Spectrum) */
.btn:active { background: var(--parchment-2); }
.btn.primary:active { background: var(--accent-active); filter: brightness(0.93); }
.btn.ghost:active, .btn.quiet:active { background: var(--parchment-2); }
.btn.danger:active { background: var(--high-dim); }

/* pending / loading state — non-interactive, shows a spinner (Spectrum) */
.btn.is-loading, .orb.is-loading { pointer-events: none; position: relative; color: transparent !important; }
.btn.is-loading > *, .orb.is-loading > * { visibility: hidden; }
.btn.is-loading::after, .orb.is-loading::after {
  content: ""; position: absolute; top: 50%; left: 50%; width: 16px; height: 16px;
  margin: -8px 0 0 -8px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.45); border-top-color: #fff;
  animation: btn-spin .7s linear infinite;
}
.btn.is-loading:not(.primary)::after { border-color: rgba(34,34,34,.25); border-top-color: var(--ink); }
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* icon-only — Airbnb circular control */
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px;
  border-radius: var(--radius-pill); border: 1px solid transparent; background: transparent;
  color: var(--ink); cursor: pointer; transition: background .12s, border-color .12s;
}
.icon-btn:hover { background: var(--parchment); }
.icon-btn svg { width: 17px; height: 17px; }

/* ---------- inputs ---------- */
.field { display: flex; flex-direction: column; gap: 7px; }
.field > label, .label {
  font-size: 14px; font-weight: 600; color: var(--ink);
}
.field .hint { font-size: 13px; color: var(--muted); }
.input, .textarea, .select {
  width: 100%; padding: 13px 14px; background: var(--canvas);
  border: 1px solid var(--hairline-strong); border-radius: var(--radius-input);
  color: var(--ink); font-size: 16px; transition: border-color .12s ease, box-shadow .12s ease;
}
.input::placeholder, .textarea::placeholder { color: var(--muted); }
/* focus: border thickens to ink, no colour glow (Airbnb rule) */
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink);
}
.textarea { resize: vertical; min-height: 96px; line-height: 1.5; }
.select { appearance: none; -webkit-appearance: none; background-image: var(--chevron); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }
.input-with-icon { position: relative; }
.input-with-icon .lead { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
.input-with-icon .input { padding-left: 42px; }

/* segmented control — selected = white pill on soft track */
.segmented { display: inline-flex; padding: 4px; background: var(--parchment); border-radius: var(--radius-pill); gap: 4px; }
.segmented label {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: var(--radius-pill); cursor: pointer; font-size: 14px; font-weight: 500;
  color: var(--muted); transition: color .12s; user-select: none;
}
.segmented input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segmented label:has(input:checked) { background: var(--canvas); color: var(--ink); box-shadow: var(--shadow-2); }
.segmented label:has(input:focus-visible) { outline: 2px solid var(--accent-focus); outline-offset: 2px; }

/* toggle switch — on = ink (Airbnb) */
.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch .track {
  width: 44px; height: 26px; border-radius: 999px; background: #c1c1c1;
  position: relative; transition: background .16s; flex: 0 0 auto;
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(24,44,89,.14), 0 2px 4px rgba(24,44,89,.14); transition: transform .16s;
}
.switch input:checked + .track { background: var(--ink); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent-focus); outline-offset: 2px; }

/* ---------- generic card ---------- */
.card {
  background: var(--canvas); border: 1px solid var(--hairline);
  border-radius: var(--radius-card); box-shadow: none;
}
.panel {
  background: var(--canvas); border: 1px solid var(--hairline);
  border-radius: var(--radius-card); box-shadow: none; padding: 24px;
}
.panel-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.panel-head h2 { font-size: 21px; font-weight: 700; }
.panel-head .sub { font-size: 14px; color: var(--muted); margin-top: 4px; }

/* ---------- severity chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 600; letter-spacing: 0; white-space: nowrap;
  border: 1px solid transparent;
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.chip.s-high   { background: var(--high-dim); color: var(--high); border-color: var(--high-line); }
.chip.s-ai     { background: var(--ai-dim);   color: var(--ai);   border-color: var(--ai-line); }
.chip.s-copy   { background: var(--copy-dim); color: var(--copy); border-color: var(--copy-line); }
.chip.s-review { background: var(--parchment); color: var(--ink);   border-color: var(--hairline-strong); }
.chip.s-med    { background: var(--parchment); color: var(--ink);   border-color: var(--hairline-strong); }
.chip.s-ok     { background: var(--parchment); color: var(--muted); border-color: var(--hairline); }
.chip.s-low    { background: var(--parchment); color: var(--muted); border-color: var(--hairline); }
.chip.neutral  { background: var(--parchment); color: var(--muted); border-color: var(--hairline); }

/* status badge (runs) */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px;
  border-radius: var(--radius-pill); font-size: 13px; font-weight: 600; border: 1px solid transparent;
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.s-running { background: var(--accent-dim); color: var(--accent); border-color: rgba(255,75,38,.20); }
.badge.s-running .dot { animation: pulse 1.4s ease-in-out infinite; }
.badge.s-done { background: var(--parchment); color: var(--ink); border-color: var(--hairline); }
.badge.s-failed { background: var(--parchment); color: var(--high); border-color: var(--hairline); }
.badge.s-scheduled { background: var(--parchment); color: var(--ink); border-color: var(--hairline-strong); }
.badge.s-paused { background: var(--parchment); color: var(--muted); border-color: var(--hairline); }
.badge.s-queued { background: var(--parchment); color: var(--muted); border-color: var(--hairline); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

/* ---------- progress ---------- */
.progress { height: 6px; border-radius: 999px; background: var(--parchment-2); overflow: hidden; }
.progress-fill {
  height: 100%; border-radius: 999px; width: var(--p, 0%);
  background: var(--accent);
  transition: width .5s cubic-bezier(.22,.61,.36,1);
}

/* ---------- divider / misc ---------- */
.hr { height: 1px; background: var(--hairline); border: 0; margin: 18px 0; }
.kbd {
  font-family: var(--mono); font-size: 11.5px; padding: 2px 6px; border-radius: 6px;
  background: var(--parchment); border: 1px solid var(--hairline-strong); color: var(--muted);
}
.tag {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: var(--radius-pill);
  background: var(--canvas); border: 1px solid var(--hairline); font-size: 13px; color: var(--body);
}

/* buttons never wrap their label */
.btn { white-space: nowrap; }
