/* =========================================================
   PLANNER — mission control, ported from
   some-mission-control-g2.html onto Reach's tokens (styles.css):
   lime accent, 14px cards, pill buttons, dot-grid backdrop.
   All classes are prefixed `pl-` so they never collide with the
   kanban / scheduler / automations styles.
   ========================================================= */
:root {
  /* format colours, in priority order (pastel, ink on top) */
  --chart-1: #FDEBF4;
  --chart-2: #F1ECFD;
  --chart-3: #E7F4FE;
  --chart-4: #E2FBE7;
  --chart-line: rgba(26, 26, 26, 0.07);
  /* status dots */
  --st-ok: #8BEA9A;
  --st-wait: #FFE748;
  --st-late: #FA8D8D;
  --st-ready: #D2EAFE;
  --ok-ink: #2F7D4F;
  /* lime accent, derived shades */
  --accent-strong: #CDE65F;
  --accent-glow: rgba(230, 255, 138, 0.55);
  --accent-wash: #FBFFE6;
}

.view.planner { flex-direction: column; min-width: 0; }
.pl-scroll {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}
.pl-wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 8px 28px 48px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}
@media (max-width: 900px) { .pl-wrap { padding: 4px 16px 40px; } }
.pl-wrap h1, .pl-wrap h2, .pl-wrap h3, .pl-wrap p { margin: 0; }
.pl-wrap :focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-glow), 0 0 0 1px var(--accent-strong); }
.pl-muted { color: var(--ink-muted); font-weight: 400; }
.pl-bad { color: var(--danger); font-weight: 600; }
.pl-warn { color: var(--danger); }
.pl-minw { min-width: 0; }
.pl-spacer { flex: 1; }

/* small variant of Reach's pill buttons */
.pl-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  font-size: 12.5px;
  white-space: nowrap;
}
.pl-btn svg { width: 14px; height: 14px; flex: none; }
.pl-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.pl-btn:disabled:hover { background: transparent; filter: none; }
.pl-btn-quiet { border-color: transparent; color: var(--ink-muted); }

/* ---- header ---- */
.pl-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 32px;
  align-items: end;
  padding: 18px 0 16px;
}
.pl-kicker { font-size: 10px; font-weight: 600; letter-spacing: 0.16em; color: var(--ink-muted); }
.pl-h1 { font-size: clamp(28px, 3.6vw, 40px); font-weight: 600; letter-spacing: -0.02em; line-height: 1.12; margin-top: 8px; }
.pl-mark { background: var(--accent); color: var(--accent-ink); padding: 0 0.16em; border-radius: 8px; }
.pl-head-r { text-align: right; }
.pl-claim { font-size: 14px; color: var(--ink-soft); max-width: 46ch; margin-left: auto; }
.pl-claim b { color: var(--ink); font-weight: 600; }
.pl-head-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 10px; }
.pl-savestate {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px 3px 9px;
}
.pl-savestate::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--st-ok); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1); }
@media (max-width: 760px) {
  .pl-head { grid-template-columns: 1fr; gap: 12px; }
  .pl-head-r { text-align: left; }
  .pl-claim { margin-left: 0; }
  .pl-head-actions { justify-content: flex-start; }
}

/* ---- notice ---- */
.pl-notice {
  display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  background: #FFFBE0; border: 1px solid #F1E39A; border-radius: var(--radius-sm);
  padding: 10px 14px; margin-bottom: 12px; font-size: 13px; color: var(--ink-soft);
}
.pl-notice b { color: var(--ink); font-weight: 600; }

