/* PD Scheduler. Dark-first, system fonts only (CSP). */
:root {
  --bg: #111213;
  --panel: #18191b;
  --panel-2: #1e1f22;
  --raised: #25262a;
  --line: #2a2b2f;
  --line-2: #37383d;
  --ink: #ececea;
  --muted: #9c9da1;
  --dim: #6e6f74;
  --accent: #8fd18a;
  --accent-ink: #0d1a0c;
  --accent-soft: rgb(143 209 138 / .14);
  --ok: #6fd292;
  --ok-bg: rgb(111 210 146 / .13);
  --warn: #f0b955;
  --warn-bg: rgb(240 185 85 / .13);
  --bad: #ff7f7a;
  --bad-bg: rgb(255 127 122 / .13);
  --info: #8fb3ff;
  --info-bg: rgb(143 179 255 / .13);
  --neutral-bg: #2a2b2f;
  --ig: #e1306c;
  --yt: #ff2d2d;
  --fb: #2d7ff9;
  --focus: #8fd18a;
  --shadow: 0 12px 40px rgb(0 0 0 / .45);
  --radius: 10px;
  --radius-lg: 12px;
  --sidebar: 216px;
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f4f2;
    --panel: #ffffff;
    --panel-2: #f7f7f5;
    --raised: #efefec;
    --line: #e3e3df;
    --line-2: #d2d2cc;
    --ink: #1a1a18;
    --muted: #66665f;
    --dim: #8f8f88;
    --accent: #3f9b3a;
    --accent-ink: #ffffff;
    --accent-soft: rgb(63 155 58 / .12);
    --ok: #1d7f3e;
    --ok-bg: #e4f3e8;
    --warn: #915600;
    --warn-bg: #fcefd6;
    --bad: #c02626;
    --bad-bg: #fbe5e5;
    --info: #2f5bd3;
    --info-bg: #e6ecfb;
    --neutral-bg: #ececea;
    --focus: #3f9b3a;
    --shadow: 0 12px 40px rgb(0 0 0 / .14);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; line-height: 1.25; }
.muted { color: var(--muted); }
.small-text { font-size: 12px; }
.spacer { flex: 1; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.error-text { color: var(--bad); margin: 6px 0 0; }
.error-text:empty { display: none; }
.warn-text { color: var(--warn); background: var(--warn-bg); border-radius: var(--radius); padding: 10px 12px; margin: 0 0 16px; font-size: 13px; }
.note { margin: 0 0 12px; padding: 8px 12px; background: var(--info-bg); color: var(--ink); border-radius: var(--radius); font-size: 13px; }
.note-status { background: var(--panel-2); border: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.linkish { color: var(--accent); font-weight: 600; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------------------------------------------------------- controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--ink);
  font: 600 13px/1 var(--font); cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background-color .12s, border-color .12s, filter .12s;
}
.btn:hover:not(:disabled) { background: var(--raised); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.07); background: var(--accent); }
.btn.danger { color: var(--bad); }
.btn.danger.solid { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--raised); }
.btn.small { min-height: 32px; padding: 0 10px; font-size: 12.5px; }
.btn.link { background: none; border: none; color: var(--muted); padding: 0; min-height: 0; font-weight: 500; }
.btn.link:hover:not(:disabled) { background: none; color: var(--ink); text-decoration: underline; }
.icon-btn { width: 36px; padding: 0; }
.btn.small.icon-btn { width: 32px; }

