/* Pinterest Publisher — shared operator console styles. No script, no external font, no inline style.
   BRAND tokens (--brand*, --heading, neutrals) are neutral defaults here; each brand's own values
   come from its profile, served at /assets/brand.css after this file. STATUS tokens (green / amber /
   red / gray) are not brandable, so importance is never shown with a status colour. */

:root, [data-theme="light"] {
  color-scheme: light;
  --brand: #3b4b5c; --brand-strong: #2c3947; --brand-ink: #ffffff; --brand-soft: #e8edf2; --brand-line: #cdd6df;
  --heading: #1f2933;
  --ink: #2a211d; --muted: #6a5e57; --line: #e8dfd6; --line-strong: #d3c6ba;
  --bg: #f7f3ee; --card: #fffdfa; --subtle: #f1ebe4; --input: #ffffff;
  --focus: #2b6a9b;
  --green: #22683f; --green-bg: #e2f0e5; --amber: #845600; --amber-bg: #fbefd5;
  --red: #a2302e; --red-bg: #f9e4e1; --gray: #5b554f; --gray-bg: #eee9e3;
  --shadow: 0 1px 2px rgba(63, 44, 36, .06), 0 1px 3px rgba(63, 44, 36, .04);
  --radius: 12px;
}
[data-theme="dark"] {
  color-scheme: dark;
  --brand: #9fb4c8; --brand-strong: #bccbd9; --brand-ink: #111820; --brand-soft: #243140; --brand-line: #3a4a5a;
  --heading: #e6edf3;
  --ink: #f2eae3; --muted: #bcb0a6; --line: #3a302a; --line-strong: #4f4239;
  --bg: #16110e; --card: #211a16; --subtle: #2a221d; --input: #1b1512;
  --focus: #8dc2ec;
  --green: #92d4a8; --green-bg: #1b3325; --amber: #f0c56f; --amber-bg: #3a2c12;
  --red: #f3a59f; --red-bg: #3f201d; --gray: #cdc4bc; --gray-bg: #2f2823;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35);
}
@media (prefers-color-scheme: dark) {
  [data-theme="system"] {
    color-scheme: dark;
    --brand: #9fb4c8; --brand-strong: #bccbd9; --brand-ink: #111820; --brand-soft: #243140; --brand-line: #3a4a5a;
    --heading: #e6edf3;
    --ink: #f2eae3; --muted: #bcb0a6; --line: #3a302a; --line-strong: #4f4239;
    --bg: #16110e; --card: #211a16; --subtle: #2a221d; --input: #1b1512;
    --focus: #8dc2ec;
    --green: #92d4a8; --green-bg: #1b3325; --amber: #f0c56f; --amber-bg: #3a2c12;
    --red: #f3a59f; --red-bg: #3f201d; --gray: #cdc4bc; --gray-bg: #2f2823;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35);
  }
}

