/* Post Planner: Liquid Glass, day and night.
   Day is a pale sky with soft colour behind frosted panels; night is deep navy with indigo and teal glow.
   The glass material and the LinkedIn preview are the two things meant to stand out; everything else stays quiet. */

:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
  --r-lg: 24px;
  --r-md: 16px;
  --r-sm: 11px;
  --editor-scroll-offset: 92px;
}

/* ---------- day ---------- */
:root, :root[data-theme="light"] {
  color-scheme: light;
  --bg: #e3ecf8;
  --blob1: #7db4ff; --blob2: #c3a8ff; --blob3: #86e6d4;
  --ink: #0c1a2b;
  --muted: #475a70;
  --accent: #1769d6;
  --accent-2: #0b4fb0;
  --accent-ink: #ffffff;
  --glass: rgba(255, 255, 255, 0.50);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --pop: #f6f9ff;
  --glass-edge: rgba(255, 255, 255, 0.75);
  --hi: rgba(255, 255, 255, 0.95);
  --lo: rgba(80, 110, 160, 0.14);
  --sheen: rgba(255, 255, 255, 0.55);
  --sheen2: rgba(180, 210, 255, 0.25);
  --shadow: 0 18px 40px -16px rgba(30, 60, 110, 0.35), 0 2px 6px rgba(30, 60, 110, 0.08);
  --field: rgba(255, 255, 255, 0.6);
  --field-edge: rgba(70, 100, 150, 0.22);
  --line: rgba(60, 90, 140, 0.16);
  --ok: #12703f; --ok-bg: rgba(24, 160, 90, 0.15);
  --info: #1558b8; --info-bg: rgba(23, 105, 214, 0.14);
  --warn: #8a5300; --warn-bg: rgba(230, 150, 20, 0.18);
  --bad: #b3261e; --bad-bg: rgba(220, 60, 50, 0.14);
  --idle: #4c5d70; --idle-bg: rgba(90, 110, 140, 0.14);
  --li-bg: #ffffff; --li-text: #1d2226; --li-sub: #5e6a74; --li-line: #e0dfdc; --li-link: #0a66c2;
}

/* ---------- night ---------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #060b16;
  --blob1: #2457d6; --blob2: #6d3df0; --blob3: #0a9f98;
  --ink: #e9f1fb;
  --muted: #9fb2c8;
  --accent: #6ab0ff;
  --accent-2: #3e86e6;
  --accent-ink: #06142a;
  --glass: rgba(24, 34, 54, 0.46);
  --glass-strong: rgba(22, 32, 52, 0.86);
  --pop: #121b2c;
  --glass-edge: rgba(255, 255, 255, 0.14);
  --hi: rgba(255, 255, 255, 0.22);
  --lo: rgba(0, 0, 0, 0.35);
  --sheen: rgba(255, 255, 255, 0.10);
  --sheen2: rgba(110, 150, 255, 0.10);
  --shadow: 0 20px 44px -18px rgba(0, 0, 0, 0.7), 0 2px 8px rgba(0, 0, 0, 0.3);
  --field: rgba(8, 14, 28, 0.5);
  --field-edge: rgba(255, 255, 255, 0.16);
  --line: rgba(255, 255, 255, 0.12);
  --ok: #5fd9a0; --ok-bg: rgba(60, 200, 130, 0.16);
  --info: #86bfff; --info-bg: rgba(90, 160, 255, 0.16);
  --warn: #f5b862; --warn-bg: rgba(240, 170, 60, 0.16);
  --bad: #ff8d84; --bad-bg: rgba(255, 110, 100, 0.16);
  --idle: #9fb2c8; --idle-bg: rgba(150, 175, 205, 0.14);
  --li-bg: #1b1f23; --li-text: #e9eaec; --li-sub: #a9b3bd; --li-line: #38434f; --li-link: #71b7fb;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink);
  font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
h2 { font-size: 17px; font-weight: 650; letter-spacing: -0.01em; }
button, input, textarea, select { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 12.5px; margin-top: 6px; line-height: 1.45; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- backdrop ---------- */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--bg); }
.blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.75; will-change: transform; }
.b1 { width: 52vw; height: 52vw; left: -12vw; top: -14vw; background: var(--blob1); animation: drift1 38s ease-in-out infinite alternate; }
.b2 { width: 46vw; height: 46vw; right: -10vw; top: 8vh; background: var(--blob2); animation: drift2 44s ease-in-out infinite alternate; }
.b3 { width: 42vw; height: 42vw; left: 24vw; bottom: -20vw; background: var(--blob3); animation: drift3 50s ease-in-out infinite alternate; }
:root[data-theme="dark"] .blob { opacity: 0.5; }
@keyframes drift1 { to { transform: translate(8vw, 10vh) scale(1.08); } }
@keyframes drift2 { to { transform: translate(-10vw, 6vh) scale(0.94); } }
@keyframes drift3 { to { transform: translate(6vw, -8vh) scale(1.1); } }
@media (prefers-reduced-motion: reduce) { .blob { animation: none; } * { scroll-behavior: auto; } }

