/* ThatOne admin, in the app's Clarity palette (ThatOne/Design/Theme.swift). */
:root {
  --paper: #f7f9f7;
  --ink: #173c36;
  --muted: #586c64;
  --line: #dce4df;
  --sea-glass: #d6e9de;
  --quiet: #e8eee9;
  --progress: #668f79;
  --surface: #fff;
  --forest: #0e2d29;
  --beacon: #ff9b45;
  --danger: #b0413e;
  --attention: #895c0a;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 20px; font-weight: 700; }
h1 span { color: var(--muted); font-weight: 500; }
h2 { font-size: 22px; }
h2.sub { font-size: 17px; margin: 28px 0 4px; }
h3.group { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin: 22px 0 10px; }
h3 { font-size: 14px; font-weight: 600; margin-bottom: 10px; }

.muted, .hint { color: var(--muted); }
.hint { font-weight: 400; font-size: 13px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px max(16px, calc((100vw - 1080px) / 2));
  background: var(--surface); border-bottom: 1px solid var(--line);
}

main { max-width: 1080px; margin: 0 auto; padding: 24px 16px 64px; }
main > section + section { margin-top: 48px; }

.heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px;
}

.periods { display: flex; gap: 4px; background: var(--sea-glass); padding: 3px; border-radius: 999px; }
.periods a {
  color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 600;
  padding: 5px 12px; border-radius: 999px;
}
.periods a[aria-current] { background: var(--ink); color: #fff; }

.totals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 16px 0; }
.total strong { display: block; font-size: 28px; font-variant-numeric: tabular-nums; }
.total span { color: var(--muted); font-size: 13px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 6px 4px; text-align: left; font-weight: 400; vertical-align: middle; }
thead th { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
tbody tr + tr th, tbody tr + tr td, .shares tr + tr th, .shares tr + tr td { border-top: 1px solid var(--line); }
.daily th[scope=row] { white-space: nowrap; }
.n, .pct { text-align: right; white-space: nowrap; }
.pct { color: var(--muted); width: 3.5em; }
.shares th { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { width: 40%; }

/* Opens per day: one series of columns, its value on hover or focus. */
.chart { margin: 8px 0 30px; }
.plot { display: grid; grid-template-columns: auto 1fr; gap: 10px; }
.axis {
  list-style: none; margin: 0; padding: 0; height: 220px;
  display: flex; flex-direction: column; justify-content: space-between;
  color: var(--muted); font-size: 12px; text-align: right; font-variant-numeric: tabular-nums;
}
/* Zero-height rows, so each label is centered on its gridline. */
.axis li { line-height: 0; }
.columns {
  list-style: none; margin: 0; padding: 0; height: 220px; position: relative;
  display: flex; align-items: flex-end; gap: 2px;
  border-bottom: 1px solid #b9c6bf;
  background:
    linear-gradient(var(--line), var(--line)) 0 0 / 100% 1px no-repeat,
    linear-gradient(var(--line), var(--line)) 0 50% / 100% 1px no-repeat;
}
.columns.days-90 { gap: 1px; }
.column {
  flex: 1 1 0; min-width: 0; height: 100%; position: relative;
  display: flex; align-items: flex-end; justify-content: center;
  border-radius: 4px 4px 0 0; outline: none;
}
.column:hover, .column:focus-visible { background: rgba(23, 60, 54, 0.06); }
.column:focus-visible { box-shadow: inset 0 0 0 2px var(--progress); }
.col-bar {
  position: relative; display: block; width: 100%; max-width: 24px;
  background: #2f8a5b; border-radius: 4px 4px 0 0;
}
.col-bar:not(.h0) { min-height: 2px; }
.column:hover .col-bar, .column:focus-visible .col-bar { background: #236e48; }
.tip {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); z-index: 5;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 10px;
  padding: 7px 10px; white-space: nowrap; font-size: 13px; line-height: 1.35;
  box-shadow: 0 6px 18px rgba(14, 45, 41, 0.14);
  opacity: 0; pointer-events: none; transition: opacity 0.12s;
}
.tip.start { left: 0; transform: none; }
.tip.end { left: auto; right: 0; transform: none; }
.tip strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.tip span { display: block; color: var(--muted); font-size: 12px; }
.column:hover .tip, .column:focus-visible .tip { opacity: 1; }
.date {
  position: absolute; top: calc(100% + 7px); left: 50%; transform: translateX(-50%);
  color: var(--muted); font-size: 12px; white-space: nowrap;
}
.as-table summary { color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; }
.as-table table { margin-top: 8px; }

progress {
  appearance: none; -webkit-appearance: none; display: block;
  width: 100%; height: 8px; border: 0; border-radius: 4px; background: var(--quiet); overflow: hidden;
}
progress::-webkit-progress-bar { background: var(--quiet); border-radius: 4px; }
progress::-webkit-progress-value { background: var(--progress); border-radius: 4px; }
progress::-moz-progress-bar { background: var(--progress); border-radius: 4px; }

.badge { font-size: 13px; font-weight: 700; padding: 4px 12px; border-radius: 999px; }
.badge.on { background: var(--sea-glass); color: var(--ink); }
.badge.on::before { content: "● "; color: #2f8a5b; }
.badge.off { background: var(--quiet); color: var(--muted); }

.campaign { display: grid; grid-template-columns: 300px 1fr; gap: 24px; align-items: start; margin-top: 16px; }

.preview {
  position: relative; aspect-ratio: 9 / 16; width: 100%; overflow: hidden;
  border-radius: 28px; background: #000; border: 6px solid var(--forest);
}
.preview iframe, .preview img { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; object-fit: cover; }
.preview .close {
  position: absolute; top: 12px; right: 12px; width: 30px; height: 30px; border-radius: 50%;
  background: rgba(0, 0, 0, 0.45); color: #fff; display: grid; place-items: center; font-size: 18px;
  pointer-events: none;
}
.preview .cta {
  position: absolute; left: 14px; right: 14px; bottom: 16px; padding: 13px; text-align: center;
  background: #fff; color: var(--ink); border-radius: 14px; font-weight: 600; text-decoration: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.settings .switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.settings .switch p { margin: 0; }
.edit { display: grid; gap: 6px; padding-top: 16px; }
.edit label:not(.radio) { font-weight: 600; font-size: 14px; margin-top: 10px; }
fieldset { border: 0; padding: 0; margin: 0; display: flex; gap: 20px; align-items: center; }
legend { font-weight: 600; font-size: 14px; float: left; margin-right: 8px; }
.radio { display: flex; gap: 6px; align-items: center; }

input[type=text], input[type=url], input[type=number], input[type=password] {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px;
}
input:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--progress); outline-offset: 2px; }
input[type=radio] { accent-color: var(--ink); width: 18px; height: 18px; margin: 0; }

button {
  font: inherit; font-weight: 600; color: #fff; background: var(--ink); border: 0; border-radius: 14px;
  padding: 12px 20px; cursor: pointer; min-height: 44px;
}
button:hover { opacity: 0.88; }
button.secondary { background: var(--surface); color: var(--danger); border: 1px solid var(--line); }
button.link { background: none; color: var(--muted); padding: 8px; min-height: 0; }
.edit button { margin-top: 14px; justify-self: start; }

.error { color: var(--danger); font-weight: 600; margin: 8px 0; }
.ok { background: var(--sea-glass); border-radius: 12px; padding: 10px 14px; margin: 10px 0; font-weight: 600; }

body.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.card.narrow { width: min(360px, 100%); padding: 28px; }
.login h1 { margin-bottom: 20px; text-align: center; }
.login form { display: grid; gap: 8px; }
.login label { font-weight: 600; font-size: 14px; }
.login button { margin-top: 8px; }

@media (max-width: 760px) {
  .totals { grid-template-columns: repeat(2, 1fr); }
  .campaign { grid-template-columns: 1fr; }
  .preview { width: min(280px, 100%); margin: 0 auto; }
  .plot .axis, .columns { height: 160px; }
  .grid { grid-template-columns: 1fr; }
}

/* Column heights, generated in admin.go. */
.h0{height:0%}.h1{height:1%}.h2{height:2%}.h3{height:3%}.h4{height:4%}.h5{height:5%}.h6{height:6%}.h7{height:7%}.h8{height:8%}.h9{height:9%}.h10{height:10%}.h11{height:11%}.h12{height:12%}.h13{height:13%}.h14{height:14%}.h15{height:15%}.h16{height:16%}.h17{height:17%}.h18{height:18%}.h19{height:19%}.h20{height:20%}.h21{height:21%}.h22{height:22%}.h23{height:23%}.h24{height:24%}.h25{height:25%}.h26{height:26%}.h27{height:27%}.h28{height:28%}.h29{height:29%}.h30{height:30%}.h31{height:31%}.h32{height:32%}.h33{height:33%}.h34{height:34%}.h35{height:35%}.h36{height:36%}.h37{height:37%}.h38{height:38%}.h39{height:39%}.h40{height:40%}.h41{height:41%}.h42{height:42%}.h43{height:43%}.h44{height:44%}.h45{height:45%}.h46{height:46%}.h47{height:47%}.h48{height:48%}.h49{height:49%}.h50{height:50%}.h51{height:51%}.h52{height:52%}.h53{height:53%}.h54{height:54%}.h55{height:55%}.h56{height:56%}.h57{height:57%}.h58{height:58%}.h59{height:59%}.h60{height:60%}.h61{height:61%}.h62{height:62%}.h63{height:63%}.h64{height:64%}.h65{height:65%}.h66{height:66%}.h67{height:67%}.h68{height:68%}.h69{height:69%}.h70{height:70%}.h71{height:71%}.h72{height:72%}.h73{height:73%}.h74{height:74%}.h75{height:75%}.h76{height:76%}.h77{height:77%}.h78{height:78%}.h79{height:79%}.h80{height:80%}.h81{height:81%}.h82{height:82%}.h83{height:83%}.h84{height:84%}.h85{height:85%}.h86{height:86%}.h87{height:87%}.h88{height:88%}.h89{height:89%}.h90{height:90%}.h91{height:91%}.h92{height:92%}.h93{height:93%}.h94{height:94%}.h95{height:95%}.h96{height:96%}.h97{height:97%}.h98{height:98%}.h99{height:99%}.h100{height:100%}
