/* Campaign Desk — styles. No build step, no external fonts. */
:root {
  --bg: #f4f3ef;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --line: #e3e0d8;
  --line-strong: #cfcbc1;
  --text: #1c1b19;
  --muted: #6c6960;
  --faint: #9a968c;
  --ink: #1c1b19;
  --accent: #3550c8;
  --accent-soft: #e9edfd;
  --go: #13724a;
  --go-hover: #0f5f3d;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --warn: #8a5a00;
  --warn-soft: #fff3d6;
  --ok: #13724a;
  --ok-soft: #e3f4ea;
  --info: #2c4fc4;
  --info-soft: #e8eefe;
  --violet: #6b39c4;
  --violet-soft: #f0e9fd;
  --shadow: 0 1px 2px rgba(28, 27, 25, .06), 0 4px 16px rgba(28, 27, 25, .06);
  --shadow-lg: 0 12px 48px rgba(28, 27, 25, .18);
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151514;
    --surface: #1e1e1c;
    --surface-2: #232321;
    --line: #33322f;
    --line-strong: #46443f;
    --text: #ecebe6;
    --muted: #a3a097;
    --faint: #77746c;
    --ink: #ecebe6;
    --accent: #8ea2ff;
    --accent-soft: #252b45;
    --go: #2f9e6a;
    --go-hover: #39b37a;
    --danger: #ff8a7d;
    --danger-soft: #3a1f1c;
    --warn: #f2c063;
    --warn-soft: #362b14;
    --ok: #6fd3a0;
    --ok-soft: #173326;
    --info: #9db0ff;
    --info-soft: #222a47;
    --violet: #c4a8ff;
    --violet-soft: #2c2342;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
    --shadow-lg: 0 12px 48px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
}
[x-cloak] { display: none !important; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.grow { flex: 1 1 auto; }
.row { display: flex; align-items: center; gap: 8px; }
.wrap { flex-wrap: wrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ----------------------------------------------------------------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 24px;
  height: 54px; padding: 0 20px;
  background: var(--ink); color: #f4f3ef;
}
@media (prefers-color-scheme: dark) { .topbar { background: #0d0d0c; border-bottom: 1px solid var(--line); } }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: .01em; color: inherit; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 6px;
  background: conic-gradient(from 200deg, #6f86ff, #2fbf7f, #f2b13c, #e2626b, #6f86ff);
  box-shadow: inset 0 0 0 4px #1c1b19;
}
.nav { display: flex; gap: 4px; }
.nav a {
  color: #c9c6bd; padding: 6px 12px; border-radius: 8px; font-weight: 520;
}
.nav a:hover { color: #fff; background: rgba(255, 255, 255, .08); text-decoration: none; }
.nav a.active { color: #fff; background: rgba(255, 255, 255, .14); }
.topbar .user { margin-left: auto; display: flex; align-items: center; gap: 12px; color: #c9c6bd; font-size: 13px; }
.topbar .user form { margin: 0; }
.linkbtn { background: none; border: 0; color: #c9c6bd; cursor: pointer; font: inherit; padding: 0; }
.linkbtn:hover { color: #fff; text-decoration: underline; }

main { padding: 20px; max-width: 1480px; margin: 0 auto; }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 13px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--surface); color: var(--text);
  font: 520 13.5px/1 var(--sans); cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { background: var(--surface-2); border-color: var(--faint); text-decoration: none; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .seg button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.primary:hover { opacity: .9; }
.btn.go { background: var(--go); border-color: var(--go); color: #fff; }
.btn.go:hover { background: var(--go-hover); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--line); }
.btn.sm { height: 28px; padding: 0 9px; font-size: 12.5px; }
.btn.icon { width: 30px; height: 30px; padding: 0; justify-content: center; }
.btn .count {
  font-family: var(--mono); font-size: 11.5px; padding: 1px 6px; border-radius: 99px;
  background: rgba(255, 255, 255, .22);
}
.btn:not(.go):not(.primary) .count { background: var(--surface-2); border: 1px solid var(--line); }

/* -------------------------------------------------------------------- forms */
label.field { display: grid; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
label.field .hint { font-weight: 400; color: var(--faint); margin-left: 4px; }
.settings-grid label.field { grid-template-rows: auto 1fr auto; }
.settings-grid label.field .hint { margin-left: 0; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=date],
input[type=time], input[type=number], input[type=search], select, textarea {
  width: 100%; height: 36px; padding: 0 10px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--surface); color: var(--text);
  font: 14px var(--sans);
}
textarea { height: auto; padding: 8px 10px; resize: vertical; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; }
input.bad, select.bad, textarea.bad { border-color: var(--danger); background: var(--danger-soft); }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; color: var(--text); font-size: 13.5px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }

.seg { display: inline-flex; padding: 3px; gap: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; }
.seg button {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  padding: 7px 12px; border-radius: 7px; font: 560 13px var(--sans);
}
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* -------------------------------------------------------------------- cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 14px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { margin: 0; font-size: 15px; }
.card-body { padding: 16px; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }

/* ------------------------------------------------------------- board header */
.boardhead { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px 24px; margin-bottom: 16px; }
.datebox { display: flex; align-items: center; gap: 6px; }
.datebox h1 { margin: 0 6px; font-size: 24px; letter-spacing: -.01em; font-weight: 680; min-width: 270px; }
.datebox h1 small { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.datebox input[type=date] { width: 150px; }
.stats { display: flex; gap: 6px; flex-wrap: wrap; }
.stat {
  display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 10px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--line); font-size: 12.5px; color: var(--muted);
  cursor: pointer;
}
.stat b { font: 650 15px var(--mono); color: var(--text); }
.stat.on { border-color: var(--text); color: var(--text); }
.stat.err b { color: var(--danger); }
.stat.okk b { color: var(--ok); }
.stat.chk b { color: var(--violet); }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.toolbar .sep { width: 1px; height: 24px; background: var(--line-strong); margin: 0 4px; }
.toolbar input[type=search] { width: 220px; height: 34px; }
.toolbar select { width: auto; height: 34px; }

/* ----------------------------------------------------------------- timeline */
.timeline { padding: 12px 16px 8px; }
.tl-axis, .tl-lane { display: grid; grid-template-columns: 150px 1fr; align-items: center; }
.tl-axis .scale { position: relative; height: 18px; }
.tl-axis .tick { position: absolute; top: 0; transform: translateX(-50%); font: 11px var(--mono); color: var(--faint); }
.tl-lane { height: 26px; }
.tl-lane .lname { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 10px; display: flex; align-items: center; gap: 7px; }
.tl-lane .track { position: relative; height: 26px; border-top: 1px dashed var(--line); }
.tl-lane:last-child .track { border-bottom: 1px dashed var(--line); }
.tl-grid { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); opacity: .7; }
.tl-now { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--danger); border-radius: 2px; }
.tl-dot {
  position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px;
  border-radius: 50%; border: 2px solid var(--surface); cursor: pointer;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .15);
}
.tl-dot:hover { transform: scale(1.35); z-index: 2; }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }

/* ----------------------------------------------------- per-install sections */
.install { margin-top: 14px; }
.install .card-head { gap: 12px; }
.install .card-head .tz { font-size: 12px; color: var(--muted); font-family: var(--mono); }
.install .card-head .counts { font-size: 12.5px; color: var(--muted); }

table.plan { width: 100%; border-collapse: collapse; }
table.plan th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--faint); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
table.plan td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.plan tr:last-child td { border-bottom: 0; }
table.plan tr.r { cursor: pointer; }
table.plan tr.r:hover td { background: var(--surface-2); }
table.plan tr.r.sel td { background: var(--accent-soft); }
table.plan td.cb { width: 34px; }
table.plan td.time { width: 64px; font: 600 14px var(--mono); }
table.plan td.client { width: 140px; }
table.plan td.list { width: 210px; }
table.plan td.content { width: 220px; }
table.plan td.status { width: 150px; }
table.plan td.acts { width: 120px; text-align: right; white-space: nowrap; }
table.plan .subj { font-weight: 560; }
table.plan .sub { font-size: 12px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
table.plan .issues { margin-top: 6px; display: grid; gap: 3px; }
.issue { font-size: 12px; display: flex; gap: 6px; align-items: baseline; overflow-wrap: anywhere; min-width: 0; }
.issue::before { content: ""; width: 6px; height: 6px; border-radius: 50%; flex: none; transform: translateY(-1px); }
.issue.error { color: var(--danger); }
.issue.error::before { background: var(--danger); }
.issue.warn { color: var(--warn); }
.issue.warn::before { background: #e0a21b; }
tr.r.has-error td:first-child { box-shadow: inset 3px 0 0 var(--danger); }

/* ------------------------------------------------------------- status chips */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 99px;
  font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--muted);
  border: 1px solid transparent;
}
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .85; }
.chip.draft { background: var(--surface-2); color: var(--muted); border-color: var(--line); }
.chip.ready { background: var(--info-soft); color: var(--info); }
.chip.fix, .chip.failed { background: var(--danger-soft); color: var(--danger); }
.chip.queued, .chip.working, .chip.paused { background: var(--warn-soft); color: var(--warn); }
.chip.working::before { animation: pulse 1s infinite; }
.chip.scheduled { background: var(--ok-soft); color: var(--ok); }
.chip.sending { background: var(--ok-soft); color: var(--ok); }
.chip.sending::before { animation: pulse 1s infinite; }
.chip.sent { background: var(--ink); color: var(--bg); }
.chip.unknown { background: var(--violet-soft); color: var(--violet); }
.chip.cancelled { background: var(--surface-2); color: var(--faint); border-color: var(--line); }
table.plan tr.r.cancelled td { opacity: .55; }
table.plan tr.r.cancelled td .subj { text-decoration: line-through; }
@keyframes pulse { 50% { opacity: .25; } }
.kind { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.kind b { color: var(--text); font-weight: 560; }

/* --------------------------------------------------------------- the drawer */
.scrim { position: fixed; inset: 0; background: rgba(20, 19, 17, .38); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 41;
  width: min(640px, 100vw); background: var(--surface); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
}
.drawer header { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.drawer header h2 { margin: 0; font-size: 17px; }
.drawer .body { flex: 1; overflow: auto; padding: 18px; display: grid; gap: 14px; align-content: start; }
.drawer footer { display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface-2); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: 1.1fr .7fr 1fr; gap: 12px; }
@media (max-width: 640px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.section-title { font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); font-weight: 700; margin: 6px 0 -4px; }
.picker { position: relative; }
.picker .menu {
  position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); max-height: 280px; overflow: auto;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: var(--shadow-lg);
}
.picker .opt { padding: 8px 10px; cursor: pointer; display: grid; gap: 1px; border-bottom: 1px solid var(--line); }
.picker .opt:last-child { border-bottom: 0; }
.picker .opt:hover, .picker .opt.hi { background: var(--accent-soft); }
.picker .opt .t { font-weight: 560; }
.picker .opt .m { font-size: 12px; color: var(--muted); }
.chosen {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface-2);
}
.chosen .t { font-weight: 600; }
.note { font-size: 12.5px; padding: 9px 11px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); overflow-wrap: anywhere; }
.note.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.note.err { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.note.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.preview { width: 100%; height: 460px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.dropzone {
  border: 1.5px dashed var(--line-strong); border-radius: 8px; padding: 14px; text-align: center; color: var(--muted);
  font-size: 13px; cursor: pointer;
}
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

/* ------------------------------------------------------------------- modals */
.modal {
  position: fixed; z-index: 50; left: 50%; top: 12vh; transform: translateX(-50%);
  width: min(560px, calc(100vw - 32px)); background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg);
}
.modal header { padding: 16px 18px 6px; }
.modal header h2 { margin: 0; font-size: 18px; }
.modal .body { padding: 8px 18px 16px; display: grid; gap: 12px; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
.modal.wide { width: min(1120px, calc(100vw - 32px)); top: 5vh; }
.modal.wide .body { max-height: 72vh; overflow: auto; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table.imp { width: 100%; min-width: 780px; border-collapse: collapse; font-size: 13px; }
table.imp th { text-align: left; font-weight: 600; color: var(--muted); font-size: 11px; text-transform: uppercase;
  letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
table.imp td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.imp tr:last-child td { border-bottom: 0; }
table.imp tr.bad td { background: var(--danger-soft); }
table.imp td.checks { min-width: 260px; }
table.imp td.checks > div + div { margin-top: 3px; }
.selbar { position: sticky; top: 8px; z-index: 5; display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  margin-bottom: 10px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface);
  box-shadow: var(--shadow); }
table.sent th.num, table.sent td.num { text-align: right; }
table.sent td.num { position: relative; padding-bottom: 12px; }
table.sent .bar { position: absolute; right: 10px; bottom: 5px; height: 3px; border-radius: 2px; background: var(--ok); opacity: .55; }
.filetag { display: inline-flex; align-items: center; gap: 2px; padding: 1px 2px 1px 9px; border: 1px solid var(--line);
  border-radius: 999px; background: var(--surface-2); font-size: 12.5px; }
.filetag .btn.icon { padding: 2px 6px; min-height: 0; }
.breakdown { display: grid; gap: 4px; max-height: 260px; overflow: auto; }
.breakdown div { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; padding: 6px 8px; border-radius: 6px; background: var(--surface-2); }

/* ------------------------------------------------------------------- toasts */
.toasts { position: fixed; z-index: 60; bottom: 18px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; }
.toast {
  padding: 10px 14px; border-radius: 9px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lg);
  font-size: 13.5px; max-width: 560px;
}
.toast.err { background: var(--danger); color: #fff; }

/* -------------------------------------------------------------- misc pages */
.page-title { display: flex; align-items: center; gap: 12px; margin: 4px 0 16px; }
.page-title h1 { margin: 0; font-size: 22px; }
table.simple { width: 100%; border-collapse: collapse; }
table.simple th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); padding: 8px 12px; border-bottom: 1px solid var(--line); }
table.simple td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.simple tr:last-child td { border-bottom: 0; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--danger); } .dot.none { background: var(--faint); }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }

