:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --bg-side: #fbfbfa;
  --bg-soft: #f7f7f5;
  --bg-hover: rgba(55, 53, 47, .06);
  --bg-active: rgba(55, 53, 47, .1);
  --border: #ededec;
  --border-strong: #e0e0de;
  --text: #37352f;
  --text-2: #787774;
  --text-3: #a5a4a0;
  --accent: #2383e2;
  --today: #eb5757;
  --green: #448361;
  --shadow: 0 0 0 1px rgba(15, 15, 15, .05), 0 3px 6px rgba(15, 15, 15, .1), 0 9px 24px rgba(15, 15, 15, .2);
  --hour: 48px;
  --font: -apple-system, "Segoe UI Variable Text", "Segoe UI", Inter, Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #191919;
    --bg-side: #202020;
    --bg-soft: #1f1f1f;
    --bg-hover: rgba(255, 255, 255, .055);
    --bg-active: rgba(255, 255, 255, .09);
    --border: #2a2a2a;
    --border-strong: #363636;
    --text: #e6e6e4;
    --text-2: #9b9b9b;
    --text-3: #626262;
    --shadow: 0 0 0 1px rgba(255, 255, 255, .08), 0 3px 6px rgba(0, 0, 0, .35), 0 9px 24px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  font: 13px/1.4 var(--font);
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
input, textarea, select { user-select: text; }
button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; }
.spacer { flex: 1; }
.muted { color: var(--text-2); }
svg { flex: none; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--text-3); }
::-webkit-scrollbar-track { background: transparent; }

.drag { -webkit-app-region: drag; }
.drag button, .drag input, .drag select, .drag a, .drag .seg { -webkit-app-region: no-drag; }

/* ---------- Buttons & inputs ---------- */
.btn {
  height: 28px; padding: 0 10px; border-radius: 6px;
  border: 1px solid var(--border-strong); background: var(--bg);
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer; font-size: 13px; white-space: nowrap; text-decoration: none; color: var(--text);
}
.btn:hover { background: var(--bg-hover); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 500; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { border-color: transparent; background: none; color: #e03e3e; }
.btn.danger:hover { background: rgba(224, 62, 62, .1); }
.btn.sm { height: 24px; padding: 0 8px; font-size: 12px; }

.icon-btn {
  width: 28px; height: 28px; border: none; background: none; border-radius: 6px;
  display: inline-grid; place-items: center; cursor: pointer; color: var(--text-2);
  font-size: 18px; line-height: 1; padding: 0;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn.sm { width: 22px; height: 22px; font-size: 16px; }

.field, select, input[type=date], input[type=time], input[type=url], textarea {
  font: inherit; color: var(--text); background: transparent;
  border: 1px solid transparent; border-radius: 6px; padding: 4px 8px; outline: none;
}
.field:hover, select:hover, input[type=date]:hover, input[type=time]:hover, input[type=url]:hover, textarea:hover { background: var(--bg-hover); }
.field:focus, select:focus, input[type=date]:focus, input[type=time]:focus, input[type=url]:focus, textarea:focus {
  border-color: var(--accent); background: var(--bg);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
select { cursor: pointer; }
select option { background: var(--bg); color: var(--text); }
.input {
  width: 100%; height: 34px; font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--border-strong); border-radius: 6px; padding: 0 10px; outline: none;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }

.seg { display: inline-flex; background: var(--bg-hover); border-radius: 7px; padding: 2px; gap: 2px; }
.seg button {
  border: none; background: none; padding: 0 10px; height: 24px; border-radius: 5px;
  font-size: 12.5px; color: var(--text-2); cursor: pointer;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--bg); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 0 0 1px var(--border); }

/* ---------- Layout ---------- */
#app { display: grid; grid-template-columns: 252px 1fr; height: 100vh; }
#sidebar {
  background: var(--bg-side); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; min-height: 0;
}
#main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
#topbar {
  height: 48px; flex: none; display: flex; align-items: center; gap: 8px;
  padding: 0 16px; border-bottom: 1px solid var(--border);
}
body.electron #topbar, body.electron .pg-top { padding-right: 150px; }
#title { white-space: nowrap; font-size: 17px; font-weight: 600; margin-right: 6px; letter-spacing: -.01em; }
#title .yr { color: var(--text-2); font-weight: 500; }
.nav { display: flex; }
.nav .icon-btn { font-size: 20px; }
#view { flex: 1; min-height: 0; position: relative; }

/* ---------- Sidebar ---------- */
.sb-brand {
  height: 48px; flex: none; display: flex; align-items: center; gap: 9px;
  padding: 0 16px; font-weight: 600; font-size: 13.5px;
}
.logo {
  width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center;
  background: var(--text); color: var(--bg); font-size: 12px; font-weight: 800;
}
.sb-scroll { flex: 1; overflow-y: auto; min-height: 0; padding-bottom: 12px; }
.sb-section { padding: 6px 8px; }
.sb-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 8px; font-size: 11.5px; font-weight: 600; color: var(--text-2);
}
.sb-footer {
  flex: none; display: flex; align-items: center; justify-content: space-between;
  padding: 8px; border-top: 1px solid var(--border);
}
.kbd-hint { font-size: 11px; color: var(--text-3); padding-right: 6px; }

