/* The Becoming HQ: an editorial planner. Soft cream page, warm-white cards, soft black type,
   champagne for "selected" and "needs you", black for the main action. */
:root {
  color-scheme: light;
  --page: #EEE9DF;        /* soft cream page */
  --ivory: #F7F4EC;       /* quiet panels */
  --card: #FFFCF6;        /* warm-white cards */
  --ink: #191817;         /* text, 16:1 */
  --charcoal: #59554F;    /* secondary text, 6:1 on the page */
  --champagne: #F4E6AC;   /* selected, highlight fills (never text) */
  --champagne-deep: #E3C96B;
  --beige: #D7C9B7;
  --blush: #EBD9D5;
  --blush-deep: #D8A99F;
  --taupe: #C8BFB3;       /* decorative borders */
  --field: #8A8073;       /* input borders, 3.8:1 */
  --rose-ink: #8B5E57;    /* overdue, 5.4:1 */
  --good-ink: #2F5D50;
  --good-bg: #DCE8E1;
  --serif: "Playfair Display", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --r: 18px;
  --side: 236px;
  --shadow: 0 1px 2px rgba(25, 24, 23, .04), 0 10px 26px -18px rgba(25, 24, 23, .25);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.5; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3 { font-family: var(--serif); font-weight: 800; letter-spacing: -.02em; line-height: 1.08; text-wrap: balance; }
h1 em, h2 em, h3 em, .brand em { font-style: italic; }
a { color: var(--ink); text-decoration-color: var(--field); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.muted { color: var(--charcoal); }
.small { font-size: 13px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.struck { text-decoration: line-through; color: var(--charcoal); }
.late { color: var(--rose-ink); font-weight: 600; }
.attention { color: var(--rose-ink); font-weight: 600; margin-top: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.label { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--charcoal); }

/* ---------- side navigation ---------- */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--side); background: var(--ivory); border-right: 1px solid var(--taupe); display: flex; flex-direction: column; padding: 28px 14px 20px; z-index: 20; }
.brand { display: flex; flex-direction: column; text-decoration: none; padding: 0 12px; }
.brand-kicker { font-size: 10.5px; font-weight: 700; letter-spacing: .24em; text-transform: uppercase; color: var(--charcoal); }
.brand-name { font-family: var(--serif); font-weight: 800; font-size: 25px; letter-spacing: -.02em; line-height: 1.1; }
#nav { margin-top: 30px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 999px; color: var(--charcoal); text-decoration: none; font-weight: 500; transition: background .15s, color .15s; }
.nav-link svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav-link:hover { background: var(--card); color: var(--ink); }
.nav-link[aria-current="page"] { background: var(--champagne); color: var(--ink); font-weight: 700; }
.sidebar-note { color: var(--charcoal); font-family: var(--serif); font-style: italic; font-weight: 700; font-size: 14px; padding: 14px 12px 0; line-height: 1.35; }
.topbar { display: none; }

/* ---------- page ---------- */
#main { margin-left: var(--side); outline: none; min-height: 100vh; }
.page { max-width: 1140px; margin: 0 auto; padding: 34px 32px 64px; display: flex; flex-direction: column; gap: 18px; animation: rise .18s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.page-title h1, .home-head h1 { font-size: clamp(34px, 4.4vw, 50px); }
.page-title p.muted { margin-top: 6px; }
.page-title .label, .home-head .label { margin-bottom: 6px; }
.home-head .muted { margin-top: 6px; font-size: 16px; }
.notice { display: flex; justify-content: space-between; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--taupe); border-left: 4px solid var(--champagne-deep); border-radius: 14px; padding: 10px 14px; font-size: 14px; }
.notice.bad { border-left-color: var(--rose-ink); color: var(--rose-ink); display: block; }
.notice p { margin: 0; }

/* ---------- panels, cards, tiles ---------- */
.panel, .card, .tile { background: var(--card); border: 1px solid var(--taupe); border-radius: var(--r); box-shadow: var(--shadow); min-width: 0; }
.panel, .card { padding: 20px 22px; }
.panel-head, .card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.panel-head h2 { font-size: 26px; margin-top: 4px; }
.card-head h3 { font-size: 21px; }
.card-foot { margin-top: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.tiles-4 { grid-template-columns: repeat(4, 1fr); }
.tile { padding: 16px 18px; }
.tile-label { color: var(--charcoal); font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.tile-value { font-family: var(--serif); font-weight: 800; font-size: 28px; line-height: 1.2; margin-top: 4px; overflow-wrap: anywhere; }
.tile-ex { font-size: 12px; color: var(--charcoal); margin-top: 6px; }
.empty { color: var(--charcoal); padding: 16px 0; text-align: center; }
.tag-ex { display: inline-block; margin-left: 6px; padding: 1px 7px; background: var(--blush); border-radius: 999px; font: 700 10px/1.5 var(--sans); letter-spacing: .06em; text-transform: uppercase; vertical-align: middle; }
.status { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--ivory); border: 1px solid var(--taupe); font-size: 12px; font-weight: 600; white-space: nowrap; }
.status.good { background: var(--good-bg); border-color: var(--good-bg); color: var(--good-ink); }
.status.warn { background: var(--champagne); border-color: var(--champagne); }
.status.bad { background: var(--blush); border-color: var(--blush); color: var(--rose-ink); }

/* ---------- buttons and pills ---------- */
.btn-primary, .btn-ghost, .btn-danger, .btn-small { border-radius: 999px; font-weight: 600; white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; transition: background .15s; }
.btn-primary { background: var(--ink); color: var(--card); border: 1px solid var(--ink); padding: 9px 18px; font-size: 13.5px; letter-spacing: .02em; }
.btn-primary:hover { background: #33302c; }
.btn-ghost { background: transparent; border: 1px solid var(--ink); padding: 9px 18px; font-size: 13.5px; }
.btn-ghost:hover, .btn-small:hover { background: var(--ivory); }
.btn-danger { background: transparent; border: 1px solid var(--rose-ink); color: var(--rose-ink); padding: 9px 18px; font-size: 13.5px; }
.btn-small { background: var(--card); border: 1px solid var(--field); padding: 5px 12px; font-size: 12.5px; }
.btn-text { background: none; border: 0; padding: 4px 2px; font-weight: 700; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; text-decoration: underline; text-decoration-color: var(--champagne-deep); text-decoration-thickness: 2px; text-underline-offset: 4px; color: var(--ink); }
.btn-text.light { color: var(--champagne); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.icon-btn { background: none; border: 0; width: 32px; height: 32px; border-radius: 50%; color: var(--charcoal); font-size: 16px; flex: none; }
.icon-btn:hover { background: var(--ivory); color: var(--ink); }
.link-btn { background: none; border: 0; padding: 0; text-align: left; text-decoration: underline; text-decoration-color: var(--field); text-underline-offset: 3px; font-weight: 600; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.fpill { border: 1px solid var(--taupe); background: var(--card); border-radius: 999px; padding: 6px 14px; font-size: 13.5px; text-decoration: none; white-space: nowrap; }
.fpill.on { background: var(--ink); color: var(--card); border-color: var(--ink); }
.pill { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid var(--taupe); background: var(--ivory); white-space: nowrap; }

/* ---------- workflow stage colours (always shown with their name) ---------- */
.st-idea { --st: #C8BFB3; } .st-finalized { --st: #A99F92; } .st-scripted { --st: #D4B44A; } .st-filmed { --st: #C98E83; }
.st-edited { --st: #8A8073; } .st-scheduled { --st: #59554F; } .st-posted { --st: #191817; } .st-analyzed { --st: #191817; }
.st-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--st, var(--taupe)); margin-right: 5px; flex: none; }
.pill[class*="st-"] { border-color: var(--st); background: var(--card); box-shadow: inset 3px 0 0 var(--st); }

/* ---------- home ---------- */
.rings { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.ring-tile { background: var(--card); border: 1px solid var(--taupe); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; min-width: 0; }
.ring { position: relative; width: 84px; height: 84px; }
.ring svg { display: block; }
.ring-track { fill: none; stroke: var(--ivory); stroke-width: 7; }
.ring-fill { fill: none; stroke: var(--ink); stroke-width: 7; stroke-linecap: round; transition: stroke-dasharray .4s ease; }
.ring-fill.alert { stroke: var(--rose-ink); }
.ring-center { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-weight: 800; font-size: 19px; letter-spacing: -.02em; }
.home-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.panel.wide { grid-column: 1 / -1; }
.tasks { list-style: none; margin: 0; padding: 0; }
.tasks.top { counter-reset: t; }
.task { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--ivory); }
.task label { flex: 1; min-width: 0; cursor: pointer; overflow-wrap: anywhere; }
.tasks.top .task::before { counter-increment: t; content: counter(t); font-family: var(--serif); font-weight: 800; font-size: 20px; width: 18px; flex: none; }
.check { width: 20px; height: 20px; accent-color: var(--ink); margin: 0; flex: none; }
.suggest { background: var(--ivory); border-radius: 14px; padding: 12px 14px; margin-top: 12px; }
.suggest ul { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.suggest li { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.quick-add { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.quick-add input { flex: 1 1 200px; min-width: 0; }
.quick-add input, .quick-add select { border: 1px solid var(--field); border-radius: 999px; padding: 9px 16px; background: #fff; font-size: 16px; }
.more { margin-top: 12px; }
.more summary { cursor: pointer; font-weight: 600; font-size: 14px; padding: 6px 0; }
.countdowns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.count-card { border: 1px solid var(--taupe); border-radius: 14px; padding: 12px 14px; background: var(--card); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.count-card b { font-family: var(--serif); font-weight: 800; font-size: 34px; line-height: 1; }
.count-card p { overflow-wrap: anywhere; }
.count-card.today { grid-column: 1 / -1; background: var(--champagne); border: 2px solid var(--ink); flex-direction: row; align-items: center; gap: 14px; flex-wrap: wrap; }
.count-card.today b { font-size: 30px; }
.needs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.needs li { display: grid; grid-template-columns: 12px minmax(0, 1fr); column-gap: 10px; align-items: center; }
.needs li .muted { grid-column: 2; }
.dot-state { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--champagne-deep); vertical-align: -1px; }
.dot-state.late { background: var(--rose-ink); }
.legend { margin-top: 12px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.meter { margin-bottom: 12px; }
.meter-top { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; margin-bottom: 5px; }
.meter-top strong { font-variant-numeric: tabular-nums; }
.meter-track { height: 8px; border-radius: 4px; background: var(--ivory); overflow: hidden; }
.meter-track span { display: block; height: 100%; background: var(--ink); border-radius: 4px; }
textarea#reflection { width: 100%; border: 1px solid var(--field); border-radius: 14px; padding: 12px 14px; background: #fff; font-size: 16px; resize: vertical; }

/* ---------- studio ---------- */
.studio-nav { display: flex; gap: 10px; background: var(--card); border: 1px solid var(--taupe); border-radius: 22px; padding: 10px; box-shadow: var(--shadow); overflow-x: auto; }
.studio-group { display: flex; flex-direction: column; align-items: center; gap: 4px; border-radius: 16px; padding: 6px 8px 8px; flex: none; }
.studio-group.active { background: var(--champagne); }
.studio-group > .label { font-size: 9.5px; }
.studio-tiles { display: flex; gap: 8px; }
.studio-tile { display: flex; flex-direction: column; align-items: center; gap: 5px; text-decoration: none; width: 64px; }
.tile-icon { position: relative; width: 48px; height: 48px; border-radius: 14px; background: var(--ivory); border: 1px solid var(--taupe); display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px -3px rgba(25, 24, 23, .25); }
.tile-icon svg { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.studio-tile.on .tile-icon { border: 2px solid var(--ink); background: var(--card); }
.badge { position: absolute; top: -7px; right: -8px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--ink); color: var(--card); font-size: 11px; font-weight: 700; line-height: 20px; text-align: center; }
.tile-label { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--charcoal); white-space: nowrap; }
.studio-tile.on .tile-label { color: var(--ink); }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.section-head h2 { font-size: 32px; }
.section-head p { margin-top: 4px; max-width: 62ch; }
.ccards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.ccard { display: flex; flex-direction: column; gap: 8px; background: var(--card); border: 1px solid var(--taupe); border-radius: 16px; padding: 14px 16px; text-decoration: none; box-shadow: var(--shadow); transition: border-color .15s, transform .15s; min-width: 0; }
.ccard:hover { border-color: var(--ink); }
.ccard-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.ccard h3 { font-size: 19px; overflow-wrap: anywhere; }
.ccard-hook { font-size: 14px; color: var(--charcoal); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* this week */
.week-bar, .cal-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.week-switch { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.sq { width: 34px; height: 34px; border: 1.5px solid var(--ink); border-radius: 8px; background: var(--card); font-size: 18px; line-height: 1; }
.week-wrap { overflow-x: auto; padding-bottom: 6px; background: var(--ivory); border: 1px solid var(--taupe); border-radius: 22px; padding: 12px; }
.week { display: grid; grid-template-columns: repeat(8, minmax(118px, 1fr)); gap: 8px; min-width: 980px; }
.day { background: var(--card); border: 1px solid var(--taupe); border-radius: 14px; padding: 9px; display: flex; flex-direction: column; gap: 6px; min-height: 170px; transition: background .12s, border-color .12s; }
.day.queue { background: transparent; border-style: dashed; }
.day.today { background: var(--champagne); border: 2px solid var(--ink); }
.day.drop-over { border-color: var(--ink); background: #fffbe9; }
.day-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid var(--taupe); padding-bottom: 4px; }
.day-head span { font-size: 12.5px; font-weight: 600; }
.day-tally { font-size: 10.5px; color: var(--charcoal); font-variant-numeric: tabular-nums; }
.drop-hint { font-size: 12px; color: var(--charcoal); }
.drop-btn { margin-top: auto; border: 1px dashed var(--field); background: transparent; border-radius: 10px; padding: 5px; font-size: 12px; color: var(--charcoal); }
.drop-btn:hover { border-style: solid; color: var(--ink); }
.chip { display: block; background: var(--card); border: 1px solid var(--taupe); border-left: 4px solid var(--st, var(--taupe)); border-radius: 10px; padding: 6px 8px; text-decoration: none; font-size: 12.5px; cursor: grab; box-shadow: 0 2px 6px -4px rgba(25, 24, 23, .3); }
.chip.dragging { opacity: .45; }
.chip-top { display: flex; align-items: center; font-size: 9.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--charcoal); }
.chip-title { display: block; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; margin-top: 2px; }
.bank { background: var(--card); border: 1px solid var(--taupe); border-radius: 16px; padding: 10px 14px; }
.bank summary { cursor: pointer; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; padding: 4px 0; }
.bank-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin-top: 10px; }

/* card editor */
.editor-bar { display: flex; justify-content: space-between; align-items: center; }
.editor { background: var(--card); border: 1px solid var(--taupe); border-radius: 22px; padding: 22px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 16px; }
.title-input { font-family: var(--serif); font-weight: 800; font-size: clamp(26px, 4vw, 36px); letter-spacing: -.02em; border: 0; border-bottom: 1px solid var(--taupe); background: transparent; padding: 4px 0 8px; width: 100%; }
.title-input:focus { outline: none; border-bottom-color: var(--ink); }
.status-row .pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.spill { border: 1px solid var(--taupe); background: var(--card); border-radius: 999px; padding: 7px 14px 7px 12px; font-size: 13.5px; display: inline-flex; align-items: center; gap: 6px; }
.spill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--st); }
.spill.on { background: var(--ink); color: var(--card); border-color: var(--ink); font-weight: 600; }
.spill.on::before { box-shadow: 0 0 0 2px var(--card); }
.editor-h { font-size: 22px; margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--ivory); }
.cgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 14px; }
.cgrid.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.cfield { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.cfield.wide { grid-column: 1 / -1; }
.cfield .label { font-size: 10.5px; }
.cfield input, .cfield select, .cfield textarea { width: 100%; min-width: 0; border: 1px solid var(--field); border-radius: 12px; padding: 9px 12px; background: #fff; font-size: 16px; min-height: 42px; }
.cfield textarea { resize: vertical; line-height: 1.5; }
.cfield .hint { font-size: 12px; color: var(--charcoal); }
.editor-foot { display: flex; justify-content: space-between; gap: 10px; padding-top: 14px; border-top: 1px solid var(--ivory); }

/* ---------- calendar ---------- */
.month-targets { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 4px 20px; }
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.cal-head span { text-align: center; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--charcoal); padding-bottom: 6px; }
.cal-cell { min-height: 96px; background: var(--ivory); border: 1px solid transparent; border-radius: 10px; padding: 6px; text-align: left; display: flex; flex-direction: column; gap: 3px; min-width: 0; overflow: hidden; }
.cal-cell:hover { border-color: var(--taupe); }
.cal-cell.other { opacity: .45; }
.cal-cell.selected { border: 2px solid var(--ink); background: var(--card); }
.cal-cell.today .cal-num { background: var(--champagne); border: 1.5px solid var(--ink); }
.cal-num { font-size: 13px; font-weight: 700; width: 24px; height: 24px; line-height: 21px; text-align: center; border-radius: 50%; flex: none; border: 1.5px solid transparent; }
.cal-items { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-item { font-size: 11px; line-height: 1.35; border-radius: 4px; padding: 1px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border: 1px solid var(--taupe); background: var(--card); }
.cal-more { font-size: 11px; color: var(--charcoal); }
.cal-dots { display: none; gap: 3px; justify-content: center; flex-wrap: wrap; }
.cal-dots i { width: 7px; height: 7px; border-radius: 50%; border: 1px solid var(--field); }
.rd-planned { background: var(--card) !important; }
.rd-ready-to-film { background: var(--champagne) !important; border-color: var(--champagne-deep) !important; }
.rd-filmed { background: var(--blush) !important; border-color: var(--blush-deep) !important; }
.rd-ready-to-post { background: var(--beige) !important; border-color: var(--field) !important; }
.rd-scheduled { background: var(--charcoal) !important; border-color: var(--charcoal) !important; color: var(--card); }
.rd-posted { background: var(--ink) !important; border-color: var(--ink) !important; color: var(--card); }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; font-size: 12.5px; color: var(--charcoal); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend i { width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--field); display: inline-block; }
.agenda { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.agenda li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.agenda .muted { flex-basis: 100%; }
.rd-tag { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--taupe); }

/* ---------- settings ---------- */
.kv { margin: 0; }
.kv div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--ivory); }
.kv dt { color: var(--charcoal); }
.kv dd { margin: 0; font-weight: 600; text-align: right; }
.setting-list { list-style: none; margin: 0; padding: 0; }
.setting-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--ivory); }
.setting-list li > div { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.workspace { margin-bottom: -4px; }

/* ---------- carried over: money, business ---------- */
.subtabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--taupe); scrollbar-width: none; }
.subtabs::-webkit-scrollbar { display: none; }
.subtabs a { padding: 8px 14px; color: var(--charcoal); text-decoration: none; font-weight: 600; font-size: 14px; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subtabs a.active { color: var(--ink); border-bottom-color: var(--ink); }
.hero { background: var(--ink); color: var(--card); border-radius: 22px; padding: 24px 28px 26px; }
.hero-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.month-switch { display: inline-flex; align-items: center; gap: 6px; color: var(--champagne); font-size: 14px; }
.month-switch button { width: 34px; height: 34px; border-radius: 50%; border: 1px solid #4b4640; background: transparent; color: inherit; font-size: 20px; line-height: 1; }
.hero-number { font-family: var(--serif); font-weight: 800; font-size: 58px; letter-spacing: -.02em; line-height: 1.1; margin-top: 14px; }
.hero-sub { color: #d9d3c6; margin-top: 2px; }
.goalbar { display: flex; gap: 2px; height: 12px; background: #34302b; border-radius: 6px; margin-top: 18px; overflow: hidden; }
.goalbar span { display: block; height: 100%; }
.goalbar-in { background: var(--champagne); border-radius: 0 4px 4px 0; }
.goalbar-due { background: var(--blush-deep); }
.hero-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: #d9d3c6; margin-top: 10px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.dot.gold { background: var(--champagne); }
.dot.blush { background: var(--blush-deep); }
.hero-stats { display: flex; flex-wrap: wrap; gap: 14px 42px; margin-top: 20px; padding-top: 16px; border-top: 1px solid #3a3530; }
.hero-stats p { color: #c2baab; font-size: 13px; }
.hero-stats strong { font-family: var(--serif); font-weight: 800; font-size: 24px; }
.chart { position: relative; min-height: 230px; }
.chart svg { display: block; overflow: visible; }
.grid { stroke: var(--ivory); stroke-width: 1; }
.tick { fill: var(--charcoal); font-size: 11px; font-family: var(--sans); }
.tick.current { fill: var(--ink); font-weight: 700; }
.bar { fill: var(--field); }
.bar.current { fill: var(--ink); }
.hit { fill: transparent; outline: none; }
.hit:hover, .hit:focus { fill: rgba(25, 24, 23, .05); }
.goal-line { stroke: var(--rose-ink); stroke-width: 1.5; stroke-dasharray: 5 4; }
.goal-text { fill: var(--rose-ink); font-size: 11px; font-weight: 700; font-family: var(--sans); }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--card); border-radius: 8px; padding: 6px 10px; font-size: 12px; white-space: nowrap; display: flex; flex-direction: column; z-index: 3; }
.tip[hidden] { display: none; }
.hbars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.hbar-top { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; margin-bottom: 5px; }
.hbar-top strong { white-space: nowrap; font-variant-numeric: tabular-nums; }
.hbar-track { height: 8px; background: var(--ivory); border-radius: 4px; overflow: hidden; }
.hbar-track span { display: block; height: 100%; border-radius: 4px; background: var(--ink); }
.hbars .muted { margin-top: 4px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--charcoal); padding: 6px 10px; border-bottom: 1px solid var(--taupe); white-space: nowrap; }
th.num { text-align: right; }
td { padding: 11px 10px; border-bottom: 1px solid var(--ivory); vertical-align: middle; font-size: 14px; }
tr:last-child td { border-bottom: 0; }
td:last-child { text-align: right; }
.inline-select { padding: 5px 8px; border: 1px solid var(--field); border-radius: 8px; background: #fff; font-size: 13px; max-width: 100%; }
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.kanban-col { flex: 0 0 200px; background: var(--ivory); border-radius: 14px; padding: 10px; min-height: 120px; }
.kanban-col h4 { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; display: flex; justify-content: space-between; margin-bottom: 8px; padding: 2px 4px; }
.deal-card { background: var(--card); border: 1px solid var(--taupe); border-radius: 12px; padding: 10px; margin-bottom: 8px; }
.deal-card p { margin-top: 3px; }
.deal-value { font-family: var(--serif); font-weight: 800; font-size: 18px; margin: 4px 0 8px !important; }
.deal-card .inline-select { width: 100%; }
.deal-name { background: none; border: 0; padding: 0; text-align: left; font-weight: 700; text-decoration: underline; text-decoration-color: var(--champagne-deep); text-underline-offset: 3px; }
.contact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.contact { border: 1px solid var(--taupe); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.contact a { overflow-wrap: anywhere; }

/* ---------- forms ---------- */
dialog { border: 0; border-radius: 22px; padding: 0; width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); background: var(--card); color: var(--ink); box-shadow: 0 18px 50px rgba(25, 24, 23, .3); }
dialog::backdrop { background: rgba(25, 24, 23, .45); }
dialog form { padding: 22px 22px 18px; }
dialog h2 { font-size: 26px; }
.modal-intro { margin-top: 4px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.field { grid-column: 1 / -1; min-width: 0; }
.field.half { grid-column: span 1; }
.field label { display: block; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--charcoal); margin-bottom: 5px; }
.opt { font-weight: 400; letter-spacing: 0; text-transform: none; font-size: 12px; }
/* 16px text stops iPhones zooming in when a box is tapped. */
.field input, .field select, .field textarea { width: 100%; min-width: 0; display: block; padding: 9px 12px; border: 1px solid var(--field); border-radius: 12px; background: #fff; font-size: 16px; min-height: 42px; }
.hint { font-size: 12px; color: var(--charcoal); margin-top: 3px; }
.form-error { color: var(--rose-ink); font-size: 14px; margin-top: 10px; }
.modal-actions { display: flex; align-items: center; gap: 8px; margin-top: 18px; }
.spacer { flex: 1; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px); background: var(--ink); color: var(--card); border-radius: 999px; padding: 10px 18px; display: flex; gap: 14px; align-items: center; opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; z-index: 60; max-width: calc(100vw - 32px); font-size: 14px; }
#toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast-undo { background: none; border: 0; color: var(--champagne); font-weight: 700; text-decoration: underline; padding: 2px; }

/* ---------- phase 2: script studio ---------- */
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.btn-pill { border: 1.5px solid var(--ink); background: var(--card); border-radius: 999px; padding: 8px 16px; font-size: 12.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.btn-pill:hover { background: var(--ivory); }
.draft-panel .btn-primary { font-size: 12.5px; letter-spacing: .06em; text-transform: uppercase; font-weight: 700; }
.draft-panel { background: var(--champagne); border: 1px solid var(--champagne-deep); border-radius: 20px; padding: 16px 18px; }
.draft-panel textarea { width: 100%; margin-top: 8px; border: 1px solid var(--field); border-radius: 14px; padding: 10px 12px; background: var(--card); font-size: 16px; resize: vertical; }
.panel-note { margin-top: 12px; }
.versions { margin-top: 12px; background: var(--card); border-radius: 14px; padding: 8px 12px; }
.versions summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.versions ul { list-style: none; margin: 8px 0 0; padding: 0; }
.versions li { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--ivory); flex-wrap: wrap; }
.versions li > span:first-child { min-width: 0; flex: 1 1 220px; overflow-wrap: anywhere; }
.v-btns { display: flex; gap: 6px; }
.ok { color: var(--good-ink); font-weight: 600; }
.prompt-form .prompt-box, .prompt-form .answer-box, .prompt-form .note-input { width: 100%; border: 1px solid var(--field); border-radius: 12px; padding: 10px 12px; background: #fff; font-size: 16px; margin-top: 5px; }
.prompt-form .prompt-box { background: var(--ivory); font-size: 13px; line-height: 1.45; resize: vertical; }
.prompt-form .label { display: block; }
.stars-field { border: 0; padding: 0; margin: 14px 0 10px; display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.stars-field legend { margin-bottom: 4px; padding: 0; width: 100%; }
.star-opt { cursor: pointer; font-size: 26px; color: var(--taupe); line-height: 1; padding: 2px; }
.star-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.stars-field:has(input:checked) .star-opt { color: var(--ink); }
.stars-field .star-opt:has(input:checked) ~ .star-opt { color: var(--taupe); }
.star-opt:has(input:focus-visible) { outline: 2px solid var(--ink); border-radius: 6px; }

/* hook bank */
.hook-layout { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 16px; align-items: start; }
.write-hooks { display: flex; flex-direction: column; gap: 10px; }
.spice-select { border: 1.5px solid var(--ink); border-radius: 999px; padding: 9px 14px; font-weight: 700; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; background: var(--card); }
.write-hooks textarea, .search { width: 100%; border: 1px solid var(--field); border-radius: 14px; padding: 10px 12px; background: #fff; font-size: 16px; }
.search { border-radius: 999px; margin-bottom: 10px; }
.panel .filters + .filters { margin-top: 6px; }
.hook-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.hook { border: 1px solid var(--taupe); border-radius: 14px; padding: 10px 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; background: var(--card); }
.hook-text { font-weight: 600; overflow-wrap: anywhere; grid-column: 1; }
.hook-meta { grid-column: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.hook-btns { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.stars { display: inline-flex; }
.star { background: none; border: 0; padding: 0 1px; font-size: 17px; line-height: 1; color: var(--taupe); }
.star.on { color: var(--ink); }
.perf { color: var(--good-ink); font-weight: 600; }
.from-cards summary { cursor: pointer; display: flex; gap: 10px; flex-wrap: wrap; align-items: baseline; }

/* series */
.series-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.series-card { background: var(--card); border: 1px solid var(--taupe); border-radius: 22px; padding: 18px 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.series-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.series-top h3 { font-size: 26px; margin-top: 4px; }
.next { text-align: right; flex: none; }
.next b { font-family: var(--serif); font-weight: 800; font-size: 34px; line-height: 1; }
.opening { margin: 0; background: var(--ivory); border-radius: 14px; padding: 12px 14px; font-size: 15px; }
.series-card details summary { cursor: pointer; padding: 4px 0; }
.series-card details summary::before { content: "+ "; }
.series-card details[open] summary::before { content: "– "; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.ep-list { list-style: none; margin: 6px 0 0; padding: 0; }
.ep-list li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--taupe); flex-wrap: wrap; }

/* plan my week */
.plan-list { list-style: none; margin: 14px 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow-y: auto; }
.plan-list li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--taupe); border-radius: 12px; }
.plan-list label { display: flex; flex-direction: column; min-width: 0; cursor: pointer; overflow-wrap: anywhere; }
.rules-note { margin-top: 10px; }
.rules-note summary { cursor: pointer; font-weight: 600; }

/* results */
.tiles-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.insights { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.insights dt { font-family: var(--serif); font-weight: 800; font-size: 17px; border-top: 1.5px solid var(--ink); padding-top: 6px; }
.insights dd { margin: 4px 0 0; font-size: 14px; color: var(--charcoal); overflow-wrap: anywhere; }
.recent { list-style: none; margin: 0; padding: 0; }
.recent li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--ivory); }
.recent li > div { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.times { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* calendar day and pipeline views */
.day-view { display: flex; flex-direction: column; gap: 14px; }
.block { border-top: 1px solid var(--ivory); padding-top: 10px; }
.block:first-child { border-top: 0; padding-top: 0; }
.block .label { margin-bottom: 8px; }
.time { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 64px; }
.pipeline { display: grid; grid-template-columns: repeat(6, minmax(170px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 6px; min-width: 0; max-width: 100%; position: relative; }
/* Hidden labels inside sideways-scrolling areas must stay inside them. */
.week-wrap, .kanban, .studio-nav { position: relative; }
.pipe-col { background: var(--ivory); border: 1px solid var(--taupe); border-radius: 16px; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 160px; }
.pipe-col h3 { display: flex; justify-content: space-between; align-items: center; font-family: var(--sans); letter-spacing: .1em; }
.pipe-col h3 span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; border: 1px solid var(--field); display: inline-block; }
.pipe-card { background: var(--card); border: 1px solid var(--taupe); border-radius: 12px; padding: 9px 10px; display: flex; flex-direction: column; gap: 4px; }
.pipe-card a { overflow-wrap: anywhere; }
.btn-pair { display: inline-flex; gap: 12px; }
.voice-preview { color: var(--charcoal); max-height: 220px; overflow-y: auto; background: var(--ivory); border-radius: 12px; padding: 10px 12px; }

@media (max-width: 1180px) {
  .tiles-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hook-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .tiles-5 { grid-template-columns: 1fr 1fr; }
  .hook { grid-template-columns: minmax(0, 1fr); }
  .hook-btns { grid-column: 1; grid-row: auto; justify-content: flex-start; }
  .series-list { grid-template-columns: minmax(0, 1fr); }
  .pipeline { margin: 0 -16px; padding: 0 16px 6px; width: calc(100% + 32px); max-width: calc(100% + 32px); grid-template-columns: repeat(6, 200px); }
  .plan-list li { grid-template-columns: auto minmax(0, 1fr); }
  .plan-list li .inline-select { grid-column: 2; }
  .draft-panel { padding: 14px; }
  .btn-pill { padding: 8px 12px; }
}

/* ---------- phase 3: content library ---------- */
.lib-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.lib-bar .search { flex: 1 1 260px; margin: 0; min-width: 0; }
.lib-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-select { border: 1px solid var(--taupe); background: var(--card); border-radius: 999px; padding: 7px 12px; font-size: 13.5px; max-width: 100%; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.media-card { background: var(--card); border: 1px solid var(--taupe); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; min-width: 0; }
.media-thumb-btn { border: 0; padding: 0; background: none; display: block; width: 100%; }
.thumb { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; aspect-ratio: 4 / 3; background: var(--ivory); overflow: hidden; }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumb svg { width: 34px; height: 34px; fill: none; stroke: var(--field); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.thumb:not(.no-img) svg { opacity: 0; }
.thumb.small { width: 64px; height: 64px; aspect-ratio: auto; border-radius: 10px; flex: none; }
.thumb.small svg { width: 24px; height: 24px; }
.media-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.media-body h3 { font-size: 17px; overflow-wrap: anywhere; }
.media-body .btns { margin-top: 6px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { border: 0; background: var(--ivory); border-radius: 999px; padding: 2px 9px; font-size: 12px; }
.tag:hover { background: var(--champagne); }
.dup-panel { border-left: 4px solid var(--champagne-deep); }
.lib-empty { text-align: left; }
.lib-empty h2 { font-size: 26px; margin-bottom: 6px; }
.card-media { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.card-media li { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.card-media li > div { display: flex; flex-direction: column; flex: 1 1 160px; min-width: 0; overflow-wrap: anywhere; }
.preview-box { padding: 18px 20px; }
.preview-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; background: var(--ivory); border-radius: 14px; overflow: hidden; margin-bottom: 10px; }
.preview-frame.tall { aspect-ratio: 9 / 16; max-height: 62vh; width: auto; margin-inline: auto; }
.preview-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; }
.limits { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.folders { background: var(--ivory); border-radius: 12px; padding: 12px 14px; font-size: 13.5px; line-height: 1.6; overflow-x: auto; margin: 0 0 10px; }
code { background: var(--ivory); border-radius: 6px; padding: 1px 6px; font-size: .92em; overflow-wrap: anywhere; }

@media (max-width: 760px) {
  .media-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .media-body { padding: 10px; }
  .media-body .btns .btn-small { padding: 5px 9px; }
  .lib-bar .btn-primary { width: 100%; }
}
@media (max-width: 380px) { .media-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- phase 4: business studios ---------- */
.live-grid, .asset-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.live-card, .asset-card { background: var(--card); border: 1px solid var(--taupe); border-radius: 20px; padding: 16px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.live-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.live-top h3, .asset-card h3 { font-size: 22px; margin-top: 3px; overflow-wrap: anywhere; }
.checks { list-style: none; margin: 0; padding: 0; }
.checks label { display: flex; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--ivory); cursor: pointer; font-size: 14px; }
.asset-card details summary { cursor: pointer; padding: 4px 0; }
.stage-track { list-style: none; margin: 2px 0; padding: 0; display: flex; gap: 3px; }
.stage-track li { flex: 1; font-size: 9.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--charcoal); border-top: 4px solid var(--ivory); padding-top: 4px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-track li.on { border-top-color: var(--ink); color: var(--ink); }
.fb-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.fb-list li { background: var(--ivory); border-radius: 12px; padding: 8px 10px; }
.milestones { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.milestones li { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border: 1px solid var(--taupe); border-radius: 14px; flex-wrap: wrap; }
.milestones li b { font-family: var(--serif); font-weight: 800; font-size: 22px; min-width: 100px; }
.milestones li span { color: var(--charcoal); font-size: 14px; }
.milestones li.hit { background: var(--champagne); border-color: var(--champagne-deep); }
.milestones li.hit span { color: var(--ink); font-weight: 600; }
.milestones li.hit b::after { content: " ✓"; font-family: var(--sans); font-size: 16px; }
.rd-live { background: var(--good-bg) !important; border-color: var(--good-ink) !important; color: var(--good-ink); }
.workspace { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; position: relative; }
@media (max-width: 760px) {
  .live-grid, .asset-list { grid-template-columns: minmax(0, 1fr); }
  .panel-head, .card-head { flex-wrap: wrap; }
  .btn-pair { flex-wrap: wrap; align-items: center; }
  .workspace { margin: 0 -16px; padding: 0 16px 4px; width: calc(100% + 32px); }
}

/* ---------- phase 5: life ---------- */
.hide-private .pv { filter: blur(7px); user-select: none; }
.life-bar { display: flex; align-items: flex-end; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.life-bar .subtabs { flex: 1 1 auto; min-width: 0; }
.privacy-btn { margin-bottom: 4px; }
.ar-content { --ar: #E3C96B; --ar-bg: var(--champagne); }
.ar-business { --ar: #8A8073; --ar-bg: var(--beige); }
.ar-personal { --ar: #C98E83; --ar-bg: var(--blush); }
.ar-family { --ar: #2F5D50; --ar-bg: #DCE8E1; }
.ar-fitness { --ar: #4C6A9A; --ar-bg: #DFE6F2; }
.ar-money { --ar: #59554F; --ar-bg: var(--ivory); }
.cal-item[class*="ar-"] { background: var(--ar-bg); border-color: var(--ar); }
.cal-dots i[class*="ar-"], .cal-legend i[class*="ar-"] { background: var(--ar-bg); border-color: var(--ar); }
.area-tag { flex: none; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; background: var(--ar-bg); border: 1px solid var(--ar); color: var(--ink); }
.life-week { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.life-day { background: var(--card); border: 1px solid var(--taupe); border-radius: 16px; padding: 12px 14px; min-width: 0; }
.life-day.today { border: 2px solid var(--ink); background: #fffbea; }
.day-link { background: none; border: 0; padding: 0 0 6px; font-weight: 700; display: flex; gap: 8px; align-items: baseline; }
.life-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.life-item { display: flex; gap: 10px; align-items: flex-start; }
.life-main { display: flex; flex-direction: column; min-width: 0; flex: 1; overflow-wrap: anywhere; }
.fit-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.fit-day { background: var(--card); border: 1px solid var(--taupe); border-radius: 14px; padding: 10px; min-height: 120px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fit-day.today { border: 2px solid var(--ink); background: var(--champagne); }
.fit-item { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; font-size: 13.5px; }
.fit-item > span { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.fit-item.done strong { text-decoration: line-through; }
.meter-track.over span { background: var(--rose-ink); }
.big-meter { padding: 10px 0; border-bottom: 1px solid var(--ivory); }
.big-meter .btns { margin-top: 8px; }
.goal-card.done { opacity: .75; }
.goal-card .meter-track span { background: var(--ink); }
@media (max-width: 1180px) { .fit-week { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .fit-week { grid-template-columns: 1fr 1fr; }
  .life-week { grid-template-columns: minmax(0, 1fr); }
  #nav .nav-link { font-size: 9.5px; margin: 4px 0; padding: 7px 0 6px; }
  #nav .nav-link svg { width: 19px; height: 19px; }
  .life-bar .privacy-btn { margin-left: auto; }
}

/* ---------- phase 6: operator ---------- */
.rules { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.rules li { display: flex; gap: 12px; }
.rule-title { color: var(--ink); font-weight: 600; text-decoration-color: var(--champagne-deep); text-underline-offset: 3px; }
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.q-panel h3 { font-size: 22px; margin: 4px 0 12px; }
.rules li { align-items: flex-start; justify-content: space-between; }
.rules li > div { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.rules.numbered { counter-reset: n; }
.rules.numbered li::before { counter-increment: n; content: counter(n); flex: none; width: 26px; height: 26px; line-height: 26px; border-radius: 50%; background: var(--ink); color: var(--card); text-align: center; font-family: var(--serif); font-weight: 800; }
.top-three { border: 2px solid var(--ink); }
.log-list { list-style: none; margin: 0; padding: 0; }
.log-list li { display: grid; grid-template-columns: 130px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--ivory); overflow-wrap: anywhere; }
.review-form { display: flex; flex-direction: column; gap: 10px; }
.review-form textarea { width: 100%; }
.ai-card p { margin-bottom: 8px; max-width: 70ch; }
@media (max-width: 760px) {
  .log-list li { grid-template-columns: minmax(0, 1fr) auto; }
  .log-list li > .muted { grid-column: 1 / -1; }
  /* On phones the Operator lives in the top bar, so seven items fit the bottom bar. */
  #nav .nav-link[data-route="operator"] { display: none; }
}

/* ---------- phase 7: cloud sync ---------- */
.sync-pill { display: inline-flex; align-items: center; gap: 6px; margin: 10px 12px 0; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; text-decoration: none; color: var(--charcoal); background: var(--card); border: 1px solid var(--taupe); white-space: nowrap; }
.sync-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--taupe); }
.sync-pill[data-state="synced"]::before { background: var(--good-ink); }
.sync-pill[data-state="syncing"]::before { background: var(--champagne-deep); }
.sync-pill[data-state="offline"]::before, .sync-pill[data-state="error"]::before, .sync-pill[data-state="needs-choice"]::before { background: var(--rose-ink); }
.topbar .sync-pill { margin: 0 4px 0 0; }
.cloud-panel { border: 2px solid var(--ink); }
.cloud-form .field { margin-bottom: 10px; }
@media (max-width: 760px) { .topbar .sync-pill { font-size: 10.5px; padding: 3px 8px; } }
/* Very narrow screens: the sync label shrinks to its coloured dot (full status stays in Settings). */
@media (max-width: 400px) { .topbar .sync-pill { font-size: 0; gap: 0; padding: 6px; } .topbar .brand-name { font-size: 19px; } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- tablets ---------- */
@media (max-width: 1180px) {
  .grid-2, .home-grid { grid-template-columns: minmax(0, 1fr); }
  .tiles-4 { grid-template-columns: repeat(2, 1fr); }
  .cgrid.five { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- phones ---------- */
@media (max-width: 760px) {
  .topbar { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 15; background: var(--ivory); border-bottom: 1px solid var(--taupe); padding: calc(10px + env(safe-area-inset-top)) 16px 10px; }
  .topbar .brand { padding: 0; }
  .topbar .brand-name { font-size: 21px; }
  .topbar-settings { width: 44px; height: 44px; padding: 0; justify-content: center; margin: -8px -8px -8px 0; }
  .sidebar { inset: auto 0 0 0; width: auto; padding: 0 4px env(safe-area-inset-bottom); flex-direction: row; border-right: 0; border-top: 1px solid var(--taupe); }
  .sidebar > .brand, .sidebar-foot { display: none; }
  #nav { margin: 0; flex-direction: row; gap: 0; width: 100%; }
  #nav .nav-link { flex: 1 1 0; min-width: 0; flex-direction: column; gap: 3px; padding: 7px 2px 6px; font-size: 10.5px; border-radius: 12px; margin: 4px 1px; text-align: center; min-height: 52px; }
  #nav .nav-link span { white-space: nowrap; }
  #main { margin-left: 0; }
  .page { padding: 18px 16px calc(96px + env(safe-area-inset-bottom)); gap: 14px; }
  .rings { gap: 8px; }
  .ring-tile { padding: 12px 6px; }
  .ring { transform: scale(.86); margin: -6px; }
  .ring-tile .label { font-size: 9.5px; letter-spacing: .08em; }
  .ring-tile .muted { font-size: 11px; }
  .countdowns { grid-template-columns: 1fr 1fr; }
  .panel, .card { padding: 16px 14px; }
  .panel-head h2 { font-size: 23px; }
  .tiles, .tiles-4 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tiles > .tile:first-child:nth-last-child(odd) { grid-column: 1 / -1; }
  .cgrid, .cgrid.five { grid-template-columns: 1fr 1fr; }
  .editor { padding: 16px 14px; }
  .section-head h2 { font-size: 27px; }
  .hero { padding: 18px; }
  .hero-number { font-size: 44px; }
  .week-wrap { margin: 0 -16px; border-radius: 0; border-left: 0; border-right: 0; scroll-snap-type: x proximity; }
  .week { grid-template-columns: repeat(8, 150px); min-width: 0; }
  .day { scroll-snap-align: start; }
  .btn-primary, .btn-ghost, .btn-danger { min-height: 42px; }
  .btn-small { min-height: 36px; }
  .inline-select { min-height: 36px; font-size: 16px; }
  .cal-cell { min-height: 54px; padding: 4px 1px; align-items: center; }
  .cal-items { display: none; }
  .cal-dots { display: flex; }
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { border: 1px solid var(--taupe); border-radius: 14px; padding: 6px 12px; margin-bottom: 10px; background: var(--card); }
  table.stack td { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 7px 0; border-bottom: 1px solid var(--ivory); text-align: right; }
  table.stack tr td:last-child { border-bottom: 0; }
  table.stack td::before { content: attr(data-label); color: var(--charcoal); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; flex: none; text-align: left; }
  table.stack td[data-label=""]::before { content: none; }
  table.stack td[data-label=""] { justify-content: flex-end; }
  table.stack .cell { min-width: 0; text-align: right; }
  .table-wrap { overflow: visible; }
  .kanban { margin: 0 -14px; padding: 0 14px 8px; }
  .kanban-col { flex-basis: 78%; max-width: 260px; }
  dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 22px 22px 0 0; max-height: 92dvh; }
  dialog form { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  #toast { bottom: calc(76px + env(safe-area-inset-bottom)); width: max-content; border-radius: 14px; }
}
@media (max-width: 380px) {
  .countdowns { grid-template-columns: 1fr; }
  .cgrid, .cgrid.five { grid-template-columns: 1fr; }
}