input[type=text], input[type=password], input[type=date], input[type=datetime-local], select, textarea {
  width: 100%; min-height: 40px; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--ink);
  font: 14px/1.4 var(--font);
}
input:disabled, textarea:read-only { opacity: .8; }
textarea { resize: vertical; min-height: 96px; }
input[type=file] { max-width: 100%; font: 13px var(--font); color: var(--muted); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
label { font-weight: 600; font-size: 13px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-weight: 600; font-size: 13px; padding: 0; margin-bottom: 4px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field label { display: flex; justify-content: space-between; gap: 8px; }
.counter { font: 12px var(--mono); color: var(--muted); font-weight: 400; }
.counter.over { color: var(--bad); }
.checks { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; font-weight: 500; cursor: pointer; }

.badge {
  display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 10px;
  font: 700 10px/1 var(--font); text-transform: uppercase; letter-spacing: .05em; white-space: nowrap;
}
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.count {
  display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px; padding: 0 6px;
  border-radius: 10px; background: var(--raised); color: var(--muted); font: 600 11px/1 var(--font);
}
.count.hot { background: var(--accent-soft); color: var(--accent); }
.count.warn { background: var(--warn-bg); color: var(--warn); }
.count.bad { background: var(--bad-bg); color: var(--bad); }

/* ---------------------------------------------------------- brand */
.brand-row { display: flex; align-items: center; gap: 9px; min-width: 0; }
.mark { color: var(--accent); flex: none; }
.mark path { stroke: var(--accent-ink); }
.brand { font: 700 16px/1 var(--font); letter-spacing: -0.01em; white-space: nowrap; }

/* ---------------------------------------------------------- boot / login */
.boot { padding: 40px 16px; text-align: center; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card {
  width: 100%; max-width: 360px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 28px 24px; display: flex; flex-direction: column; gap: 8px;
}
.login-card h1 { font-size: 18px; }
.login-card .brand-row { margin-bottom: 14px; }
.login-card .btn { margin-top: 8px; min-height: 40px; }

/* ---------------------------------------------------------- shell */
.mobilebar { display: none; }
.scrim { display: none; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 30;
  display: flex; flex-direction: column; gap: 4px; padding: 16px 12px 12px;
  background: var(--bg); overflow-y: auto;
}
.sb-brand { padding: 2px 6px 14px; }
.dry-strip {
  margin: -4px 0 10px; padding: 6px 10px; border-radius: 8px; background: var(--warn-bg); color: var(--warn);
  font: 600 11.5px/1.3 var(--font); text-align: center;
}
.new-btn { width: 100%; min-height: 40px; border-radius: 20px; font-size: 14px; margin-bottom: 12px; }
.sb-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 0 10px;
  border: 0; border-radius: 8px; background: transparent; color: var(--ink); cursor: pointer;
  font: 500 14px/1 var(--font); text-align: left;
}
.nav-item svg { color: var(--muted); flex: none; }
.nav-item:hover { background: var(--panel-2); }
.nav-item[aria-current=page] { background: var(--raised); }
.nav-item[aria-current=page] svg { color: var(--ink); }
.nav-label { flex: 1; }
.nav-item .count { background: transparent; }
.nav-item .count.hot { background: var(--accent-soft); }
.nav-item .count.warn { background: var(--warn-bg); }
.sb-section { font-size: 12px; color: var(--muted); font-weight: 600; padding: 18px 10px 6px; }
.channel-list { display: flex; flex-direction: column; gap: 2px; }
.ch-row { display: flex; align-items: center; border-radius: 8px; min-width: 0; }
.ch-row:hover, .ch-row.active { background: var(--panel-2); }
.ch-row.active { box-shadow: inset 0 0 0 1px var(--line-2); }
.ch-main {
  flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 44px; padding: 4px 8px;
  border: 0; background: none; color: var(--ink); cursor: pointer; text-align: left; font: inherit; border-radius: 8px;
}
.ch-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.ch-name { font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-sub { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-main .count { background: transparent; }
.ch-row.off .ch-name { color: var(--muted); }
.ch-row.off .avatar { opacity: .55; }
.ch-row { position: relative; }
.ch-row.off .ch-main { align-items: flex-start; min-height: 52px; padding-top: 6px; }
.ch-row.off .ch-main .count { margin-top: 6px; }
.ch-row.off .ch-text { padding-top: 1px; }
.ch-row.off:has(.ch-sub) .ch-main { min-height: 66px; }
.ch-connect {
  position: absolute; left: 50px; bottom: 6px; padding: 2px 0; border: 0;
  background: none; color: var(--accent); font: 600 11.5px/1.2 var(--font); cursor: pointer;
}
.ch-connect:hover:not(:disabled) { text-decoration: underline; }
.ch-connect:disabled { color: var(--dim); cursor: not-allowed; }
.sb-foot {
  display: flex; align-items: center; gap: 10px; padding: 10px 6px 2px; margin-top: 12px; border-top: 1px solid var(--line);
}
.sb-who { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.sb-who-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-who-sub { font-size: 11px; color: var(--muted); }

.main {
  margin: 8px 8px 8px var(--sidebar); min-height: calc(100vh - 16px);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 22px 28px 64px; min-width: 0;
}
.page-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 21px; font-weight: 650; letter-spacing: -0.01em; }
.page-icon {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 9px;
  border: 1px solid var(--line-2); background: var(--panel-2);
}
.page-sub { margin: -8px 0 18px; font-size: 13px; }

.seg { display: inline-flex; padding: 3px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--panel-2); }
.seg-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 12px; border: 0; border-radius: 6px;
  background: transparent; color: var(--muted); font: 600 13px/1 var(--font); cursor: pointer;
}
.seg-btn[aria-pressed=true] { background: var(--accent-soft); color: var(--accent); }
.seg-btn:hover:not([aria-pressed=true]) { color: var(--ink); }

.subbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line); margin-bottom: 20px; min-height: 44px;
}
.tabs { display: flex; gap: 2px; min-width: 0; align-self: stretch; }
.tab {
  display: inline-flex; align-items: center; gap: 7px; padding: 0 10px; min-height: 44px;
  border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none;
  color: var(--muted); font: 500 14px/1 var(--font); cursor: pointer; white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected=true] { color: var(--ink); border-bottom-color: var(--accent); }
