/* CutBox admin: the CutBox black-and-white system (tokens from web/app.css). Light theme, monochrome only. */
:root {
  --bg: #ffffff; --bg-2: #f5f5f5; --bg-3: #ebebeb; --line: #e5e5e5; --line-2: #cfcfcf;
  --text: #0a0a0a; --muted: #6b6b6b; --accent: #0a0a0a; --accent-ink: #ffffff;
  --display: "Bricolage Grotesque", "Arial Black", system-ui, sans-serif;
  --sans: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --rule: 1.5px solid var(--text);
  --halftone: radial-gradient(circle at center, var(--text) 1px, transparent 1.5px);
  --hatch: repeating-linear-gradient(135deg, var(--text) 0 1px, transparent 1px 7px);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; min-height: 100vh; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
svg { display: block; }
::selection { background: var(--text); color: var(--bg); }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
em { font-style: normal; }

/* ---------- brand + top bar ---------- */
.brand { display: flex; align-items: center; gap: 8px; }
.mark { width: 18px; height: 18px; border: var(--rule); background: var(--halftone); background-size: 4px 4px; }
.word { font: 800 19px/1 var(--display); letter-spacing: -.02em; }
.tag { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; border: var(--rule); padding: 1px 6px; }
.brand.big .word { font-size: 30px; }
.brand.big .mark { width: 26px; height: 26px; }
.top {
  position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: var(--rule);
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; padding: 10px 20px;
}
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { text-decoration: none; padding: 7px 12px; font-weight: 600; white-space: nowrap; border: 1.5px solid transparent; }
.tabs a:hover { background: var(--bg-2); }
.tabs a[aria-current="page"] { border: var(--rule); background: var(--text); color: var(--bg); }
.controls { display: flex; gap: 8px; align-items: center; }
.sel select, .field input, .field select {
  border: var(--rule); border-radius: 0; background: var(--bg); padding: 7px 10px; min-height: 36px; width: 100%;
}
.sel select { width: auto; font-weight: 600; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 14px;
  border: var(--rule); border-radius: 0; background: var(--bg); font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: transform .12s ease, box-shadow .12s ease, background .15s;
}
.btn:hover { background: var(--bg-2); }
.btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: 3px 3px 0 var(--line-2); }
.btn.primary:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--text); }
.btn.ghost { border-color: transparent; }
.btn.ghost:hover { border-color: var(--text); }
.btn.sm { min-height: 30px; padding: 0 10px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: default; transform: none; box-shadow: none; }

