/* Content Analysis Pro. Base styles shared with Content Designer Tracker
   (copied from ContentTracker/cdt/static/style.css), CAP additions at the end.
   House rule: no white or near-white text on buttons or controls — every
   button sets its own dark text explicitly. */

:root {
  color-scheme: light;
  --bg: #F4F6F5;
  --surface: #FFFFFF;
  --surface-2: #EDF1EF;
  --border: #D5DDD9;
  --text: #17201B;
  --muted: #56625C;
  --primary-fill: #8FE0BC;
  --primary-hover: #78D1A8;
  --primary-text: #0B3D26;
  --secondary-fill: #E3E9E6;
  --secondary-hover: #D3DCD7;
  --secondary-text: #17201B;
  --danger-fill: #FBE3E4;
  --danger-hover: #F6CDD0;
  --danger-text: #8E1B24;
  --alert: #B4232F;
  --warn: #A9560A;
  --chart-line: #2E8A5E;
  --chart-bar: #C9D3CE;
  /* Timeline dots: validated together for colour-blind separation. */
  --tl-late: #B4232F;
  --tl-soon: #C9971C;
  --tl-ok: #2E8A5E;
  --focus: #1F7A50;
  --nav-active: #D7F3E6;
  --status-not_started: #B8C2BD;
  --status-in_progress: #E39B1A;
  --status-done: #2E8A5E;
  --risk-none: #6B7570;
  --risk-low: #3F7A22;
  --risk-medium: #8C6408;
  --risk-high: #A9560A;
  --risk-critical: #B23434;
  --risk-extreme: #7E1A1A;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #141A17;
    --surface: #1C2420;
    --surface-2: #232D28;
    --border: #34413A;
    --text: #E4ECE8;
    --muted: #9AA8A1;
    --secondary-fill: #A9BDB3;
    --secondary-hover: #BCCDC4;
    --secondary-text: #102018;
    --danger-fill: #F2B8BC;
    --danger-hover: #F6CACD;
    --danger-text: #5C0E15;
    --alert: #F5A3A9;
    --warn: #F0A253;
    --chart-line: #45A473;
    --chart-bar: #3E4C45;
    --tl-late: #C93A33;
    --tl-soon: #B98A1F;
    --tl-ok: #45A473;
    --focus: #8FE0BC;
    --nav-active: #24402F;
    --status-not_started: #4A5650;
    --status-in_progress: #D4921C;
    --status-done: #4CAF7D;
    --risk-none: #9AA8A1;
    --risk-low: #7FCB4E;
    --risk-medium: #E0B84A;
    --risk-high: #F0A253;
    --risk-critical: #F27272;
    --risk-extreme: #FF8A8A;
  }
}