/* ── base ─────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand); text-underline-offset: 2px; }
a:hover { color: var(--brand-strong); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0; color: var(--heading); letter-spacing: -.015em; }
h2 { font-size: 1rem; margin: 0 0 .75rem; color: var(--heading); }
p { margin: .4rem 0; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; }
code { background: var(--subtle); padding: .05rem .3rem; border-radius: 4px; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.strong { font-weight: 600; }
a.strong { color: var(--ink); text-decoration: none; }
a.strong:hover { color: var(--brand); text-decoration: underline; }
.nowrap { white-space: nowrap; }
.break { overflow-wrap: anywhere; word-break: break-word; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sr, .skip { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip:focus { position: fixed; z-index: 10; top: .5rem; left: .5rem; width: auto; height: auto; clip: auto; padding: .5rem .9rem; background: var(--card); border: 2px solid var(--focus); border-radius: 8px; }
.empty { color: var(--muted); margin: .25rem 0; }
.icon { width: 1.15em; height: 1.15em; flex: 0 0 auto; vertical-align: -.2em; }
.dot { width: .55rem; height: .55rem; border-radius: 50%; display: inline-block; flex: 0 0 auto; background: var(--gray); }
.dot-green { background: var(--green); } .dot-amber { background: var(--amber); } .dot-red { background: var(--red); } .dot-gray { background: var(--gray); }

/* ── shell ────────────────────────────────────────────────────────────── */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .6rem 1.25rem; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .65rem; text-decoration: none; color: var(--heading); }
.brand:hover { color: var(--heading); }
.brand-logo { height: 40px; width: auto; display: block; border-radius: 8px; }
/* A logo supplied with its own light background (e.g. a JPEG) sits on a light plate in every theme. */
.brand-logo.plate { background: #ffffff; padding: 2px; box-shadow: 0 0 0 1px var(--line); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 750; font-size: 1.12rem; letter-spacing: .01em; color: var(--brand); }
.brand-sub { font-size: .78rem; color: var(--muted); }
.logo-dark { display: none; }
[data-theme="dark"] .logo-light { display: none; }
[data-theme="dark"] .logo-dark { display: block; }
@media (prefers-color-scheme: dark) {
  [data-theme="system"] .logo-light { display: none; }
  [data-theme="system"] .logo-dark { display: block; }
}
.topbar-right { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; justify-content: flex-end; }
.conn { display: inline-flex; align-items: center; gap: .45rem; padding: .3rem .7rem; border-radius: 999px; font-size: .84rem; font-weight: 600; text-decoration: none; border: 1px solid var(--line); color: var(--ink); background: var(--bg); }
.conn:hover { color: var(--ink); border-color: var(--line-strong); }
.who { display: inline-flex; align-items: center; gap: .35rem; color: var(--muted); font-size: .88rem; }

.env { border-bottom: 1px solid var(--line); background: var(--amber-bg); color: var(--ink); }
.env-inner { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem 1rem; padding: .45rem 1.25rem; font-size: .86rem; }
.env-label { display: inline-flex; align-items: center; gap: .35rem; font-weight: 750; letter-spacing: .08em; color: var(--amber); }
.env-text { flex: 1 1 18rem; }
.env-lock { display: inline-flex; align-items: center; gap: .35rem; font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; padding: .15rem .6rem; border-radius: 999px; background: var(--card); color: var(--heading); border: 1px solid var(--line); }
.env-lock.env-open, .env-production { background: var(--red-bg); color: var(--red); }
.env-inline { display: flex; align-items: center; gap: .5rem; font-size: .84rem; color: var(--muted); margin: 0 0 1rem; }
.pill { display: inline-block; padding: .08rem .55rem; border-radius: 999px; font-size: .74rem; font-weight: 750; letter-spacing: .06em; }
.pill-amber { background: var(--amber-bg); color: var(--amber); }

.layout { display: flex; flex: 1; min-height: 0; }
.sidebar { width: 236px; flex: 0 0 236px; padding: 1rem .75rem 2rem; border-right: 1px solid var(--line); background: var(--card); }
.nav-group { margin-bottom: .9rem; }
.nav-heading { display: block; padding: .15rem .75rem .3rem; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.sidebar a, .mobile-nav a { display: flex; align-items: center; gap: .65rem; padding: .5rem .75rem; margin: .05rem 0; border-radius: 9px; text-decoration: none; color: var(--ink); font-weight: 500; position: relative; }
.sidebar a:hover, .mobile-nav a:hover { background: var(--subtle); color: var(--ink); }
.sidebar a .icon, .mobile-nav a .icon { color: var(--muted); }
.sidebar a.active, .mobile-nav a.active { background: var(--brand-soft); color: var(--brand-strong); font-weight: 650; }
.sidebar a.active .icon, .mobile-nav a.active .icon { color: var(--brand); }
.sidebar a.active::before { content: ""; position: absolute; left: -.75rem; top: .4rem; bottom: .4rem; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.mobile-nav { display: none; }
main { flex: 1; min-width: 0; padding: 1.5rem 2rem 3rem; max-width: 1480px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: .75rem 1.5rem; margin-bottom: 1.25rem; }
.lede { color: var(--muted); margin: .3rem 0 0; max-width: 62ch; }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.foot { padding: .9rem 2rem; color: var(--muted); font-size: .8rem; border-top: 1px solid var(--line); background: var(--card); }

/* ── surfaces ─────────────────────────────────────────────────────────── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.15rem 1.25rem; margin-bottom: 1rem; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; margin-bottom: .6rem; }
.card-head h2 { margin: 0; }
.card.warning { border-color: var(--amber); background: var(--amber-bg); }
.grid-2, .grid-3, .grid-main, .composer, .status-grid { display: grid; gap: 1rem; margin-bottom: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); align-items: start; }
.composer { grid-template-columns: minmax(0, 1.4fr) minmax(280px, .9fr); align-items: start; }
.grid-2 > .card, .grid-3 > .card, .grid-main > .card, .composer > .card, .composer-side > .card:last-child { margin-bottom: 0; }

.status-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.status-card { display: flex; gap: .75rem; align-items: flex-start; padding: .95rem 1rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.status-icon { display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 10px; background: var(--subtle); color: var(--heading); flex: 0 0 auto; }
.status-green .status-icon { background: var(--green-bg); color: var(--green); }
.status-amber .status-icon { background: var(--amber-bg); color: var(--amber); }
.status-red .status-icon { background: var(--red-bg); color: var(--red); }
.status-heading { font-size: .78rem; color: var(--muted); font-weight: 600; }
.status-value { display: flex; align-items: center; gap: .45rem; font-weight: 700; color: var(--ink); }
.status-note { font-size: .82rem; color: var(--muted); margin-top: .1rem; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.stat { display: flex; flex-direction: column; padding: .9rem 1rem; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); text-decoration: none; color: var(--ink); box-shadow: var(--shadow); border-top: 3px solid var(--line-strong); }
.stat:hover { border-color: var(--line-strong); color: var(--ink); }
.stat-value { font-size: 1.8rem; font-weight: 750; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { font-weight: 600; font-size: .9rem; }
.stat-hint { color: var(--muted); font-size: .78rem; }
.stat-amber { border-top-color: var(--amber); } .stat-amber .stat-value { color: var(--amber); }
.stat-red { border-top-color: var(--red); } .stat-red .stat-value { color: var(--red); }
.stat-green { border-top-color: var(--green); } .stat-green .stat-value { color: var(--green); }

.badge { display: inline-flex; align-items: center; padding: .12rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 650; white-space: nowrap; margin: 0 .25rem .15rem 0; border: 1px solid transparent; }
.badge-green { color: var(--green); background: var(--green-bg); }
.badge-amber { color: var(--amber); background: var(--amber-bg); }
.badge-red { color: var(--red); background: var(--red-bg); }
.badge-gray { color: var(--gray); background: var(--gray-bg); }

.notice { padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-weight: 500; border: 1px solid transparent; }
.notice p { margin: 0; }
.notice-green { background: var(--green-bg); color: var(--green); }
.notice-amber { background: var(--amber-bg); color: var(--amber); }
.notice-red { background: var(--red-bg); color: var(--red); }
.notice-gray { background: var(--gray-bg); color: var(--gray); }
.notice .tech { margin-top: .35rem; }

.tech { margin-top: .5rem; font-size: .84rem; color: var(--muted); }
.tech > summary { cursor: pointer; width: fit-content; }
.tech > summary:hover { color: var(--ink); }
.tech-body { margin-top: .5rem; }
details.card.tech { margin-top: 0; }
details.card.tech > summary { font-weight: 600; color: var(--heading); font-size: .95rem; }
.reasons { margin: .35rem 0 0; padding-left: 1.1rem; color: var(--red); font-size: .9rem; }
.empty-state { text-align: left; padding: .5rem 0; }
.empty-title { font-weight: 600; margin: 0; color: var(--ink); }

/* ── controls ─────────────────────────────────────────────────────────── */
.button, button { font: inherit; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .5rem .95rem; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--card); color: var(--ink); text-decoration: none; cursor: pointer; font-weight: 600; line-height: 1.3; }
.button:hover, button:hover { border-color: var(--muted); color: var(--ink); background: var(--subtle); }
.button.active { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-strong); }
.primary, button.primary, .button.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.primary:hover, button.primary:hover, .button.primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); color: var(--brand-ink); }
button.danger, .button.danger { color: var(--red); border-color: var(--red-bg); }
button.danger:hover, .button.danger:hover { background: var(--red-bg); border-color: var(--red); color: var(--red); }
button.ghost { border-color: transparent; background: none; color: var(--muted); padding: .35rem .5rem; font-weight: 500; }
button.ghost:hover { color: var(--ink); background: var(--subtle); }
button:disabled { opacity: .55; cursor: not-allowed; }
button.link { border: 0; background: none; padding: 0; color: var(--brand); text-decoration: underline; font-weight: 500; }
.small-button { padding: .28rem .65rem; font-size: .84rem; }
form.inline { display: inline; margin: 0; }