.tab-approvals .count.hot { background: var(--accent); color: var(--accent-ink); }
.pill-select {
  width: auto; min-height: 32px; padding: 4px 28px 4px 10px; border-radius: 8px; font-size: 13px; font-weight: 500;
  background: var(--panel-2); appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) 52%, calc(100% - 9px) 52%; background-size: 5px 5px; background-repeat: no-repeat;
}
.tz { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--muted); padding: 0 4px; }
.cal-nav { display: flex; align-items: center; gap: 4px; padding: 6px 0; }
.cal-label { font-size: 16px; font-weight: 650; margin: 0 8px 0 4px; }
.hint-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; max-width: 760px; margin: 0 auto 18px;
  padding: 10px 12px 10px 14px; border-radius: var(--radius); background: var(--accent-soft); font-size: 13px;
}
.hint-bar span { flex: 1 1 220px; }

/* ---------------------------------------------------------- avatars */
.avatar {
  position: relative; flex: none; display: inline-grid; place-items: center; border-radius: 50%;
  background: var(--raised); color: var(--ink); font: 700 11px/1 var(--font); letter-spacing: .02em;
  border: 1px solid var(--line-2);
}
.av-md { width: 32px; height: 32px; }
.av-lg { width: 42px; height: 42px; font-size: 13px; }
.av-me { width: 32px; height: 32px; background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.av-youtube:not(.av-glyph) { background: linear-gradient(135deg, #3a1d1d, #2a2526); }
.av-instagram:not(.av-glyph) { background: linear-gradient(135deg, #3b1d34, #2a2330); }
.av-facebook:not(.av-glyph) { background: linear-gradient(135deg, #1b2a45, #222832); }
@media (prefers-color-scheme: light) {
  .av-youtube:not(.av-glyph), .av-instagram:not(.av-glyph), .av-facebook:not(.av-glyph) { background: var(--raised); }
}
.av-glyph.av-youtube { color: var(--yt); }
.av-glyph.av-instagram { color: var(--ig); }
.av-glyph.av-facebook { color: var(--fb); }
.av-badge {
  position: absolute; right: -4px; bottom: -4px; display: grid; place-items: center;
  width: 16px; height: 16px; border-radius: 5px; color: #fff; border: 2px solid var(--panel);
}
.av-lg .av-badge { width: 19px; height: 19px; }
.plat-instagram { background: var(--ig); }
.plat-youtube { background: var(--yt); }
.plat-facebook { background: var(--fb); }
.plat-dot { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 4px; color: #fff; flex: none; }

/* ---------------------------------------------------------- list view */
.post-list { max-width: 760px; margin: 0 auto; }
.day { margin-bottom: 28px; }
.day-head { font-size: 15px; font-weight: 500; color: var(--muted); margin: 0 0 12px; display: flex; gap: 0; align-items: baseline; flex-wrap: wrap; }
.day-head .rel { color: var(--ink); font-weight: 650; white-space: pre; }
.day-head .n { margin-left: 10px; font-size: 12px; color: var(--dim); }
.q-item { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 4px; margin-bottom: 14px; }
.q-time { display: flex; flex-direction: column; padding-top: 12px; }
.q-clock { font-size: 14px; font-weight: 650; }
.q-tz { font-size: 11px; color: var(--dim); }
.empty {
  padding: 48px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--line-2); border-radius: var(--radius-lg);
  display: flex; flex-direction: column; align-items: center; gap: 12px; max-width: 760px; margin: 0 auto;
}
.empty p { margin: 0; }

.card {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-lg); min-width: 0;
  transition: border-color .12s;
}
.card:hover { border-color: var(--line-2); }
.card.is-unapproved { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.card.is-problem { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.card-main { display: flex; gap: 16px; padding: 14px 14px 12px 16px; }
.card-body { flex: 1; min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; min-width: 0; }
.who { display: flex; flex-direction: column; min-width: 0; }
.who-name { font-weight: 650; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-sub { font-size: 11.5px; color: var(--muted); }
.type-pill {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 7px;
  background: var(--raised); color: var(--ink); font: 600 11.5px/1 var(--font); flex: none;
}
.card-title { font-weight: 650; font-size: 14px; margin-bottom: 4px; overflow-wrap: anywhere; }
.card-sub { font-size: 12px; color: var(--muted); margin-bottom: 4px; overflow-wrap: anywhere; }
.caption {
  margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.caption.open { display: block; -webkit-line-clamp: unset; }
.see-more { font-size: 13px; margin-top: 2px; }
.card-error {
  display: flex; gap: 6px; align-items: flex-start; margin: 10px 0 0; padding: 8px 10px; border-radius: 8px;
  background: var(--bad-bg); color: var(--bad); font-size: 13px; overflow-wrap: anywhere;
}
.card-error svg { flex: none; margin-top: 2px; }
.note .card-error { display: inline; background: none; padding: 0; margin: 0; }

.thumb {
  position: relative; flex: none; width: 116px; height: 156px; border-radius: 10px; border: 1px solid var(--line);
  background: radial-gradient(120% 90% at 50% 0%, #2a2b2f 0%, #0b0b0c 70%); color: #fff;
  display: grid; place-items: end start; padding: 10px; cursor: pointer; overflow: hidden;
}
.thumb:hover .play { background: #fff; color: #000; }
.thumb .play, .pv-placeholder .play {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  background: rgb(255 255 255 / .14); color: #fff; transition: background-color .12s;
}
.thumb.playing { padding: 0; cursor: default; place-items: center; background: #000; }
.thumb.playing video { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-loading { color: #bbb; font-size: 12px; }
.thumb-close {
  position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; border: 0;
  background: rgb(0 0 0 / .6); color: #fff; display: grid; place-items: center; cursor: pointer;
}

.card-foot {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px 10px 16px;
  border-top: 1px solid var(--line); min-height: 52px;
}
.foot-info { flex: 1 1 200px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; min-width: 0; }
.foot-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.foot-actions:empty { display: none; }
.status { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 11px; font: 600 11.5px/1 var(--font); white-space: nowrap; }
.s-ok { background: var(--ok-bg); color: var(--ok); }
.s-info { background: var(--info-bg); color: var(--info); }
.s-warn { background: var(--warn-bg); color: var(--warn); }
.s-bad { background: var(--bad-bg); color: var(--bad); }
.s-neutral { background: var(--neutral-bg); color: var(--muted); }
.appr { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.appr.yes { color: var(--ok); }
.appr.no { color: var(--warn); }
.batch { font: 12px var(--mono); color: var(--muted); overflow-wrap: anywhere; }

.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 190px; padding: 5px;
  background: var(--raised); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.menu-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; padding: 0 10px;
  border: 0; border-radius: 6px; background: none; color: var(--ink); font: 500 13px/1 var(--font);
  text-align: left; cursor: pointer; text-decoration: none;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--panel-2); outline: none; }
.menu-item.danger { color: var(--bad); }

.confirm-inline {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; width: 100%;
  background: var(--warn-bg); border-radius: 8px; padding: 6px 8px;
}
.confirm-inline .msg { flex: 1 1 180px; font-size: 13px; font-weight: 600; color: var(--ink); }
.foot-actions:has(.confirm-inline) { flex: 1 1 100%; }

/* ---------------------------------------------------------- calendar */
.calendar-wrap { overflow-x: auto; max-width: 100%; border: 1px solid var(--line); border-radius: var(--radius-lg); }
.cal { display: grid; grid-template-columns: 62px repeat(7, minmax(108px, 1fr)); min-width: 820px; }
.cal-corner, .cal-dayhead { position: sticky; top: 0; background: var(--panel); z-index: 1; border-bottom: 1px solid var(--line); }
.cal-dayhead {
  display: flex; justify-content: center; align-items: baseline; gap: 6px; padding: 10px 4px;
  font-size: 13px; color: var(--muted); border-left: 1px solid var(--line);
}
.cal-dn { color: var(--ink); font-weight: 600; }
.cal-dayhead.today { color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
.cal-dayhead.today .cal-dn { color: var(--accent); }
.cal-hour { padding: 6px 8px 0 0; text-align: right; font-size: 11px; color: var(--dim); border-top: 1px solid var(--line); }
.cal-cell {
  min-height: 56px; padding: 5px; display: flex; flex-direction: column; gap: 5px;
  border-top: 1px solid var(--line); border-left: 1px solid var(--line);
}
.cal-cell.today { background: rgb(143 209 138 / .035); }
.cal-cell.past { background: rgb(0 0 0 / .08); }
.cal-card {
  display: flex; flex-direction: column; gap: 4px; width: 100%; padding: 7px 8px; text-align: left;
  border: 1px solid var(--line-2); border-radius: 8px; background: var(--panel-2); color: var(--ink);
  font: inherit; cursor: pointer; min-width: 0;
}
.cal-card:hover { border-color: var(--muted); }
.cal-card.is-unapproved { border-style: dashed; border-color: var(--warn); }
.cal-card.is-problem { border-color: var(--bad); background: var(--bad-bg); }
.cal-card.is-posted { opacity: .7; }
.cal-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.cal-time { font-size: 12px; font-weight: 650; white-space: nowrap; }
.cal-flag { margin-left: auto; font-size: 10px; font-weight: 700; color: var(--warn); text-transform: uppercase; letter-spacing: .04em; }
.cal-text {
  font-size: 12.5px; line-height: 1.35; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.cal-empty { text-align: center; margin: 14px; }
.cal-legend { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0; padding: 10px 12px; border-top: 1px solid var(--line); min-width: 820px; }
.lg { display: inline-block; width: 14px; height: 10px; border-radius: 3px; border: 1px solid var(--line-2); margin-left: 8px; }
.lg:first-child { margin-left: 0; }
.lg-unapproved { border: 1px dashed var(--warn); }
.lg-problem { border-color: var(--bad); background: var(--bad-bg); }
.lg-posted { opacity: .6; background: var(--panel-2); }

/* ---------------------------------------------------------- batches + settings */
.batch-list { display: grid; gap: 12px; max-width: 760px; }
.batch-row { padding: 14px 16px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.batch-top { display: flex; align-items: center; gap: 10px; }
.batch-name { flex: 1; font: 650 14px var(--mono); overflow-wrap: anywhere; }
.batch-counts { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin: 6px 0 8px; }
.batch-counts b { color: var(--ink); font-weight: 650; }
.meter { height: 5px; border-radius: 3px; background: var(--raised); overflow: hidden; margin-bottom: 12px; }
.meter span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.batch-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.chips { display: grid; gap: 10px; max-width: 760px; margin-bottom: 14px; }
.chip {
  display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 12px 10px 14px; flex-wrap: wrap;
  border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel-2); min-width: 0;
}
.chip .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--dim); margin-left: 7px; vertical-align: middle; }
.chip.on .dot { background: var(--ok); }
.chip-text { display: flex; flex-direction: column; min-width: 0; flex: 1 1 160px; }
.chip-label { font-size: 14px; font-weight: 650; }
.chip-name { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-hint { font-size: 12px; color: var(--muted); }
.chip .spacer { display: none; }
.chip .confirm-inline { flex: 1 1 100%; }
.panel { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px 16px; max-width: 760px; margin-bottom: 14px; }
.panel-title { font-size: 14px; margin-bottom: 6px; }
.page-row { display: flex; align-items: center; gap: 12px; }
.page-row label { white-space: nowrap; }
.page-row select { max-width: 360px; }
.tick-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tick-row .muted { flex: 1 1 260px; }

/* ---------------------------------------------------------- dialogs */
.dlg {
  border: 1px solid var(--line-2); border-radius: var(--radius-lg); padding: 0; background: var(--panel); color: var(--ink);
  width: min(560px, calc(100vw - 16px)); max-height: calc(100dvh - 16px); box-shadow: var(--shadow);
}
.dlg-wide { width: min(880px, calc(100vw - 16px)); }
.dlg::backdrop { background: rgb(0 0 0 / .6); }
.dlg-body { padding: 16px 18px 18px; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.dlg-head h2 { font-size: 17px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.progress { height: 6px; border-radius: 3px; background: var(--raised); overflow: hidden; }
.progress-bar { height: 100%; width: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .15s; }
.table-wrap { overflow-x: auto; max-width: 100%; }
.imp-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.imp-table th { text-align: left; color: var(--muted); font-weight: 600; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.imp-table td { padding: 5px 6px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.imp-table td.mono { font-family: var(--mono); }
.imp-table .ok { color: var(--ok); }
.imp-table .bad { color: var(--bad); }
.imp-table .dim { color: var(--muted); }
.imp-table .progress { width: 80px; margin-top: 3px; }
.result { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: var(--ok-bg); font-size: 13px; }
.result ul { margin: 6px 0 0; padding-left: 18px; }

/* composer */
.dlg-compose { width: min(1080px, calc(100vw - 24px)); height: min(780px, calc(100dvh - 24px)); max-height: none; overflow: hidden; }
.dlg-compose[open] { display: flex; }
.cmp { display: flex; flex-direction: column; flex: 1; min-height: 0; width: 100%; }
.cmp-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 14px 24px; border-bottom: 1px solid var(--line); }
.cmp-head h2 { font-size: 17px; }
.cmp-body { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 340px; min-height: 0; }
.cmp-main { padding: 18px 24px; overflow-y: auto; min-width: 0; }
.cmp-channels { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.ch-toggle {
  position: relative; padding: 2px; border: 2px solid transparent; border-radius: 50%; background: none; cursor: pointer;
  opacity: .45; filter: grayscale(.8); transition: opacity .12s, filter .12s, border-color .12s;
}
.ch-toggle.on { opacity: 1; filter: none; border-color: var(--accent); }
.ch-toggle:disabled { cursor: default; }
.ch-toggle .avatar { border-color: transparent; }
.ch-toggle .av-badge { border-color: var(--panel); }
.ch-tick {
  position: absolute; left: -2px; top: -2px; display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
}
.ch-hint { margin-left: 4px; }
.editor { border: 1px solid var(--line-2); border-radius: var(--radius-lg); background: var(--panel-2); margin-bottom: 14px; }
.editor:focus-within { border-color: var(--muted); }
.editor textarea { border: 0; background: transparent; min-height: 150px; padding: 14px 16px; font-size: 15px; line-height: 1.55; resize: vertical; }
.editor textarea:focus-visible { outline: none; }
.media-zone { display: flex; align-items: flex-start; gap: 14px; padding: 0 16px 12px; flex-wrap: wrap; }
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  width: 150px; min-height: 108px; padding: 12px; border: 1.5px dashed var(--line-2); border-radius: 10px;
  color: var(--ink); font-weight: 500; font-size: 13px; cursor: pointer; transition: border-color .12s, background-color .12s;
}
.drop svg { color: var(--muted); }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop:has(+ .media-info) { flex: none; }
.media-zone:focus-within .drop { border-color: var(--accent); }
.media-info { flex: 1 1 160px; display: flex; flex-direction: column; gap: 6px; justify-content: center; min-height: 40px; min-width: 0; overflow-wrap: anywhere; }
.media-info p { margin: 0; }
.editor-foot { display: flex; justify-content: flex-end; padding: 0 16px 10px; }
.when-row { display: flex; gap: 8px; }
.when-row input { flex: 1; min-width: 0; }
.cmp-preview { border-left: 1px solid var(--line); background: var(--panel-2); padding: 18px 20px; overflow-y: auto; }
.pv-title { font-size: 15px; margin-bottom: 12px; }
.pv-tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.pv-tabs:empty { display: none; }
.pv-tab {
  display: inline-flex; align-items: center; gap: 5px; min-height: 28px; padding: 0 10px; border-radius: 14px;
  border: 1px solid var(--line-2); background: none; color: var(--muted); font: 600 12px/1 var(--font); cursor: pointer;
}
.pv-tab[aria-pressed=true] { background: var(--raised); color: var(--ink); }
.phone { border: 1px solid var(--line-2); border-radius: 18px; background: var(--panel); padding: 12px; max-width: 300px; margin: 0 auto; }
.ph-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; min-width: 0; }
.ph-media { border-radius: 10px; overflow: hidden; background: #000; aspect-ratio: 9 / 16; max-height: 360px; display: grid; place-items: center; margin: 0 auto; }
.ph-media video { width: 100%; height: 100%; object-fit: contain; display: block; }
.pv-placeholder { display: flex; flex-direction: column; align-items: center; gap: 8px; color: #aaa; font-size: 12px; padding: 16px; text-align: center; }
.ph-title { font-weight: 650; font-size: 14px; margin-top: 10px; overflow-wrap: anywhere; }
.ph-caption {
  margin: 8px 0 0; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden;
}
.ph-when { display: flex; align-items: center; gap: 6px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.pv-empty { text-align: center; margin: 40px 0; }
.cmp-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 16px 12px 24px; border-top: 1px solid var(--line); }
.cmp-foot .btn { min-height: 40px; }

/* ---------------------------------------------------------- toasts */
.toasts {
  position: fixed; z-index: 100; right: 16px; bottom: 16px;
  display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100vw - 32px)); pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; gap: 10px; align-items: flex-start;
  background: var(--raised); color: var(--ink); border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 8px 10px 12px;
  font-size: 13px; box-shadow: var(--shadow); overflow-wrap: anywhere;
}
.toast > svg { flex: none; margin-top: 2px; }
.toast.ok > svg { color: var(--ok); }
.toast.error { border-color: var(--bad); }
.toast.error > svg { color: var(--bad); }
.toast .t-msg { flex: 1; white-space: pre-wrap; }
.toast button { background: none; border: 0; color: var(--muted); cursor: pointer; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 6px; flex: none; }
.toast button:hover { background: var(--panel-2); color: var(--ink); }

/* ---------------------------------------------------------- tablet / phone */
@media (max-width: 1000px) {
  .cmp-body { grid-template-columns: minmax(0, 1fr) 280px; }
}
@media (max-width: 800px) {
  .mobilebar {
    display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 25;
    padding: 8px 12px; background: var(--bg); border-bottom: 1px solid var(--line);
  }
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; width: min(280px, 86vw); border-right: 1px solid var(--line); box-shadow: var(--shadow); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open { overflow: hidden; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 29; background: rgb(0 0 0 / .5); }
  .main { margin: 0; border: 0; border-radius: 0; padding: 16px 16px 72px; min-height: 0; }
  .hide-sm { display: none; }
  .page-head h1 { font-size: 19px; }
  .subbar { gap: 8px; }
  .tabs { width: 100%; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: none; padding: 0 8px; }
  .q-item { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .q-time { flex-direction: row; gap: 6px; align-items: baseline; padding-top: 0; }
  .card-main { padding: 12px; gap: 12px; }
  .thumb { width: 76px; height: 104px; }
  .card-foot { padding: 10px 12px; }
  .foot-actions { flex: 1 1 100%; justify-content: flex-start; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .page-row { flex-direction: column; align-items: stretch; gap: 4px; }
  .page-row select { max-width: none; }
  .dlg { width: calc(100vw - 8px); max-width: calc(100vw - 8px); max-height: calc(100dvh - 8px); }
  .dlg-compose { height: calc(100dvh - 8px); }
  .cmp-body { display: block; overflow-y: auto; }
  .cmp-main { overflow: visible; padding: 14px 16px; }
  .cmp-preview { border-left: 0; border-top: 1px solid var(--line); overflow: visible; padding: 16px; }
  .cmp-head { padding: 10px 10px 10px 16px; }
  .cmp-foot { padding: 10px 16px; }
  .cmp-foot #cmp-foot-note { flex: 1 1 100%; }
  .cmp-foot .btn { flex: 1; }
  .editor textarea { min-height: 150px; }
  .toasts { left: 16px; right: 16px; width: auto; }
}
