/* Operations Command Console: Rise colors, light and dark themes, responsive from phone to desktop. */
:root {
  --ink: #15364c;
  --ink-soft: #405a6b;
  --muted: #6f7f79;
  --line: #e1e6e0;
  --surface: #fff;
  --canvas: #f5f7f4;
  --accent: #087d85;
  --accent-dark: #063c5a;
  --accent-pale: #e7f4f3;
  --gold: #8a5f1c;
  --gold-pale: #fbf2df;
  --red: #a9472f;
  --red-pale: #fbefec;
  --green: #1f7a4d;
  --blue: #2b5c8a;
  --blue-pale: #e9f0f8;
  --shadow: 0 2px 8px rgb(34 56 49 / 5%), 0 10px 28px rgb(34 56 49 / 4%);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e6eef0; --ink-soft: #b7c6cc; --muted: #8fa19b; --line: #2b3a40; --surface: #172227; --canvas: #0f181c;
    --accent: #3fb8bf; --accent-dark: #8fd9de; --accent-pale: #133238; --gold: #e2b56a; --gold-pale: #33291a;
    --red: #ec8f7a; --red-pale: #3a2220; --green: #6dca96; --blue: #8db8e6; --blue-pale: #1b2a3a; --shadow: 0 2px 10px rgb(0 0 0 / 35%);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #e6eef0; --ink-soft: #b7c6cc; --muted: #8fa19b; --line: #2b3a40; --surface: #172227; --canvas: #0f181c;
  --accent: #3fb8bf; --accent-dark: #8fd9de; --accent-pale: #133238; --gold: #e2b56a; --gold-pale: #33291a;
  --red: #ec8f7a; --red-pale: #3a2220; --green: #6dca96; --blue: #8db8e6; --blue-pale: #1b2a3a; --shadow: 0 2px 10px rgb(0 0 0 / 35%);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--canvas); color: var(--ink); font: 15px/1.45 "Segoe UI", system-ui, -apple-system, Arial, sans-serif; }
h1, h2 { margin: 0; line-height: 1.2; }
button, input, select, textarea { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

.topbar { position: sticky; top: 0; z-index: 50; display: flex; flex-direction: column; background: #1b2c2a; color: #d7e4df; border-bottom: 1px solid #243834; }
.topbar-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding: 14px 24px 8px; }
.company-title { margin: 0; font-size: 40px; line-height: 1; font-weight: 750; letter-spacing: -0.03em; color: #f4faf8; text-align: center; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand img { border-radius: 8px; flex: none; background: #fff; padding: 2px; }
.brand-kicker { margin: 0; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: #8fb0a8; font-weight: 600; }
.brand h1 { font-size: 20px; color: #f4faf8; }
.view-switch { display: flex; gap: 4px; flex-wrap: wrap; padding: 4px 16px 12px; }
.view-switch button { color: #d5e2de; background: transparent; border-color: transparent; border-radius: 10px; white-space: nowrap; }
.nav-badge { display: inline-block; margin-left: 6px; min-width: 1.15rem; padding: 0 5px; border-radius: 999px; background: #f0c2b6; color: #3b1610; font-size: 12px; font-weight: 700; line-height: 1.35; text-align: center; vertical-align: 1px; }
.view-switch button:hover { background: #243834; }
.view-switch button[aria-pressed="true"] { background: #1d4a46; color: #7ee0cf; }
.storefront { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.storefront button { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 6px 10px; color: var(--muted); }
.storefront button.is-on { background: var(--accent); color: white; border-color: transparent; }
.storefront button:disabled { opacity: .45; cursor: not-allowed; }

.overview { display: grid; gap: 16px; }
.home-hero h2 { font-size: 28px; margin-top: 4px; }
.home-stats, .home-tiles, .home-pipeline, .portfolio { display: grid; gap: 12px; }
.home-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.home-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.home-pipeline { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.home-stats article, .home-tiles article, .home-tiles button, .home-pipeline article, .home-pipeline button { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; color: inherit; text-align: left; cursor: pointer; }
.home-pipeline button { cursor: pointer; }
#schedule-company { margin: 0 0 6px; font-weight: 700; color: var(--ink); }
.schedule-timing { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 8px 0 12px; background: var(--surface); }
.schedule-timing h3 { margin: 0 0 10px; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.timing-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; align-items: start; }
.timing-card { min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.timing-card.is-risk { background: var(--gold-pale); border-color: var(--gold); }
.timing-label { display: block; font-size: 12px; color: var(--muted); }
.timing-card strong { display: block; font-size: 22px; margin: 2px 0; }
.timing-card p { margin: 0; font-size: 12px; }
.timing-list { margin-top: 8px; font-size: 13px; }
.timing-list summary, .timing-notes summary { cursor: pointer; font-weight: 600; }
.timing-card.is-risk .timing-list summary { color: var(--gold); }
.timing-list ul { list-style: none; margin: 6px 0 0; padding: 0; max-height: 180px; overflow-y: auto; }
.timing-list li { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
.timing-list li button { padding: 0; border: 0; background: transparent; color: var(--accent-dark); text-align: left; overflow-wrap: anywhere; cursor: pointer; }
.timing-list li button:hover { text-decoration: underline; }
.timing-notes { margin-top: 10px; font-size: 13px; color: var(--muted); }
.timing-notes ul { margin: 6px 0 0; padding-left: 18px; }
.schedule { display: grid; gap: 6px; }
.schedule-checks { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.schedule-row { display: grid; grid-template-columns: minmax(140px, 220px) minmax(0, 1fr); gap: 8px 12px; align-items: center; }
.schedule-label { min-width: 0; }
.schedule-name { justify-content: flex-start; text-align: left; width: 100%; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.schedule-row.is-selected .schedule-name { border-color: var(--accent); }
.schedule-track { position: relative; height: 36px; width: 100%; background: var(--canvas); border-radius: 0; }
.schedule-months .schedule-track { background: transparent; height: 22px; overflow: hidden; }
.schedule-month { position: absolute; top: 0; font-size: 11px; line-height: 22px; color: var(--muted); white-space: nowrap; text-align: center; }
.schedule-detail { grid-column: 1 / -1; padding: 10px 12px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.schedule-detail-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.schedule-detail .schedule-track { margin-bottom: 8px; }
.schedule-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.schedule-steps li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.schedule-dot { width: 10px; height: 10px; border-radius: 0; }
.schedule-bar { position: absolute; top: 10px; height: 16px; border-radius: 0; min-width: 2px; color: #fff; font-size: 11px; line-height: 16px; overflow: hidden; white-space: nowrap; padding: 0 4px; text-align: center; }
.schedule-bar.phase-agreement, .schedule-bar.phase-permits { color: #1a1408; }
.schedule-mark { position: absolute; top: 10px; width: 2px; height: 16px; border-radius: 0; }
.schedule-empty { position: absolute; left: 8px; top: 4px; }
.schedule-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.schedule-modes { display: flex; gap: 6px; margin: 0 0 10px; }
.schedule-modes button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.plan-list { display: grid; gap: 8px; }
.plan-quarter h3 { margin: 12px 0 6px; font-size: 15px; }
.plan-quarter h3 .muted { font-weight: 400; font-size: 13px; }
.plan-earlier summary { cursor: pointer; margin: 12px 0 6px; }
.plan-earlier summary h3 { display: inline; }
.plan-row { display: grid; grid-template-columns: minmax(180px, 1.4fr) repeat(4, minmax(0, 1fr)); gap: 6px 14px; align-items: start; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 6px; background: var(--surface); }
.plan-row.is-risk { border-color: var(--gold); }
.plan-store { min-width: 0; display: grid; gap: 2px; }
.plan-store .schedule-name { padding: 0; border: 0; background: transparent; text-align: left; font-weight: 700; color: var(--accent-dark); overflow-wrap: anywhere; }
.plan-cell { min-width: 0; display: grid; gap: 1px; font-size: 14px; }
.plan-row.is-dead { opacity: 0.6; }
.mywork-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 14px; }
.mywork-chips span { border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 13px; background: var(--surface); }
.mywork-chips .is-warn { border-color: var(--gold); background: var(--gold-pale); color: var(--ink); }
.mywork-chips .is-risk { border-color: var(--red); background: var(--red-pale); color: var(--ink); }
.mywork-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px 18px; }
.mywork-block { min-width: 0; margin-bottom: 14px; }
.mywork-block h3 { margin: 0 0 6px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.mywork-count { font-size: 12px; font-weight: 700; background: var(--accent-pale); color: var(--accent-dark); border-radius: 999px; padding: 1px 8px; }
.mywork-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.mywork-list li { border-bottom: 1px solid var(--line); padding-bottom: 6px; overflow-wrap: anywhere; }
.mywork-list .link { padding: 0; border: 0; background: transparent; font-weight: 700; color: var(--accent-dark); text-align: left; }
.mywork-date { font-weight: 700; font-variant-numeric: tabular-nums; }
.mywork-late { color: var(--red); font-weight: 600; }
.mywork-note { margin: 4px 0 0; white-space: pre-wrap; color: var(--ink); }
@media (max-width: 600px) { .mywork-grid { grid-template-columns: 1fr; } }
.plan-cell > small:first-child { font-size: 11px; color: var(--muted); }
.plan-warnings { grid-column: 1 / -1; font-size: 13px; color: var(--gold); background: var(--gold-pale); border-radius: 8px; padding: 4px 10px; }
.plan-warnings summary { cursor: pointer; font-weight: 600; }
.plan-warnings ul { margin: 4px 0 4px; padding-left: 18px; }
.schedule-legend span { display: inline-flex; align-items: center; justify-content: center; min-width: 7.5rem; padding: 4px 14px; border-radius: 4px; text-align: center; color: #fff; }
.schedule-legend .phase-agreement, .schedule-legend .phase-permits { color: #1a1408; }
.phase-agreement { background: #f5a400; }
.phase-loi { background: #1f6feb; }
.phase-lease { background: #00838f; }
.phase-design { background: #5b2bd9; }
.phase-permits { background: #f26a00; }
.phase-construction { background: #e10600; }
.phase-opening { background: #0ea84a; }
.home-pipeline button:hover { border-color: var(--accent); }
.home-stat { display: block; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; color: inherit; cursor: pointer; }
.home-stat strong { display: block; font-size: 28px; line-height: 1.1; }
.home-stat:hover { border-color: var(--accent); }
.home-stats article.is-risk, .home-tiles article.is-risk, .home-tiles button.is-risk, .home-stat.is-risk { background: var(--gold-pale); border-color: var(--gold); }
.home-stats article.is-risk strong, .home-tiles article.is-risk strong, .home-tiles button.is-risk strong, .home-stat.is-risk strong, .home-tone .is-risk { color: var(--gold); }
.home-tone .is-on-track { color: var(--green); font-weight: 700; }
.home-tone .is-risk { font-weight: 700; }
.home-stats article.is-attention, .home-tiles article.is-attention, .home-tiles button.is-attention, .home-stat.is-attention { background: var(--red-pale); border-color: var(--red); }
.home-stats article.is-attention strong, .home-tiles article.is-attention strong, .home-tiles button.is-attention strong, .home-stat.is-attention strong, .home-tone .is-attention, .home-row.is-attention em { color: var(--red); }
.home-row.is-attention { box-shadow: inset 3px 0 0 var(--red); }
.home-tone { display: flex; gap: 16px; flex-wrap: wrap; }
.home-stats strong, .home-tiles strong, .home-pipeline strong { display: block; font-size: 28px; line-height: 1.1; color: var(--ink); }
.home-block { padding: 16px 18px; }
.goal-year select { min-height: 34px; }
.goal-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); margin-top: 10px; }
.goal-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: grid; gap: 8px; align-content: start; min-width: 0; }
.goal-card.is-met { border-color: var(--green); }
.goal-card.is-untracked { background: var(--canvas); }
.goal-title { font-weight: 600; color: var(--ink-soft); overflow-wrap: anywhere; }
.goal-figures { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.goal-figures strong { font-size: 30px; line-height: 1.1; color: var(--ink); }
.goal-card.is-met .goal-figures strong { color: var(--green); }
.goal-bar { height: 8px; border-radius: 999px; background: var(--accent-pale); overflow: hidden; }
.goal-bar span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.goal-card.is-met .goal-bar span { background: var(--green); }
.goal-foot, .goal-note { margin: 0; }
.goal-estimated { text-align: left; font-size: 13px; }
.goal-card > .ghost { justify-self: start; }
.goal-rules { margin-top: 12px; color: var(--ink-soft); font-size: 13px; }
.goal-rules summary { cursor: pointer; }
.goal-form { display: grid; gap: 8px; }
.goal-form label { display: grid; gap: 4px; font-size: 13px; }
.goal-form input { min-width: 0; }
.goal-form-actions { display: flex; gap: 8px; }
.home-block h3 { margin: 0 0 8px; }
.home-row, .portfolio-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; border-top: 1px solid var(--line); background: transparent; color: inherit; padding: 10px 0; cursor: pointer; }
.home-row small, .portfolio-row span { display: block; color: var(--muted); font-size: 12px; }
.portfolio-row .portfolio-counts { display: flex; flex-wrap: wrap; }
.portfolio-row .portfolio-counts span { display: inline; }
.portfolio-row .portfolio-counts .is-paused { color: var(--gold); font-weight: 700; }
.portfolio-row .portfolio-counts .is-completed { color: var(--green); font-weight: 700; }
.home-row em, .portfolio-row em { margin-left: auto; color: var(--accent-dark); font-style: normal; font-size: 12px; }
.portfolio { grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) { .home-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .portfolio { grid-template-columns: 1fr; } }
/* Overview layout: a main column and a side column of what needs someone today. Nothing is hidden. */
dialog.sheet-preview { width: min(1200px, calc(100vw - 24px)); }
dialog.sheet-preview[open] { display: flex; flex-direction: column; overflow: hidden; }
.sheet-preview-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; padding: 16px 20px 10px; border-bottom: 1px solid var(--line); flex: none; }
.sheet-preview-head h2 { margin: 0 0 4px; font-size: 18px; overflow-wrap: anywhere; }
.sheet-preview-head p { margin: 0; font-size: 13px; }
.sheet-preview-actions { display: flex; gap: 8px; flex: none; }
.sheet-preview-actions a.button { display: inline-flex; align-items: center; text-decoration: none; color: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; font-size: 13px; }
.sheet-tabs { display: flex; gap: 4px; padding: 8px 20px 0; overflow-x: auto; flex: none; }
.sheet-tabs button { border: 1px solid var(--line); border-bottom: 0; border-radius: 8px 8px 0 0; padding: 6px 12px; background: var(--canvas); color: inherit; cursor: pointer; white-space: nowrap; }
.sheet-tabs button[aria-selected="true"] { background: var(--surface); font-weight: 700; box-shadow: inset 0 3px 0 var(--accent); }
.sheet-preview-body { padding: 10px 20px 18px; min-height: 0; flex: 1 1 auto; display: flex; flex-direction: column; }
.sheet-scroll { overflow: auto; border: 1px solid var(--line); border-radius: 8px; flex: 1 1 auto; min-height: 120px; }
.sheet-table { border-collapse: collapse; font-size: 12px; }
.sheet-table th, .sheet-table td { border: 1px solid var(--line); padding: 3px 8px; white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.sheet-table thead th { position: sticky; top: 0; background: var(--canvas); color: var(--ink-soft); font-weight: 600; z-index: 1; }
.sheet-table tbody th { position: sticky; left: 0; background: var(--canvas); color: var(--muted); font-weight: 500; }
.sheet-cut { margin: 0 0 8px; color: var(--gold); font-size: 13px; font-weight: 600; }
.portal-preview { margin-left: 8px; font-size: 13px; }
@media (max-width: 640px) { .sheet-preview-head { flex-direction: column; } .sheet-tabs, .sheet-preview-body { padding-left: 12px; padding-right: 12px; } }
.home-summary { margin: 4px 0 0; color: var(--ink-soft); font-size: 15px; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin-top: 16px; align-items: start; }
.home-main, .home-side { display: grid; gap: 16px; min-width: 0; }
.home-grid .home-block { margin: 0; }
.home-pipeline { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.home-pipeline button { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; border-radius: 10px; }
.home-pipeline button strong { font-size: 20px; }
.home-path .home-row strong { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.home-side .portfolio { grid-template-columns: 1fr; gap: 0; }
.home-waiting-row { display: flex; align-items: baseline; gap: 10px; width: 100%; text-align: left; border: 0; border-top: 1px solid var(--line); background: transparent; color: inherit; padding: 8px 0; cursor: pointer; }
.home-waiting-row:first-of-type { border-top: 0; }
.home-waiting-row strong { font-size: 22px; min-width: 2ch; color: var(--ink); }
.home-waiting-row.is-risk strong { color: var(--gold); }
.home-waiting-row.is-attention strong { color: var(--red); }
.home-waiting-row:hover span { text-decoration: underline; }
@media (min-width: 1100px) { .home-grid { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); } }
.dash-companies { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.company-card { padding: 0; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); border-top: 4px solid var(--accent); }
.company-card.pln { border-top-color: var(--gold); }
.company-card.spavia, .company-card.burnbootcamp { border-top-color: var(--muted); }
.coming-soon { margin: 0; padding: 8px 18px 16px; color: var(--muted); }
.company-head, .company-section { padding: 16px 18px; }
.company-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.company-head p { margin: 0 0 2px; }
.metric-list { list-style: none; margin: 0; padding: 0; }
.metric-list li { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.metric-list span { font-weight: 650; }
.metric-list p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.metric-list strong { font-size: 28px; line-height: 1; }
.company-section h3 { margin: 0 0 10px; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.stage-bar { display: grid; grid-template-columns: minmax(110px, 1fr) minmax(70px, 120px) 32px; gap: 8px; align-items: center; font-size: 13px; margin: 7px 0; }
.stage-bar .track { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.stage-bar .track span { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.stage-line { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 3px 0; }
.attention-item { display: block; width: 100%; text-align: left; border: 0; border-top: 1px solid var(--line); background: transparent; color: inherit; padding: 10px 0; cursor: pointer; }
.attention-item:hover { background: var(--accent-pale); }
.attention-item strong { display: block; }
.attention-item p { margin: 2px 0 0; color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 900px) {
  .dash-companies { grid-template-columns: 1fr; }
}
.work-block { margin-bottom: 18px; }
.work-block h3 { margin: 0 0 8px; font-size: 15px; }
.task-form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.task-form-row label { display: grid; gap: 4px; font-size: 13px; color: var(--ink-soft); }
.task-form .check, .task-checklist .check { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--ink); }
.task-card { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 8px 0; background: var(--surface); }
.task-card p { margin: 4px 0; font-size: 13px; }
.task-card.is-done { opacity: 0.75; }
.task-card.is-submitted { border-color: var(--gold); background: var(--gold-pale); color: var(--ink); }
.task-card.is-late:not(.is-done) { border-left: 4px solid var(--red); }
.task-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.task-head strong { overflow-wrap: anywhere; }
.task-status { font-size: 12px; font-weight: 700; color: var(--accent-dark); white-space: nowrap; }
.task-status.is-submitted { color: var(--ink); }
.task-status.is-done { color: var(--green); }
.task-details { white-space: pre-wrap; overflow-wrap: anywhere; }
.task-checklist { list-style: none; margin: 6px 0; padding: 0; display: grid; gap: 4px; }
.task-review { font-weight: 600; }
.task-review.is-returned { color: var(--red); }
.task-blocked { color: var(--muted); font-style: italic; }
.task-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; }
.task-actions input { flex: 1 1 200px; min-width: 0; }
.work-form { display: grid; gap: 8px; margin-bottom: 10px; }
.draft { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; }
.draft label { display: grid; gap: 4px; margin: 8px 0; font-size: 12px; color: var(--muted); }
.draft input, .draft textarea { width: 100%; }
.draft-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.draft-status { font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--blue-pale); color: var(--blue); }
.draft-status.is-reviewed { background: var(--accent-pale); color: var(--accent-dark); }
.draft-status.is-sent { background: var(--accent-pale); color: var(--green); }
.draft-status.is-skipped { background: var(--canvas); color: var(--muted); }
.draft-status.is-failed, .draft-status.is-sending { background: var(--red-pale); color: var(--red); }
.draft.is-sent, .draft.is-skipped { background: var(--canvas); }
.draft-missing { margin: 4px 0; color: var(--gold); font-weight: 600; }
.draft-missing:empty { display: none; }
.draft-outcome { margin: 6px 0; }
.draft-outcome.is-warning { color: var(--red); font-weight: 600; }
.draft-actions { flex-wrap: wrap; gap: 8px; justify-content: flex-start; }
.request-block { margin-bottom: 18px; }
.request-form { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: center; }
.request-form input[name=note] { grid-column: 1 / -1; }
.request-form .check-line, .mywork-block .check-line { display: flex; gap: 6px; align-items: center; font-size: 13px; }
.mywork-block .check-line input { width: auto; }
.request-form .check-line input { width: auto; }
.request-form button { justify-self: end; }
.request-list, .outstanding-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.request-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.request-list li > div { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; }
.request-list li > small { grid-column: 1; }
.request-list li > button { grid-column: 2; grid-row: 1 / span 2; }
.request-list li.is-overdue, .outstanding-row.is-overdue { border-color: var(--red); }
.outstanding { margin-bottom: 16px; padding: 16px 18px; }
.outstanding h4 { margin: 14px 0 0; font-size: 14px; color: var(--ink-soft); }
.outstanding-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.4fr) auto; gap: 8px 14px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; background: var(--surface); }
.outstanding-main, .outstanding-meta { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.outstanding-meta .portal-badge { justify-self: start; }
.outstanding-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 760px) {
  .request-form { grid-template-columns: 1fr; }
  .request-form button { justify-self: start; }
  .outstanding-row { grid-template-columns: 1fr; }
  .outstanding-actions { justify-content: flex-start; }
}
.prepare-email { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0 12px; }
.prepare-email select { min-width: 0; flex: 1 1 240px; }
dialog.email-review { width: min(860px, calc(100vw - 32px)); }
dialog.email-review[open] { display: flex; flex-direction: column; overflow: hidden; }
.email-review-head { padding: 18px 22px 8px; border-bottom: 1px solid var(--line); flex: none; }
.email-review-head h2 { margin: 0 0 4px; }
.email-review-list { padding: 14px 22px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.email-review-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 22px; border-top: 1px solid var(--line); }
@media (max-width: 640px) {
  .email-review-head, .email-review-list, .email-review-foot { padding-left: 14px; padding-right: 14px; }
}
.topbar-actions { display: flex; align-items: center; gap: 10px; justify-self: end; flex-wrap: wrap; }
.account-spot { display: grid; justify-items: center; gap: 4px; }
.account-photo { width: 49px; height: 49px; border-radius: 11px; object-fit: cover; background: #1b2c2a; }
@keyframes chat-alert {
  0%, 100% { box-shadow: 0 0 0 0 transparent; }
  50% { box-shadow: 0 0 0 3px #7dffe8; }
}
body.chat-unread #show-chat,
body.chat-unread #chat-dock { animation: chat-alert 1.2s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
  body.chat-unread #show-chat, body.chat-unread #chat-dock { animation: none; outline: 2px solid #7dffe8; }
}
.account-photo.avatar-default { object-fit: contain; padding: 5px; }
.chat-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: #1b2c2a; flex: none; }
.chat-avatar.avatar-default { object-fit: contain; padding: 3px; }
.chat-who { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.company-switch { display: grid; gap: 2px; font-size: 12px; color: #b7c9c4; }
.company-switch select, .topbar .version, .topbar .ghost { background: #243834; color: #f4faf8; border-color: #34504b; }
.company-switch select { min-width: 210px; font-size: 14px; font-weight: 650; color: var(--ink); background: var(--surface); }
.version { font: 600 12px/1 ui-monospace, Consolas, monospace; background: var(--accent-pale); color: var(--accent-dark); padding: 6px 9px; border-radius: 999px; }

.page { max-width: 1500px; margin: 0 auto; padding: 20px 24px 32px; display: grid; gap: 18px; }
.page-gate { max-width: 560px; margin: 24px auto; }
body.chat-docked .page-gate { margin-right: calc(var(--chat-dock-width, 400px) + 24px); }
body.access-locked .page, body.access-locked .view-switch, body.access-locked .company-switch { display: none; }
.page-gate .work-form { max-width: 420px; }
.avatar { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: #1b2c2a; }
.avatar-default { object-fit: contain; padding: 8px; }
.account-line { display: flex; align-items: center; gap: 10px; }
.account-edit { display: grid; gap: 8px; margin: 0 0 16px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.group-picks { display: grid; justify-items: stretch; gap: 10px; width: min(100%, 420px); text-align: left; }
.priv-group { border: 1px solid var(--line); border-radius: 10px; margin: 0; padding: 8px 12px 10px; text-align: left; }
.priv-title { margin: 0 0 6px; font-size: 12px; font-weight: 700; color: var(--muted); text-align: left; }
.priv-group label, .account-edit label.check {
  display: flex; flex-direction: row; align-items: center; justify-content: flex-start;
  gap: 8px; margin: 6px 0 0; width: auto; max-width: 100%; text-align: left; white-space: nowrap;
}
.account-actions { display: flex; justify-content: flex-start; flex-wrap: wrap; gap: 8px; }
button.danger { color: var(--red); border-color: var(--red); }
.delete-block { text-align: left; border: 1px solid var(--red); border-radius: 10px; padding: 10px 12px; background: var(--red-pale); }
.delete-block ul { margin: 8px 0 0; padding-left: 18px; }
tr.is-attention { background: var(--red-pale); }
tr.is-risk { background: var(--gold-pale); }
td.why-cell { max-width: 36rem; overflow-wrap: break-word; word-break: normal; white-space: normal; }
.why { display: block; font-weight: 600; color: var(--red); overflow-wrap: break-word; word-break: normal; white-space: normal; }
.why.is-risk { color: var(--gold); }
.field.is-flagged { background: var(--red-pale); box-shadow: inset 0 0 0 2px var(--red); border-radius: 8px; }
.field.is-flagged.is-risk { background: var(--gold-pale); box-shadow: inset 0 0 0 2px var(--gold); }
.account-line img { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; }
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); display: grid; gap: 2px; }
.stat-value { font-size: 26px; font-weight: 700; }
.stat-label { color: var(--muted); font-size: 13px; }
button.stat-toggle {
  font: inherit; color: inherit; text-align: left; width: 100%; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow);
}
button.stat-toggle[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
button.stat-toggle[aria-pressed="false"] { opacity: 0.55; background: var(--canvas); }
.stat-check {
  display: inline-block; width: 14px; height: 14px; margin-right: 6px; vertical-align: -2px;
  border: 1.5px solid var(--muted); border-radius: 3px; background: var(--surface);
}
button.stat-toggle[aria-pressed="true"] .stat-check { background: var(--accent); border-color: var(--accent); }
button.stat-toggle[aria-pressed="true"] .stat-check::after {
  content: ""; display: block; width: 4px; height: 8px; margin: 0 0 1px 4px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.panel-head h2 { font-size: 18px; }
.panel-head p { margin: 4px 0 0; }

button { cursor: pointer; border-radius: 8px; border: 1px solid transparent; padding: 8px 14px; background: none; }
button:disabled { opacity: .5; cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.primary { background: var(--accent); color: #fff; font-weight: 600; }
:root[data-theme="dark"] .primary { color: #06262a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .primary { color: #06262a; } }
.primary:hover:not(:disabled) { filter: brightness(1.08); }
.ghost { border-color: var(--line); background: var(--surface); }
.ghost:hover { background: var(--accent-pale); }
.small { padding: 4px 10px; font-size: 13px; }
.icon { width: 38px; height: 38px; padding: 0; flex: none; }
.link { padding: 0; border: 0; color: var(--accent); font-weight: 600; text-align: left; }
.link:hover { text-decoration: underline; }

.filters { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; margin-bottom: 14px; }
.filters label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.filters .search { flex: 1 1 280px; }
.filters .check { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink); padding-bottom: 8px; white-space: nowrap; }
.filters .check input { width: auto; }
input, select, textarea { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 8px 10px; min-width: 0; width: 100%; }
input[type="checkbox"] { width: 16px; height: 16px; min-width: 16px; padding: 0; margin: 0; flex: 0 0 16px; accent-color: var(--accent); }
.filters select { min-width: 170px; }
textarea { resize: vertical; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; min-width: 1180px; font-size: 14px; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th.site, td.site { min-width: 340px; width: 34%; }
td.site .link { white-space: nowrap; }
table.glance-why { min-width: 1280px; table-layout: auto; }
table.glance-why th.site, table.glance-why td.site { min-width: 12rem; width: 14rem; max-width: 16rem; }
table.glance-why td.site .link { display: block; max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.glance-why th.clip, table.glance-why td.clip { max-width: 8.5rem; width: 8.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; overflow-wrap: normal; word-break: normal; }
table.glance-why td.clip .chip { max-width: 8rem; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
table.glance-why th.why, table.glance-why td.why-cell { width: 36rem; min-width: 28rem; max-width: none; overflow: visible; white-space: normal; text-overflow: unset; }
table.glance-why td.why-cell, table.glance-why .why { white-space: pre-wrap; overflow: visible; text-overflow: unset; overflow-wrap: anywhere; }
th { position: sticky; top: 0; background: var(--canvas); white-space: nowrap; z-index: 1; }
th .sort { padding: 0; border: 0; font-weight: 600; color: var(--ink-soft); }
td { max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; word-break: normal; }
tbody tr:hover { background: var(--accent-pale); }
tr.is-dead td { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 24px; }
.review-group { display: grid; gap: 8px; }
.review-group h3 { margin: 8px 0 0; }
.review-store { text-align: left; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface); }
.review-store.is-attention { box-shadow: inset 3px 0 0 var(--red); }
.review-store.is-risk { box-shadow: inset 3px 0 0 var(--gold); }
.review-store .link { font-weight: 700; white-space: normal; text-align: left; }
.review-meta { margin: 4px 0 0; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.review-note { margin: 8px 0 0; white-space: pre-wrap; width: 100%; }
.comment-history { text-align: left; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.comment-history h4 { margin: 10px 0 4px; }
.history-note { margin: 0 0 10px; }
.chat-dock { position: fixed; top: var(--topbar-height, 0px); right: 0; bottom: 0; z-index: 40; display: flex; flex-direction: column; width: var(--chat-dock-width, 400px); background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow); }
.chat-dock[hidden] { display: none !important; }
.chat-dock-handle { position: absolute; left: -6px; top: 0; bottom: 0; width: 12px; cursor: ew-resize; }
.chat-dock-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.chat-dock-bar strong { margin-right: auto; }
.chat-dock-body { flex: 1; min-height: 0; overflow: auto; padding: 12px; }
.chat-dock.is-popped { position: fixed; inset: 0; width: 100% !important; height: 100%; border: 0; box-shadow: none; }
.chat-dock.is-popped .chat-dock-handle { display: none; }
body.chat-docked .page { margin-right: var(--chat-dock-width, 400px); }
#chat-dock .chat-layout { display: flex; flex-direction: column; grid-template-columns: minmax(0, 1fr); height: 100%; min-height: 0; overflow: hidden; gap: 8px; }
#chat-dock .chat-side { flex: 0 1 auto; max-height: 42%; width: 100%; min-width: 0; overflow: auto; }
#chat-dock .chat-tabs { flex: none; }
#chat-dock .chat-thread { flex: 1 1 auto; width: 100%; min-width: 0; min-height: 0; overflow: auto; }
#chat-dock .chat-nav, #chat-dock .chat-search, #chat-dock .chat-new, #chat-dock #chat-alerts { max-width: 100%; }
#chat-dock .chat-nav button, #chat-dock .chat-new, #chat-dock #chat-alerts { max-width: 100%; }
.chat-layout { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: 20px; min-height: 480px; text-align: left; }
.chat-layout > * { min-width: 0; max-width: 100%; }
.chat-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.chat-tab { display: inline-flex; align-items: center; gap: 6px; max-width: 180px; border: 1px solid var(--line); border-radius: 999px; background: var(--canvas); color: var(--ink); padding: 4px 8px; }
.chat-tab.is-open { border-color: var(--accent); background: var(--accent-pale); }
.chat-tab span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-tab-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); flex: none; }
.chat-tab-close { color: var(--muted); }
@media (max-width: 800px) {
  .chat-dock { top: 0; width: 100% !important; }
  body.chat-docked .page, body.chat-docked .page-gate { margin-right: 0; }
}
.chat-side { display: grid; gap: 16px; align-content: start; min-width: 0; }
.chat-nav { display: flex; flex-wrap: wrap; gap: 12px; }
.chat-nav button, .chat-new, .chat-search button, .chat-search-more summary { min-height: 40px; }
.chat-new { justify-self: start; }
.chat-search { display: grid; gap: 12px; }
.chat-search-more { display: grid; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.chat-search-more summary { cursor: pointer; padding: 8px 0; }
.chat-mention-menu { display: grid; gap: 6px; }
.chat-list { display: grid; gap: 8px; margin-top: 4px; }
.chat-row { display: flex; align-items: flex-start; gap: 4px; }
.chat-row > button:first-child { flex: 1; text-align: left; display: grid; justify-items: start; min-width: 0; }
.chat-time, .chat-meta time { white-space: nowrap; color: var(--muted); font-size: 12px; }
.chat-meta { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.chat-thread { display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--line); border-radius: 12px; padding: 12px; min-height: 480px; }
.chat-messages { display: grid; gap: 8px; align-content: start; flex: 1; }
.chat-bubble { border-radius: 10px; padding: 8px 10px; background: var(--canvas); }
.chat-bubble.is-mine { background: var(--accent-soft, var(--canvas)); }
.chat-bubble p { margin: 4px 0 0; white-space: pre-wrap; }
.chat-compose { display: flex; gap: 8px; }
.chat-compose textarea { flex: 1; }
#chat-thread .chat-compose { display: grid; }
.chat-compose-row { display: flex; gap: 8px; align-items: flex-end; }
.chat-compose-row textarea { flex: 1; min-width: 0; }
.chat-reply, .chat-reply-bar { margin: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; color: var(--muted); background: var(--canvas); border: 1px solid var(--line); }
.chat-reply-bar { white-space: normal; display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.chat-saved-list { display: grid; gap: 8px; min-width: 0; }
.chat-saved-list button { text-align: left; min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timeline { display: grid; gap: 8px; }
.timeline-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.timeline-item { display: grid; gap: 2px; text-align: left; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--canvas); min-width: 0; }
.timeline-item p { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-context p, .chat-pinned p { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-pinned { border-left: 3px solid var(--gold); padding-left: 8px; }
.chat-invite { display: flex; gap: 8px; align-items: center; }
.chat-invite select { flex: 1; min-width: 0; }
.document-group { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: var(--surface); }
.document-group summary { cursor: pointer; font-weight: 700; }
.document-slot { display: grid; gap: 6px; padding: 10px 0; border-top: 1px solid var(--line); }
.document-slot-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.document-upload { display: flex; gap: 8px; align-items: center; margin: 0; }
.document-upload input[type="file"] { max-width: 220px; }
.document-slot .hint { margin: 0; color: var(--muted); font-size: 13px; }
.chat-search, .chat-task { display: grid; gap: 12px; }
.chat-search label, .chat-task label { display: grid; gap: 2px; font-size: 12px; }
.chat-people { display: grid; justify-items: start; gap: 6px; }
.chat-people label { display: flex; align-items: center; justify-content: flex-start; gap: 8px; white-space: nowrap; }
@media (max-width: 800px) {
  .topbar-row { grid-template-columns: 1fr; justify-items: start; padding: 12px 16px 8px; }
  .company-title { font-size: 28px; text-align: left; }
  .topbar-actions { justify-self: start; }
  .page, .chat-layout, .chat-side, .chat-thread, .chat-list, .chat-row, .chat-context { min-width: 0; max-width: 100%; }
  .chat-layout { grid-template-columns: 1fr; overflow-x: clip; }
  .chat-compose, .chat-compose-row { flex-direction: column; align-items: stretch; }
  .chat-compose textarea, .chat-compose-row textarea { width: 100%; min-width: 0; }
  .chat-compose-row button { min-height: 44px; }
  .timeline-filters button { flex: 1 1 auto; }
  .chat-search, .chat-task, .chat-invite { width: 100%; }
  .chat-invite { flex-direction: column; align-items: stretch; }
}

.chip { display: inline-flex; align-items: center; justify-content: center; min-height: 1.7rem; padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1; text-align: center; white-space: nowrap; }
.chip.good { background: var(--accent-pale); color: var(--accent-dark); }
.chip.progress { background: var(--blue-pale); color: var(--blue); }
.chip.early { background: var(--gold-pale); color: var(--gold); }
.chip.hold, .chip.dead { background: var(--red-pale); color: var(--red); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }

dialog { width: min(1100px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgb(0 0 0 / 25%); }
dialog::backdrop { background: rgb(10 25 30 / 45%); }
.dialog-shell { display: flex; flex-direction: column; max-height: calc(100vh - 34px); }
.dialog-head { display: flex; justify-content: space-between; gap: 12px; padding: 18px 22px 10px; }
.dialog-head > div:first-child { min-width: 0; flex: 1; }
.record-stages { margin-top: 10px; }
.stage-summary { margin: 0 0 8px; color: var(--ink-soft); font-size: 13px; }
.stage-summary strong { color: var(--accent-dark); }
.stage-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 6px; }
.stage-chip { display: grid; gap: 2px; text-align: left; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); border-top: 4px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; min-width: 0; }
.stage-chip .stage-name { font-weight: 700; font-size: 13px; overflow-wrap: anywhere; }
.stage-chip .stage-count { font-size: 12px; color: var(--ink-soft); }
.stage-chip small { font-size: 11px; color: var(--muted); }
.stage-chip.is-done { border-top-color: var(--green); }
.stage-chip.is-current { border-top-color: var(--accent); background: var(--accent-pale); }
.stage-chip.is-passed { border-top-color: var(--gold); }
.stage-chip.is-open { outline: 2px solid var(--accent); outline-offset: 1px; }
.stage-detail { margin-top: 8px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--surface); }
.stage-detail-head { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; margin-bottom: 6px; }
.stage-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.stage-step { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 8px; align-items: start; padding: 6px 0; border-top: 1px solid var(--line); }
.stage-step:first-child { border-top: 0; }
.stage-step-main { display: grid; gap: 2px; min-width: 0; }
.stage-dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: 11px; font-weight: 800; color: var(--surface); margin-top: 2px; }
.stage-step.is-done .stage-dot { background: var(--green); border-color: var(--green); }
.stage-step.is-next .stage-dot { border-color: var(--accent); background: var(--accent-pale); }
.stage-step.is-passed .stage-dot { border-color: var(--gold); }
.stage-step.is-passed .stage-when { color: var(--gold); font-weight: 600; }
.stage-step-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.stage-unconfirmed { color: var(--gold); font-weight: 600; }
@media (max-width: 640px) { .stage-step { grid-template-columns: 22px minmax(0, 1fr); } .stage-step-actions { grid-column: 2; justify-content: flex-start; } }
.stage-warning { color: var(--gold); }
.sched-row.is-highlighted { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.dialog-head h2, .record-title { font-size: 20px; overflow-wrap: anywhere; }
.record-title { display: block; width: min(100%, 40rem); margin: 0; padding: 2px 0; border: 0; background: transparent; color: inherit; font: inherit; font-size: 28px; font-weight: 750; line-height: 1.2; text-align: left; }
.record-title:focus { outline: 2px solid var(--accent); border-radius: 6px; }
.dialog-head p { margin: 0 0 4px; font-size: 13px; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 22px 12px; border-bottom: 1px solid var(--line); }
.tabs button { border: 1px solid var(--line); border-radius: 999px; background: var(--canvas); color: var(--ink); padding: 8px 14px; font-weight: 600; white-space: nowrap; }
.tabs button[aria-selected="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
:root[data-theme="dark"] .tabs button[aria-selected="true"] { color: #06262a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tabs button[aria-selected="true"] { color: #06262a; } }
#tab-documents { border-color: var(--accent); }
.dialog-body { overflow-y: auto; padding: 16px 22px; flex: 1; }
.section-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.field-section { border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px 16px; margin: 0 0 14px; scroll-margin-top: 8px; min-width: 0; }
.field-section legend { font-weight: 700; padding: 0 6px; color: var(--accent-dark); }
.field-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px 14px; }
.field { display: grid; gap: 4px; align-content: start; font-size: 13px; color: var(--ink-soft); }
.vendor-pick { font-size: 12px; padding: 4px 6px; color: var(--ink-soft); max-width: 100%; }
.defaults-vendors { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 14px; }
.defaults-form input[type=number] { max-width: 160px; }
.defaults-vendors label { display: grid; gap: 4px; font-size: 13px; color: var(--ink-soft); }
.file-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.file-chosen:empty { display: none; }
.field-label { position: relative; display: inline-block; }
.field-tip { display: none; position: absolute; z-index: 6; left: 0; bottom: calc(100% + 6px); width: min(320px, 70vw); padding: 8px 10px; border-radius: 8px; background: var(--ink); color: var(--surface); font-size: 13px; font-weight: 500; line-height: 1.35; box-shadow: var(--shadow); pointer-events: none; }
body.field-help .field:hover .field-tip, body.field-help .field:focus-within .field-tip { display: block; }
.sticky-board { display: grid; gap: 8px; margin-top: 10px; }
.sticky-note { background: var(--gold-pale); color: var(--ink); border-radius: 10px; padding: 8px 10px; }
.sticky-note p { margin: 0; white-space: pre-wrap; }
.sticky-form { display: flex; gap: 8px; align-items: flex-end; margin: 0; }
.sticky-form textarea { flex: 1; min-height: 44px; }
.note-notify { font-size: 0.9rem; }
.note-notify summary { cursor: pointer; color: var(--ink-soft); overflow-wrap: anywhere; }
.note-notify label { display: flex; gap: 6px; align-items: center; padding: 4px 0; }
.note-notify p, .note-earlier p { margin: 4px 0; }
.note-earlier summary { cursor: pointer; font-size: 0.85rem; color: var(--ink-soft); }
.field.wide { grid-column: span 2; }
.field small { font-size: 12px; }
.schedule-section > div > p.muted { margin: 0 0 10px; font-size: 13px; }
.schedule-readiness { border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.schedule-readiness.is-waiting { border-left-color: var(--muted); }
.schedule-readiness p { margin: 4px 0 0; font-size: 13px; }
.sched-phase h4 { margin: 14px 0 4px; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.sched-item { border-top: 1px solid var(--line); }
.sched-row { display: grid; grid-template-columns: minmax(150px, 1.4fr) 1fr 1.2fr 110px 100px 76px; gap: 6px 12px; align-items: center; padding: 7px 4px; font-size: 14px; }
.sched-row.is-risk { background: var(--gold-pale); }
.sched-step { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.sched-cell { min-width: 0; overflow-wrap: anywhere; }
.sched-cell small { display: block; font-size: 11px; color: var(--muted); }
.sched-cell em { display: block; font-size: 12px; color: var(--muted); }
.sched-status { font-size: 12px; font-weight: 700; color: var(--muted); }
.sched-status.is-actual { color: var(--green); }
.sched-status.is-projected { color: var(--accent-dark); }
.sched-variance { font-size: 13px; }
.sched-variance.is-late { color: var(--gold); font-weight: 700; }
.sched-warning { margin: 0; padding: 2px 4px 8px; font-size: 13px; color: var(--gold); background: var(--gold-pale); }
.sched-note { margin: 0; padding: 0 4px 8px; font-size: 12px; }
.sched-edit { display: flex; flex-wrap: wrap; align-items: end; gap: 8px 10px; padding: 8px 4px 12px; }
.sched-edit label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.sched-edit label.grow { flex: 1 1 220px; }
.sched-edit.is-baseline { border-top: 1px dashed var(--line); }
.dialog-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 22px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.foot-actions { display: flex; gap: 8px; margin-left: auto; }
.status { margin: 0; font-size: 14px; }
.status.warn { color: var(--gold); font-weight: 600; }
.status.error { color: var(--red); font-weight: 600; }

.comment-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 16px; }
.comment-form label { display: grid; gap: 4px; font-size: 13px; color: var(--ink-soft); }
.comment-form .grow { flex: 1 1 320px; }
.comment-list, .history-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.comment, .history-list li { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.comment-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.comment-body, .diff { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.diff del { color: var(--red); }
.diff ins { color: var(--accent-dark); text-decoration: none; }
.row-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); z-index: 10; max-width: calc(100vw - 32px); }
.toast.error { background: var(--red); color: #fff; }
.footer { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; max-width: 1500px; margin: 0 auto; padding: 0 24px 24px; color: var(--muted); font-size: 13px; }

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .field.wide { grid-column: auto; }
}
@media (max-width: 600px) {
  .topbar, .page, .footer { padding-left: 16px; padding-right: 16px; }
  .view-switch { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-left: 0; padding-right: 0; }
  .sched-row { grid-template-columns: 1fr 1fr; }
  .sched-step { grid-column: 1 / -1; }
  .sched-row button { justify-self: start; }
  .plan-row { grid-template-columns: 1fr 1fr; }
  .plan-store { grid-column: 1 / -1; }
  .brand h1 { font-size: 17px; }
  .brand img { width: 32px; height: 32px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel { padding: 14px; }
  .panel-head { flex-direction: column; }
  .filters label, .filters select { width: 100%; }
  .field-grid { grid-template-columns: 1fr; }
  dialog { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; }
  .dialog-shell { max-height: 100dvh; height: 100%; }
  .dialog-head, .dialog-body, .dialog-foot { padding-left: 16px; padding-right: 16px; }
  .tabs { padding: 0 16px; }
}

.library-brand { margin-top: 1rem; }
.library-group h4 { margin: 0.75rem 0 0.25rem; color: var(--ink-soft); }
.library-list { list-style: none; margin: 0 0 0.5rem; padding: 0; }
.library-list li { padding: 0.4rem 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.library-list a { font-weight: 600; }
.email-edit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.email-edit textarea { width: 100%; font: 13px/1.5 ui-monospace, Consolas, monospace; }
.email-preview { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 12px 14px; max-height: 420px; overflow-y: auto; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.email-preview h4 { margin: 12px 0 4px; }
.email-preview p { margin: 0 0 10px; }
.email-preview ul { margin: 0 0 10px; padding-left: 20px; }
.fill-in-note { background: var(--gold-pale); color: var(--gold); border-radius: 6px; padding: 6px 8px; font-weight: 600; }
@media (max-width: 800px) { .email-edit { grid-template-columns: 1fr; } }

/* Franchisee portal. A franchisee sees only this page; Rise opens it from Franchisee portals. Brand colors are tokens so
   another brand can use the same page. Spavia's are placeholders until Spavia supplies its brand colors and logo. */
body.portal-mode .topbar, body.portal-mode main.page, body.portal-mode .footer, body.portal-mode #chat-dock { display: none !important; }
.portal { --brand: var(--accent); --brand-ink: #fff; --brand-pale: var(--accent-pale); display: grid; gap: 16px; }
.portal[data-brand="Spavia"] { --brand: #4f7a6a; --brand-pale: #e8f0ec; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .portal[data-brand="Spavia"] { --brand: #8cc4ae; --brand-ink: #10231c; --brand-pale: #1a2d27; } }
:root[data-theme="dark"] .portal[data-brand="Spavia"] { --brand: #8cc4ae; --brand-ink: #10231c; --brand-pale: #1a2d27; }
.portal-root { max-width: 1180px; margin: 0 auto; padding: 18px 24px 40px; }
#view-portal .portal { margin-top: 4px; }
#view-portal .portal-tabs { position: static; }
.portal-head { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 16px; padding: 14px 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.portal-brand { display: flex; flex-direction: column; min-width: 0; }
.portal-mark { font: 600 26px/1.1 Georgia, "Times New Roman", serif; letter-spacing: .02em; color: var(--brand); }
.portal-sub { font-size: 13px; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.portal-user { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.portal-viewer { font-weight: 600; }
.portal-powered { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.portal-powered img { border-radius: 4px; background: #fff; }
.portal-demo { margin: 0; padding: 10px 14px; border-radius: 10px; border: 1px dashed var(--gold); background: var(--gold-pale); font-size: 14px; }
.portal-rise-note { margin: 0; padding: 10px 14px; border-radius: 10px; background: var(--blue-pale); font-size: 14px; }
.portal-hero { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(260px, 1fr); gap: 18px; padding: 22px; border-radius: 16px; background: linear-gradient(135deg, var(--brand-pale), var(--surface) 70%); border: 1px solid var(--line); box-shadow: var(--shadow); }
.portal-hero h2 { font-size: 30px; letter-spacing: -0.01em; }
.portal-kicker { margin: 0 0 4px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.portal-address { margin: 4px 0 0; color: var(--ink-soft); }
.portal-hero-side { display: grid; gap: 12px; align-content: start; }
.portal-stat { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.portal-stat span { font-size: 13px; color: var(--muted); }
.portal-stat strong { font-size: 20px; }
.portal-pm { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: center; padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.portal-pm > div { display: flex; flex-direction: column; min-width: 0; }
.portal-pm a { color: var(--brand); overflow-wrap: anywhere; }
.portal-pm .portal-cta { grid-column: 1 / -1; margin-top: 6px; }
.portal-pm-role { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.portal-avatar { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); font-weight: 700; }
.portal-cta, .portal-form button[type="submit"], .portal-form.inline button:not(.ghost) { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-weight: 600; }
.portal-cta:hover, .portal-form button[type="submit"]:hover { filter: brightness(1.08); }
.portal-tabs { position: sticky; top: 0; z-index: 5; display: flex; gap: 4px; overflow-x: auto; padding: 6px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); scrollbar-width: thin; }
.portal-tabs button { white-space: nowrap; border-radius: 9px; font-weight: 600; color: var(--ink-soft); }
.portal-tabs button[aria-pressed="true"] { background: var(--brand-pale); color: var(--ink); box-shadow: inset 0 -2px 0 var(--brand); }
.portal-count { display: inline-block; margin-left: 6px; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--brand); color: var(--brand-ink); font-size: 12px; line-height: 20px; text-align: center; }
.portal-count.is-zero { background: var(--canvas); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.portal-count.is-example { background: var(--gold-pale); color: var(--ink); box-shadow: inset 0 0 0 1px var(--gold); }
.portal-example-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; border: 2px dashed var(--gold); background: var(--gold-pale); color: var(--ink); }
.portal-example-banner > span:nth-child(2) { flex: 1 1 260px; }
.portal-action.is-example { border-style: dashed; }
.portal-body { display: grid; gap: 16px; }
.portal-card { padding: 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); min-width: 0; }
.portal-card h3 { margin: 0 0 10px; font-size: 17px; }
.portal-card p { margin: 6px 0; }
.portal-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.portal-card-head h3 { margin: 0; }
.portal-card.is-todo { border-color: var(--brand); box-shadow: inset 4px 0 0 var(--brand), var(--shadow); }
.portal-big { font-size: 24px; font-weight: 700; color: var(--brand); margin: 0 0 4px !important; }
.portal-late { color: var(--red); font-weight: 600; }
.portal-hold { padding: 6px 10px; border-radius: 8px; background: var(--gold-pale); font-size: 14px; }
.portal-next, .portal-todo, .portal-plain { margin: 0 0 10px; padding-left: 20px; display: grid; gap: 8px; }
.portal-next li, .portal-todo li { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.portal-update { border-color: var(--gold); background: linear-gradient(0deg, var(--surface), var(--gold-pale)); }
.portal-update-body { font-size: 16px; white-space: pre-wrap; }
.portal-badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; border: 1px solid var(--line); white-space: nowrap; }
.tone-accent { background: var(--brand-pale); border-color: var(--brand); color: var(--ink); }
.tone-good { background: color-mix(in srgb, var(--green) 14%, var(--surface)); border-color: var(--green); color: var(--ink); }
.tone-warn { background: var(--gold-pale); border-color: var(--gold); color: var(--ink); }
.tone-bad { background: var(--red-pale); border-color: var(--red); color: var(--ink); }
.tone-info { background: var(--blue-pale); border-color: var(--blue); color: var(--ink); }
.tone-plain { background: var(--canvas); color: var(--ink-soft); }
.portal-dot { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--line); background: var(--surface); color: var(--brand-ink); font-size: 13px; font-weight: 800; flex: none; }
.is-done > .portal-dot { background: var(--brand); border-color: var(--brand); }
.is-current > .portal-dot { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-pale); }
.portal-activity { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.portal-activity li { display: grid; grid-template-columns: 32px 1fr auto; gap: 10px; align-items: start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.portal-activity li:last-child { border-bottom: 0; }
.portal-activity li > div { min-width: 0; overflow-wrap: anywhere; }
.portal-activity p { margin: 2px 0 0; font-size: 14px; overflow-wrap: anywhere; }
.portal-activity time { font-size: 13px; color: var(--muted); white-space: nowrap; }
.portal-activity-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--brand-pale); color: var(--brand); font-weight: 700; }
.portal-phases { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.portal-phase { padding: 16px 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.portal-phase.is-current { border-color: var(--brand); box-shadow: inset 4px 0 0 var(--brand), var(--shadow); }
.portal-phase-head { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 12px; }
.portal-phase-head h3 { margin: 0; font-size: 17px; }
.portal-phase-head p { margin: 0; font-size: 14px; }
.portal-phase-num { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--canvas); border: 2px solid var(--line); font-weight: 800; }
.portal-phase.is-done .portal-phase-num { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.portal-phase.is-current .portal-phase-num { border-color: var(--brand); color: var(--brand); }
.portal-phase-count { font-size: 13px; }
.portal-steps { list-style: none; margin: 12px 0 0; padding: 0 0 0 16px; border-left: 2px solid var(--line); display: grid; gap: 10px; }
.portal-steps li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; margin-left: -14px; }
.portal-steps .portal-dot { width: 24px; height: 24px; }
.portal-step-main { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; min-width: 0; }
.portal-step-main .portal-hold, .portal-step-main form { flex-basis: 100%; }
.portal-steps li.is-upcoming strong { color: var(--ink-soft); font-weight: 600; }
.portal-action.is-overdue { border-color: var(--red); box-shadow: inset 4px 0 0 var(--red), var(--shadow); }
.portal-action-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.portal-empty { text-align: center; padding: 34px 18px; }
.portal-form { display: grid; gap: 10px; margin-top: 10px; }
.portal-form label { display: grid; gap: 4px; font-size: 14px; font-weight: 600; }
.portal-form.inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.portal-form.inline input[type="text"] { flex: 1 1 220px; width: auto; }
.portal-form.inline input[type="date"], .portal-form.inline select { width: auto; }
.portal-form-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.portal-form-row label { flex: 1 1 180px; }
.portal-form-row button { flex: none; }
.portal-form-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.portal-check { display: flex !important; align-items: center; gap: 8px; font-weight: 500 !important; }
.portal-checklist { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 6px; }
.portal-checklist label { display: flex; gap: 10px; align-items: center; }
.portal-thread { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; max-height: 560px; overflow-y: auto; }
.portal-message { max-width: 82%; padding: 10px 14px; border-radius: 14px 14px 14px 4px; background: var(--canvas); border: 1px solid var(--line); }
.portal-message.is-mine { justify-self: end; border-radius: 14px 14px 4px 14px; background: var(--brand-pale); border-color: var(--brand); }
.portal-message.is-announcement { max-width: 100%; justify-self: stretch; background: var(--gold-pale); border-color: var(--gold); }
.portal-message-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 14px; }
.portal-message-head time { color: var(--muted); font-size: 12px; margin-left: auto; }
.portal-message-body { margin: 6px 0 0 !important; white-space: pre-wrap; overflow-wrap: anywhere; }
.portal-topic { margin: 4px 0 0 !important; font-size: 13px; color: var(--ink-soft); }
.portal-compose { margin-top: 0; }
.portal-doc-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.portal-requests, .portal-files { list-style: none; margin: 0; padding: 0; display: grid; }
.portal-requests li, .portal-files li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.portal-requests li:last-child, .portal-files li:last-child { border-bottom: 0; }
.portal-requests li > form { flex-basis: 100%; }
.portal-request-main, .portal-file-main { flex: 1 1 260px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.portal-request-main p, .portal-file-main p { margin: 2px 0 !important; }
.portal-file-main a { color: var(--brand); font-weight: 600; overflow-wrap: anywhere; }
.portal-files li.is-internal { opacity: .8; }
.portal-resource-icon { display: inline-grid; place-items: center; width: 42px; height: 48px; flex: none; border-radius: 8px; background: var(--brand-pale); color: var(--brand); font-size: 11px; font-weight: 800; letter-spacing: .04em; }
.portal-doc-group h4 { margin: 14px 0 2px; font-size: 14px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); }
.portal-note { font-size: 13px; margin: 4px 0 0 !important; }
.portal-store-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.portal-store { width: 100%; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; text-align: left; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.portal-store:hover { border-color: var(--accent); background: var(--accent-pale); }
.portal-store strong { font-size: 17px; }
.portal-store-flags { display: flex; gap: 6px; flex-wrap: wrap; }
@media (max-width: 900px) {
  .portal-hero { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .portal-root { padding: 10px 12px 28px; }
  .portal-head { grid-template-columns: 1fr; }
  .portal-user { justify-content: flex-start; }
  .portal-hero { padding: 16px; }
  .portal-hero h2 { font-size: 24px; }
  .portal-phase-head { grid-template-columns: auto 1fr; }
  .portal-phase-head .portal-badge, .portal-phase-count { grid-column: 2; justify-self: start; }
  .portal-steps li { grid-template-columns: auto 1fr; }
  .portal-steps li > button { grid-column: 2; justify-self: start; }
  .portal-message { max-width: 94%; }
  .portal-doc-summary { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .portal-doc-summary .portal-stat { padding: 10px; }
  .portal-doc-summary .portal-stat strong { font-size: 18px; }
  .portal-activity li { grid-template-columns: 30px 1fr; }
  .portal-activity time { grid-column: 2; }
}

/* Portal dashboard, timeline and franchisee preview. */
body.portal-previewing .topbar, body.portal-previewing .footer, body.portal-previewing #chat-dock { display: none !important; }
.portal-preview-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 10px 14px; border-radius: 12px; background: var(--ink); color: var(--surface); font-size: 14px; box-shadow: var(--shadow); }
.portal-preview-bar > span:nth-child(2) { flex: 1 1 320px; }
.portal-preview-bar button { background: var(--surface); color: var(--ink); border-color: var(--surface); font-weight: 700; }
.portal-preview-dot { width: 10px; height: 10px; border-radius: 50%; background: #f2b84b; box-shadow: 0 0 0 4px rgba(242, 184, 75, .3); flex: none; }
.portal-viewer { display: inline-flex; align-items: center; gap: 8px; }
.portal-avatar.small { width: 30px; height: 30px; font-size: 12px; }
.portal-welcome { margin: 0 0 8px; font: italic 600 19px/1.3 Georgia, "Times New Roman", serif; color: var(--brand); }
.portal-hero-status { display: flex; align-items: center; gap: 18px; margin-top: 18px; }
.portal-ring { --p: 0; flex: none; display: grid; place-items: center; width: 108px; height: 108px; border-radius: 50%; background: conic-gradient(var(--brand) calc(var(--p) * 1%), var(--line) 0); }
.portal-ring > span { display: grid; place-content: center; width: 84px; height: 84px; border-radius: 50%; background: var(--surface); text-align: center; }
.portal-ring strong { font-size: 26px; line-height: 1; }
.portal-ring small { margin-top: 2px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.portal-hero-now { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.portal-hero-now .portal-kicker { margin: 0; }
.portal-hero-phase { font-size: 24px; color: var(--brand); line-height: 1.15; }
.portal-opening small { margin-top: 2px; }
.portal-journey { grid-column: 1 / -1; list-style: none; margin: 4px 0 0; padding: 16px 0 2px; border-top: 1px solid var(--line); display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.portal-journey li { position: relative; min-width: 0; }
.portal-journey li::before { content: ""; position: absolute; top: 14px; left: calc(50% + 18px); right: calc(-50% + 18px); height: 3px; border-radius: 2px; background: var(--line); }
.portal-journey li:last-child::before { display: none; }
.portal-journey li.is-done::before { background: var(--brand); }
.portal-journey button { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 0 4px; border: 0; background: none; box-shadow: none; color: inherit; font: inherit; text-align: center; cursor: pointer; }
.portal-journey button:hover .portal-journey-label { color: var(--brand); }
.portal-journey .portal-dot { width: 30px; height: 30px; color: var(--muted); font-size: 12px; }
.portal-journey li.is-done .portal-dot { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.portal-journey li.is-current .portal-dot { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); box-shadow: 0 0 0 5px var(--brand-pale); }
.portal-journey-label { font-size: 13px; font-weight: 600; line-height: 1.25; color: var(--ink-soft); }
.portal-journey li.is-current .portal-journey-label { color: var(--ink); font-weight: 800; }
.portal-here { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--brand); }
.portal-focus { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; }
.portal-focus .portal-card { display: flex; flex-direction: column; gap: 4px; }
.portal-focus .portal-card > button { margin-top: auto; align-self: flex-start; }
.portal-now { background: linear-gradient(160deg, var(--brand-pale), var(--surface) 65%); }
.portal-card .portal-big { font-size: 26px; line-height: 1.15; }
.portal-lead { font-size: 16px; color: var(--ink-soft); }
.portal-milestone-box { display: flex; flex-direction: column; gap: 3px; margin: 10px 0 4px; padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--brand); }
.portal-milestone-box .portal-kicker { margin: 0; }
.portal-milestone-box strong { font-size: 17px; }
.portal-milestone-date { font-size: 13px; font-weight: 700; color: var(--brand); }
.portal-next { list-style: none; padding: 0; gap: 12px; }
.portal-next li { display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: start; }
.portal-next li > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.portal-next-num { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); font-size: 13px; font-weight: 800; color: var(--ink-soft); }
.portal-next li:first-child .portal-next-num { border-color: var(--blue); border-style: dashed; color: var(--ink); }
.portal-quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.portal-quick-card { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; height: auto; padding: 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); color: var(--ink); font: inherit; text-align: left; white-space: normal; cursor: pointer; transition: transform .15s ease, border-color .15s ease; }
.portal-quick-card:hover { border-color: var(--brand); transform: translateY(-2px); }
.portal-quick-icon { display: grid; place-items: center; width: 38px; height: 38px; margin-bottom: 4px; border-radius: 10px; background: var(--brand-pale); color: var(--brand); font-size: 18px; }
.portal-quick-title { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.portal-quick-card strong { font-size: 18px; }
.portal-quick-card .muted { font-size: 13px; }
.portal-empty-inline { display: flex; align-items: center; gap: 12px; }
.portal-empty-inline p { margin: 0; }
.portal-empty-icon { display: inline-grid; place-items: center; width: 52px; height: 52px; margin-bottom: 8px; border-radius: 50%; background: var(--brand-pale); color: var(--brand); font-size: 24px; font-weight: 800; }
.portal-empty p { max-width: 520px; margin-inline: auto !important; }
.portal-timeline-summary { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 24px; }
.portal-timeline-summary .portal-kicker, .portal-timeline-summary .portal-big { margin: 0 !important; }
.portal-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; color: var(--ink-soft); }
.portal-legend li { display: flex; align-items: center; gap: 6px; }
.portal-legend .portal-dot { width: 18px; height: 18px; border-width: 2px; font-size: 10px; }
.is-next > .portal-dot { border-color: var(--blue); border-style: dashed; }
.portal-phase-note { margin: 2px 0 !important; font-size: 14px; color: var(--ink-soft); }
.portal-step-main { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 2px; }
.portal-step-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.portal-step-note { font-size: 14px; color: var(--ink-soft); }
.portal-steps li.is-current .portal-step-main { margin-top: -4px; padding: 8px 12px; border-radius: 10px; background: var(--brand-pale); }
.portal-intro { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; margin-top: 8px; }
.portal-intro h4 { margin: 0 0 12px; font-size: 18px; color: var(--brand); }
.portal-features { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.portal-features li { position: relative; padding-left: 26px; font-size: 15px; }
.portal-features li::before { content: "\2713"; position: absolute; left: 0; top: 0; color: var(--brand); font-weight: 800; }
.portal-example { display: grid; gap: 10px; margin: 0; padding: 14px; border-radius: 12px; border: 2px dashed var(--line); background: var(--canvas); }
.portal-example figcaption { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.portal-example-tag { padding: 2px 8px; border-radius: 999px; border: 1px solid var(--gold); background: var(--gold-pale); color: var(--ink); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.portal-example .portal-message { max-width: 100%; }
.portal-example .portal-message.is-mine { justify-self: end; max-width: 92%; }
.portal-example-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.portal-example-row.is-highlighted { outline: 2px solid var(--accent); outline-offset: 6px; border-radius: 8px; transition: outline-color .3s; }
.portal-flow { list-style: none; margin: 6px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.portal-flow li { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--canvas); font-size: 14px; }
.portal-flow li:not(:last-child)::after { content: "\2192"; position: absolute; top: 50%; right: -6px; transform: translate(50%, -50%); color: var(--muted); font-weight: 800; }
.portal-flow-alt { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px !important; font-size: 14px; }
.portal-doc-grid { align-items: start; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-top: 12px; }
.portal-doc-group { min-width: 0; padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--canvas); }
.portal-doc-group.has-files { background: var(--surface); border-color: var(--brand); }
.portal-doc-group-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.portal-doc-group h4 { margin: 0; }
.portal-count-plain { font-size: 12px; color: var(--muted); white-space: nowrap; }
.portal-next-section { display: flex; justify-content: flex-end; }
.portal-next-section button { font-weight: 700; }
.portal-cta:disabled, .portal-form button[type="submit"]:disabled { opacity: .55; cursor: not-allowed; filter: none; }
@media (max-width: 900px) {
  .portal-focus, .portal-intro { grid-template-columns: 1fr; }
  .portal-quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portal-flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portal-flow li::after { display: none; }
}
@media (max-width: 600px) {
  .portal-ring { width: 88px; height: 88px; }
  .portal-ring > span { width: 68px; height: 68px; }
  .portal-ring strong { font-size: 21px; }
  .portal-hero-phase { font-size: 21px; }
  .portal-journey { grid-auto-columns: 84px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: thin; }
  .portal-flow { grid-template-columns: 1fr; }
  .portal-quick-card { padding: 12px; }
  .portal-quick-card strong { font-size: 16px; }
}
.mail-problem { color: var(--red); }
.mail-banner { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; border: 1px solid currentColor; background: var(--red-pale); }
.mail-link input { width: 100%; font-family: ui-monospace, monospace; font-size: 0.85rem; }
.mail-events { margin: 6px 0 0; padding-left: 18px; font-size: 0.9rem; overflow-wrap: anywhere; }
.mail-connect-page { max-width: 560px; margin: 48px auto; }
.mail-connection p { overflow-wrap: anywhere; }