/* ---------- gate ---------- */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 16px; background-image: var(--halftone); background-size: 14px 14px; }
.gate-card { width: min(420px, 100%); background: var(--bg); border: var(--rule); box-shadow: 6px 6px 0 var(--text); padding: 28px; display: grid; gap: 14px; }
.gate [hidden] { display: none !important; }
.signin-stack { display: grid; gap: 12px; }
.gsi-slot { min-height: 44px; display: flex; justify-content: center; }
.btn.apple { display: flex; align-items: center; justify-content: center; gap: 10px; width: 320px; max-width: 100%; min-height: 44px; margin: 0 auto; background: var(--text); color: var(--bg); border-color: var(--text); text-decoration: none; }
.btn.apple:hover { opacity: .9; background: var(--text); }
.or { display: flex; align-items: center; gap: 12px; font: 600 11px/1 var(--mono); color: var(--muted); letter-spacing: .1em; }
.or::before, .or::after { content: ""; flex: 1; height: 1.5px; background: var(--line-2); }
.breakglass { margin-top: 18px; border-top: 1.5px solid var(--line); padding-top: 10px; }
.breakglass summary { cursor: pointer; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.breakglass form { display: grid; gap: 10px; margin-top: 10px; }
.denied-title { font: 800 24px/1.1 var(--display); letter-spacing: -.02em; margin: 0 0 8px; }
#deniedEmail { overflow-wrap: anywhere; }
.who { font-size: 12px; color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.error { border: var(--rule); background: var(--bg-2); padding: 8px 10px; margin: 0; font-weight: 600; }

/* ---------- layout ---------- */
#view { padding: 20px; max-width: 1280px; margin: 0 auto; display: grid; gap: 20px; }
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; border-bottom: var(--rule); padding-bottom: 10px; }
.page-head h1 { font: 800 34px/1 var(--display); letter-spacing: -.03em; margin: 0; }
.page-head p { margin: 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.kpi { border: var(--rule); padding: 12px 14px; display: grid; gap: 2px; min-height: 92px; align-content: start; }
.kpi .k-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.kpi .k-value { font: 700 26px/1.15 var(--mono); letter-spacing: -.02em; overflow-wrap: anywhere; }
.kpi .k-value.multi { font-size: 18px; white-space: pre-line; }
.kpi .k-sub { font-size: 12px; color: var(--muted); }
.kpi.inv { background: var(--text); color: var(--bg); }
.kpi.inv .k-label, .kpi.inv .k-sub { color: #a8a8a8; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.card { border: var(--rule); padding: 14px 16px 16px; min-width: 0; display: grid; gap: 10px; align-content: start; }
.card h2 { font: 700 16px/1.2 var(--display); margin: 0; display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.card h2 small { font: 500 12px var(--sans); color: var(--muted); }
.card.wide { grid-column: 1 / -1; }
.empty { margin: 0; padding: 18px; text-align: center; color: var(--muted); border: 1.5px dashed var(--line-2); }
.note { font-size: 12px; color: var(--muted); margin: 0; }

/* ---------- charts ---------- */
.chart { width: 100%; height: 150px; color: var(--text); overflow: visible; }
.chart .bar { fill: var(--text); }
.chart .bar:hover, .chart .dot:hover { fill: var(--muted); }
.chart .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.chart .axis { stroke: var(--text); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.chart .line { fill: none; stroke: var(--text); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.chart .dot { fill: var(--bg); stroke: var(--text); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.chart .tick { font: 600 10px var(--mono); fill: var(--muted); }
.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.hb-row { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.hb-label { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-val { white-space: nowrap; font-size: 12px; }
.hb-bar { width: 100%; height: 6px; margin-top: 3px; }
.hb-bar .hb-bg { fill: var(--bg-3); }
.hb-bar .bar { fill: var(--text); }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border-bottom: var(--rule); }
td.num, th.num { text-align: right; font-family: var(--mono); }
.cohort td.c { text-align: center; font-family: var(--mono); font-size: 12px; min-width: 44px; }
.h0 { background: var(--bg); } .h1 { background: #f2f2f2; } .h2 { background: #e0e0e0; } .h3 { background: #c8c8c8; }
.h4 { background: #a8a8a8; } .h5 { background: #808080; color: #fff; } .h6 { background: #5a5a5a; color: #fff; }
.h7 { background: #3a3a3a; color: #fff; } .h8 { background: #1f1f1f; color: #fff; } .h9 { background: #0a0a0a; color: #fff; }

/* ---------- funnels ---------- */
.funnel { display: grid; gap: 6px; }
.f-step { display: grid; grid-template-columns: minmax(90px, 140px) 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.f-step .f-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.f-step .f-name.extra { color: var(--muted); font-weight: 500; }
.f-step svg { height: 18px; width: 100%; }
.f-step .f-bg { fill: var(--bg-3); }
.f-step .bar { fill: var(--text); }
.f-step .f-num { font-family: var(--mono); font-size: 12px; text-align: right; min-width: 120px; }
.drop { color: var(--text); font-weight: 700; }

/* ---------- hero stack ---------- */
.stack { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.hero-card { border: var(--rule); display: grid; grid-template-columns: 28px 128px 1fr auto; gap: 12px; padding: 10px; align-items: start; background: var(--bg); }
.hero-card.off { background: var(--bg-2); }
.hero-card.off .h-media { opacity: .5; }
.hero-card.dragging { opacity: .4; }
.hero-card.over { box-shadow: 0 -4px 0 var(--text); }
.h-handle { cursor: grab; display: grid; gap: 4px; justify-items: center; padding-top: 6px; user-select: none; }
.h-handle .dots { width: 12px; height: 20px; background: var(--halftone); background-size: 6px 6px; }
.h-pos { font: 700 12px var(--mono); }
.h-media { width: 128px; aspect-ratio: 16 / 9; border: var(--rule); background: var(--bg-3); background-image: var(--hatch); background-size: 8px 8px; overflow: hidden; }
.h-media img, .h-media video { width: 100%; height: 100%; object-fit: cover; display: block; background: var(--bg); }
.h-main { min-width: 0; display: grid; gap: 6px; }
.h-title { font: 700 16px/1.2 var(--display); margin: 0; overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font: 600 11px var(--mono); border: 1px solid var(--text); padding: 1px 6px; text-transform: uppercase; letter-spacing: .03em; }
.chip.solid { background: var(--text); color: var(--bg); }
.h-stats { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; }
.h-stats b { font: 700 14px var(--mono); display: block; }
.h-actions { display: grid; gap: 6px; justify-items: end; }
.h-actions .row { display: flex; gap: 4px; }

/* ---------- dialog sheet ---------- */
dialog.sheet { border: var(--rule); padding: 0; width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 24px); box-shadow: 8px 8px 0 var(--text); }
dialog.sheet::backdrop { background: rgba(255, 255, 255, .8); }
.sheet form { display: grid; grid-template-rows: auto 1fr auto; max-height: calc(100vh - 28px); }
.sheet-head, .sheet-foot { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: var(--rule); }
.sheet-foot { border-bottom: 0; border-top: var(--rule); justify-content: flex-end; }
.sheet-head h2 { font: 800 20px var(--display); margin: 0; }
.sheet-body { overflow-y: auto; padding: 16px; display: grid; gap: 14px; }
.field { display: grid; gap: 4px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > span, .field > legend { font-size: 12px; font-weight: 700; padding: 0; }
.upload { gap: 6px; }
.field input[type="file"] { border: 0; padding: 0; min-height: 0; width: auto; max-width: 100%; }
.up-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.up-status { font-size: 12px; color: var(--muted); }
progress { width: 100%; height: 6px; appearance: none; border: 0; background: var(--bg-3); }
progress::-webkit-progress-bar { background: var(--bg-3); }
progress::-webkit-progress-value { background: var(--text); }
progress::-moz-progress-bar { background: var(--text); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checks { display: flex; gap: 12px; flex-wrap: wrap; padding-top: 6px; }
.checks label, .switch { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; font-weight: 600; }
input[type="checkbox"] { accent-color: var(--text); width: 16px; height: 16px; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; font-weight: 600; z-index: 20; max-width: calc(100vw - 32px); }
.loading { padding: 40px; text-align: center; color: var(--muted); font-family: var(--mono); }

/* ---------- small screens ---------- */
@media (max-width: 1120px) {
  .top { grid-template-columns: 1fr auto; padding: 10px 16px; }
  .tabs { grid-column: 1 / -1; grid-row: 2; }
  .controls { grid-column: 2; grid-row: 1; flex-wrap: wrap; justify-content: flex-end; }
}
@media (max-width: 640px) {
  .who { display: none; }
  #view { padding: 16px; gap: 16px; }
  .page-head h1 { font-size: 28px; }
  .grid { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi .k-value { font-size: 20px; }
  .controls #refresh { display: none; }
  .hero-card { grid-template-columns: 22px 1fr; }
  .h-media { grid-column: 2; width: 100%; }
  .h-main, .h-actions { grid-column: 1 / -1; }
  .h-actions { justify-items: start; }
  .grid2 { grid-template-columns: 1fr; }
  .f-step { grid-template-columns: 1fr auto; }
  .f-step svg { grid-column: 1 / -1; grid-row: 2; }
}