/* mini calendar */
#mini { padding: 4px 12px 10px; }
.mini-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 4px 6px; font-weight: 600; font-size: 12.5px; }
.mini-head .icon-btn { width: 22px; height: 22px; font-size: 16px; }
.mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 1px; }
.mini-dow { font-size: 10.5px; color: var(--text-3); text-align: center; padding: 3px 0; }
.mini-day {
  position: relative; height: 27px; display: grid; place-items: center; font-size: 11.5px;
  cursor: pointer; border-radius: 0; color: var(--text);
}
.mini-day span { width: 23px; height: 23px; display: grid; place-items: center; border-radius: 50%; }
.mini-day:hover span { background: var(--bg-active); }
.mini-day.other { color: var(--text-3); }
.mini-day.inrange { background: var(--bg-hover); }
.mini-day.inrange.rs { border-radius: 6px 0 0 6px; }
.mini-day.inrange.re { border-radius: 0 6px 6px 0; }
.mini-day.inrange.rs.re { border-radius: 6px; }
.mini-day.today span { background: var(--today); color: #fff; font-weight: 600; }
.mini-day.has::after {
  content: ""; position: absolute; bottom: 1px; width: 3px; height: 3px; border-radius: 50%; background: var(--text-3);
}

/* channels */
.ch-row {
  display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 4px 0 8px;
  border-radius: 6px; cursor: default;
}
.ch-row:hover { background: var(--bg-hover); }
.ch-check {
  width: 15px; height: 15px; border-radius: 4px; border: 1.5px solid var(--c); background: var(--c);
  display: grid; place-items: center; padding: 0; cursor: pointer; color: #fff; flex: none;
}
.ch-row.off .ch-check { background: transparent; color: transparent; }
.ch-ico { color: var(--c); display: grid; place-items: center; }
.ch-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-row.off .ch-name { color: var(--text-3); }
.ch-count { font-size: 11px; color: var(--text-3); }
.ch-row .ch-edit { opacity: 0; width: 22px; height: 22px; font-size: 14px; }
.ch-row:hover .ch-edit { opacity: 1; }
.sb-empty { padding: 6px 8px; color: var(--text-2); font-size: 12px; }
.sb-empty .btn { margin-top: 8px; }

/* ---------- Time grid ---------- */
.timegrid { display: flex; flex-direction: column; height: 100%; }
.tg-head {
  display: grid; grid-template-columns: 60px repeat(var(--cols), 1fr);
  border-bottom: 1px solid var(--border); flex: none; padding-right: 10px;
}
.tg-tz { font-size: 10px; color: var(--text-3); display: flex; align-items: flex-end; justify-content: flex-end; padding: 0 8px 8px 0; }
.tg-dayhead {
  display: flex; align-items: center; justify-content: center; gap: 6px; height: 46px;
  color: var(--text-2); font-size: 12px; cursor: pointer; border-left: 1px solid transparent;
}
.tg-dayhead:hover .dnum { background: var(--bg-hover); }
.tg-dayhead .dnum {
  font-size: 15px; font-weight: 500; color: var(--text); width: 28px; height: 28px;
  display: grid; place-items: center; border-radius: 50%;
}
.tg-dayhead.today .dow { color: var(--today); font-weight: 600; }
.tg-dayhead.today .dnum, .tg-dayhead.today:hover .dnum { background: var(--today); color: #fff; font-weight: 600; }
.tg-scroll { flex: 1; overflow-y: scroll; position: relative; }
.tg-body {
  display: grid; grid-template-columns: 60px repeat(var(--cols), 1fr);
  height: calc(var(--hour) * 24); position: relative;
}
.tg-gutter { position: relative; }
.tg-gutter span {
  position: absolute; right: 8px; transform: translateY(-50%);
  font-size: 10.5px; color: var(--text-3); white-space: nowrap;
}
.tg-col {
  position: relative; border-left: 1px solid var(--border);
  background-image: repeating-linear-gradient(to bottom, var(--border) 0, var(--border) 1px, transparent 1px, transparent var(--hour));
  cursor: default;
}
.tg-col.weekend { background-color: var(--bg-soft); }

.ev {
  position: absolute; border-radius: 5px; padding: 3px 6px 3px 7px; font-size: 12px;
  overflow: hidden; cursor: pointer;
  background: color-mix(in srgb, var(--c) 15%, var(--bg));
  border-left: 3px solid var(--c);
  color: color-mix(in srgb, var(--c) 45%, var(--text));
  box-shadow: 0 0 0 1px var(--bg);
}
.ev:hover { background: color-mix(in srgb, var(--c) 22%, var(--bg)); }
.ev.dragging { box-shadow: var(--shadow); z-index: 6; opacity: .95; }
.ev.published { background: color-mix(in srgb, var(--c) 7%, var(--bg)); }
.ev.published .ev-title { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--c) 50%, transparent); }
.ev-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-title .ev-t { font-weight: 400; opacity: .8; margin-left: 4px; }
.ev-meta { font-size: 11px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-prog { display: flex; gap: 2px; margin-top: 4px; }
.ev-prog i { flex: 1; height: 3px; border-radius: 2px; background: color-mix(in srgb, var(--c) 22%, transparent); }
.ev-prog i.doing { background: color-mix(in srgb, var(--c) 55%, transparent); }
.ev-prog i.done { background: var(--c); }
.ev.short { padding-top: 1px; }
.ev.short .ev-prog { display: none; }
.ev-resize { position: absolute; left: 0; right: 0; bottom: 0; height: 7px; cursor: ns-resize; }
body.grabbing, body.grabbing * { cursor: grabbing !important; }
body.resizing, body.resizing * { cursor: ns-resize !important; }

.drag-ghost {
  position: absolute; left: 2px; right: 3px; border-radius: 5px; pointer-events: none; z-index: 5;
  background: color-mix(in srgb, var(--accent) 16%, var(--bg)); border-left: 3px solid var(--accent);
  font-size: 11px; padding: 2px 6px; color: var(--accent); box-shadow: var(--shadow);
}
.now-line { position: absolute; left: -1px; right: 0; height: 2px; background: var(--today); z-index: 4; pointer-events: none; }
.now-line::before {
  content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--today);
}

