/* RepeatBook. One family (Schibsted Grotesk), one loud thing: the repeat strip (a row of ticks, one per upcoming date). */
@import url("https://fonts.googleapis.com/css2?family=Schibsted+Grotesk:wght@400;500;600;700;800&display=swap");
:root {
  --ink: #14202b; --soft: #55626d; --page: #f4f6f3; --card: #fff; --rule: #dce2dc;
  --repeat: #0f6e62; --repeat-deep: #0a5249; --repeat-wash: #e3f0ec;
  --skip: #a3aca7; --warn: #a96300; --warn-wash: #fbf0de; --stop: #b33a3a; --stop-wash: #f8e5e4;
  --r: 10px; --font: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.5 var(--font); color: var(--ink); background: var(--page); font-variant-numeric: tabular-nums; }
a { color: var(--repeat-deep); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0 0 12px; }
.muted { color: var(--soft); }
.small { font-size: 13px; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--repeat) 55%, transparent); outline-offset: 2px; }

/* Shell */
.top { display: flex; align-items: center; gap: 16px; padding: 14px 24px; background: var(--card); border-bottom: 1px solid var(--rule); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; }
.brand svg { width: 26px; height: 26px; }
.plan { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--repeat-wash); color: var(--repeat-deep); }
.tabs { display: flex; gap: 2px; margin-left: 12px; flex-wrap: wrap; }
.tabs button { font: 600 14px var(--font); border: 0; background: none; color: var(--soft); padding: 8px 12px; border-radius: 8px; cursor: pointer; }
.tabs button[aria-selected="true"] { color: var(--ink); background: var(--page); box-shadow: inset 0 -2px 0 var(--repeat); }
.top .right { margin-left: auto; display: flex; gap: 10px; align-items: center; }
main { padding: 24px; max-width: 1180px; margin: 0 auto; }
.head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.head .grow { flex: 1; min-width: 240px; }
.head p { margin: 4px 0 0; color: var(--soft); }