.form-grid { display: grid; gap: 1rem; align-content: start; }
.form-grid > h2 { margin: 0; }
.form-grid > h2 + p { margin-top: -.6rem; }
input[type="checkbox"], input[type="radio"] { width: 1.1rem; height: 1.1rem; min-width: 1.1rem; padding: 0; border: 0; border-radius: 0; background: none; accent-color: var(--brand); flex: 0 0 auto; }
label { display: grid; gap: .3rem; font-weight: 600; }
.hint { font-weight: 400; font-size: .84rem; color: var(--muted); }
input, select, textarea { font: inherit; padding: .55rem .7rem; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--input); color: var(--ink); width: 100%; min-width: 0; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input[aria-invalid="true"], textarea[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--red); }
input[type="file"] { padding: .45rem; background: var(--subtle); }
textarea { resize: vertical; }
label.check { display: flex; gap: .55rem; align-items: flex-start; font-weight: 450; }
label.check input, .choice-item input { width: auto; margin-top: .25rem; accent-color: var(--brand); }
.field-error { color: var(--red); font-size: .84rem; font-weight: 600; }
.file-drop { border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: 1rem; background: var(--subtle); }
.file-drop .file-head { display: flex; align-items: center; gap: .5rem; }
.staged { font-weight: 400; font-size: .88rem; color: var(--muted); margin: 0; }
fieldset.choice { border: 0; padding: 0; margin: 0; display: grid; gap: .45rem; }
.choice-item { display: flex; align-items: center; gap: .6rem; font-weight: 500; padding: .55rem .75rem; border: 1px solid var(--line); border-radius: 9px; }
.choice-item:hover { border-color: var(--line-strong); }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.actions-stack { display: grid; gap: .5rem; margin-bottom: 1rem; }
.actions-stack form.inline button, .actions-stack .button { width: 100%; }
.schedule-form { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; align-items: end; margin-top: .5rem; }
.schedule-form label:nth-of-type(3) { grid-column: 1 / -1; }
.schedule-form button, .schedule-form label.check { grid-column: 1 / -1; }
.schedule-form label.check { font-weight: 450; }
.filters { display: flex; flex-wrap: wrap; gap: .6rem .75rem; align-items: end; padding: .8rem 1rem; }
.filters label { flex: 1 1 160px; font-size: .84rem; }