/* ---------- glass ---------- */
.glass {
  position: relative; isolation: isolate;
  background: var(--glass);
  -webkit-backdrop-filter: blur(24px) saturate(170%);
  backdrop-filter: blur(24px) saturate(170%);
  border: 1px solid var(--glass-edge);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow), inset 0 1px 0 var(--hi), inset 0 -1px 0 var(--lo);
}
.glass::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  background: linear-gradient(135deg, var(--sheen) 0%, transparent 34%, transparent 66%, var(--sheen2) 100%);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: var(--glass-strong); }
}
.card { padding: 20px; }

/* ---------- shell ---------- */
.shell { max-width: 1340px; margin: 0 auto; padding: 14px 20px 48px; }
.bar {
  display: flex; align-items: center; gap: 14px; padding: 10px 14px; margin-bottom: 18px;
  position: sticky; top: 12px; z-index: 20; border-radius: 999px; background: var(--glass-strong);
}
.brand { display: flex; align-items: center; gap: 10px; padding-left: 6px; }
.logo {
  flex: none;
  width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; color: var(--accent-ink);
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 6px 14px -6px var(--accent);
}
.brand h1 { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.tabs { display: flex; gap: 4px; padding: 4px; margin-left: 10px; border-radius: 999px; background: var(--field); border: 1px solid var(--field-edge); }
.tab { border: 0; background: transparent; padding: 7px 16px; border-radius: 999px; cursor: pointer; color: var(--muted); font-weight: 600; }
.tab[aria-selected="true"] { background: var(--glass-strong); color: var(--ink); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12), inset 0 1px 0 var(--hi); }
.bar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; min-width: 0; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--field-edge); background: var(--field); font-weight: 600; font-size: 13.5px;
}
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--idle); }
.pill.ok .dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.pill.warn .dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }
.pill.bad .dot { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-bg); }
.icon-btn {
  flex: none;
  width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--field-edge); background: var(--field);
}
.icon-btn:hover, .pill:hover { background: var(--glass-strong); }

.banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 16px; border-radius: var(--r-md); }
.banner.warn { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn); }
.banner.bad { background: var(--bad-bg); color: var(--bad); border: 1px solid var(--bad); }
.banner span { flex: 1 1 260px; font-weight: 550; }