/* Chosen on My account: dark regardless of the device setting. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141A17;
  --surface: #1C2420;
  --surface-2: #232D28;
  --border: #34413A;
  --text: #E4ECE8;
  --muted: #9AA8A1;
  --secondary-fill: #A9BDB3;
  --secondary-hover: #BCCDC4;
  --secondary-text: #102018;
  --danger-fill: #F2B8BC;
  --danger-hover: #F6CACD;
  --danger-text: #5C0E15;
  --alert: #F5A3A9;
  --warn: #F0A253;
  --chart-line: #45A473;
  --chart-bar: #3E4C45;
  --tl-late: #C93A33;
  --tl-soon: #B98A1F;
  --tl-ok: #45A473;
  --focus: #8FE0BC;
  --nav-active: #24402F;
  --status-not_started: #4A5650;
  --status-in_progress: #D4921C;
  --status-done: #4CAF7D;
  --risk-none: #9AA8A1;
  --risk-low: #7FCB4E;
  --risk-medium: #E0B84A;
  --risk-high: #F0A253;
  --risk-critical: #F27272;
  --risk-extreme: #FF8A8A;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; font-size: 15px; }
/* Text size, chosen on My account. Everything is sized in rem, so it all scales. */
html[data-text="small"] { font-size: 13.5px; }
html[data-text="large"] { font-size: 17px; }
html[data-text="x-large"] { font-size: 19px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 1.6rem; }
p { margin: 0.25rem 0; }
a { color: var(--focus); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.muted, .hint { color: var(--muted); }
.hint { font-size: 0.82rem; font-weight: normal; }
.alert-text { color: var(--alert); }
.center { text-align: center; margin-top: 1rem; }

/* Layout */
.shell { display: grid; grid-template-columns: 210px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 20px 12px; display: flex; flex-direction: column; gap: 16px;
  position: sticky; top: 0; height: 100vh;
}
.brand {
  display: flex; align-items: center; gap: 10px; padding: 0 8px;
  color: var(--text); text-decoration: none; font-weight: 700; line-height: 1.2;
}
.brand img { border-radius: 7px; flex-shrink: 0; }
.nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav a {
  display: block; padding: 8px 10px; border-radius: 8px;
  color: var(--text); text-decoration: none;
}
.nav a:hover { background: var(--surface-2); }
.nav a[aria-current="page"] { background: var(--nav-active); font-weight: 600; }
/* Process Steps sits at the bottom, just above the signed-in person. */
.nav-bottom { margin-top: auto; }
.account { margin-top: 0; padding: 0 8px; display: grid; gap: 4px; font-size: 0.88rem; }
.account-name { font-weight: 600; }
.content { padding: 28px 32px 48px; min-width: 0; max-width: 1100px; }
.solo { min-height: 100vh; display: grid; place-items: center; padding: 16px; align-content: center; gap: 12px; }

.page-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 18px;
}
.page-head > p { flex-basis: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions form { margin: 0; }
.section-title { font-size: 1.1rem; margin: 28px 0 10px; }

/* Buttons — every variant sets dark text explicitly. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 7px 14px; border-radius: 8px; border: 1px solid transparent;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn-primary { background: var(--primary-fill); color: var(--primary-text); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--secondary-fill); color: var(--secondary-text); }
.btn-secondary:hover { background: var(--secondary-hover); }
.btn-danger { background: var(--danger-fill); color: var(--danger-text); }
.btn-danger:hover { background: var(--danger-hover); }
.btn-small { min-height: 30px; padding: 3px 10px; font-size: 0.85rem; }
.link-button {
  background: none; border: 0; padding: 0; font: inherit; color: var(--focus);
  text-decoration: underline; cursor: pointer;
}
.import-form label { margin: 0; }

/* Forms */
/* Flex-wrap so label text and an inline .hint share a line, with the control below. */
label { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; font-weight: 600; font-size: 0.9rem; }
label > input:not([type="checkbox"]):not([type="radio"]), label > select, label > textarea { flex-basis: 100%; }
input, select, textarea {
  font: inherit; font-weight: normal; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; width: 100%;
}
textarea { resize: vertical; min-height: 2.6em; }
input[type="checkbox"], input[type="radio"] { width: auto; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 14px; }
legend { font-weight: 700; padding: 0; margin-bottom: 4px; }
fieldset[disabled] input, fieldset[disabled] textarea { background: var(--surface-2); color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; font-weight: normal; }
.stack { display: grid; gap: 14px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; }
.form-actions.start { justify-content: flex-start; }
.form-error {
  background: var(--danger-fill); color: var(--danger-text);
  padding: 8px 12px; border-radius: 8px; font-weight: 600;
}
.title-input { font-weight: 700; font-size: 1.05rem; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-weight: 600; }
.flash-ok { background: var(--nav-active); color: var(--text); }
.flash-error { background: var(--danger-fill); color: var(--danger-text); }

/* Cards */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 12px;
}
.card h3 { font-size: 1rem; margin-bottom: 4px; }
.card ul { margin: 0; padding-left: 1.2rem; display: grid; gap: 6px; }
.card-warn { background: #FFF6E5; }
.narrow { max-width: 560px; }
.auth-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 28px; width: min(400px, 100%); display: grid; gap: 12px;
}
.auth-card img { border-radius: 12px; }
.auth-card h1 { font-size: 1.35rem; }

