/* Content Designer Tracker. Mint palette carried over from the desktop app.
   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 */
/* Layout: a slim top bar plus a slide-in drawer (the old sidebar). The drawer opens
   from a hidden checkbox, so it works without JavaScript; app.js adds Esc and focus. */
:root { --bar-h: 56px; --drawer-ease: cubic-bezier(0.22, 1, 0.36, 1); --drawer-spring: cubic-bezier(0.34, 1.56, 0.64, 1); }
.shell { min-height: 100vh; }
.drawer-check {
  position: fixed; top: 8px; left: 12px; z-index: 61; width: 40px; height: 40px;
  margin: 0; opacity: 0; cursor: pointer;
}
.drawer-btn { position: fixed; top: 8px; left: 12px; z-index: 60; width: 40px; height: 40px; border-radius: 8px; }
.drawer-btn span {
  position: absolute; left: 9px; width: 22px; height: 2px; border-radius: 2px; background: var(--text);
  transition: transform 280ms var(--drawer-spring), opacity 160ms;
}
.drawer-btn span:nth-child(1) { top: 12px; }
.drawer-btn span:nth-child(2) { top: 19px; }
.drawer-btn span:nth-child(3) { top: 26px; }
.drawer-check:hover ~ .drawer-btn { background: var(--surface-2); }
.drawer-check:focus-visible ~ .drawer-btn { outline: 2px solid var(--focus); }
.drawer-check:checked ~ .drawer-btn span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.drawer-check:checked ~ .drawer-btn span:nth-child(2) { opacity: 0; }
.drawer-check:checked ~ .drawer-btn span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.drawer-bar {
  position: sticky; top: 0; z-index: 30; height: var(--bar-h); display: flex; align-items: center;
  padding: 0 16px 0 64px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.drawer-bar .brand { padding: 0; }
.drawer-scrim {
  position: fixed; inset: 0; z-index: 45; background: rgba(8, 9, 13, 0.5);
  opacity: 0; pointer-events: none; transition: opacity 280ms var(--drawer-ease);
}
.drawer-check:checked ~ .drawer-scrim { opacity: 1; pointer-events: auto; }
.sidebar {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 50; width: 280px; max-width: 86vw; overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--primary-fill);
  padding: 8px 12px 20px; display: flex; flex-direction: column; gap: 16px;
  transform: translateX(-101%); visibility: hidden;
  transition: transform 280ms var(--drawer-ease), visibility 0s linear 280ms;
}
.drawer-check:checked ~ .sidebar { transform: none; visibility: visible; transition-delay: 0s; }
html:has(.drawer-check:checked) { overflow: hidden; }
.sidebar .brand { min-height: 40px; padding: 0 8px 0 48px; }
/* The nav items fade in one after another once the panel is open. */
.sidebar .nav li, .sidebar .account { opacity: 0; transform: translateX(-12px); }
.drawer-check:checked ~ .sidebar .nav li,
.drawer-check:checked ~ .sidebar .account { animation: drawer-in 280ms var(--drawer-ease) forwards; }
.sidebar .nav:not(.nav-bottom) li:nth-child(1) { animation-delay: 80ms; }
.sidebar .nav:not(.nav-bottom) li:nth-child(2) { animation-delay: 135ms; }
.sidebar .nav:not(.nav-bottom) li:nth-child(3) { animation-delay: 190ms; }
.sidebar .nav:not(.nav-bottom) li:nth-child(4) { animation-delay: 245ms; }
.sidebar .nav:not(.nav-bottom) li:nth-child(5) { animation-delay: 300ms; }
.sidebar .nav:not(.nav-bottom) li:nth-child(6) { animation-delay: 355ms; }
.sidebar .nav:not(.nav-bottom) li:nth-child(n+7) { animation-delay: 410ms; }
.sidebar .nav-bottom li:nth-child(1) { animation-delay: 450ms; }
.sidebar .nav-bottom li:nth-child(n+2) { animation-delay: 505ms; }
.sidebar .account { animation-delay: 560ms; }
@keyframes drawer-in { to { opacity: 1; transform: none; } }

/* C-Suite apps: links to the home page and the other apps, at the bottom of the drawer. */
.sidebar .suite-nav { border-top: 1px solid var(--border); padding-top: 10px; }
.sidebar .nav-bottom ~ .suite-nav { margin-top: 0; }
.sidebar .suite-title {
  padding: 4px 10px 2px; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
}
.sidebar .suite-nav li:nth-child(1) { animation-delay: 420ms; }
.sidebar .suite-nav li:nth-child(2) { animation-delay: 455ms; }
.sidebar .suite-nav li:nth-child(3) { animation-delay: 490ms; }
.sidebar .suite-nav li:nth-child(4) { animation-delay: 525ms; }
.sidebar .suite-nav li:nth-child(5) { animation-delay: 560ms; }
.sidebar .suite-nav li:nth-child(6) { animation-delay: 595ms; }
.sidebar .suite-nav li:nth-child(n+7) { animation-delay: 630ms; }
.sidebar .account { animation-delay: 680ms; }
@media (prefers-reduced-motion: reduce) {
  .sidebar, .drawer-scrim, .drawer-btn span { transition-duration: 0.001ms !important; }
  .drawer-check:checked ~ .sidebar .nav li,
  .drawer-check:checked ~ .sidebar .account { animation-duration: 0.001ms !important; animation-delay: 0s !important; }
}
@media print { .drawer-check, .drawer-btn, .drawer-bar, .drawer-scrim, .sidebar { display: none; } }
.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; margin: 0 auto; }
.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 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; }

/* 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) {
  .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; }

/* Export rows: the download link plus a small "save to my folder" icon (_export.html). */
.export-row { display: flex; align-items: center; gap: 4px; }
.export-row > a:first-child { flex: 1; }
.menu-items .save-link, .save-link {
  display: inline-flex; align-items: center; padding: 6px; border-radius: 6px; color: var(--muted); text-decoration: none;
}
.menu-items .save-link:hover, .save-link:hover { background: var(--surface-2); color: var(--text); }
.save-icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