/* -------------------------------------------------------------------- login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login {
  width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); padding: 28px; display: grid; gap: 14px;
}
.login h1 { margin: 0; font-size: 20px; display: flex; align-items: center; gap: 10px; }
.login .brand-mark { box-shadow: inset 0 0 0 4px var(--surface); }

@media (max-width: 900px) {
  table.plan td.list, table.plan td.content, table.plan th.list, table.plan th.content { display: none; }
  .datebox h1 { min-width: 0; font-size: 20px; }
  .tl-axis, .tl-lane { grid-template-columns: 90px 1fr; }
}

@media (max-width: 640px) {
  main { padding: 12px; }
  .topbar { gap: 10px; padding: 0 12px; }
  .brand-name, .topbar .username { display: none; }
  .nav a { padding: 6px 8px; }
  .boardhead { gap: 10px; }
  .datebox { flex-wrap: wrap; }
  .datebox h1 { order: -1; width: 100%; margin: 0 0 4px; }
  .toolbar > select, .toolbar input[type=search] { width: 100%; }
  .toolbar .grow { display: none; }
  table.plan td.client, table.plan th.client, table.plan td.acts, table.plan th.acts { display: none; }
  table.plan td.status { width: auto; }
  .install .card-head { flex-wrap: wrap; }
  .tl-axis, .tl-lane { grid-template-columns: 64px 1fr; }
  .tl-lane .lname { font-size: 11px; }
  .drawer .body { padding: 14px; }
  table.simple { display: block; overflow-x: auto; }
}