.stats { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 20px; min-width: 130px;
}
.stat-value { font-size: 1.7rem; font-weight: 700; line-height: 1.2; }
.stat-label { color: var(--muted); font-size: 0.85rem; }

.controls { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; align-items: end; }
.controls label { font-weight: normal; color: var(--muted); font-size: 0.8rem; }
.controls input { width: 300px; max-width: 100%; }
.controls select { width: 190px; }
.empty { color: var(--muted); padding: 16px 0; }

.workflow-card { position: relative; }
.workflow-card:hover { border-color: var(--focus); }
.card-top { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.card-top h2 { font-size: 1.1rem; }
.stretched { color: var(--text); text-decoration: none; }
.stretched::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.card-actions { display: flex; gap: 6px; position: relative; z-index: 1; }
.card-actions form { margin: 0; }
.meta { color: var(--muted); margin: 2px 0 8px; }
.warning { color: var(--alert); font-size: 0.85rem; }
.warning.strong { font-weight: 700; font-size: 0.92rem; }

.progress-row { display: flex; align-items: center; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
progress {
  -webkit-appearance: none; appearance: none; width: 260px; max-width: 100%; height: 10px;
  border: 0; border-radius: 5px; background: var(--surface-2); overflow: hidden;
}
progress::-webkit-progress-bar { background: var(--surface-2); border-radius: 5px; }
progress::-webkit-progress-value { background: var(--status-done); border-radius: 5px; }
progress::-moz-progress-bar { background: var(--status-done); border-radius: 5px; }

.pill {
  display: inline-block; font-size: 0.75rem; font-weight: 800; letter-spacing: 0.03em;
  padding: 2px 7px; border-radius: 6px; background: var(--surface-2); vertical-align: middle;
}
.pill-alert { color: var(--alert); }
.pill-analysis { color: var(--status-done); margin-left: 4px; }
.analysis-stages { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.9rem; }
.analysis-stages input { accent-color: var(--status-done); margin: 0 4px 0 0; vertical-align: middle; }

/* Workflow detail */
.back { display: inline-block; margin-bottom: 10px; text-decoration: none; font-weight: 600; }
.detail-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.detail-head { margin: 10px 0 20px; }
.role-badges { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.role-badges li { background: var(--surface-2); border-radius: 6px; padding: 3px 9px; font-size: 0.85rem; }

.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-items {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 5; min-width: 160px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px; display: grid; gap: 2px; box-shadow: 0 6px 20px rgb(0 0 0 / 0.12);
}
.menu-items a { padding: 6px 10px; border-radius: 6px; color: var(--text); text-decoration: none; }
.menu-items a:hover { background: var(--surface-2); }
.menu-items.stack { min-width: 240px; padding: 12px; }

.step-card { border-left: 5px solid var(--status-not_started); }
.step-card.status-in_progress { border-left-color: var(--status-in_progress); }
.step-card.status-done { border-left-color: var(--status-done); }
.step-top { display: grid; grid-template-columns: auto 1fr 170px; gap: 12px; margin-bottom: 10px; }
.step-number {
  width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2);
  display: grid; place-items: center; font-weight: 700;
}
.step-text h3 { font-size: 1rem; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.step-text p { color: var(--muted); }
.step-text p.hint { margin-top: 4px; }
.step-controls { display: grid; gap: 8px; align-content: start; }
.step-controls label { font-size: 0.75rem; color: var(--muted); }
.field-label { margin-top: 8px; font-size: 0.8rem; color: var(--muted); }
.step-foot { margin-top: 8px; min-height: 1.2em; }

.risk-none { color: var(--risk-none); }
.risk-low { color: var(--risk-low); }
.risk-medium { color: var(--risk-medium); }
.risk-high { color: var(--risk-high); }
.risk-critical { color: var(--risk-critical); }
.risk-extreme { color: var(--risk-extreme); }
select.risk-select:not(.risk-none) { font-weight: 700; }

/* Board cards */
.board-card {
  display: grid; gap: 2px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 10px; color: var(--text); text-decoration: none; font-size: 0.9rem;
}
.board-card:hover { border-color: var(--focus); }
.badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }

/* Step dates and edit conflicts */
.step-dates { display: flex; flex-wrap: wrap; align-items: end; gap: 8px 14px; margin: 4px 0 6px; }
.step-dates label { font-size: 0.75rem; color: var(--muted); }
.step-dates input { width: auto; padding: 5px 8px; }
.step-dates [data-timing] { padding-bottom: 7px; }
.conflict {
  border: 1px solid var(--alert); border-radius: 8px; padding: 10px 12px; margin-top: 6px;
  background: var(--surface-2); display: grid; gap: 8px;
}
.conflict-title { font-weight: 600; color: var(--alert); }
.conflict blockquote {
  margin: 0; padding: 6px 10px; border-left: 3px solid var(--border);
  white-space: pre-wrap; max-height: 12em; overflow: auto;
}

/* Board: one row per step, top to bottom */
.board-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.board-row {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 14px; display: grid; gap: 10px;
}
.board-row.is-empty { background: transparent; padding-top: 6px; padding-bottom: 6px; }
.board-row.is-empty .board-title { color: var(--muted); font-weight: normal; }
.board-step { display: flex; align-items: center; gap: 10px; }
.board-step .step-number { width: 26px; height: 26px; font-size: 0.85rem; flex-shrink: 0; }
.board-title { font-weight: 700; }
.board-count {
  margin-left: auto; min-width: 26px; text-align: center; font-size: 0.8rem; font-weight: 700;
  color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 1px 8px;
}
.board-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }

/* Team roles legend */
.team-roles h2 { font-size: 1.1rem; }
.role-legend { margin: 10px 0 6px; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px 20px; }
.role-legend dt { font-size: 0.82rem; color: var(--muted); }
.role-legend dd { margin: 2px 0 0; font-weight: 600; }
.archive-link { margin-top: 18px; }
.intro { margin-bottom: 14px; }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
thead th { background: var(--surface-2); font-size: 0.85rem; }
tbody tr:last-child > * { border-bottom: 0; }
.raci tbody th { font-weight: normal; }
.raci td { text-align: center; font-weight: 700; width: 64px; }
.raci-R, .raci-A { color: var(--focus); }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.row-actions form { margin: 0; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .card-warn { background: #3A2E15; }
}
:root[data-theme="dark"] .card-warn { background: #3A2E15; }

/* Phones and narrow windows */
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { min-width: 0; }
  .sidebar {
    position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--border);
    padding: 12px 16px; gap: 10px;
  }
  .nav { grid-auto-flow: column; overflow-x: auto; }
  .nav a { white-space: nowrap; }
  .nav-bottom { margin-top: 0; }
  .account { margin-top: 0; padding: 0; grid-auto-flow: column; justify-content: start; gap: 12px; align-items: center; }
  .content { padding: 18px 16px 40px; }
  .step-top { grid-template-columns: auto 1fr; }
  .step-controls { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .controls input, .controls select { width: 100%; }
  .controls label { flex: 1 1 200px; }
  .card-top { flex-direction: column; }
  .menu-items { right: auto; left: 0; }
}

/* API key reveal on the Team screen */
.key-box { background: var(--nav-active); border-radius: 8px; padding: 12px; display: grid; gap: 8px; }
.key-value { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85em; }

/* Activity history */
.history { list-style: none; margin: 0; padding: 0; }
.history li {
  display: grid; grid-template-columns: 10.5em 1fr; gap: 4px 14px;
  padding: 9px 0; border-bottom: 1px solid var(--border);
}
.history li:last-child { border-bottom: 0; }
.history time { color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; padding-top: 1px; }
.history-detail summary { cursor: pointer; color: var(--focus); font-size: 0.85rem; margin-top: 4px; }
.diff { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.diff blockquote {
  margin: 2px 0 0; padding: 6px 10px; background: var(--surface-2); border-radius: 6px;
  white-space: pre-wrap; font-size: 0.88rem; max-height: 14em; overflow: auto;
}
@media (max-width: 760px) {
  .history li { grid-template-columns: 1fr; }
  .diff { grid-template-columns: 1fr; }
}

/* My account choices */
.choice-row { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.choice { display: flex; align-items: center; gap: 6px; font-weight: normal; }
.choice input { width: auto; }
.account-name { color: var(--text); text-decoration: none; }
.account-name[aria-current="page"] { text-decoration: underline; }

/* Compact layout, chosen on My account */
[data-density="compact"] .content { padding-top: 18px; }
[data-density="compact"] .card { padding: 10px 12px; margin-bottom: 8px; }
[data-density="compact"] .step-top { margin-bottom: 6px; }
[data-density="compact"] .step-text p { margin: 0; }
[data-density="compact"] .field-label { margin-top: 4px; }
[data-density="compact"] textarea { padding: 5px 8px; }
[data-density="compact"] .section-title { margin: 18px 0 8px; }
[data-density="compact"] .stat { padding: 6px 14px; }
[data-density="compact"] .board-list, [data-density="compact"] .card-list { gap: 4px; }
[data-density="compact"] .board-row { padding: 6px 10px; gap: 6px; }
[data-density="compact"] .history li { padding: 5px 0; }
[data-density="compact"] .page-head { margin-bottom: 10px; }
.raci-names { display: block; font-weight: normal; font-size: 0.75rem; color: var(--muted); max-width: 9em; }
.raci thead th:not(:first-child) { text-align: center; }
.step-dates input.date-overdue { border-color: var(--alert); color: var(--alert); font-weight: 600; }

/* Board: current step's due date — orange within a week, red when late. */
.step-due { font-size: 0.82rem; color: var(--muted); }
.step-due.due-soon { color: var(--warn); font-weight: 700; }
.step-due.due-late { color: var(--alert); font-weight: 700; }
.in-progress-label { font-size: 0.78rem; font-weight: 700; color: var(--status-in_progress); }

/* Team: one card per person; edit forms open inside the card */
.people { display: grid; gap: 10px; }
.person { margin-bottom: 0; }
.person-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: start; gap: 10px 16px; }
.person-info h3 { font-size: 1rem; margin: 0; }
.person-info p { margin: 2px 0 0; }
.person .row-actions { justify-content: flex-start; }
.person-panel { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.person-panel h4 { margin: 0; font-size: 0.95rem; }

/* Sign-ins graph: one 2px line, recessive grid and axes, crosshair tooltip. */
.chart-card { margin-top: 16px; }
.chart-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 16px; }
.chart-head h2 { font-size: 1.05rem; margin: 0; }
.chart-total { font-size: 1.3rem; font-weight: 700; }
.chart { position: relative; margin-top: 10px; outline-offset: 4px; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; touch-action: pan-y; }
.chart-grid { stroke: var(--border); stroke-width: 1; }
.chart-axis { fill: var(--muted); font-size: 11px; }
.chart-line { fill: none; stroke: var(--chart-line); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-dot, .chart-dot-static { fill: var(--chart-line); stroke: var(--surface); stroke-width: 2; }
.chart-crosshair { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-tip {
  position: absolute; top: 4px; pointer-events: none; display: grid; gap: 1px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 10px; box-shadow: 0 4px 14px rgb(0 0 0 / 0.12); font-size: 0.85rem; white-space: nowrap;
}
.chart-tip strong { font-size: 1rem; }
.chart-tip span { color: var(--muted); }
.chart-table { margin-top: 8px; }
.chart-table summary { cursor: pointer; color: var(--focus); font-size: 0.88rem; }
.chart-table .table-wrap { max-height: 18em; overflow: auto; margin-top: 6px; }
.signin-filters { margin-top: 24px; }
.notice { display: grid; gap: 6px; margin-bottom: 18px; }
.notice p { margin: 0; }

/* Project page: current step highlight and collapsible step cards */
.steps-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 0 0 12px; }
.step-card { scroll-margin-top: 16px; }
.step-card.is-current { box-shadow: 0 0 0 2px var(--focus); }
.pill-current { color: var(--focus); }
.step-toggle {
  background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; text-align: left;
}
.step-toggle:hover { color: var(--focus); }
.step-toggle-icon { display: inline-block; font-size: 0.8em; color: var(--muted); transition: transform 0.15s; }
.step-toggle[aria-expanded="true"] .step-toggle-icon { transform: rotate(90deg); }
.step-summary { display: none; color: var(--muted); font-size: 0.9rem; }
.step-card.is-collapsed { padding-top: 10px; padding-bottom: 10px; }
.step-card.is-collapsed .step-top { margin-bottom: 0; align-items: center; }
.step-card.is-collapsed .step-summary { display: block; }
.step-card.is-collapsed :is(.step-description, .step-controls, .step-dates, .field-label, .conflict, .step-foot) { display: none; }

/* Buttons inside drop-down menus (⋯) look like the menu's links */
.menu-items form { margin: 0; }
.menu-item {
  width: 100%; text-align: left; background: none; border: 0; font: inherit; color: var(--text);
  padding: 6px 10px; border-radius: 6px; cursor: pointer;
}
.menu-item:hover { background: var(--surface-2); }
.menu-item-danger { color: var(--alert); }

/* Projects: Overdue tile and quick filters */
.stat-alert { border-color: var(--alert); }
.stat-alert .stat-value { color: var(--alert); }
.quick-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  text-decoration: none; font-size: 0.9rem; font-weight: 600;
}
.chip:hover { border-color: var(--focus); }
.chip[aria-current="true"] { background: var(--primary-fill); border-color: var(--primary-fill); color: var(--primary-text); }
.chip-count { font-weight: 700; color: var(--muted); font-size: 0.8rem; }
.chip[aria-current="true"] .chip-count { color: var(--primary-text); }

/* Timeline */
.timeline-range { flex-basis: 100%; margin: 0; }
.timeline { overflow-x: auto; }
.timeline svg { width: 100%; min-width: 760px; height: auto; display: block; }
.tl-week { fill: transparent; }
.tl-week-alt { fill: var(--surface-2); fill-opacity: 0.5; }
.tl-axis { fill: var(--muted); font-size: 11px; }
.tl-load { fill: var(--chart-line); }
.tl-load-count { fill: var(--text); font-size: 12px; font-weight: 700; }
.tl-busiest { font-size: 13px; }
.tl-today { stroke: var(--focus); stroke-width: 1.5; stroke-dasharray: 4 3; }
.tl-today-label { fill: var(--focus); font-size: 11px; font-weight: 700; }
.tl-label { fill: var(--text); font-size: 12.5px; font-weight: 600; }
.tl-label-alert { fill: var(--alert); }
a:hover .tl-label { text-decoration: underline; }
.tl-bar { fill: var(--chart-bar); }
.tl-bar-open { fill-opacity: 0.55; }
.tl-due { fill: var(--text); }
.tl-dot { stroke: var(--surface); stroke-width: 2; }
.tl-late { fill: var(--tl-late); background: var(--tl-late); }
.tl-soon { fill: var(--tl-soon); background: var(--tl-soon); }
.tl-ok { fill: var(--tl-ok); background: var(--tl-ok); }
.tl-key.tl-late { border-radius: 1px; transform: rotate(45deg) scale(0.85); }
.tl-done { fill: var(--surface); stroke: var(--muted); background: var(--surface); }
circle.tl-done { stroke: var(--muted); stroke-width: 2; }
.card .tl-legend { list-style: none; padding: 0; margin: 10px 0 4px; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.85rem; color: var(--muted); }
.tl-legend li, .tl-list li { display: flex; align-items: center; gap: 6px; }
.tl-key { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.tl-key.tl-done { border: 2px solid var(--muted); width: 10px; height: 10px; box-sizing: border-box; }
.tl-key-bar { display: inline-block; width: 22px; height: 8px; border-radius: 4px; background: var(--chart-bar); }
.tl-key-due { display: inline-block; width: 3px; height: 14px; border-radius: 1.5px; background: var(--text); }
.tl-list-week { font-size: 0.95rem; margin: 14px 0 4px; }
.card .tl-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; font-size: 0.9rem; }
.tl-bar-late { fill: var(--tl-late); fill-opacity: 0.55; }
.tl-key-bar.tl-key-late { background: var(--tl-late); opacity: 0.55; }
.tl-late-note { fill: var(--tl-late); font-size: 11px; font-weight: 700; }
.timeline-export { align-self: end; }


/* ===================== Content Analysis Pro ===================== */

.content-wide { max-width: 1500px; }
.narrow-wide { max-width: 720px; }
.prewrap { white-space: pre-wrap; }
.brief { color: var(--muted); max-width: 70ch; white-space: pre-wrap; margin-top: 6px; }
.section-title.first { margin-top: 0; }
.pill-ok { color: var(--status-done); }
.pill-busy { color: var(--status-in_progress); }
.detail-head h1 { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* New analysis: file drop zone */
.dropzone {
  border: 2px dashed var(--border); border-radius: var(--radius); background: var(--surface);
  padding: 22px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px;
}
.dropzone.is-over { border-color: var(--focus); background: var(--nav-active); }
.dropzone p { margin: 0; }
.file-button { position: relative; overflow: hidden; }
.file-button input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%;
}
.file-button:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.file-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.file-list li {
  display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 6px 6px 12px;
}
.file-list li span:first-child { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.char-count { display: block; text-align: right; font-size: 0.75rem; color: var(--muted); margin-top: 2px; }

/* Progress while analyzing */
.status-card h2 { font-size: 1.15rem; margin-bottom: 8px; }
.status-steps { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 6px; }
.status-steps li { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.status-steps li::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--status-not_started); flex-shrink: 0;
}
.status-steps li.is-current { color: var(--text); font-weight: 600; }
.status-steps li.is-current::before { border-color: var(--status-in_progress); border-top-color: transparent; animation: spin 0.9s linear infinite; }
.status-steps li.is-done { color: var(--text); }
.status-steps li.is-done::before { background: var(--status-done); border-color: var(--status-done); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .status-steps li.is-current::before { animation: none; } }
.retry-form { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin-top: 10px; }
.retry-form label { min-width: 260px; }

/* Three-column workspace: material | editor | review & hand-off */
.workspace { display: grid; grid-template-columns: 250px minmax(0, 1fr) 280px; gap: 20px; align-items: start; }
.workspace-empty { grid-template-columns: minmax(0, 520px); }
.panel { display: grid; gap: 18px; font-size: 0.9rem; position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; padding-right: 4px; }
.panel section { display: grid; gap: 6px; }
.panel-title { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-top: 6px; }
.doc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.doc-list li { display: grid; gap: 1px; overflow-wrap: anywhere; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.analysis-stages { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.analysis-stages li { display: flex; align-items: center; gap: 6px; }
.stage-box {
  display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 4px;
  border: 2px solid var(--status-not_started); font-size: 0.8rem; font-weight: 800; line-height: 1;
}
.analysis-stages .is-done .stage-box { border-color: var(--status-done); background: var(--primary-fill); color: var(--primary-text); }
.analysis-stages .is-done { font-weight: 600; }
.compact-form { gap: 6px; }
.menu-form { padding: 8px 10px; gap: 6px; min-width: 260px; border-bottom: 1px solid var(--border); }
.version-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.version-list li { border-left: 3px solid var(--border); padding-left: 8px; }
.version-list li.is-current { border-left-color: var(--status-done); }
.row-actions.start { justify-content: flex-start; gap: 10px; }
.activity summary { cursor: pointer; color: var(--focus); }
.activity .history li { grid-template-columns: 1fr; gap: 0; }

/* Editor */
.editor-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  position: sticky; top: 0; z-index: 3; background: var(--bg); padding: 6px 0 10px;
}
.save-state { color: var(--muted); font-size: 0.9rem; }
.save-state.is-dirty { color: var(--warn); font-weight: 600; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.tabs [role="tab"] {
  font: inherit; font-weight: 600; color: var(--text); background: none; border: 0;
  border-bottom: 3px solid transparent; padding: 8px 12px; cursor: pointer; margin-bottom: -1px;
}
.tabs [role="tab"]:hover { background: var(--surface-2); border-radius: 6px 6px 0 0; }
.tabs [role="tab"][aria-selected="true"] { border-bottom-color: var(--status-done); }
.tab-count { font-size: 0.78rem; font-weight: 700; background: var(--surface-2); border-radius: 6px; padding: 1px 6px; color: var(--muted); }
.tab-panel { display: grid; gap: 12px; justify-items: start; }
.tab-panel:focus { outline: none; }
.item-list { display: grid; gap: 12px; width: 100%; }
.item-card { display: grid; gap: 10px; margin: 0; }
.item-card.is-dragging { opacity: 0.5; }
.item-card.drop-target { border-color: var(--focus); box-shadow: 0 0 0 2px var(--focus); }
.item-card.is-resolved { opacity: 0.75; }
.item-card[data-decision="approved"] { border-left: 5px solid var(--status-done); }
.item-card[data-decision="rejected"] { border-left: 5px solid var(--alert); }
.item-head { display: flex; align-items: center; gap: 10px; }
.item-title { flex: 1; font-size: 1rem; margin: 0; }
.item-actions { display: flex; gap: 4px; }
.drag-handle { cursor: grab; color: var(--muted); font-weight: 700; letter-spacing: -2px; padding: 4px 2px; user-select: none; }
.field { display: grid; gap: 4px; min-width: 0; }
.field > label { font-size: 0.8rem; color: var(--muted); }
.field-row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end; }
.field-row .field { flex: 1 1 200px; }
.field-row .field-narrow { flex: 0 0 110px; }
.options { display: grid; gap: 6px; }
.option-row { display: flex; align-items: center; gap: 8px; }
.option-row input[type="text"] { flex: 1; }
.option-letter { font-weight: 700; width: 1.2em; }
.decision { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; }
.decision .field-label { margin: 0; }
.decision-approved { color: var(--status-done); }
.decision-rejected { color: var(--alert); }
.resolved-check { padding-bottom: 8px; }
.extracted {
  white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; font-size: 0.85rem; max-height: 75vh; overflow: auto;
}
.check-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.check-list .ok { color: var(--status-done); }
.check-list .bad { color: var(--alert); }
.readonly-version ol { display: grid; gap: 6px; }

@media (max-width: 1200px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 260px; }
  .panel-left { grid-column: 1 / -1; position: static; max-height: none; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
}
@media (max-width: 860px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .panel { position: static; max-height: none; }
  .item-head { flex-wrap: wrap; }
}
.btn:disabled, .btn[disabled] { opacity: 0.5; cursor: not-allowed; }