/* ---------- Month ---------- */
.month { display: flex; flex-direction: column; height: 100%; }
.m-head { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--border); flex: none; }
.m-head div { padding: 8px 10px; font-size: 11.5px; color: var(--text-2); }
.m-grid { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); grid-template-rows: repeat(6, 1fr); min-height: 0; }
.m-cell {
  border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: 4px; display: flex; flex-direction: column; gap: 2px; min-height: 0; min-width: 0;
}
.m-cell:nth-child(7n) { border-right: none; }
.m-cell.other { background: var(--bg-soft); }
.m-cell.other .m-num { color: var(--text-3); }
.m-cell.drop { background: color-mix(in srgb, var(--accent) 8%, var(--bg)); }
.m-top { display: flex; padding: 0 2px; }
.m-num {
  font-size: 12px; min-width: 24px; height: 24px; padding: 0 6px; display: grid; place-items: center;
  border-radius: 12px; cursor: pointer;
}
.m-num:hover { background: var(--bg-hover); }
.m-cell.today .m-num { background: var(--today); color: #fff; font-weight: 600; }
.m-evs { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: 2px; }
.mchip {
  display: flex; align-items: center; gap: 6px; font-size: 12px; height: 21px; flex: none;
  padding: 0 6px; border-radius: 4px; cursor: pointer; white-space: nowrap; overflow: hidden;
  background: color-mix(in srgb, var(--c) 14%, var(--bg));
  color: color-mix(in srgb, var(--c) 45%, var(--text));
}
.mchip:hover { background: color-mix(in srgb, var(--c) 22%, var(--bg)); }
.mchip.published { opacity: .6; text-decoration: line-through; }
.mchip .dot { width: 3px; height: 13px; border-radius: 2px; background: var(--c); flex: none; }
.mchip .tm { opacity: .75; font-size: 11px; flex: none; }
.mchip .tt { font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.mchip .pg { margin-left: auto; font-size: 10px; opacity: .75; flex: none; }
.m-more { font-size: 11px; color: var(--text-2); padding: 1px 6px; cursor: pointer; border-radius: 4px; flex: none; }
.m-more:hover { background: var(--bg-hover); }

/* ---------- Popover ---------- */
.popover {
  position: fixed; z-index: 80; width: 330px; background: var(--bg); border-radius: 10px;
  box-shadow: var(--shadow); padding: 12px; display: flex; flex-direction: column; gap: 6px;
}
.qc-title {
  font: inherit; font-size: 17px; font-weight: 600; border: none; outline: none; background: none;
  color: var(--text); padding: 4px 6px 8px; width: 100%;
}
.qc-title::placeholder { color: var(--text-3); }
.qc-field { display: flex; align-items: center; gap: 4px; }
.qc-field select { flex: 1; min-width: 0; }
.qc-ico { width: 28px; display: grid; place-items: center; color: var(--text-2); }
.qc-dur { color: var(--text-2); font-size: 12px; }
.qc-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 6px; }
.qc-add { font-size: 12px; color: var(--accent); cursor: pointer; background: none; border: none; padding: 0 0 0 34px; text-align: left; }

/* ---------- App shell: calendar vs pages ---------- */
#cal { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#pagehost { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#btn-filter.active { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.sm { font-size: 12px; }
.bad { color: #e03e3e; }
.good { color: var(--green); }

/* nav */
#nav { padding: 0 8px 8px; display: flex; flex-direction: column; gap: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 9px; height: 30px; padding: 0 8px; border: none; background: none;
  border-radius: 6px; cursor: pointer; color: var(--text-2); font-size: 13px; text-align: left;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.on { background: var(--bg-active); color: var(--text); font-weight: 500; }
.nav-item span:not(.badge) { flex: 1; }
.badge { background: var(--today); color: #fff; font-size: 10.5px; font-weight: 600; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 5px; }
kbd { font: 10.5px var(--font); color: var(--text-3); border: 1px solid var(--border-strong); border-radius: 4px; padding: 0 4px; }
.ch-row { cursor: pointer; }
.ch-row.on { background: var(--bg-active); }

/* ideas */
#idea-form { padding: 2px 4px 4px; }
#idea-form .field { width: 100%; font-size: 12.5px; }
#idea-form .field::placeholder { color: var(--text-3); }
.idea-row { display: flex; align-items: center; gap: 8px; height: 28px; padding: 0 8px; border-radius: 6px; cursor: grab; }
.idea-row:hover { background: var(--bg-hover); }
.idea-dot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px dashed var(--c); flex: none; }
.idea-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.idea-ch { font-size: 11px; color: var(--text-3); max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#ideas-section.drop { background: color-mix(in srgb, var(--accent) 8%, transparent); border-radius: 8px; outline: 1.5px dashed var(--accent); outline-offset: -3px; }
body.dragging-idea #view { outline: 2px dashed color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: -4px; }

/* event extras */
.ev-badge { font-size: 10.5px; font-weight: 700; padding: 0 4px; border-radius: 3px; margin-right: 4px; background: color-mix(in srgb, var(--c) 22%, transparent); }
.ev-live { display: inline-flex; vertical-align: -2px; margin-right: 3px; }
.ev-live svg { width: 12px; height: 12px; }
.ev.behind { box-shadow: 0 0 0 1px var(--bg), inset 0 0 0 1px color-mix(in srgb, #e03e3e 60%, transparent); }
.ev-flag { position: absolute; top: 3px; right: 4px; width: 14px; height: 14px; border-radius: 50%; background: #e03e3e; color: #fff; font-size: 10px; font-weight: 800; display: grid; place-items: center; }
.mchip .ev-badge { margin: 0; }
.mchip.behind .pg { color: #e03e3e; font-weight: 700; opacity: 1; }
.slot {
  position: absolute; left: 2px; right: 3px; border-radius: 5px; border: 1.5px dashed color-mix(in srgb, var(--c) 55%, transparent);
  color: color-mix(in srgb, var(--c) 60%, var(--text-2)); padding: 2px 6px; font-size: 11px; cursor: pointer; overflow: hidden;
  display: flex; flex-direction: column; z-index: 1; background: color-mix(in srgb, var(--c) 4%, transparent);
}
.slot:hover { background: color-mix(in srgb, var(--c) 10%, transparent); }
.slot span { font-weight: 600; display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.slot small { opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot.late, .mslot.late { border-color: #e03e3e; color: #e03e3e; }
.mslot { font-size: 11px; border: 1px dashed color-mix(in srgb, var(--c) 55%, transparent); color: color-mix(in srgb, var(--c) 60%, var(--text-2)); border-radius: 4px; padding: 1px 6px; cursor: pointer; flex: none; white-space: nowrap; overflow: hidden; display: flex; align-items: center; gap: 4px; }
.mslot:hover { background: var(--bg-hover); }

/* popovers */
.qc-ep { width: 64px; flex: none; }
.qc-hint { font-size: 12px; color: var(--text-2); padding: 2px 6px 0 34px; display: flex; gap: 6px; align-items: center; min-height: 18px; }
.qc-hint.late { color: #e03e3e; }
.popover.flt, .popover.menu { width: 300px; max-height: 70vh; overflow-y: auto; }
.flt-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 2px 6px; }
.flt-grp { padding: 6px 0; border-top: 1px solid var(--border); }
.flt-t { font-size: 11px; font-weight: 600; color: var(--text-2); padding: 2px 4px 4px; text-transform: uppercase; letter-spacing: .04em; }
.chk { display: flex; align-items: center; gap: 8px; padding: 4px; border-radius: 5px; cursor: pointer; }
.chk:hover { background: var(--bg-hover); }
.chk input { accent-color: var(--accent); margin: 0; }
.chk span { display: flex; align-items: center; gap: 6px; }
.sd { width: 8px; height: 8px; border-radius: 50%; background: var(--p); display: inline-block; }
.menu-item { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; text-align: left; padding: 7px 8px; border: none; background: none; border-radius: 6px; cursor: pointer; }
.menu-item:hover { background: var(--bg-hover); }
.popover .field.cp-title { width: 100%; border: 1px solid var(--border-strong); margin-top: 4px; }

/* ---------- Pages (shared) ---------- */
.pg-top {
  height: 48px; flex: none; display: flex; align-items: center; gap: 8px;
  padding: 0 12px; border-bottom: 1px solid var(--border);
}
.crumb { color: var(--text-2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.crumb b { color: var(--text); font-weight: 500; }
.pg-scroll { flex: 1; overflow-y: auto; }
.pg-inner { max-width: 1060px; margin: 0 auto; padding: 40px 56px 120px; user-select: text; }
.pg-inner.wide { max-width: 1240px; }
.pg-icon {
  width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center; overflow: hidden;
  background: color-mix(in srgb, var(--c) 14%, var(--bg)); color: var(--c);
}
.pg-icon img { width: 100%; height: 100%; object-fit: cover; }
.pg-kicker { margin-top: 14px; color: var(--c); font-weight: 600; font-size: 12.5px; display: flex; gap: 6px; align-items: center; }
.pg-title {
  font: inherit; font-size: 34px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2;
  border: none; outline: none; width: 100%; background: none; color: var(--text); padding: 0; margin: 10px 0 20px;
}
.pg-title::placeholder { color: var(--text-3); }
.props { display: grid; grid-template-columns: 170px 1fr; row-gap: 2px; margin-bottom: 34px; }
.prop-k { color: var(--text-2); display: flex; align-items: center; gap: 8px; min-height: 34px; }
.prop-v { display: flex; align-items: center; gap: 6px; min-height: 34px; flex-wrap: wrap; }
.prop-v input[type=url] { flex: 1; min-width: 200px; }
.field.ep { width: 64px; }
.metrics label { display: flex; align-items: center; gap: 4px; color: var(--text-2); font-size: 12px; }
.metrics .field { width: 96px; border-color: var(--border); }
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 12px;
  background: color-mix(in srgb, var(--p) 15%, var(--bg)); color: color-mix(in srgb, var(--p) 70%, var(--text));
  font-weight: 500; font-size: 12.5px; white-space: nowrap;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--p); }
.pill.sm { height: 20px; font-size: 11px; padding: 0 8px; }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 4px; font-size: 11.5px; font-weight: 500; background: var(--bg-active); color: var(--text-2); white-space: nowrap; }
.tag.ok { background: color-mix(in srgb, var(--green) 16%, transparent); color: var(--green); }
.tag.bad { background: rgba(224, 62, 62, .14); color: #e03e3e; }
.tag.warn { background: rgba(217, 115, 13, .15); color: #d9730d; }
.tag.blue { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.countdown { font-size: 12.5px; padding: 0 4px; }
.countdown.late { color: var(--today); font-weight: 500; }
.bar { width: 220px; height: 8px; border-radius: 4px; background: var(--bg-active); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--green); border-radius: 4px; transition: width .25s; }
.switch { position: relative; display: inline-block; width: 34px; height: 20px; cursor: pointer; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--border-strong); border-radius: 10px; transition: .15s; }
.switch span::after { content: ""; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; border-radius: 50%; background: #fff; transition: .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(14px); }
.pg-h { font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .06em; margin: 30px 0 12px; display: flex; align-items: center; gap: 10px; }
.pg-h .sm { text-transform: none; letter-spacing: 0; font-weight: 400; }
.pg-notes { width: 100%; min-height: 160px; resize: vertical; font-size: 14px; line-height: 1.6; border: 1px solid var(--border) !important; padding: 12px 14px !important; background: var(--bg-soft); }
.empty-card { border: 1px dashed var(--border-strong); border-radius: 10px; padding: 16px; color: var(--text-2); display: flex; gap: 8px; align-items: center; }
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
details > summary.pg-h::before { content: "▸"; font-size: 11px; transition: transform .15s; }
details[open] > summary.pg-h::before { transform: rotate(90deg); }

/* timeline */
.timeline { border: 1px solid var(--border-strong); border-radius: 12px; overflow: hidden; }
.tl-row {
  display: grid; grid-template-columns: 220px 150px 64px 1fr 252px 34px; align-items: center; column-gap: 8px;
  padding: 10px 12px 8px; border-top: 1px solid var(--border);
}
.tl-row:first-child { border-top: none; }
.tl-row.done { background: color-mix(in srgb, var(--s) 5%, var(--bg)); }
.tl-headrow { padding-top: 6px; padding-bottom: 4px; background: var(--bg-soft); }
.tl-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tl-num {
  width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center; padding: 0;
  font-weight: 700; font-size: 12px; border: 2px solid var(--border-strong); color: var(--text-2); background: var(--bg); cursor: pointer;
}
.tl-row.doing .tl-num { border-color: var(--s); color: var(--s); background: color-mix(in srgb, var(--s) 12%, var(--bg)); }
.tl-row.done .tl-num { border-color: var(--s); background: var(--s); color: #fff; }
.tl-label { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-row.done .tl-label, .tl-row.doing .tl-label { color: var(--s); }
.tl-sub { font-size: 11px; color: var(--text-3); }
.tl-owner { width: 100%; font-size: 12.5px; }
.tl-days { display: flex; align-items: center; gap: 2px; color: var(--text-2); font-size: 12px; }
.tl-days input { width: 44px; font: inherit; font-size: 12.5px; color: var(--text); background: transparent; border: 1px solid transparent; border-radius: 5px; padding: 3px 4px; text-align: right; }
.tl-days input:hover { background: var(--bg-hover); }
.tl-days input:focus { outline: none; border-color: var(--accent); background: var(--bg); }
.tl-days input.custom { color: var(--accent); font-weight: 600; }
.tl-dates { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-dates.late { color: #e03e3e; font-weight: 500; }
.tl-seg { display: flex; }
.tl-seg button { flex: 1; padding: 0 4px; font-size: 11.5px; }
.tl-seg button.on[data-v=doing] { color: var(--s); }
.tl-seg button.on[data-v=done] { background: var(--s); color: #fff; box-shadow: none; }
.tl-nbtn { width: 28px; height: 28px; }
.tl-nbtn.has { color: var(--accent); }
.tl-track { grid-column: 1 / -1; position: relative; height: 12px; margin-top: 8px; border-radius: 6px; background: var(--bg-hover); }
.tl-headrow .tl-track { margin-top: 0; height: 30px; background: none; }
.tl-scale span { position: absolute; top: 0; text-align: center; font-size: 10px; line-height: 1.25; color: var(--text-3); }
.tl-scale span.now { color: var(--today); font-weight: 700; }
.tl-scale span.up { color: var(--c); font-weight: 700; }
.tl-today, .tl-upload { position: absolute; bottom: -4px; width: 2px; height: 6px; margin-left: -1px; }
.tl-today { background: var(--today); }
.tl-upload { background: var(--c); }
.tl-bar {
  position: absolute; top: 0; bottom: 0; border-radius: 6px; min-width: 6px; display: grid; place-items: center; color: #fff;
  background: color-mix(in srgb, var(--s) 30%, var(--bg));
}
.tl-bar.doing { background: repeating-linear-gradient(-45deg, var(--s) 0 6px, color-mix(in srgb, var(--s) 70%, var(--bg)) 6px 12px); }
.tl-bar.done { background: var(--s); }
.tl-bar.late { box-shadow: 0 0 0 2px #e03e3e; }
.tl-bar svg { width: 10px; height: 10px; }
.tl-notes { grid-column: 1 / -1; margin-top: 8px; min-height: 70px; resize: vertical; width: 100%; font-size: 12.5px; line-height: 1.5; border: 1px solid var(--border) !important; background: var(--bg-soft); padding: 8px 10px; }
.tl-note { padding: 10px 14px; }
.timeline { container-type: inline-size; }
@container (max-width: 940px) {
  .tl-row { grid-template-columns: 1fr 140px 64px 34px; row-gap: 6px; }
  .tl-nbtn { grid-column: 4; grid-row: 1; }
  .tl-dates { grid-column: 1; grid-row: 2; }
  .tl-seg { grid-column: 2 / 5; grid-row: 2; }
}

/* publishing kit */
.kit-grid { display: grid; grid-template-columns: 170px 1fr; gap: 10px 12px; }
.kit-k { color: var(--text-2); display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding-top: 6px; }
.kit-v { min-width: 0; }
.kit-ta, .kit-in { width: 100%; border: 1px solid var(--border) !important; background: var(--bg-soft); }
.kit-ta { resize: vertical; line-height: 1.5; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
.kit-row { display: flex; gap: 8px; }
.title-opt { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.title-opt .field { flex: 1; border: 1px solid var(--border); }
.title-opt.chosen .field { border-color: var(--green); }
.title-opt .len { font-size: 11px; color: var(--text-3); width: 44px; text-align: right; }

/* related */
.related { display: flex; flex-direction: column; gap: 6px; }
.rel-card { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 8px; cursor: pointer; }
.rel-card:hover { background: var(--bg-hover); }
.rel-ico { color: var(--c); display: grid; place-items: center; }
.rel-body { flex: 1; min-width: 0; }
.rel-t { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rel-actions { display: flex; gap: 6px; }

/* comments */
.comments { display: flex; flex-direction: column; gap: 14px; }
.cmt { display: flex; gap: 10px; }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--a); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.cmt-b { flex: 1; min-width: 0; }
.cmt-h { display: flex; align-items: center; gap: 8px; }
.cmt-h .icon-btn { margin-left: auto; opacity: 0; }
.cmt:hover .cmt-h .icon-btn { opacity: 1; }
.cmt-t { white-space: pre-wrap; margin-top: 2px; line-height: 1.5; }
.cmt.new textarea { width: 100%; border: 1px solid var(--border-strong); resize: vertical; }
.cmt-actions { display: flex; justify-content: flex-end; margin-top: 6px; }
.activity { margin-top: 10px; }
.act { padding: 4px 0; font-size: 12.5px; color: var(--text-2); }
.act b { color: var(--text); font-weight: 500; }

/* ---------- Channel page ---------- */
.swatches .sw.sm { width: 20px; height: 20px; }
.types { display: flex; flex-direction: column; gap: 14px; margin-bottom: 12px; }
.type-card { border: 1px solid var(--border-strong); border-radius: 12px; padding: 14px 16px; }
.tc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.tc-name { font-size: 16px; font-weight: 700; width: 260px; }
.tc-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 4px 0 8px; }
.tc-k { color: var(--text-2); font-size: 12px; }
.tc-tip { padding: 0 0 8px; }
.field.num { width: 56px; text-align: right; border-color: var(--border); }
.wd { display: inline-flex; gap: 3px; }
.wd button { width: 30px; height: 26px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--bg); cursor: pointer; font-size: 11.5px; color: var(--text-2); padding: 0; }
.wd button.on { background: var(--c); border-color: var(--c); color: #fff; font-weight: 600; }
.stages { border-top: 1px solid var(--border); padding-top: 8px; }
.st-row { display: grid; grid-template-columns: 14px 1fr 70px 180px 170px 64px; align-items: center; gap: 8px; padding: 2px 0; }
.st-row .field { border-color: var(--border); }
.st-head { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.st-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--s); }
.st-btns { display: flex; justify-content: flex-end; gap: 2px; align-items: center; }
.stages > .btn { margin-top: 6px; }
.tc-preview { margin-top: 12px; padding: 10px 12px; background: var(--bg-soft); border-radius: 8px; }
.tp-prev { display: flex; flex-direction: column; gap: 4px; }
.tp-row { display: grid; grid-template-columns: 150px 1fr 110px; gap: 10px; align-items: center; font-size: 12px; }
.tp-n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-track { position: relative; height: 10px; background: var(--bg-hover); border-radius: 5px; }
.tp-track i { position: absolute; top: 0; bottom: 0; border-radius: 5px; background: var(--s); }
.tp-track i.up { background: var(--c); }
.tp-d { font-size: 11px; text-align: right; }
.series-table { border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; margin-bottom: 10px; }
.sr-row { display: grid; grid-template-columns: 1fr 140px 80px 70px 64px 120px 230px; gap: 8px; align-items: center; padding: 6px 10px; border-top: 1px solid var(--border); }
.sr-row:first-child { border-top: none; }
.sr-head { background: var(--bg-soft); font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.sr-num { font-variant-numeric: tabular-nums; font-weight: 600; }
.sr-row.archived { opacity: .55; }
.series-add { display: flex; gap: 8px; align-items: center; }
.series-add .field { width: 300px; border: 1px solid var(--border-strong); }
.modal.sm { width: 380px; }

/* ---------- Today ---------- */
.today-hero h1 { font-size: 32px; letter-spacing: -.02em; margin: 2px 0 4px; }
.today-hero p { margin: 0 0 10px; }
.today-grid { display: grid; grid-template-columns: 1fr 330px; gap: 32px; align-items: start; }
@media (max-width: 1100px) { .today-grid { grid-template-columns: 1fr; } }
.task {
  display: flex; gap: 12px; padding: 12px 14px; border: 1px solid var(--border-strong); border-left: 4px solid var(--c);
  border-radius: 10px; margin-bottom: 8px; background: var(--bg); transition: opacity .25s, transform .25s;
}
.task.overdue { border-color: color-mix(in srgb, #e03e3e 45%, var(--bg)); border-left-color: #e03e3e; }
.task.done-anim { opacity: 0; transform: translateX(16px); }
.task-check {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); background: var(--bg); color: transparent;
  display: grid; place-items: center; cursor: pointer; flex: none; margin-top: 1px; padding: 0;
}
.task-check:hover { border-color: var(--green); color: var(--green); }
.task-body { flex: 1; min-width: 0; }
.task-t { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.task-stage { color: var(--s); }
.task-v { cursor: pointer; }
.task-v:hover { text-decoration: underline; }
.task-why { color: var(--text-2); margin-top: 3px; line-height: 1.45; }
.task-blk { color: #d9730d; font-size: 12px; margin-top: 4px; display: flex; align-items: center; gap: 5px; }
.task-meta { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.task-meta svg { vertical-align: -2px; }
.day-group { margin-bottom: 8px; }
.dg-h { font-size: 12px; font-weight: 600; color: var(--text-2); margin: 10px 0 6px; }
.side-card { border: 1px solid var(--border-strong); border-radius: 12px; padding: 12px; margin-top: 30px; }
.side-card + .side-card { margin-top: 14px; }
.side-card.bad { border-color: color-mix(in srgb, #e03e3e 40%, var(--bg)); }
.side-h { font-weight: 600; display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.side-card.bad .side-h { color: #e03e3e; }
.side-row { display: flex; gap: 10px; padding: 6px; border-radius: 6px; cursor: pointer; }
.side-row:hover { background: var(--bg-hover); }
.side-t { font-weight: 500; }
.side-row svg { vertical-align: -2px; }
.up-bar { width: 3px; border-radius: 2px; background: var(--c); flex: none; align-self: stretch; }
.up-bar.dashed { background: none; border-left: 2px dashed var(--c); width: 0; }
.slotrow.late .muted { color: #e03e3e; }

/* ---------- Insights ---------- */
.ins-h { font-size: 30px; letter-spacing: -.02em; margin-bottom: 2px; }
.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 22px 0; }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(3, 1fr); } }
.kpi { border: 1px solid var(--border-strong); border-radius: 12px; padding: 12px 14px; }
.kpi-l { font-size: 12px; color: var(--text-2); }
.kpi-v { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin: 2px 0; font-variant-numeric: tabular-nums; }
.kpi-s { font-size: 11.5px; color: var(--text-2); }
.kpi.good .kpi-v { color: var(--green); }
.kpi.bad .kpi-v { color: #e03e3e; }
.kpi.warn .kpi-v { color: #d9730d; }
.verdicts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 1100px) { .verdicts { grid-template-columns: 1fr; } }
.verdict { border-radius: 12px; padding: 14px 16px; border: 1px solid var(--border-strong); }
.verdict.good { background: color-mix(in srgb, var(--green) 6%, var(--bg)); }
.verdict.bad { background: rgba(224, 62, 62, .05); }
.verdict.tip { background: color-mix(in srgb, var(--accent) 5%, var(--bg)); }
.v-h { font-weight: 700; display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.verdict.good .v-h { color: var(--green); }
.verdict.bad .v-h { color: #e03e3e; }
.verdict.tip .v-h { color: var(--accent); }
.verdict ul { margin: 0; padding-left: 18px; line-height: 1.5; }
.verdict li + li { margin-top: 5px; }
.ins-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
@media (max-width: 1100px) { .ins-cols { grid-template-columns: 1fr; } }
.ins-card { border: 1px solid var(--border-strong); border-radius: 12px; padding: 4px 16px 14px; min-width: 0; }
.tbl .tr { display: grid; grid-template-columns: 1.6fr .7fr 1.2fr .8fr .7fr .8fr; gap: 8px; align-items: center; padding: 6px 0; border-top: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.tbl .tr.four { grid-template-columns: 1.6fr .7fr 1fr .8fr; }
.tbl .tr.five { grid-template-columns: 1.6fr .8fr .8fr .6fr .8fr; }
.tbl .th { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; border-top: none; }
.cell-name { display: flex; align-items: center; gap: 6px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 8px; height: 8px; border-radius: 2px; background: var(--c); flex: none; display: inline-block; }
.minibar { display: inline-block; width: 50px; height: 6px; border-radius: 3px; background: var(--bg-active); margin-right: 6px; overflow: hidden; vertical-align: middle; }
.minibar i { display: block; height: 100%; background: var(--green); }
.hbar { display: grid; grid-template-columns: 110px 1fr 80px; gap: 10px; align-items: center; padding: 3px 0; font-size: 12.5px; }
.hb-t { height: 10px; background: var(--bg-hover); border-radius: 5px; overflow: hidden; }
.hb-t i { display: block; height: 100%; background: var(--text-3); border-radius: 5px; }
.hb-t i.good { background: var(--green); }
.hb-t i.bad { background: #e03e3e; }
.hb-v { text-align: right; color: var(--text-2); font-variant-numeric: tabular-nums; }
.perf { display: flex; gap: 10px; padding: 7px 6px; border-radius: 6px; cursor: pointer; align-items: center; }
.perf:hover { background: var(--bg-hover); }
.perf-b { flex: 1; min-width: 0; }
.perf-v { display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; }
.ins-foot { margin-top: 20px; }

/* ---------- Settings ---------- */
.people { display: flex; flex-direction: column; gap: 6px; }
.person { display: flex; align-items: center; gap: 10px; }
.person .field { width: 220px; border-color: var(--border); }
.swatches.tiny { gap: 4px; }
.sw.xs { width: 14px; height: 14px; }
.person-add { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.person-add .field { width: 340px; border: 1px solid var(--border-strong); }
.key-row { display: flex; gap: 6px; align-items: center; }
.key-row .field { width: 300px; border: 1px solid var(--border-strong); font-family: ui-monospace, Consolas, monospace; }

/* ---------- Search palette ---------- */
.pal-back { place-items: start center; padding-top: 12vh; background: rgba(15, 15, 15, .35); }
.palette { width: 620px; max-width: calc(100vw - 40px); background: var(--bg); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.pal-in { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--border); color: var(--text-2); }
.pal-in input { flex: 1; height: 50px; border: none; outline: none; background: none; font: inherit; font-size: 16px; color: var(--text); }
.pal-list { max-height: 52vh; overflow-y: auto; padding: 6px; }
.pal-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; cursor: pointer; }
.pal-item.on { background: var(--bg-active); }
.pal-ico { color: var(--c); display: grid; place-items: center; width: 18px; }
.pal-l { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pal-s { margin-left: auto; color: var(--text-2); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; }
.pal-foot { border-top: 1px solid var(--border); padding: 7px 14px; font-size: 11.5px; color: var(--text-3); }
.pal-empty { padding: 20px; text-align: center; color: var(--text-2); }

/* ---------- Modal ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 90; background: rgba(15, 15, 15, .45);
  display: grid; place-items: center; animation: fade .12s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: 480px; max-width: calc(100vw - 40px); max-height: calc(100vh - 60px); overflow-y: auto;
  background: var(--bg); border-radius: 12px; box-shadow: var(--shadow); padding: 22px 24px;
}
.modal h2 { font-size: 18px; margin-bottom: 14px; }
.lbl { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin: 14px 0 6px; }
.plats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.plat {
  display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 10px 4px;
  border: 1px solid var(--border-strong); border-radius: 8px; background: var(--bg); cursor: pointer; font-size: 11.5px;
}
.plat svg { color: var(--pc); }
.plat:hover { background: var(--bg-hover); }
.plat.on { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent); }
.swatches { display: flex; flex-wrap: wrap; gap: 7px; }
.sw { width: 24px; height: 24px; border-radius: 50%; border: none; background: var(--c); cursor: pointer; padding: 0; outline-offset: 2px; }
.sw.on { outline: 2px solid var(--c); }
.modal-actions { display: flex; gap: 8px; margin-top: 22px; align-items: center; }
.set-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); gap: 12px; }
.set-row:last-of-type { border-bottom: none; }
.set-row small { display: block; color: var(--text-2); font-size: 12px; }

/* ---------- Toast ---------- */
#toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 100;
  background: #2f2f2f; color: #fff; border-radius: 8px; padding: 8px 8px 8px 14px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 12px; font-size: 13px;
}
#toast[hidden] { display: none; }
#toast button { background: rgba(255, 255, 255, .12); border: none; color: #fff; border-radius: 5px; padding: 4px 10px; cursor: pointer; }
#toast button:hover { background: rgba(255, 255, 255, .2); }

/* ---------- channel logos ---------- */
.av { border-radius: 50%; object-fit: cover; flex: none; display: inline-block; vertical-align: middle; background: var(--bg-active); }
.av-fb { display: inline-grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 14%, var(--bg)); }
.ch-ico { position: relative; }
.hdot { position: absolute; right: -2px; bottom: -2px; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--bg-side, var(--bg)); background: #d9730d; }
.hdot.off { background: #e03e3e; }
.hl-av { position: relative; display: grid; place-items: center; flex: none; }
.ev-title .ev-av { margin-right: 4px; vertical-align: -3px; }
.mchip .mc-av { margin-left: -2px; }
.idea-av { border: none; background: none; padding: 0; width: 18px; height: 18px; display: grid; place-items: center; cursor: pointer; flex: none; border-radius: 50%; }
.idea-av:hover { box-shadow: 0 0 0 2px var(--border-strong); }
#idea-form { display: flex; gap: 4px; }
#idea-form .field { flex: 1; min-width: 0; }
#idea-ch { max-width: 92px; font-size: 11.5px; color: var(--text-2); border: none; background: transparent; cursor: pointer; }
.menu-item.on { background: var(--bg-active); }
.menu-item .mi-av { display: none; }
.popover.menu .menu-item:has(.mi-av) { flex-direction: row; align-items: center; gap: 8px; }
.popover.menu .menu-item:has(.mi-av) .mi-av { display: grid; }
.ch-logo { display: flex; align-items: center; gap: 14px; }
.ch-logo-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.pg-icon .av { width: 100% !important; height: 100% !important; border-radius: 0; }
.pg-icon.busy { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }

/* ---------- upload frequency editor ---------- */
.cad { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.modal .cad { display: flex; }
.cad select, .cad input[type=time], .cad input[type=date] { height: 28px; }
.modal .wd button.on { background: var(--accent); border-color: var(--accent); }

/* ---------- very light upload-day markers ---------- */
.slot { opacity: .55; border-width: 1px; border-style: dotted; background: transparent; transition: opacity .12s; }
.slot:hover { opacity: 1; background: color-mix(in srgb, var(--c) 8%, transparent); }
.slot span { font-weight: 500; gap: 5px; }
.slot .av { opacity: .9; }
.slot.late { opacity: .8; }
.slot-pips { display: inline-flex; gap: 2px; margin-left: 2px; }
.slot-pip { position: relative; border: none; background: none; padding: 0; width: 16px; height: 16px; border-radius: 50%; cursor: pointer; opacity: .4; display: grid; place-items: center; transition: opacity .12s; }
.slot-pip:hover { opacity: 1; }
.slot-pip::after { content: ''; position: absolute; inset: -1px; border-radius: 50%; border: 1px dashed var(--text-3); }
.slot-pip.late { opacity: .85; }
.slot-pip.late::after { border: 1.5px solid #e03e3e; }
.slot-pip b { position: absolute; right: -5px; top: -5px; font-size: 9px; font-weight: 700; color: var(--text-2); }
.slot-more { font-size: 10px; color: var(--text-3); align-self: center; }
.mslot { opacity: .55; border-style: dotted; gap: 5px; }
.mslot:hover { opacity: 1; }
.mslot.late { opacity: .85; }
.mslot span { overflow: hidden; text-overflow: ellipsis; }

/* ---------- off-schedule warning bar ---------- */
#alertbar, .alertbar-in {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 14px; font-size: 12.5px; flex: none;
  background: rgba(224, 62, 62, .08); border-bottom: 1px solid rgba(224, 62, 62, .2); color: var(--text);
}
.alertbar-in { border: 1px solid rgba(224, 62, 62, .22); border-radius: 10px; margin: 0 0 22px; }
#alertbar .ab-ic, .alertbar-in .ab-ic { color: #e03e3e; display: grid; }
.ab-ch { display: grid; margin-right: -4px; }
.ab-ch .av { box-shadow: 0 0 0 2px var(--bg); }
.ab-t { flex: 1; min-width: 0; margin-left: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ab-t b { font-weight: 600; }

/* ---------- schedule health card (channel page) ---------- */
.health { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); margin: 26px 0 6px; }
.health .hd { width: 10px; height: 10px; border-radius: 50%; background: var(--green); flex: none; }
.health.none .hd { background: var(--text-3); }
.health.risk { border-color: rgba(217, 115, 13, .35); background: rgba(217, 115, 13, .06); }
.health.risk .hd { background: #d9730d; }
.health.off { border-color: rgba(224, 62, 62, .35); background: rgba(224, 62, 62, .06); }
.health.off .hd { background: #e03e3e; }
.health .hb { flex: 1; min-width: 0; }

/* ---------- back-on-schedule screen ---------- */
.modal.wide { width: 760px; }
.rc-top { display: flex; align-items: center; gap: 10px; }
.rc-top h2 { margin: 0; }
.rc-intro { margin: 6px 0 16px; }
.rc-ch { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; }
.rc-h { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.rc-row { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); align-items: flex-start; }
.rc-k { color: #d9730d; display: grid; padding-top: 2px; }
.rc-row.bad .rc-k { color: #e03e3e; }
.rc-b { flex: 1; min-width: 0; }
.rc-t { font-weight: 500; margin-bottom: 2px; }
.rc-a { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: 330px; }
.rc-idea { height: 26px; font-size: 12px; max-width: 160px; }
.rc-tip { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: var(--bg-hover); font-size: 12.5px; color: var(--text-2); display: flex; gap: 8px; align-items: center; }
.rc-ok { padding: 6px 0; }
.side-t .av { vertical-align: -3px; margin-right: 2px; }

/* ---------- selected channel (new uploads go here) ---------- */
.ch-row.active { background: color-mix(in srgb, var(--c) 16%, transparent); box-shadow: inset 3px 0 0 var(--c); }
.ch-row.active .ch-name { font-weight: 600; }
.ch-row .ch-edit svg { width: 14px; height: 14px; }
#btn-new.has-ch { max-width: 260px; overflow: hidden; }
#btn-new.has-ch .av { box-shadow: 0 0 0 1.5px #fff; }
@media (hover: none) { .ch-row .ch-edit { opacity: .7; } }

/* ---------- phone layout ---------- */
.menu-btn { display: none; }
#sb-back { display: none; }
#app { height: 100dvh; }
#sidebar { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
#main { padding-top: env(safe-area-inset-top); }
@media (max-width: 760px) {
  #app { grid-template-columns: 1fr; }
  .menu-btn { display: inline-grid; }
  #sidebar { position: fixed; z-index: 70; top: 0; bottom: 0; left: 0; width: min(300px, 86vw); transform: translateX(-102%); transition: transform .2s ease; box-shadow: var(--shadow); }
  body.sb-open #sidebar { transform: none; }
  body.sb-open #sb-back { display: block; position: fixed; inset: 0; z-index: 69; background: rgba(0, 0, 0, .35); }
  #topbar { padding: 0 6px; gap: 4px; }
  #title { font-size: 15px; margin-right: 0; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  #title .yr, #btn-search, #btn-filter { display: none; }
  #topbar .seg button { padding: 0 9px; }
  #topbar .seg .lg { display: none; }
  #btn-today { padding: 0 7px; font-size: 12px; }
  #topbar .nav .icon-btn { width: 24px; }
  #alertbar { padding: 6px 8px; gap: 6px; }
  #btn-new { padding: 0 9px; font-size: 0; gap: 0; }
  #btn-new::after { content: '+'; font-size: 18px; }
  #btn-new.has-ch .av { margin-right: 4px; }
  .ab-t { white-space: normal; font-size: 12px; }
  #alertbar { flex-wrap: wrap; }
  .ab-ch { display: none; }
  .tg-head, .tg-body { grid-template-columns: 44px repeat(var(--cols), 1fr); }
  .tg-dayhead { flex-direction: column; gap: 0; height: 52px; }
  .slot-pips { margin: 0; }
  .mchip .tm, .mchip .pg { display: none; }
  .pg-top { padding: 0 6px; gap: 4px; }
  .pg-top .btn.ghost:not([data-act="back"]) { font-size: 0; gap: 0; padding: 0 6px; }
  .pg-inner, .pg-inner.wide { padding: 20px 16px 80px; }
  .props { grid-template-columns: 1fr; }
  .props .prop-k { margin-top: 8px; }
  .stages { overflow-x: auto; }
  .st-row { min-width: 600px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .series-table { overflow-x: auto; }
  .sr-row { min-width: 640px; }
  .person { flex-wrap: wrap; }
  .person-add, .series-add { flex-wrap: wrap; }
  .person-add .field, .series-add .field, .person .field { width: 100%; flex: 1 1 100%; }
  .set-row { flex-wrap: wrap; }
  .tc-row { row-gap: 6px; }
  .popover, .popover.flt, .popover.menu { left: 8px !important; right: 8px; top: auto !important; bottom: calc(8px + env(safe-area-inset-bottom)) !important; width: auto; max-height: 75dvh; overflow-y: auto; }
  .modal { padding: 18px 16px; max-height: calc(100dvh - 40px); }
  .rc-row { flex-wrap: wrap; }
  .rc-a { max-width: none; justify-content: flex-start; padding-left: 26px; }
  input, select, textarea, .field, .input { font-size: 16px; } /* stops iPhone zooming into fields */
}

/* ---------- sign-in & sync ---------- */
body.locked #app, body.locked #popover { visibility: hidden; }
#login { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: var(--bg-side); padding: 20px; }
.login-card { width: 360px; max-width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 14px; padding: 26px 24px; box-shadow: var(--shadow); }
.login-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.login-brand img { border-radius: 11px; }
.login-brand b { font-size: 16px; }
.login-msg { min-height: 18px; margin: 12px 0 4px; font-size: 12.5px; color: #e03e3e; }
.login-msg.ok { color: var(--green); }
.login-btn { width: 100%; height: 36px; justify-content: center; font-size: 14px; }
.login-alt { margin: 10px auto 0; display: flex; }
.sync { font-size: 11px; color: var(--text-3); display: inline-flex; align-items: center; gap: 5px; padding-right: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sync i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); flex: none; }
.sync.saving i, .sync.pending i { background: var(--accent); animation: pulse 1s infinite; }
.sync.offline i { background: var(--text-3); }
.sync.error { color: #e03e3e; } .sync.error i { background: #e03e3e; }
.sb-footer:has(#sync-status:not([hidden])) .kbd-hint { display: none; }