/* ── tables ───────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; padding: .5rem .6rem; border-bottom: 1px solid var(--line); }
td { padding: .65rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--subtle); }
.c-thumb { width: 60px; }
.row-red td:first-child { box-shadow: inset 3px 0 var(--red); }
.row-amber td:first-child { box-shadow: inset 3px 0 var(--amber); }
.row-green td:first-child { box-shadow: inset 3px 0 var(--green); }
a.url { color: var(--brand); overflow-wrap: anywhere; word-break: break-word; }
.url-cell { max-width: 22rem; }

.thumb { display: inline-grid; place-items: center; object-fit: cover; border-radius: 8px; background: var(--subtle); color: var(--muted); border: 1px solid var(--line); }
.thumb-sm { width: 44px; height: 44px; }
.thumb-md { width: 64px; height: 80px; }
.thumb-lg { width: 100%; max-height: 560px; height: auto; object-fit: contain; }
.thumb-missing .icon { width: 50%; height: 50%; }
.preview { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 1.25rem; }
.preview-image { background: var(--subtle); border-radius: var(--radius); display: grid; place-items: center; min-height: 12rem; }
.pin-title { font-size: 1.25rem; color: var(--ink); margin-bottom: .4rem; }
.pin-description { white-space: normal; }
.pin-head { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .75rem; margin-bottom: .75rem; }

.pin-mock { padding: 0; overflow: hidden; }
.pin-mock-image { display: grid; place-items: center; gap: .5rem; text-align: center; aspect-ratio: 2 / 3; max-height: 22rem; width: 100%; background: var(--subtle); color: var(--muted); padding: 1.5rem; font-size: .88rem; }
.pin-mock-image .icon { width: 2.5rem; height: 2.5rem; }
.pin-mock-text { padding: .9rem 1rem; }
.next-steps { margin: 0; padding-left: 1.2rem; display: grid; gap: .4rem; color: var(--muted); }

.facts { margin: 0; display: grid; gap: .55rem; }
.facts > div { display: grid; grid-template-columns: minmax(110px, 32%) 1fr; gap: .75rem; }
.facts dt { color: var(--muted); font-size: .86rem; }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.mini, .activity, .day-list, .week-list { list-style: none; margin: 0; padding: 0; }
.mini li, .day-list li { display: flex; gap: .75rem; align-items: flex-start; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.mini li:last-child, .day-list li:last-child { border-bottom: 0; }
.mini li > div, .day-main { flex: 1; min-width: 0; }
.mini a { color: var(--ink); text-decoration: none; font-weight: 600; }
.mini a:hover { color: var(--brand); text-decoration: underline; }
.activity li { display: flex; gap: .6rem; align-items: center; padding: .42rem 0; border-bottom: 1px solid var(--line); }
.activity li:last-child { border-bottom: 0; }
.activity-label { flex: 1; min-width: 0; }
.media-row { display: flex; gap: .75rem; align-items: flex-start; }
.row-actions { display: flex; flex-wrap: wrap; gap: .4rem .9rem; margin-top: .3rem; font-size: .86rem; }
.events { list-style: none; margin: 0; padding: 0; }
.events li { display: flex; gap: .6rem; align-items: center; padding: .2rem 0; }

/* ── import ───────────────────────────────────────────────────────────── */
.stepper { list-style: none; counter-reset: step; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .5rem; margin: 0 0 1rem; padding: 0; }
.stepper li { counter-increment: step; display: flex; align-items: center; gap: .55rem; padding: .6rem .75rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); font-size: .88rem; font-weight: 600; }
.stepper li::before { content: counter(step); display: grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--brand-soft); color: var(--brand-strong); font-weight: 750; flex: 0 0 auto; }
.upload-card h2 { display: flex; align-items: center; gap: .5rem; }