/* Controls */
.btn { text-decoration: none; font: 600 14px var(--font); border: 1px solid var(--rule); background: var(--card); color: var(--ink); padding: 9px 14px; border-radius: 8px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; min-height: 38px; }
.btn:hover { border-color: #b9c2bb; }
.btn.go { background: var(--repeat); border-color: var(--repeat); color: #fff; }
.btn.go:hover { background: var(--repeat-deep); }
.btn.stop { color: var(--stop); }
.btn.stop.solid { background: var(--stop); border-color: var(--stop); color: #fff; }
.btn.quiet { border-color: transparent; background: none; color: var(--repeat-deep); padding-inline: 8px; }
.btn:disabled { opacity: .5; cursor: default; }
.f { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--soft); }
input, select, textarea { font: 15px var(--font); color: var(--ink); border: 1px solid var(--rule); border-radius: 8px; padding: 8px 10px; background: #fff; min-height: 38px; width: 100%; }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; accent-color: var(--repeat); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1 1 160px; }
.row > .fit { flex: 0 0 auto; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--ink); font-weight: 500; }
.days { display: flex; gap: 4px; }
.days label { flex: 1; text-align: center; border: 1px solid var(--rule); border-radius: 8px; padding: 7px 0; font-weight: 600; font-size: 13px; cursor: pointer; background: #fff; }
.days input { position: absolute; opacity: 0; pointer-events: none; }
.days label:has(input:checked) { background: var(--repeat); border-color: var(--repeat); color: #fff; }
.days label:has(input:focus-visible) { outline: 3px solid color-mix(in srgb, var(--repeat) 55%, transparent); }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; background: #fff; }
.seg label { padding: 7px 12px; font-size: 13px; font-weight: 600; cursor: pointer; border-right: 1px solid var(--rule); }
.seg label:last-child { border-right: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--ink); color: #fff; }

/* Panels */
.panel { background: var(--card); border: 1px solid var(--rule); border-radius: var(--r); padding: 18px; }
.panel + .panel { margin-top: 16px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 860px) { .grid2 { grid-template-columns: 1fr; } .top { flex-wrap: wrap; } .tabs { margin-left: 0; } }
.stack > * + * { margin-top: 14px; }
.note { padding: 10px 12px; border-radius: 8px; background: var(--repeat-wash); font-size: 14px; }
.note.warn { background: var(--warn-wash); }
.note.stop { background: var(--stop-wash); }
.empty { text-align: center; padding: 40px 16px; color: var(--soft); }
.empty h2 { color: var(--ink); margin-bottom: 6px; }

/* Series list: a ruled list; each row ends in its repeat strip */
.list { background: var(--card); border: 1px solid var(--rule); border-radius: var(--r); }
.item { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(200px, 1.6fr) auto; gap: 16px; align-items: center; padding: 14px 18px; border-top: 1px solid var(--rule); cursor: pointer; }
.item:first-child { border-top: 0; }
.item:hover { background: #fafbf9; }
.item .who { font-weight: 700; }
.item .rule { font-size: 14px; }
.item .next { font-size: 13px; color: var(--soft); }
.item .state { justify-self: start; }
.item.ended { opacity: .6; }
@media (max-width: 700px) { .item { grid-template-columns: 1fr; gap: 6px; } }

/* The repeat strip */
.strip { display: flex; gap: 5px; align-items: flex-end; }
.tick { width: 22px; display: grid; justify-items: center; gap: 3px; font-size: 10px; color: var(--soft); font-weight: 600; }
.tick i { display: block; width: 14px; height: 22px; border-radius: 4px; background: var(--repeat); }
.tick.skipped i { background: none; border: 2px solid var(--skip); position: relative; }
.tick.skipped i::after { content: ""; position: absolute; inset: -2px; background: linear-gradient(to top right, transparent 45%, var(--skip) 45% 55%, transparent 55%); }
.tick.conflict i { background: var(--warn); }
.tick.moved i { background: none; border: 2px dashed var(--repeat); }
.strip.big .tick { width: 30px; font-size: 11px; }
.strip.big .tick i { width: 20px; height: 34px; }

/* Occurrence table (series detail, bulk, batch, jobs) */
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
.t th { text-align: left; font-weight: 600; color: var(--soft); font-size: 13px; padding: 8px 10px; border-bottom: 1px solid var(--rule); }
.t td { padding: 9px 10px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t td.when { font-weight: 700; white-space: nowrap; }
.t td.act { text-align: right; white-space: nowrap; }
.state { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--repeat-wash); color: var(--repeat-deep); white-space: nowrap; }
.state.skipped, .state.ended, .state.undone { background: #eceeec; color: var(--soft); }
.state.conflict, .state.queued, .state.running { background: var(--warn-wash); color: var(--warn); }
.state.failed, .state.cancelled { background: var(--stop-wash); color: var(--stop); }
.scroll { max-height: 460px; overflow: auto; }

/* Drawer + dialog */
.drawer { position: fixed; inset: 0 0 0 auto; width: min(560px, 100vw); background: var(--card); border-left: 1px solid var(--rule); box-shadow: -16px 0 40px #14202b1f; z-index: 20; display: flex; flex-direction: column; }
.drawer header { padding: 18px 20px; border-bottom: 1px solid var(--rule); display: flex; gap: 12px; align-items: flex-start; }
.drawer header .grow { flex: 1; }
.drawer .body { padding: 18px 20px; overflow: auto; flex: 1; }
.scrim { position: fixed; inset: 0; background: #14202b40; z-index: 19; }
dialog { border: 0; border-radius: 12px; padding: 0; width: min(460px, calc(100vw - 32px)); box-shadow: 0 20px 50px #14202b40; color: var(--ink); }
dialog::backdrop { background: #14202b55; }
dialog form { padding: 20px; display: grid; gap: 14px; }
dialog .acts { display: flex; gap: 8px; justify-content: flex-end; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 600; z-index: 40; max-width: calc(100vw - 32px); }
.toast.bad { background: var(--stop); }

/* Picker (contact search) */
.pick { position: relative; }
.pick ul { position: absolute; left: 0; right: 0; top: 100%; margin: 4px 0 0; padding: 4px; list-style: none; background: #fff; border: 1px solid var(--rule); border-radius: 8px; box-shadow: 0 8px 24px #14202b1f; z-index: 8; max-height: 260px; overflow: auto; }
.pick li { padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.pick li:hover, .pick li[aria-selected="true"] { background: var(--repeat-wash); }
.pick li small { display: block; color: var(--soft); }
.chosen { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border: 1px solid var(--repeat); border-radius: 8px; background: var(--repeat-wash); font-weight: 600; }

/* Batch dates */
.dates { display: grid; gap: 8px; }
.dates .d { display: grid; grid-template-columns: 1fr 120px auto; gap: 8px; align-items: center; }

/* Progress */
.bar { height: 8px; border-radius: 99px; background: #e7ebe7; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--repeat); transition: width .4s; }

/* Gate (not signed in) */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; text-align: center; }
.gate .box { max-width: 420px; }
.gate svg { width: 56px; height: 56px; margin-bottom: 12px; }
.spin { width: 28px; height: 28px; border: 3px solid var(--rule); border-top-color: var(--repeat); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 14px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 3s; } .bar i { transition: none; } }
