/* Shared visual system and primary screens. */
:root {
  font-size: 93.75%;
  line-height: 1.5;
  --background: #f7f8fa;
  --paper: #fff;
  --text: #202b3c;
  --muted: #46566f;
  --quiet: #586982;
  --line: #dce2ec;
  --accent: #395b89;
  --accent-dark: #2d486d;
  --ink: #202b3c;
  --sidebar: #f0f3f7;
  --warning: #963b35;
  --tint: #e8eff8;
  --soft: #f0f3f7;
  --radius: 6px;
  --shadow: none;
}
:focus-visible { outline-color: #567db0; }
::selection { background: #dce9fb; color: var(--text); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
.brand { font-size: 1.25rem; font-weight: 710; letter-spacing: -.04em; }
.brand-mark { width: 32px; height: 32px; border-radius: 6px; background: var(--accent); color: #fff; }
.brand-dot { color: var(--accent); }
.button { border-radius: 6px; }
.button.primary { box-shadow: none; }
.button.secondary { border-color: var(--line); color: var(--text); }
.button.secondary:hover, .button.quiet:hover, .icon-button:hover { background: var(--soft); border-color: var(--line); color: var(--accent-dark); }
.surface { box-shadow: none; }
.project-initial, .section-icon, .avatar-0, .avatar-1 { background: var(--tint); color: var(--accent-dark); border-radius: 6px; }
.avatar { border-radius: 50%; }
.alert-icon { background: #f8eae7; color: var(--warning); }
.decision-icon { background: var(--tint); color: var(--accent); }
.record-title { color: var(--text); font-weight: 630; }
.badge { color: var(--muted); background: var(--soft); border-radius: 4px; }
.badge-stage, .badge-testing, .badge-doing, .badge-done, .badge-supported, .badge-decision, .badge-evidence {
  background: var(--tint); color: var(--accent-dark);
}
.badge-blocked, .badge-rejected, .count { color: #89342e; background: #f8eae7; }
.badge-uncertain { color: #77531c; background: #f9efdb; }

.auth-layout { grid-template-columns: 1fr 1fr; }
.auth-story { padding: clamp(1.25rem, 4.5vw, 4.5rem); background: #f5f7fa; border-inline-end: 1px solid var(--line); color: var(--text); }
.auth-intro { width: min(100%, 32rem); margin: auto; padding: 2.5rem 0 3rem; }
.auth-intro h1 { font-size: clamp(1.35rem, 1.24rem + .72vw, 1.8rem); letter-spacing: -.035em; line-height: 1.19; font-weight: 660; margin: 0 0 .7rem; }
.auth-intro p { color: var(--muted); font-size: 1rem; }
.auth-preview { display: block; width: 100%; max-width: none; margin-top: 1.65rem; padding: 0; border-color: var(--line); border-radius: 8px; background: #fff; }
.auth-preview-head, .auth-preview li { display: grid; align-items: center; gap: .55rem; min-height: 2.65rem; padding: .48rem .85rem; font-size: .875rem; }
.auth-preview-head { grid-template-columns: minmax(0, 1fr) auto; background: var(--soft); border-radius: 7px 7px 0 0; font-weight: 650; }
.auth-preview-head span { display: flex; align-items: center; gap: .45rem; }
.auth-preview ul { list-style: none; padding: 0; }
.auth-preview li { grid-template-columns: auto minmax(0, 1fr) auto; border-top: 1px solid var(--line); }
.auth-preview svg { color: var(--accent); }
.auth-preview small { color: var(--quiet); font-size: .78rem; font-weight: 500; margin: 0; }
.auth-content { padding: 2rem; }
.auth-form-wrap { width: min(100%, 23rem); }
.auth-form-wrap h2 { font-size: 1.4rem; font-weight: 660; letter-spacing: -.03em; margin-bottom: 1.25rem; }
.auth-form-wrap form { gap: .85rem; }
.auth-form-wrap .auth-toggle { margin-block: .85rem 0; font-size: .875rem; text-align: start; }
.auth-divider { margin-block: 1.1rem; }
.form label, .share-field, .field-label { color: var(--text); font-size: .875rem; }
.form input:not([type=radio]):not([type=checkbox]), .form textarea, .form select, .share-field input {
  color: var(--text); border-color: #c8d2e1; border-radius: 6px;
}
.form input:not([type=radio]):focus, .form textarea:focus, .form select:focus, .share-field input:focus {
  border-color: var(--accent); box-shadow: 0 0 0 2px var(--tint);
}
.form input::placeholder, .form textarea::placeholder { color: var(--quiet); }
.form .stage-option:has(input:checked), .ref-options label:has(input:checked) { background: var(--tint); border-color: #99b2d1; }

.portfolio-inner { max-width: 72.5rem; padding-block: 2.2rem; }
.portfolio-grid { grid-template-columns: minmax(0, 1fr) minmax(14rem, .42fr); align-items: start; gap: 1rem; }
.project-list { min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.project-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .75rem; align-items: start; padding: .9rem 1rem; }
.project-row + .project-row { border-top: 1px solid var(--line); }
.project-row:hover { background: var(--soft); }
.project-row h2, .project-tile h2 { font-size: 1rem; font-weight: 670; margin: 0; overflow-wrap: anywhere; }
.project-row p, .project-tile p { font-size: .9rem; overflow-wrap: anywhere; color: var(--muted); margin: .2rem 0 0; }
.project-meta { display: grid; justify-items: end; gap: .2rem; text-align: end; }
.project-meta small, .project-demo-label { font-size: .78rem; color: var(--muted); }
.project-tile { min-height: 0; border-radius: var(--radius); padding: 1rem; gap: .45rem; }
.project-list .first-project { border: 0; }
.project-tile > .button { margin-top: .5rem; }
.demo-tile { background: var(--soft); }
.project-demo-label { display: flex; align-items: center; gap: .35rem; }

.shell { --sidebar: #f0f3f7; --line: #dce2ec; --radius: 6px; grid-template-columns: 13.25rem minmax(0, 1fr); background: var(--background); }
.sidebar { border-color: var(--line); padding-inline: .7rem; }
.sidebar-brand { margin: .2rem .45rem 1.1rem; }
.workspace { padding: .48rem; margin-bottom: .8rem; border-color: var(--line); border-radius: 6px; color: var(--muted); }
.workspace:hover, .profile:hover { background: var(--tint); }
.workspace strong, .profile strong { color: var(--text); }
.workspace small, .profile small { color: var(--quiet); }
.sidebar-bottom { border-color: var(--line); }
.sidebar .nav-item, .nav-group-toggle { min-height: 34px; color: var(--muted); font-size: .875rem; }
.nav-item svg, .nav-group-toggle svg { color: var(--quiet); }
.nav-item:hover, .nav-group-toggle:hover { background: #e6edf6; color: var(--text); }
.sidebar .nav-item[aria-current="page"] { background: #e1eaf6; color: var(--accent-dark); font-weight: 670; }
.sidebar .nav-item[aria-current="page"]::before { background: var(--accent); height: 17px; border-radius: 2px; }
.nav-item[aria-current="page"] svg { color: var(--accent-dark); }
.nav-groups { border-top: 1px solid var(--line); margin-top: .6rem; padding-top: .5rem; }
.nav-group-toggle { width: 100%; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .5rem; padding: .25rem .6rem; background: none; border: 0; border-radius: 6px; text-align: start; }
.nav-group-toggle[aria-expanded="true"] svg:last-child { rotate: 180deg; }
.nav-group-links { margin: .1rem 0 .3rem .8rem; padding-inline-start: .3rem; border-inline-start: 1px solid var(--line); }
.topbar { height: 53px; padding-inline: clamp(.9rem, 2.3vw, 2.2rem); }
.breadcrumbs > svg, .demo-label { color: var(--quiet); }
.demo-label i { background: var(--accent); }
.workspace-content { max-width: 79rem; padding: 1.45rem clamp(.9rem, 2.3vw, 2.2rem) 2rem; }
.page-heading h1, .overview-intro h1, .portfolio h1 {
  font-size: clamp(1.27rem, 1.15rem + .45vw, 1.53rem);
  font-weight: 680; line-height: 1.18; letter-spacing: -.035em;
}
.page-heading p, .overview-intro p { font-size: .95rem; }
.overview-date { font: inherit; color: var(--quiet); font-size: .81rem; }
.overview-title .icon-button { margin: 0; }
.overview-title h1 { margin-block: .18rem; }
.focus-card { min-height: 0; background: var(--tint); color: var(--text); border: 1px solid #cbd9eb; border-radius: 8px; padding: .8rem .9rem; }
.focus-label { color: var(--accent-dark); font-family: inherit; font-size: .81rem; text-transform: none; letter-spacing: 0; }
.focus-card h2 { font-size: clamp(1rem, .96rem + .25vw, 1.15rem); line-height: 1.35; letter-spacing: -.02em; margin-block: .3rem; }
.focus-person, .focus-edit { color: var(--accent-dark); }
.focus-edit { border-color: #b6c7df; }
.overview-summary { margin: .7rem 0 .85rem; border-block-end: 1px solid var(--line); }
.overview-summary > div { flex-direction: row; align-items: center; gap: .55rem; padding: .5rem .7rem; }
.overview-summary dt { color: var(--quiet); font-size: .84rem; }
.overview-summary dd { order: -1; font-size: 1.05rem; white-space: nowrap; }
.overview-layout { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(15rem, 1fr); gap: .85rem; align-items: start; }
.overview-work { display: grid; gap: .85rem; min-width: 0; }
.surface-heading h2, .stage-flow h2 { font-size: 1rem; font-weight: 665; }
.surface-heading { margin-bottom: .2rem; }
.surface-heading .section-icon { background: none; width: 25px; height: 25px; }
.overview-panel, .decision-card, .stage-flow { padding: .8rem .9rem; }
.decision-card { margin: 0; }
.decision-card h2 { font-size: 1.07rem; }
.date-chip { background: var(--soft); color: var(--text); border-radius: 5px; }
.date-chip.late { background: #f8eae7; color: var(--warning); }
.stage-flow { margin-top: 0; }
.stage-flow header .button { min-height: 28px; padding: 3px 0 3px 6px; }
.stage-flow header .button svg { display: none; }
.stage-flow ol { grid-template-columns: minmax(0, 1fr); gap: .15rem; }
.stage-flow li { min-height: 34px; border: 1px solid transparent; background: none; color: var(--muted); font-size: .875rem; }
.stage-flow li:not(:last-child)::after { display: none; }
.stage-flow li[aria-current] { background: var(--tint); border-color: #cbd9eb; color: var(--accent-dark); }
.stage-flow li[aria-current] small { font-size: .75rem; padding-inline-start: .1rem; }
.shell .stage-inline { color: var(--accent-dark); }
.stage-next { border-top: 1px solid var(--line); margin-top: .5rem; }
.stage-next .button { padding-inline: 0; }

.list-controls { display: flex; flex-wrap: wrap; gap: .55rem .9rem; justify-content: space-between; align-items: center; margin-bottom: .8rem; }
.list-controls .filterbar, .list-controls .tabs { margin: 0; }
.tabs { gap: .2rem .85rem; }
.tabs a[aria-current] { font-weight: 680; }
.tabs a span, .records-header, .work-table th { background: var(--soft); color: var(--muted); }
.records-header { border-radius: 7px 7px 0 0; font-family: inherit; }
.record-row, .lab-row, .team-row { border-color: var(--line); }
.record-row:hover, .lab-row:hover { background: #f8fafe; }
.search-field, .select-filter select { min-height: 36px; border-radius: 6px; border-color: var(--line); color: var(--muted); }
.list-controls .search-field { width: min(100%, 15rem); }
.empty { background: #f9fbfd; border-color: #c5d2e4; }
.notice { background: var(--soft); border-color: var(--line); color: var(--text); }
.notice-error { background: #fcf0ee; border-color: #efc9c3; color: var(--warning); }
.coach-progress, .coach-stat { background: var(--paper); border-color: var(--line); }
.coach-questions button { background: var(--soft); border-color: var(--line); color: var(--accent-dark); }
.coach-questions button:hover, .roadmap-index { background: var(--tint); color: var(--accent-dark); }
.roadmap-current .roadmap-index { background: var(--accent); color: #fff; }
.roadmap-current .roadmap-step-body { border-color: var(--accent); }
.process-layout { background: #eff4fa; }
.process-node, .process-unfilled { border-color: var(--line); }
.process-lane h2, .secondary-note summary, .overview-title .icon-button { color: var(--accent-dark); }
.process-edges path { stroke: #6884aa; }
.board-viewport { background-color: var(--soft); background-image: radial-gradient(circle, #bdcce0 1px, transparent 1.25px); }

@media (max-width: 930px) {
  .overview-layout { grid-template-columns: minmax(0, 1fr); }
  .stage-flow ol { grid-template-columns: repeat(auto-fit, minmax(min(100%, 7.1rem), 1fr)); gap: .25rem; }
  .stage-flow li { background: var(--soft); }
}
@media (max-width: 740px) {
  .auth-story { border-inline-end: 0; border-block-end: 1px solid var(--line); min-height: 0; padding: 1.2rem; }
  .auth-intro { margin: 0; padding: 1.1rem 0 0; }
  .auth-intro h1 br { display: none; }
  .auth-preview { display: none; }
  .auth-content { padding: 1.35rem 1.2rem; place-items: start center; }
  .portfolio-grid { grid-template-columns: minmax(0, 1fr); }
  .topbar { height: 55px; }
  .sidebar .nav-item, .nav-group-toggle { min-height: 40px; }
  .workspace-content { padding-block: .95rem 1.5rem; }
  .overview-summary > div { flex-direction: column-reverse; align-items: flex-start; gap: .2rem; }
  .overview-summary dd { order: initial; }
  .overview-summary dt { font-size: .76rem; }
  .list-controls .filterbar { flex: 1; }
}
@media (max-width: 420px) {
  .focus-card { gap: .5rem; }
  .project-row { grid-template-columns: auto minmax(0, 1fr); }
  .project-meta { grid-column: 2; justify-items: start; text-align: start; }
}
@media (forced-colors: active) {
  .sidebar .nav-item[aria-current="page"] { outline: 1px solid Highlight; }
}

/* Operational screens share the same compact type and row rhythm. */
.auth-intro p, .overview-intro p, .decision-card p, .coach-answer-text { max-width: 68ch; }
.auth-intro h1, .page-heading h1 { text-wrap: balance; }
.topbar { min-height: 50px; height: auto; padding-block: .38rem; }
.page-heading, .overview-intro { margin-block-end: .8rem; }
.focus-card, .overview-panel, .decision-card, .stage-flow { padding: .7rem .8rem; }
.focus-person { font-size: .87rem; }
.overview-layout, .overview-work { gap: .65rem; }
.overview-summary { margin-block: .5rem .7rem; }
.overview-summary > div { flex-wrap: wrap; }
.surface-heading h2, .stage-flow h2, .lab-row h2, .team-row h2, .engineering-card h2, .lecture-module h2, .cash-summary h2 {
  font-size: 1rem; line-height: 1.35;
}
.panel-heading h2 { font-size: 1.2rem; }
.rich-reader h2, .rich-editor h2 { font-size: 1.24rem; }
.rich-reader h3, .rich-editor h3 { font-size: 1.1rem; }
.list-count, .work-count { display: flex; flex-wrap: wrap; gap: .45rem 1.2rem; margin-block: 0 .45rem; color: var(--quiet); font-size: .8rem; }
.evidence-preview { margin-block: .25rem; }
.evidence-preview p { display: block; font-size: .86rem; line-height: 1.48; }
.evidence-preview strong { font-weight: 640; color: var(--text); }
.page-lab .lab-row .section-icon { width: 30px; height: 30px; }
.page-knowledge .template-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.template-card { padding: .8rem; }
.template-card .section-icon { width: 29px; height: 29px; }
.template-label { margin-block: .4rem .15rem; }
.template-card p { margin-bottom: .4rem; }
.team-columns, .team-row { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr) minmax(8rem, .58fr) minmax(8rem, .6fr); gap: .65rem; padding: .62rem .8rem; }
.team-columns { background: var(--soft); color: var(--quiet); font-size: .82rem; font-weight: 650; border-radius: 7px 7px 0 0; }
.team-columns span:first-child { grid-column: 1 / 3; }
.team-row { align-items: center; }
.team-row > .avatar { width: 32px; height: 32px; }
.team-actions { justify-content: end; }
.team-row .icon-button { width: 32px; height: 32px; }
.work-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem .8rem; margin-block-end: .45rem; }
.work-controls .work-links, .work-controls .pipeline-overview { margin: 0; }
.pipeline-tile { padding: .36rem .52rem; min-height: 0; border-radius: 5px; background: var(--paper); border-color: var(--line); }
.pipeline-tile[aria-pressed="true"] { background: var(--tint); color: var(--accent-dark); border-color: #b6c7df; }
.work-row-note { max-width: 38ch; color: var(--quiet); font-size: .82rem; overflow-wrap: anywhere; }
.work-table td, .work-table th { padding-block: .55rem; }
.cash-summary dl { gap: .35rem; }
.cash-summary dd { font-size: 1rem; }
.coach-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
.coach-chat > header { align-items: center; }
.coach-chat h2, .coach-card-head h2 { font-size: 1.04rem; }
.coach-questions { margin-block: .65rem; }
.coach-form textarea { min-height: 6rem; border-color: var(--line); }
.coach-spark, .coach-state.recorded { background: var(--tint); color: var(--accent-dark); }
.coach-progress progress::-webkit-progress-value { background: var(--accent); }
.coach-progress progress::-moz-progress-bar { background: var(--accent); }
.board-top, .board-bottom { padding: .42rem .6rem; }
.board-feedback { flex: 1 1 15rem; min-width: 0; }
.board-sync { color: var(--quiet); font-size: .79rem; margin-top: .12rem; overflow-wrap: anywhere; }
.board-control[aria-pressed="true"] { background: var(--tint); border-color: var(--line); color: var(--accent-dark); }

@container coach (width <= 680px) {
  .coach-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .team-columns { display: none; }
  .team-row { grid-template-columns: auto minmax(0,1fr) auto; }
}
@media (max-width: 540px) {
  .page-knowledge .template-grid { grid-template-columns: minmax(0, 1fr); }
  .team-row .team-actions { justify-content: start; }
  .board-feedback { flex-basis: 100%; }
}