/* ---- phase rail ---- */
.pl-phases { display: grid; grid-template-columns: repeat(var(--phcols, 3), minmax(0, 1fr)); gap: 12px; padding-bottom: 12px; }
.pl-phases:empty { display: none; }
.pl-phase {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 12px;
}
.pl-ph-num { font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; background: var(--surface-muted); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; text-align: center; }
.pl-ph-name { font-size: 10.5px; font-weight: 600; letter-spacing: 0.12em; color: var(--ink-muted); }
.pl-pill { font-size: 11px; font-weight: 500; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.pl-ph-pill { margin-left: auto; background: var(--surface-muted); color: var(--ink-soft); border: 1px solid var(--border); }
.pl-phase.is-now { border-color: var(--accent-strong); box-shadow: 0 0 0 3px var(--accent-glow); }
.pl-phase.is-now .pl-ph-num,
.pl-phase.is-now .pl-ph-pill { background: var(--accent); border-color: var(--accent-strong); color: var(--accent-ink); }
.pl-phase.is-now .pl-ph-name { color: var(--ink); }
.pl-phase.is-empty .pl-ph-pill { color: var(--ink-faint); }
@media (max-width: 760px) { .pl-phases { grid-template-columns: 1fr; gap: 8px; } }

/* ---- overview cards ---- */
.pl-cards { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: 14px; }
@media (max-width: 1000px) { .pl-cards { grid-template-columns: 1fr 1fr; } .pl-card--featured { grid-column: 1 / -1; } }
@media (max-width: 640px) { .pl-cards { grid-template-columns: 1fr; } }
.pl-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}
.pl-card--featured { border-color: var(--accent-strong); box-shadow: 0 0 0 3px var(--accent-glow); }
.pl-ribbon {
  position: absolute; top: 24px; right: -58px; width: 200px;
  background: var(--accent); border-block: 1px solid var(--accent-strong); color: var(--accent-ink);
  font-size: 10px; font-weight: 600; letter-spacing: 0.16em; text-align: center; padding: 5px 0; transform: rotate(45deg);
}
.pl-tier, .pl-h3 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.pl-scope { margin-top: 3px; font-size: 10px; font-weight: 600; letter-spacing: 0.16em; color: var(--ink-muted); }
.pl-bigrow { display: flex; align-items: baseline; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.pl-fig { font-size: 40px; font-weight: 600; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.pl-unit, .pl-subfig { font-size: 14px; font-weight: 500; color: var(--ink-soft); }
.pl-subfig b { color: var(--ink); font-weight: 600; }
.pl-lead { margin-top: 12px; font-size: 14px; line-height: 1.5; font-weight: 500; max-width: 46ch; }
.pl-why { margin-top: auto; padding-top: 16px; }
.pl-why-box { background: var(--surface-muted); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 11px 14px; }
.pl-card--featured .pl-why-box { background: var(--accent-wash); border-color: var(--accent-soft); }
.pl-why-box p { font-size: 13px; line-height: 1.45; color: var(--ink-soft); }
.pl-why-box b { color: var(--ink); font-weight: 600; }

/* progress segments */
.pl-segs { display: grid; grid-template-columns: repeat(var(--cols, 15), 1fr); gap: 4px; margin-top: 18px; }
.pl-segs.dense .pl-seg { height: 18px; border-radius: 4px; }
.pl-seg { height: 28px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); }
.pl-seg.done { border-color: rgba(26, 26, 26, 0.1); }
.pl-seg.done.carousel { background: var(--chart-1); }
.pl-seg.done.video    { background: var(--chart-2); }
.pl-seg.done.image    { background: var(--chart-3); }
.pl-seg.done.reel     { background: var(--chart-4); }
.pl-seg.staged { border: 1.5px dashed rgba(26, 26, 26, 0.38); }
.pl-seg.staged.carousel { background: repeating-linear-gradient(135deg, var(--chart-1) 0 4px, var(--surface) 4px 7px); }
.pl-seg.staged.video    { background: repeating-linear-gradient(135deg, var(--chart-2) 0 4px, var(--surface) 4px 7px); }
.pl-seg.staged.image    { background: repeating-linear-gradient(135deg, var(--chart-3) 0 4px, var(--surface) 4px 7px); }
.pl-seg.staged.reel     { background: repeating-linear-gradient(135deg, var(--chart-4) 0 4px, var(--surface) 4px 7px); }
.pl-seg.next { border-color: var(--ink-muted); border-width: 2px; }
.pl-seg.late { border-color: var(--danger); border-style: dashed; }
.pl-seg.staged.late { border-color: var(--st-wait); }
.pl-legend, .pl-statelegend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--ink-soft); }
.pl-statelegend { margin-top: 8px; }
.pl-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12); }
.pl-statelegend i { display: inline-block; width: 14px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.pl-sw-done { background: var(--chart-2); box-shadow: inset 0 0 0 1px rgba(26, 26, 26, 0.1); }
.pl-sw-staged { background: repeating-linear-gradient(135deg, var(--chart-2) 0 3px, var(--surface) 3px 5px); outline: 1px dashed rgba(26, 26, 26, 0.38); outline-offset: -1px; }
.pl-sw-open { background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); }
.pl-buffer {
  margin-top: 14px; padding: 10px 12px; border: 1px dashed rgba(26, 26, 26, 0.22); border-radius: var(--radius-sm);
  font-size: 12.5px; color: var(--ink-soft); display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: baseline;
}
.pl-buffer b { color: var(--ink); font-weight: 600; }
.pl-buffer .bl { font-size: 10px; font-weight: 600; letter-spacing: 0.12em; color: var(--ink-muted); }
.pl-buffer.warn { border-color: var(--st-late); background: #fff7f7; }
.pl-buffer.warn .bv { color: var(--danger); }
.pl-period { margin-top: 8px; font-size: 12px; color: var(--ink-soft); }
.pl-period b { color: var(--ink); font-weight: 600; }
.pl-period.warn b { color: var(--danger); }

/* ---- followers ---- */
.pl-fol { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; margin-top: 14px; }
@media (max-width: 900px) { .pl-fol { grid-template-columns: 1fr; } }
.pl-fol-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.pl-fol-stats { display: flex; flex-wrap: wrap; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.pl-fol-stats:empty { display: none; }
.pl-fol-stat { padding: 9px 14px; border-right: 1px solid var(--border); }
.pl-fol-stat:last-child { border-right: none; }
.pl-fol-stat .v { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.pl-fol-stat .v.up { color: var(--ok-ink); }
.pl-fol-stat .l { font-size: 10px; font-weight: 600; letter-spacing: 0.12em; color: var(--ink-muted); margin-top: 4px; }
.pl-chart { position: relative; margin-top: 18px; min-height: 240px; }
.pl-chart svg { display: block; width: 100%; height: 260px; overflow: visible; }
.pl-chart .grid { stroke: var(--border); stroke-width: 1; }
.pl-chart .axis { fill: var(--ink-muted); font-size: 11px; font-family: var(--font); }
.pl-chart .area { fill: var(--accent-soft); }
.pl-chart .lineP { fill: none; stroke: rgba(26, 26, 26, 0.35); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.pl-chart .dot { fill: var(--surface); stroke: rgba(26, 26, 26, 0.45); stroke-width: 1.5; }
.pl-chart .dot.last { fill: var(--accent); stroke: rgba(26, 26, 26, 0.55); }
.pl-chart .lbl { fill: var(--ink); font-size: 12px; font-weight: 600; font-family: var(--font); }
.pl-chart .pub { stroke: var(--ink-faint); stroke-width: 2; stroke-linecap: round; }
.pl-chart .cross { stroke: var(--ink-faint); stroke-width: 1; stroke-dasharray: 3 3; }
.pl-tip {
  position: absolute; pointer-events: none; background: var(--ink); color: #fff; border-radius: 8px;
  padding: 6px 10px; font-size: 12px; line-height: 1.35; white-space: nowrap; transform: translate(-50%, -115%);
  box-shadow: var(--shadow-lift);
}
.pl-tip b { font-size: 14px; font-weight: 600; }
.pl-chart-cap { font-size: 11.5px; color: var(--ink-muted); margin-top: 8px; display: flex; gap: 14px; flex-wrap: wrap; }
.pl-chart-cap i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; background: var(--ink-faint); margin-right: 6px; vertical-align: 3px; }
.pl-chart-empty {
  display: flex; align-items: center; justify-content: center; text-align: center; min-height: 240px;
  background: var(--surface-muted); border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
  padding: 20px; color: var(--ink-soft); font-size: 13.5px;
}
.pl-seclabel { display: block; font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em; color: var(--ink-muted); margin: 16px 0 8px; }
.pl-form { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.pl-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
.pl-form label, .pl-pgrid label, .pl-dinputs label, .pl-dgrid label, .pl-skiprow label {
  display: flex; flex-direction: column; gap: 4px; font-size: 10px; font-weight: 600; letter-spacing: 0.06em; color: var(--ink-muted); min-width: 0;
}
.pl-formmsg { font-size: 11.5px; color: var(--ink-muted); min-height: 1.2em; }
.pl-entries { display: flex; flex-direction: column; max-height: 230px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.pl-entry { display: grid; grid-template-columns: 1fr auto 26px; gap: 10px; align-items: center; padding: 6px 8px 6px 12px; border-top: 1px solid var(--border); font-size: 13px; }
.pl-entry:first-child { border-top: none; }
.pl-entry:hover { background: var(--surface-muted); }
.pl-entry .d { color: var(--ink-soft); }
.pl-entry .c { font-weight: 600; font-variant-numeric: tabular-nums; }
.pl-src { font-size: 10px; font-weight: 600; color: var(--ink-faint); text-align: center; }

/* ---- fields & controls ---- */
.pl-field {
  width: 100%;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  min-width: 0;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.pl-field:focus { border-color: var(--accent-strong); box-shadow: 0 0 0 3px var(--accent-glow); }
textarea.pl-field { resize: vertical; min-height: 58px; line-height: 1.45; }
select.pl-field {
  appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23888' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.pl-x {
  border: 0; background: transparent; color: var(--ink-faint); cursor: pointer; font-size: 17px; line-height: 1;
  padding: 2px 6px; border-radius: 6px; transition: background 120ms ease, color 120ms ease;
}
.pl-x:hover { color: var(--danger); background: rgba(231, 72, 77, 0.08); }
.pl-cb {
  appearance: none; -webkit-appearance: none; width: 18px; height: 18px; border: 1.5px solid var(--border-strong);
  border-radius: 5px; background: var(--surface); cursor: pointer; display: inline-grid; place-content: center; margin: 0; flex: none;
  transition: border-color 120ms ease, background 120ms ease;
}
.pl-cb:hover { border-color: var(--ink-muted); }
.pl-cb::after { content: ""; width: 5px; height: 9px; border: solid var(--accent-ink); border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); opacity: 0; }
.pl-cb:checked { background: var(--accent); border-color: var(--accent-strong); }
.pl-cb:checked::after { opacity: 1; }
.pl-cb:disabled { opacity: 0.5; cursor: not-allowed; }
.pl-filters, .pl-segctl { display: inline-flex; gap: 2px; flex-wrap: wrap; background: rgba(0, 0, 0, 0.04); border-radius: 8px; padding: 2px; }
.pl-chip, .pl-segctl button {
  border: 0; background: transparent; border-radius: 6px; padding: 5px 12px; font-size: 12.5px; font-weight: 500;
  cursor: pointer; color: var(--ink-muted); transition: background 120ms ease, color 120ms ease;
}
.pl-chip:hover, .pl-segctl button:hover { color: var(--ink); }
.pl-chip[aria-pressed="true"], .pl-segctl button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08); }
.pl-fsep { width: 1px; align-self: stretch; margin: 4px 2px; background: rgba(0, 0, 0, 0.1); }

/* ---- plan ---- */
.pl-main { padding-top: 36px; }
.pl-section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.pl-section-head h2 { font-size: 19px; font-weight: 600; letter-spacing: -0.01em; }
.pl-sh-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pl-plan { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-soft); overflow: hidden; }
.pl-plan-head { padding: 8px 20px; border-bottom: 1px solid var(--border); font-size: 11.5px; color: var(--ink-muted); }
.pl-week {
  padding: 8px 20px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em; color: var(--ink-muted);
  background: var(--surface-muted); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.pl-plan-head + .pl-week { border-top: none; }
.pl-prow { border-top: 1px solid var(--border); transition: background 120ms ease; }
.pl-week + .pl-prow { border-top: none; }
.pl-prow:hover { background: var(--surface-muted); }
.pl-prow.is-next { background: var(--accent-wash); box-shadow: inset 3px 0 0 var(--accent-strong); }
.pl-prow.is-new { animation: pl-flash 1.6s ease-out; }
@keyframes pl-flash { 0% { background: var(--accent); } 100% { background: transparent; } }
.pl-post { min-width: 0; }
.pl-post summary {
  list-style: none; cursor: pointer; display: grid;
  grid-template-columns: 28px 104px minmax(0, 1fr) 92px 128px 120px 16px;
  gap: 14px; align-items: center; padding: 10px 20px;
}
.pl-post summary::-webkit-details-marker { display: none; }
.pl-post summary:hover .pl-p-title { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--ink-faint); }
.pl-p-num { font-size: 12px; font-weight: 600; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.pl-p-date { font-size: 13px; color: var(--ink-soft); white-space: nowrap; }
.pl-p-date b { color: var(--ink); font-weight: 600; }
.pl-lock { display: inline-block; width: 10px; height: 10px; margin-left: 5px; vertical-align: -1px; opacity: 0.5; }
.pl-p-fun { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pl-fchip { font-size: 11px; font-weight: 600; background: var(--surface-muted); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; flex: none; }
.pl-fchip:empty { display: none; }
.pl-p-title { font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-p-title.untitled { color: var(--ink-faint); font-style: italic; font-weight: 400; }
.pl-prow.is-done .pl-p-title { color: var(--ink-muted); }
.pl-fmt { font-size: 11px; font-weight: 500; padding: 2px 9px; border-radius: 999px; text-align: center; white-space: nowrap; box-shadow: inset 0 0 0 1px rgba(26, 26, 26, 0.08); }
.pl-fmt-carousel { background: var(--chart-1); }
.pl-fmt-video    { background: var(--chart-2); }
.pl-fmt-image    { background: var(--chart-3); }
.pl-fmt-reel     { background: var(--chart-4); }
.pl-prod, .pl-state { font-size: 12px; font-weight: 500; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; color: var(--ink); }
.pl-prod::before, .pl-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; flex: none; background: #e4e7ea; }
.pl-prod.ok::before { background: var(--st-ok); }
.pl-prod.rec::before { background: var(--st-wait); box-shadow: 0 0 0 3px rgba(255, 231, 72, 0.25); }
.pl-prod.late { color: var(--danger); }
.pl-prod.late::before { background: var(--st-late); }
.pl-state { color: var(--ink-muted); }
.pl-state.ready,
.pl-state.workboard,
.pl-state.staged,
.pl-state.scheduled,
.pl-state.published { color: var(--ink); }
.pl-state.ready::before { background: var(--st-ready); box-shadow: inset 0 0 0 1px #b5d6f9; }
.pl-state.workboard::before { background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--ink-faint); }
.pl-state.staged::before { background: var(--surface); box-shadow: none; outline: 1.5px dashed rgba(26, 26, 26, 0.55); outline-offset: -1px; }
.pl-state.scheduled::before { background: var(--accent); box-shadow: inset 0 0 0 1px var(--accent-strong); }
.pl-state.published::before { background: var(--st-ok); }
.pl-state.check { color: #8a6d00; }
.pl-state.check::before { background: var(--st-wait); }
.pl-state.late, .pl-state.failed { color: var(--danger); }
.pl-state.late::before, .pl-state.failed::before { background: var(--st-late); }
.pl-chev { width: 8px; height: 8px; border-right: 1.5px solid var(--ink-faint); border-bottom: 1.5px solid var(--ink-faint); transform: rotate(45deg) translateY(-3px); transition: transform 150ms ease; }
.pl-post[open] .pl-chev { transform: rotate(225deg) translateY(-2px); }

/* expanded row */
.pl-panel { display: grid; grid-template-columns: 1fr; gap: 4px 28px; padding: 4px 20px 20px 62px; }
@media (min-width: 1180px) { .pl-panel { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); } }
.pl-panel > div > .pl-seclabel:first-child { margin-top: 4px; }
.pl-titlefield { font-weight: 500; }
.pl-hookfield { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.35; }
.pl-caphead { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.pl-capcount { font-size: 11.5px; color: var(--ink-muted); }
.pl-captext { line-height: 1.5; white-space: pre-wrap; }
.pl-captext.is-readonly { background: var(--surface-muted); color: var(--ink-soft); }
.pl-capbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.pl-capmsg { font-size: 12.5px; color: var(--ok-ink); }
/* media editor — reuses the card composer's .media-* styles (styles.css) */
.pl-media { gap: 8px; }
.pl-media .media-dropzone { padding: 16px; background: var(--surface); }
.pl-media .media-strip { min-height: 0; }
.pl-media .pl-dsub:empty { display: none; }
.pl-caphead .media-counter { align-self: center; }
.pl-sendrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.pl-sendhelp { margin-top: 6px; }
.pl-linkbox { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--surface-muted); }
.pl-linkbox--scheduled,
.pl-linkbox--published { background: var(--accent-wash); border-color: var(--accent-soft); }
.pl-linkbox--failed { background: #fff7f7; border-color: #f6c9c9; }
.pl-linkline { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.pl-linktext { color: var(--ink-soft); min-width: 0; }
.pl-linktext b { color: var(--ink); font-weight: 600; }
.pl-linktext a { text-decoration: underline; text-underline-offset: 2px; }
.pl-linkbtns { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.pl-pgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pl-pgrid .pl-field { height: 36px; padding-top: 6px; padding-bottom: 6px; }
@media (max-width: 760px) { .pl-pgrid { grid-template-columns: 1fr 1fr; } .pl-pgrid label:last-child { grid-column: 1 / -1; } }
.pl-datebox { background: var(--surface-muted); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.pl-dline { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.pl-dline b { font-weight: 600; }
.pl-dsub { font-size: 11.5px; color: var(--ink-muted); }
.pl-dinputs { display: grid; grid-template-columns: minmax(0, 1fr) 120px; gap: 8px; margin-top: 10px; }
.pl-pin { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 500; cursor: pointer; }
.pl-ptasks { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.pl-ptask { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto auto auto; gap: 8px; align-items: center; padding: 6px 6px 6px 10px; border-top: 1px solid var(--border); font-size: 13px; }
.pl-ptask:first-child { border-top: none; }
.pl-ptask.done .pl-pt-t { text-decoration: line-through; color: var(--ink-muted); }
.pl-ptask.late .pl-pt-d { color: var(--danger); }
.pl-pt-d { font-size: 11.5px; color: var(--ink-muted); white-space: nowrap; }
.pl-pt-empty { font-size: 12.5px; color: var(--ink-muted); }
.pl-ptadd { display: grid; grid-template-columns: minmax(0, 1fr) 104px auto auto; gap: 6px; margin-top: 8px; align-items: center; }
.pl-ptadd .pl-field { padding: 6px 9px; font-size: 13px; }
.pl-dbf { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--ink-muted); white-space: nowrap; }
.pl-dbf .pl-field { width: 52px; padding: 6px; text-align: right; }
.pl-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.pl-metric { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 7px 10px; background: var(--surface); }
.pl-metric span { display: block; font-size: 10px; font-weight: 600; letter-spacing: 0.06em; color: var(--ink-muted); }
.pl-metric b { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pl-derived { margin-top: 10px; font-size: 12.5px; color: var(--ink-soft); }
.pl-derived b { color: var(--ink); font-weight: 600; }
.pl-pactions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.pl-planempty { padding: 44px 24px 48px; text-align: center; }
.pl-planempty h3 { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.pl-planempty p { margin: 6px auto 18px; max-width: 52ch; color: var(--ink-soft); font-size: 13.5px; }
.pl-btns { display: inline-flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
@media (max-width: 760px) {
  .pl-post summary { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "d f" "t t" "p s"; row-gap: 6px; padding: 12px 16px; }
  .pl-p-num, .pl-chev { display: none; }
  .pl-p-date { grid-area: d; }
  .pl-p-fun { grid-area: t; }
  .pl-fmt { grid-area: f; justify-self: end; }
  .pl-prod { grid-area: p; }
  .pl-state { grid-area: s; justify-self: end; }
  .pl-panel { padding: 4px 16px 20px; }
  .pl-week, .pl-plan-head { padding-inline: 16px; }
}

/* ---- lower: tasks + format comparison ---- */
.pl-lower { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 14px; padding: 14px 0 24px; align-items: start; }
@media (max-width: 900px) { .pl-lower { grid-template-columns: 1fr; } }
.pl-tasks { display: flex; flex-direction: column; margin-top: 12px; }
.pl-task { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); align-items: start; }
.pl-task:first-child { border-top: none; }
.pl-task-t { font-size: 13.5px; line-height: 1.4; cursor: pointer; }
.pl-task-m { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 4px; font-size: 11.5px; color: var(--ink-muted); }
.pl-task-due { font-weight: 500; color: var(--ink-soft); }
.pl-task.late .pl-task-due { color: var(--danger); }
.pl-task.soon .pl-task-due { background: var(--accent); color: var(--accent-ink); padding: 0 7px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--accent-strong); }
.pl-task.done .pl-task-t { text-decoration: line-through; color: var(--ink-muted); }
.pl-task.done .pl-task-due { background: none; color: var(--ink-muted); box-shadow: none; }
.pl-kind { font-size: 10px; font-weight: 600; letter-spacing: 0.12em; color: var(--ink-muted); }

/* task type: picker on new-task rows + chip (a select dressed as a pill) on tasks */
.pl-typepick { font-size: 12.5px; padding-top: 6px; padding-bottom: 6px; }
.pl-type {
  appearance: none; -webkit-appearance: none; border: 0; cursor: pointer; font-family: inherit;
  font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink);
  padding: 1px 8px; border-radius: 999px; line-height: 1.6; max-width: 120px;
  box-shadow: inset 0 0 0 1px rgba(26, 26, 26, 0.08);
}
.pl-type:hover { box-shadow: inset 0 0 0 1px rgba(26, 26, 26, 0.3); }
.pl-type:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-glow), inset 0 0 0 1px var(--accent-strong); }
.pl-type option { text-transform: none; letter-spacing: 0; font-weight: 500; background: var(--surface); }
.pl-type--copy     { background: var(--chart-3); }
.pl-type--design   { background: var(--chart-1); }
.pl-type--video    { background: var(--chart-2); }
.pl-type--image    { background: var(--chart-4); }
.pl-type--approval { background: #FFF4C2; }
.pl-type--custom   { background: var(--surface-muted); color: var(--ink-soft); }
/* "Other" is the default: keep it quiet until hovered */
.pl-type--task     { background: transparent; color: var(--ink-faint); box-shadow: none; }
.pl-ptask.done .pl-type, .pl-task.done .pl-type { opacity: 0.55; }
@media (max-width: 560px) {
  .pl-ptadd { grid-template-columns: minmax(0, 1fr) 96px; }
  .pl-addtask { grid-template-columns: minmax(0, 1fr) 104px; }
  .pl-addtask #plTaskDue { grid-column: 1 / -1; }
}
.pl-addtask { display: grid; grid-template-columns: minmax(0, 1fr) 112px 150px; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.pl-addtask .pl-btn { grid-column: 1 / -1; justify-self: start; }
.pl-empty { font-size: 13px; color: var(--ink-soft); background: var(--surface-muted); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 11px 14px; margin-top: 14px; }
.pl-empty b { color: var(--ink); font-weight: 600; }
.pl-fmtstats { display: flex; flex-direction: column; gap: 16px; margin-top: 14px; }
.pl-fs-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; }
.pl-fs-top b { font-weight: 600; }
.pl-fs-top span { color: var(--ink-muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.pl-bar { height: 12px; border-radius: 999px; background: var(--surface); margin-top: 6px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--border); }
.pl-bar i { display: block; height: 100%; border-radius: 999px; min-width: 2px; box-shadow: inset 0 0 0 1px var(--chart-line); }
.pl-bar i.carousel { background: var(--chart-1); }
.pl-bar i.video    { background: var(--chart-2); }
.pl-bar i.image    { background: var(--chart-3); }
.pl-bar i.reel     { background: var(--chart-4); }
.pl-fs-sub { font-size: 11.5px; color: var(--ink-soft); margin-top: 6px; }

/* ---- routine band ---- */
.pl-band {
  background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent-strong); border-radius: var(--radius);
  padding: 18px 24px 20px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 34px; align-items: center;
}
.pl-btitle { font-size: 10px; font-weight: 600; letter-spacing: 0.16em; line-height: 1.6; white-space: nowrap; color: rgba(26, 29, 18, 0.55); }
.pl-btitle em { display: block; font-style: normal; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; color: var(--accent-ink); }
.pl-bitems { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.pl-bitem { font-size: 12.5px; line-height: 1.42; color: rgba(26, 29, 18, 0.72); }
.pl-bitem b { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 2px; color: var(--accent-ink); }
.pl-ptag { text-align: right; white-space: nowrap; }
.pl-n { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.pl-s { font-size: 12px; margin-top: 3px; color: rgba(26, 29, 18, 0.62); }
@media (max-width: 1000px) { .pl-band { grid-template-columns: 1fr; gap: 16px; } .pl-ptag { text-align: left; } }
@media (max-width: 620px) { .pl-bitems { grid-template-columns: 1fr; } }
.pl-legal { font-size: 11px; letter-spacing: 0.04em; color: var(--ink-muted); padding: 14px 4px 0; }

/* ---- modals (settings, import / export) ---- */
.modal.pl-modal { max-width: 760px; display: flex; flex-direction: column; max-height: calc(100vh - 40px); }
.modal.pl-modal--wide { max-width: 980px; }
.pl-modal-body { overflow: auto; flex: 1; min-height: 0; gap: 0; }
.pl-modal-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-muted);
}
.pl-modal-foot .footer-right { margin-left: auto; }
.pl-dprev { font-size: 12.5px; color: var(--ink-soft); margin: 0; min-width: 0; flex: 1 1 280px; }
.pl-dprev b { color: var(--ink); font-weight: 600; }
.pl-dsec { padding-top: 18px; margin-top: 18px; border-top: 1px solid var(--border); }
.pl-dsec:first-child { border-top: none; margin-top: 0; padding-top: 0; }
.pl-dsec h3 { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 4px; }
.pl-dhelp { font-size: 12.5px; color: var(--ink-muted); margin: 0 0 10px; max-width: 70ch; }
.pl-dgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; margin-top: 10px; }
@media (max-width: 560px) { .pl-dgrid { grid-template-columns: 1fr; } }
.pl-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
@media (max-width: 640px) { .pl-days { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.pl-day { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 6px; display: flex; flex-direction: column; gap: 7px; background: var(--surface); transition: background 120ms ease, border-color 120ms ease; }
.pl-day.on { background: var(--accent-wash); border-color: var(--accent-strong); }
.pl-day label { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.pl-day .pl-field { padding: 4px; font-size: 12px; text-align: center; }
.pl-day:not(.on) .pl-field { visibility: hidden; }
.pl-dcheck { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; align-items: start; margin-top: 12px; font-size: 12.5px; color: var(--ink-soft); cursor: pointer; }
.pl-dcheck b { color: var(--ink); font-weight: 600; }
.pl-skiprow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.pl-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.pl-chipx { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; background: var(--surface-muted); border: 1px solid var(--border); border-radius: 999px; padding: 1px 2px 1px 10px; }
.pl-chipx .pl-x { font-size: 15px; padding: 0 6px; }
.pl-phrow { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto auto auto auto; gap: 6px; align-items: center; margin-bottom: 6px; }
.pl-cnt { font-size: 11.5px; color: var(--ink-muted); white-space: nowrap; padding: 0 4px; }
.pl-icon-btn { border: 1px solid var(--border); background: var(--surface); border-radius: 8px; width: 30px; height: 30px; display: inline-grid; place-content: center; cursor: pointer; color: var(--ink-soft); font-size: 13px; }
.pl-icon-btn:hover { background: var(--surface-muted); color: var(--ink); }
.pl-icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.pl-rtrow { display: grid; grid-template-columns: minmax(0, 0.7fr) minmax(0, 1.3fr); gap: 8px; margin-bottom: 6px; }
.pl-trash { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.pl-tr { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 6px 8px 6px 12px; border-top: 1px solid var(--border); font-size: 13px; }
.pl-tr:first-child { border-top: none; }
.pl-tr > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-modal-body > .pl-segctl { align-self: flex-start; margin-bottom: 14px; }
.pl-cols { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.pl-cols code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11.5px; background: var(--surface-muted); border: 1px solid var(--border); border-radius: 5px; padding: 0 6px; }
.pl-cols code.req { background: var(--accent); border-color: var(--accent-strong); }
.pl-imp-tools { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 8px; }
.pl-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.5; min-height: 170px; white-space: pre; overflow: auto; }
.pl-impmode { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 12px; font-size: 13px; }
.pl-impmode label { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
.pl-impmode input { accent-color: var(--ink); }
.pl-imp-sum { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.pl-imp-sum span { font-size: 12px; border-radius: 999px; padding: 2px 10px; background: var(--surface-muted); border: 1px solid var(--border); }
.pl-imp-sum .ok { background: var(--accent); border-color: var(--accent-strong); }
.pl-imp-sum .bad { background: #fef2f2; border-color: #f6c9c9; color: var(--danger); }
.pl-imp-wrap { margin-top: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); max-height: 300px; overflow: auto; }
.pl-imp-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.pl-imp-table th { position: sticky; top: 0; background: var(--surface-muted); text-align: left; font-size: 10px; font-weight: 600; letter-spacing: 0.08em; color: var(--ink-muted); padding: 7px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.pl-imp-table td { padding: 6px 10px; border-top: 1px solid var(--border); vertical-align: top; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-imp-table tr.err td { background: #fff7f7; }
.pl-imp-table .msg { white-space: normal; min-width: 180px; }
.pl-imp-table .msg.err { color: var(--danger); }
.pl-imp-table .msg.warn { color: #8a6d00; }
.pl-imp-hint { font-size: 12.5px; color: var(--ink-soft); margin-top: 10px; }

/* ---- toast ---- */
.pl-toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 14px; background: var(--ink); color: #fff; border-radius: 12px;
  padding: 9px 10px 9px 16px; font-size: 13px; box-shadow: var(--shadow-lift); max-width: calc(100vw - 32px);
}
.pl-toast button { border: 0; background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 4px 12px; font-size: 12.5px; font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  .pl-chev, .pl-prow, .pl-field, .pl-chip, .pl-x, .pl-cb { transition: none; }
  .pl-prow.is-new { animation: none; }
}
