/* AdForge admin. Every colour comes from the tokens below (docs/DESIGN.md). Dark "iron" is the default; light is "paper and iron". */
@font-face { font-family: 'Unbounded'; src: url('/fonts/unbounded.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Manrope'; src: url('/fonts/manrope.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('/fonts/jetbrainsmono.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #11161C;
  --bg-rail: #0D1116;
  --surface: #1A2029;
  --surface-2: #222A35;
  --line: #2A3340;
  --line-2: #354151;
  --ink: #F2F4F6;
  --ink-2: #9DA8B6;
  --accent: #FF8A3D;
  --accent-ink: #1B0C03;
  --accent-soft: #2E1E12;
  --heat: linear-gradient(90deg, #FFB020, #FF5A1F);
  --stage: #090C10;
  --good: #5FD68F;
  --good-bg: #173A27;
  --warn: #F2C14E;
  --warn-bg: #3A2F12;
  --bad: #FF8A8A;
  --bad-bg: #3A1A1A;
  --radius: 8px;
  --radius-card: 14px;
  --shadow: 0 30px 80px rgba(0, 0, 0, .55);
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Unbounded', 'Manrope', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
}
[data-theme="light"] {
  color-scheme: light;
  --bg: #F4F1EA;
  --bg-rail: #ECE8DF;
  --surface: #FFFFFF;
  --surface-2: #EBE7DE;
  --line: #D9D4C8;
  --line-2: #C8C2B4;
  --ink: #171A1F;
  --ink-2: #5B6472;
  --accent: #E8631B;
  --accent-ink: #FFFFFF;
  --accent-soft: #FDEBDD;
  --heat: linear-gradient(90deg, #F2A300, #E8511B);
  --stage: #22252B;
  --good: #1F8A4C;
  --good-bg: #DFF3E6;
  --warn: #A86A00;
  --warn-bg: #FBF0D5;
  --bad: #C73C3C;
  --bad-bg: #FBE1E1;
  --radius: 8px;
  --radius-card: 14px;
  --shadow: 0 30px 80px rgba(23, 26, 31, .25);
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Unbounded', 'Manrope', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) { color-scheme: light; --bg: #F4F1EA; --bg-rail: #ECE8DF; --surface: #FFFFFF; --surface-2: #EBE7DE; --line: #D9D4C8; --line-2: #C8C2B4; --ink: #171A1F; --ink-2: #5B6472; --accent: #E8631B; --accent-ink: #FFFFFF; --accent-soft: #FDEBDD; --heat: linear-gradient(90deg, #F2A300, #E8511B); --stage: #22252B; --good: #1F8A4C; --good-bg: #DFF3E6; --warn: #A86A00; --warn-bg: #FBF0D5; --bad: #C73C3C; --bad-bg: #FBE1E1; --shadow: 0 30px 80px rgba(23, 26, 31, .25); }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; line-height: 1.15; }
h1 { font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 800; }
.muted { color: var(--ink-2); }
.small { font-size: 12px; }
.mono { font-family: var(--font-mono); font-size: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* layout */
.layout { display: flex; flex-wrap: wrap; min-height: 100vh; }
.sidebar { flex: 0 0 232px; padding: 20px 16px; border-right: 1px solid var(--line); background: var(--bg-rail); display: flex; flex-direction: column; gap: 6px; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; font-family: var(--font-display); font-weight: 700; font-size: 15px; color: var(--ink); text-decoration: none; }
.sidebar .logo, .logo { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: inline-grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 16px; }
.sidebar a.nav { display: block; padding: 10px 12px; border-radius: 10px; color: var(--ink-2); text-decoration: none; font-weight: 600; }
.sidebar a.nav.active { color: var(--ink); background: var(--surface-2); }
.sidebar .spacer { flex: 1 1 auto; }
.content { flex: 999 1 560px; min-width: 0; padding: 24px 28px; display: flex; flex-direction: column; gap: 20px; }
.topbar { display: none; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--bg-rail); }
.topbar strong { font-family: var(--font-display); font-weight: 700; font-size: 15px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.page-head .title { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.page-head .eyebrow { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 960px) { .two, .grid4, .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) {
  .sidebar { display: none; position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 20; }
  .sidebar.open { display: flex; }
  .topbar { display: flex; }
  .content { padding: 16px; }
  .two, .grid4, .grid3 { grid-template-columns: 1fr; }
}

/* components */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 18px; }
.card.kpi { display: flex; flex-direction: column; gap: 6px; }
.card.kpi .v { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.card.kpi .l { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.stage { background: var(--stage); border: 1px solid var(--line); border-top: 2px solid var(--accent); border-radius: var(--radius-card); padding: 24px; display: flex; justify-content: center; }
.btn { height: 40px; padding: 0 14px; border-radius: var(--radius); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 800; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.icon { width: 40px; padding: 0; justify-content: center; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field > span.label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
input[type=text], input[type=url], input[type=email], input[type=password], input[type=number], input[type=tel], select, textarea { width: 100%; height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg); color: var(--ink); font: inherit; font-size: 14px; }
textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; }
input[type=range] { accent-color: var(--accent); width: 100%; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); font-size: 12px; font-weight: 700; }
.pill.ok { background: var(--good-bg); color: var(--good); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.banner { padding: 12px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); line-height: 1.5; }
.banner.warn { background: var(--warn-bg); color: var(--ink); }
.progress { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--heat); }
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.toast { position: fixed; right: 16px; bottom: 16px; z-index: 50; padding: 10px 14px; border-radius: 10px; background: var(--ink); color: var(--bg); font-weight: 600; box-shadow: var(--shadow); }
.toast.bad { background: var(--bad); color: var(--ink); }
.scenes { display: flex; gap: 6px; }
.scenes button { min-width: 0; height: 54px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); font: inherit; font-weight: 600; cursor: pointer; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; }
.scenes button[aria-current="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); box-shadow: inset 0 2px 0 var(--warn); }
.scenes button > span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scenes button .t { font-family: var(--font-mono); font-size: 11px; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; }
.photo-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.photo-grid .ph { width: 84px; height: 84px; border-radius: 10px; object-fit: cover; border: 2px solid transparent; }
.photo-grid .ph.hero { border-color: var(--accent); }
.choice { display: flex; gap: 8px; flex-wrap: wrap; }
.choice button { flex: 1 1 0; min-width: 72px; height: 64px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg); color: var(--ink-2); font: inherit; font-weight: 700; cursor: pointer; }
.choice button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.lib { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.lib article { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); overflow: hidden; display: flex; flex-direction: column; }
.lib .poster { height: 240px; background: var(--stage); object-fit: cover; width: 100%; display: block; }
.lib .meta { padding: 14px; display: flex; flex-direction: column; gap: 8px; }