/* ---------- buttons and fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--field-edge); background: var(--field); font-weight: 600; text-decoration: none; color: var(--ink);
  transition: background 0.15s, transform 0.1s;
}
.btn:hover { background: var(--glass-strong); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  color: var(--accent-ink); border-color: transparent;
  background: linear-gradient(160deg, var(--accent), var(--accent-2));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 8px 18px -8px var(--accent);
}
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--bad); }
.btn.wide { width: 100%; padding: 12px 16px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.field { display: block; min-width: 0; margin-top: 14px; }
.field > span, .field-head > span:first-child { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field em { font-style: normal; font-weight: 450; color: var(--muted); }
.field-head { display: flex; flex-wrap: wrap; gap: 6px 10px; justify-content: space-between; align-items: baseline; }
input[type="text"], input[type="number"], input[type="password"], input[type="datetime-local"], input:not([type]), textarea, select {
  width: 100%; min-width: 0; max-width: 100%; padding: 10px 13px; border-radius: var(--r-sm); border: 1px solid var(--field-edge); background: var(--field);
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.8; }
input:disabled, textarea:disabled { opacity: 0.7; cursor: not-allowed; }
textarea { resize: vertical; min-height: 280px; line-height: 1.55; white-space: pre-wrap; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) 110px; gap: 12px; }
.ed-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.ed-head-actions { display: flex; align-items: center; gap: 10px; }
.media-row { display: grid; grid-template-columns: 22px 120px minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; margin-top: 8px; align-items: center; }
.media-row input, .media-row select { min-width: 0; }
.bulk-tools .actions { margin-top: 10px; }
.bulk-check { flex: none; accent-color: var(--accent); }

.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 5px; margin-bottom: 8px; border-radius: var(--r-sm);
  background: var(--field); border: 1px solid var(--field-edge);
}
.toolbar button {
  min-width: 34px; height: 32px; padding: 0 9px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; font-size: 14px;
}
.toolbar button:hover { background: var(--glass-strong); }
.toolbar .sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }

.alert { margin-top: 14px; padding: 10px 14px; border-radius: var(--r-sm); font-size: 14px; }
.alert.err { background: var(--bad-bg); color: var(--bad); }
.alert.note { background: var(--info-bg); color: var(--info); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.actions .spacer { flex: 1; }

/* ---------- chips ---------- */
.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 650; background: var(--idle-bg); color: var(--idle); white-space: nowrap; }
.st-published { background: var(--ok-bg); color: var(--ok); }
.st-scheduled { background: var(--info-bg); color: var(--info); }
.st-ready { background: var(--warn-bg); color: var(--warn); }
.st-failed, .st-late { background: var(--bad-bg); color: var(--bad); }

/* ---------- planner ---------- */
.planner { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 18px; align-items: start; }
.side { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; position: sticky; top: 92px; max-height: calc(100vh - 110px); overflow-y: auto; scrollbar-gutter: stable; padding: 4px 10px 24px; margin: -4px -10px -24px; }
.planner > *, .side > *, .stack > *, .work > *, .cal-wrap > *, .cal-side > *, .series-posts > * { min-width: 0; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.work { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 18px; align-items: start; }
#editor { scroll-margin-top: var(--editor-scroll-offset); }
.today-date { color: var(--muted); font-size: 13px; margin: 2px 0 8px; }
.row { display: flex; align-items: center; gap: 8px; padding: 2px; margin: 0; border-radius: 12px; width: 100%; min-width: 0; }
.row:hover, .row:has(.row-main.sel) { background: var(--field); }
.row-main { display: flex; flex: 1 1 0; align-items: center; gap: 8px; padding: 8px; margin: 0; border-radius: 10px; cursor: pointer; width: 100%; min-width: 0; max-width: 100%; background: none; border: 0; text-align: left; color: inherit; }
.row-main:hover, .row-main.sel { background: var(--field); }
.row-selectable .bulk-check { margin: 0 4px 0 8px; }
.row-main .day { flex: 0 0 auto; max-width: 68px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.row-main .day:empty { display: none; }
.row-main .t { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-main .chip { flex: 0 0 auto; max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
.side .row-main { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 8px; }
.side .row-main .day { grid-column: 1; grid-row: 1; }
.side .row-main .chip { grid-column: 2; grid-row: 1; justify-self: end; }
.side .row-main .t { grid-column: 1 / -1; grid-row: 2; white-space: normal; overflow: visible; overflow-wrap: anywhere; }
.sub { font-size: 12.5px; font-weight: 650; color: var(--muted); margin: 12px 0 2px; }
.bar-track { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin: 8px 0 6px; }
.bar-track i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--ok)); border-radius: 3px; }
.empty { text-align: center; padding: 48px 12px; display: grid; gap: 10px; justify-items: center; }
.bulk-tools, .transfer-tools { display: grid; gap: 10px; }
.bulk-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 6px 12px; }
.bulk-head > * { min-width: 0; }
.bulk-head h2 { margin-bottom: 2px; }
.bulk-select-all { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--field); font-size: 13px; font-weight: 600; }
.bulk-action-form { display: grid; gap: 10px; min-width: 0; }
.bulk-action-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.bulk-action-form .field { margin-top: 0; }
.bulk-action-controls .btn { padding-left: 12px; padding-right: 12px; }
#bulkScheduledAt { font-size: 13px; }
.transfer-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; align-items: start; }
.transfer-actions > *, .bulk-action-controls > * { min-width: 0; }
.transfer-actions .btn { width: 100%; padding-left: 8px; padding-right: 8px; }
.export-tools, #exportOptions { display: grid; gap: 8px; min-width: 0; }
#exportOptions { margin-top: 8px; }
.series-group { padding: 14px 16px; }
.series-group summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; list-style: none; }
.series-group summary::-webkit-details-marker { display: none; }
.series-group summary > span:first-child { flex: 1 1 0; min-width: 0; display: grid; gap: 2px; }
.series-group summary strong { overflow-wrap: anywhere; }
.series-group summary small { color: var(--muted); font-size: 12px; font-weight: 500; overflow-wrap: anywhere; }
.series-progress { flex: 0 1 88px; min-width: 0; color: var(--muted); font-size: 12px; text-align: right; overflow-wrap: anywhere; }
.series-group .bar-track { margin-bottom: 8px; }
.series-posts { display: grid; gap: 2px; }
.media-add-actions { display: inline-flex; gap: 6px; }
.media-add-actions .btn { padding: 5px 10px; font-size: 12px; }
.media-number { width: 22px; color: var(--muted); font-size: 12px; text-align: center; }
.assistant { margin-top: 16px; padding: 16px; border-radius: var(--r-md); background: var(--info-bg); border: 1px solid var(--field-edge); }
.assistant-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.assistant h3 { font-size: 16px; }
.assistant-badge { flex: none; padding: 3px 8px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 800; letter-spacing: .05em; }
.assistant-controls { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 10px; }
.assistant-controls .field { margin-top: 8px; }
.assistant select, .assistant input { margin-top: 5px; padding: 9px 10px; }
.assistant > .btn { margin-top: 12px; }
.assistant-output { white-space: pre-wrap; margin-top: 12px; padding: 11px; border-radius: var(--r-sm); background: var(--field); border: 1px solid var(--field-edge); }
.assistant-result { white-space: pre-wrap; line-height: 1.5; }
.assistant-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.assistant-actions .btn { margin-top: 10px; }