/* ── calendar ─────────────────────────────────────────────────────────── */
.toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .6rem; margin-bottom: .75rem; }
.toolbar-group { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.segmented { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 9px; overflow: hidden; }
.segmented .button { border: 0; border-radius: 0; }
.segmented .button + .button { border-left: 1px solid var(--line-strong); }
.month-title { font-size: 1.15rem; margin: 0 .35rem; color: var(--heading); }
.legend { display: flex; flex-wrap: wrap; gap: .3rem .9rem; font-size: .82rem; color: var(--muted); margin: 0 0 .6rem; }
.legend span { display: inline-flex; align-items: center; gap: .35rem; }
.calendar { table-layout: fixed; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.calendar th { text-align: center; background: var(--subtle); }
.cal-cell { height: 118px; padding: 0; border: 1px solid var(--line); vertical-align: top; }
.cal-cell a { display: flex; flex-direction: column; gap: .2rem; height: 100%; padding: .35rem .4rem; text-decoration: none; color: var(--ink); }
.cal-cell a:hover { background: var(--subtle); }
.cal-cell.out { background: var(--bg); }
.cal-cell.out .cal-day { color: var(--muted); font-weight: 500; }
.cal-head { display: flex; justify-content: space-between; align-items: center; }
.cal-day { font-weight: 700; font-size: .88rem; min-width: 1.7rem; height: 1.7rem; display: grid; place-items: center; border-radius: 999px; }
.cal-cell.today .cal-day { background: var(--brand-soft); color: var(--brand-strong); box-shadow: inset 0 0 0 1px var(--brand-line); }
.cal-cell.selected { box-shadow: inset 0 0 0 2px var(--brand); }
.cal-count { font-size: .72rem; color: var(--muted); }
.cal-items { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.cal-item { display: flex; align-items: center; gap: .3rem; font-size: .74rem; line-height: 1.3; padding: .08rem .3rem; border-radius: 5px; background: var(--subtle); min-width: 0; }
.cal-item-green { background: var(--green-bg); } .cal-item-amber { background: var(--amber-bg); } .cal-item-red { background: var(--red-bg); } .cal-item-gray { background: var(--gray-bg); }
.cal-time { font-variant-numeric: tabular-nums; color: var(--muted); flex: 0 0 auto; }
.cal-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cal-more { font-size: .72rem; color: var(--muted); padding-left: .3rem; }
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .5rem; margin-bottom: 1rem; }
.week-day { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem; min-height: 9rem; min-width: 0; }
.week-day.today { border-color: var(--brand-line); box-shadow: inset 0 3px 0 var(--brand); }
.week-day h2 { font-size: .88rem; margin: 0 0 .5rem; display: flex; justify-content: space-between; gap: .3rem; }
.week-item { display: grid; gap: .25rem; padding: .45rem; border-radius: 8px; background: var(--subtle); text-decoration: none; color: var(--ink); margin-bottom: .4rem; font-size: .82rem; min-width: 0; }
.week-item:hover { color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }
.week-item .strong { overflow-wrap: anywhere; }

/* ── analytics ────────────────────────────────────────────────────────── */
.bars { display: grid; gap: .5rem; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 34%) 1fr 2.5rem; gap: .6rem; align-items: center; font-size: .88rem; }
.bar-track { height: .6rem; background: var(--subtle); border-radius: 999px; overflow: hidden; }
.bar { display: block; height: 100%; border-radius: 999px; background: var(--brand); width: 0; }
.bar-green { background: var(--green); } .bar-amber { background: var(--amber); } .bar-red { background: var(--red); } .bar-gray { background: var(--gray); }
.bar-1 { width: 10%; } .bar-2 { width: 20%; } .bar-3 { width: 30%; } .bar-4 { width: 40%; } .bar-5 { width: 50%; }
.bar-6 { width: 60%; } .bar-7 { width: 70%; } .bar-8 { width: 80%; } .bar-9 { width: 90%; } .bar-10 { width: 100%; }
.chart { display: flex; align-items: flex-end; gap: .35rem; height: 10rem; padding: .5rem 0 0; border-bottom: 1px solid var(--line); }
.chart-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: .25rem; min-width: 0; }
.chart-bar { width: 100%; max-width: 2.2rem; border-radius: 6px 6px 0 0; background: var(--brand); min-height: 2px; }
.chart-bar.h-0 { height: 2px; background: var(--line-strong); }
.h-1 { height: 10%; } .h-2 { height: 20%; } .h-3 { height: 30%; } .h-4 { height: 40%; } .h-5 { height: 50%; }
.h-6 { height: 60%; } .h-7 { height: 70%; } .h-8 { height: 80%; } .h-9 { height: 90%; } .h-10 { height: 100%; }
.chart-value { font-size: .72rem; font-weight: 650; color: var(--ink); }
.chart-labels { display: flex; gap: .35rem; font-size: .68rem; color: var(--muted); margin-top: .3rem; }
.chart-labels span { flex: 1; text-align: center; min-width: 0; overflow: hidden; white-space: nowrap; }