/* ---------- date and time picker ---------- */
.picker { position: relative; }
.picker-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 13px; border-radius: var(--r-sm); cursor: pointer; text-align: left;
  border: 1px solid var(--field-edge); background: var(--field);
}
.picker-btn:disabled { opacity: 0.7; cursor: not-allowed; }
.pop {
  position: absolute; z-index: 30; left: 0; top: calc(100% + 8px); width: min(330px, calc(100vw - 40px)); padding: 14px; border-radius: 20px;
  background: var(--pop); border: 1px solid var(--glass-edge);
  box-shadow: var(--shadow), inset 0 1px 0 var(--hi);
}
.pop-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.pop-head button { width: 32px; height: 32px; border-radius: 50%; border: 0; background: transparent; cursor: pointer; font-size: 18px; }
.pop-head button:hover { background: var(--field); }
.pop-dow, .pop-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.pop-dow span { font-size: 12px; color: var(--muted); padding: 4px 0; }
.pop-grid button { height: 36px; border: 0; border-radius: 50%; background: transparent; cursor: pointer; font-variant-numeric: tabular-nums; }
.pop-grid button:hover:not(:disabled) { background: var(--field); }
.pop-grid button:disabled { opacity: 0.35; cursor: not-allowed; }
.pop-grid .dim { color: var(--muted); }
.pop-grid .today { box-shadow: inset 0 0 0 1.5px var(--accent); }
.pop-grid .sel { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.pop-time { display: flex; align-items: center; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.pop-time select { width: auto; flex: 1; padding: 8px 6px; }
.pop-time b { color: var(--muted); }
.pop-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.pop-presets button { padding: 5px 11px; border-radius: 999px; border: 1px solid var(--field-edge); background: var(--field); cursor: pointer; font-size: 13px; }
.pop-presets button:hover { background: var(--glass-strong); }
.pop-foot { display: flex; justify-content: space-between; margin-top: 12px; }

/* ---------- LinkedIn preview ---------- */
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--field); border: 1px solid var(--field-edge); }
.seg button { border: 0; background: transparent; padding: 5px 12px; border-radius: 999px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--glass-strong); color: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15); }
.li-wrap { margin-top: 12px; display: flex; justify-content: center; }
.li-card { width: 100%; max-width: 555px; background: var(--li-bg); color: var(--li-text); border: 1px solid var(--li-line); border-radius: 10px; overflow: hidden; font-family: var(--font); }
.li-wrap.mobile .li-card { max-width: 360px; font-size: 14px; }
.li-head { display: flex; gap: 10px; padding: 12px 16px 0; align-items: flex-start; }
.av { position: relative; width: 48px; height: 48px; flex: none; border-radius: 50%; display: grid; place-items: center; overflow: hidden; background: #0a66c2; color: #fff; font-weight: 700; }
.av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.li-who { flex: 1; min-width: 0; line-height: 1.3; overflow-wrap: anywhere; }
.li-who b { display: block; font-size: 14px; font-weight: 650; }
.li-who span { font-size: 12px; color: var(--li-sub); }
.li-text { padding: 10px 16px 12px; font-size: 14px; line-height: 1.43; white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; }
.li-ph { color: var(--li-sub); }
.li-tag { color: var(--li-link); font-weight: 600; }
.li-more { border: 0; background: none; padding: 0; color: var(--li-sub); cursor: pointer; font-size: 14px; }
.li-more:hover { color: var(--li-link); text-decoration: underline; }
.li-img { background: var(--li-line); min-height: 60px; }
.li-img img { display: block; width: 100%; height: auto; max-height: 560px; object-fit: cover; }
.li-img .miss { padding: 22px 16px; font-size: 13px; color: var(--li-sub); text-align: center; }
.li-doc { padding: 28px 16px; background: var(--li-line); color: var(--li-sub); text-align: center; font-weight: 650; }
.li-acts { display: flex; flex-wrap: wrap; justify-content: space-around; padding: 4px 8px; margin-top: 8px; border-top: 1px solid var(--li-line); color: var(--li-sub); font-size: 13.5px; font-weight: 600; }
.li-acts span { padding: 10px 8px; }

/* ---------- calendar ---------- */
.cal-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.cal-side { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; min-width: 0; }
.cal-top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.cal-top h2 { font-size: 21px; min-width: 170px; }
.cal-top .spacer { flex: 1; }
.cal-dow, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-dow span { text-align: center; font-size: 12.5px; font-weight: 650; color: var(--muted); padding: 4px 0 6px; }
.cell {
  min-height: 108px; padding: 6px; border-radius: 14px; background: var(--field); border: 1px solid var(--field-edge);
  cursor: pointer; display: flex; flex-direction: column; gap: 4px; overflow: hidden;
}
.cell:hover { background: var(--glass-strong); }
.cell.dim { opacity: 0.55; }
.cell.today { box-shadow: inset 0 0 0 2px var(--accent); }
.cell.sel { background: var(--glass-strong); border-color: var(--accent); }
.cell .n { font-size: 13px; font-weight: 650; padding: 0 3px; font-variant-numeric: tabular-nums; }
.cell .more { font-size: 12px; color: var(--muted); padding: 0 4px; }
.cp {
  display: block; width: 100%; text-align: left; padding: 3px 7px; border: 0; border-radius: 7px; cursor: pointer; font-size: 12px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: var(--idle-bg); color: var(--idle);
}
.cp.st-published { background: var(--ok-bg); color: var(--ok); }
.cp.st-scheduled { background: var(--info-bg); color: var(--info); }
.cp.st-ready { background: var(--warn-bg); color: var(--warn); }
.cp.st-failed, .cp.st-late { background: var(--bad-bg); color: var(--bad); }
.legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.day-list { display: grid; gap: 4px; margin: 10px 0 14px; }
.day-list > .row-main { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 4px 8px; }
.day-list .day { grid-column: 1; grid-row: 1; white-space: nowrap; }
.day-list .t { grid-column: 2; grid-row: 1; white-space: normal; overflow: visible; overflow-wrap: anywhere; line-height: 1.45; }
.day-list .chip { grid-column: 3; grid-row: 1; justify-self: end; font-variant-numeric: tabular-nums; }
.day-list .chip.st-published { background: var(--ok-bg); color: var(--ok); }
.day-list .chip.st-scheduled { background: var(--info-bg); color: var(--info); }
.day-list .chip.st-ready { background: var(--warn-bg); color: var(--warn); }
.day-list .chip.st-failed, .day-list .chip.st-late { background: var(--bad-bg); color: var(--bad); }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(5, 12, 28, 0.35); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
#busy { flex-direction: column; gap: 14px; z-index: 120; }
#busy .box { display: grid; justify-items: center; gap: 14px; padding: 26px 34px; text-align: center; max-width: 340px; }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
.dialog { width: min(420px, 100%); padding: 24px; display: grid; gap: 12px; }
.dialog .actions { justify-content: flex-end; margin-top: 8px; }
.login { width: min(400px, 100%); padding: 30px; display: grid; gap: 14px; }
.login .logo { width: 46px; height: 46px; border-radius: 15px; }
.login p.err { color: var(--bad); font-size: 14px; min-height: 20px; }

#toasts { position: fixed; z-index: 130; left: 50%; bottom: 22px; transform: translateX(-50%); display: grid; gap: 10px; width: min(480px, calc(100vw - 32px)); }
.toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 13px 16px; border-radius: 18px; font-weight: 550;
  background: var(--glass-strong); border: 1px solid var(--glass-edge); box-shadow: var(--shadow), inset 0 1px 0 var(--hi);
  -webkit-backdrop-filter: blur(24px) saturate(170%); backdrop-filter: blur(24px) saturate(170%);
  animation: rise 0.22s ease-out;
}
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }
.toast i { width: 22px; height: 22px; flex: none; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 13px; font-weight: 800; background: var(--ok-bg); color: var(--ok); }
.toast.err i { background: var(--bad-bg); color: var(--bad); }
.toast.info i { background: var(--info-bg); color: var(--info); }
.toast a { color: var(--accent); font-weight: 650; white-space: nowrap; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .work { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  :root { --editor-scroll-offset: 16px; }
  .planner, .cal-wrap { grid-template-columns: minmax(0, 1fr); }
  .planner > .work { grid-row: 1; }
  .planner > .side { grid-row: 2; }
  .side { position: static; max-height: none; overflow: visible; padding: 0; margin: 0; }
  .bar { border-radius: 26px; flex-wrap: wrap; position: static; }
  .tabs { margin-left: 0; order: 3; width: 100%; }
  .tab { flex: 1; }
  .cell { min-height: 64px; }
  .cp { font-size: 0; padding: 0; height: 7px; border-radius: 4px; }
  .cell .more { font-size: 11px; }
}
@media (max-width: 520px) {
  .shell { padding: 10px 12px 40px; }
  .card { padding: 16px; }
  .bar { gap: 10px; padding: 12px; }
  .brand { flex: 1 0 100%; min-width: 0; padding-left: 0; }
  .bar-right { width: 100%; margin-left: 0; }
  .bar-right .pill { flex: 1 1 0; min-width: 0; padding-left: 10px; padding-right: 10px; }
  .pill .dot { flex: none; }
  .pill span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabs { min-width: 0; }
  .tab { min-width: 0; padding-left: 8px; padding-right: 8px; }
  .grid2 { grid-template-columns: minmax(0, 1fr) 90px; }
  .day-list > .row-main { grid-template-columns: auto minmax(0, 1fr); }
  .day-list .chip { grid-column: 2; grid-row: 2; justify-self: start; }
  .pop { position: fixed; left: 16px; right: 16px; top: auto; bottom: 16px; width: auto; }
  .assistant-controls { grid-template-columns: minmax(0, 1fr); }
  .media-row { grid-template-columns: 22px minmax(0, 1fr) auto; }
  .media-row input { grid-column: 2 / -1; }
  .media-row select { grid-column: 2; }
}