/* ── sign in ──────────────────────────────────────────────────────────── */
body.bare { display: grid; place-items: center; min-height: 100vh; padding: 1rem; background: var(--bg); }
.bare-card { width: 100%; max-width: 440px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 2rem; box-shadow: var(--shadow); }
.bare-card h1 { font-size: 1.35rem; margin: 0 0 1rem; }
.bare-brand { margin-bottom: 1.25rem; }
.bare-card .notice { margin-bottom: 1rem; }
.stack { display: grid; gap: .95rem; }
.stack button.primary { width: 100%; padding: .65rem; }

/* ── responsive ───────────────────────────────────────────────────────── */
@media (max-width: 1280px) {
  .status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 > .card:last-child { grid-column: 1 / -1; }
}
@media (max-width: 1080px) {
  .grid-main, .preview, .composer { grid-template-columns: 1fr; }
  .stepper { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .week-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  main { padding: 1.25rem 1.25rem 3rem; }
}
@media (max-width: 760px) {
  .sidebar { display: none; }
  .mobile-nav { display: block; background: var(--card); border-bottom: 1px solid var(--line); padding: .35rem 1rem; }
  .mobile-nav summary { cursor: pointer; font-weight: 650; padding: .4rem 0; display: flex; align-items: center; gap: .5rem; list-style: none; }
  .mobile-nav summary::-webkit-details-marker { display: none; }
  .mobile-nav nav { padding-bottom: .5rem; }
  main { padding: 1rem 1rem 2.5rem; }
  h1 { font-size: 1.35rem; }
  .grid-2, .grid-3, .status-grid, .week-grid { grid-template-columns: 1fr; }
  .grid-3 > .card:last-child { grid-column: auto; }
  .stepper { grid-template-columns: 1fr 1fr; }
  .facts > div { grid-template-columns: 1fr; gap: .1rem; }
  .schedule-form { grid-template-columns: 1fr; }
  .topbar { padding: .55rem 1rem; }
  .who, .topbar .brand-sub, button.ghost span { display: none; }
  .env-inner { padding: .45rem 1rem; }
  .foot { padding: .8rem 1rem; }
  .bar-row { grid-template-columns: 1fr 2rem; }
  .bar-row .bar-track { grid-column: 1 / -1; grid-row: 2; }
  /* The month grid keeps its shape; days show markers, and the day list below carries the detail. */
  .cal-cell { height: 58px; }
  .cal-cell a { padding: .2rem; align-items: center; }
  .cal-count, .cal-time, .cal-title, .cal-more { display: none; }
  .cal-items { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: .15rem; }
  .cal-item { padding: 0; background: none; }
  .calendar th { font-size: .66rem; padding: .35rem 0; }
  /* Pin and import tables become stacked cards, so state and actions are never off-screen. */
  table.pins thead, table.import-rows thead, table.stacked thead { display: none; }
  table.pins, table.pins tbody, table.pins tr, table.pins td,
  table.import-rows, table.import-rows tbody, table.import-rows tr, table.import-rows td,
  table.stacked, table.stacked tbody, table.stacked tr, table.stacked td { display: block; width: 100%; }
  table.pins tr, table.import-rows tr, table.stacked tr { position: relative; padding: .6rem 0 .6rem 60px; border-bottom: 1px solid var(--line); min-height: 64px; }
  table.stacked tr { padding-left: 0; }
  table.pins td, table.import-rows td, table.stacked td { border: 0; padding: .15rem .25rem; white-space: normal; }
  tbody tr:hover td { background: none; }
  table.pins td.c-thumb, table.import-rows td.c-thumb { position: absolute; left: 0; top: .6rem; width: 52px; padding: 0; }
  table.stacked td.c-thumb { position: static; width: auto; }
  table.pins td.c-thumb .thumb, table.import-rows td.c-thumb .thumb { width: 48px; height: 48px; }
  table.pins td[data-label]::before, table.import-rows td[data-label]::before, table.stacked td[data-label]::before { content: attr(data-label); display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
  table.import-rows tr td:first-child { box-shadow: none; }
  table.import-rows tr.row-red { border-left: 3px solid var(--red); }
  table.import-rows tr.row-amber { border-left: 3px solid var(--amber); }
  table.import-rows tr.row-green { border-left: 3px solid var(--green); }
  .url-cell { max-width: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
