/* P36 work UI: practical, compact surfaces with consistent square geometry. */
:root {
  --canvas: #f4f2ed;
  --surface: #ffffff;
  --surface-subtle: #f8f7f3;
  --surface-hover: #efeee9;
  --ink: #232b31;
  --muted: #606b72;
  --subtle: #6b747a;
  --line: #deddd7;
  --line-strong: #c7c7c1;
  --primary: #2b4358;
  --primary-hover: #1e3346;
  --accent: #2b4b62;
  --accent-soft: #e8eef1;
  --selected-surface: #e8eef2;
  --focus-ring: #4f7891;
  --success: #4d725b;
  --success-soft: #edf2ee;
  --warning: #8b6728;
  --warning-soft: #f5f1e8;
  --danger: #a34f49;
  --danger-soft: #f6eeec;
  --info: #536d7b;
  --info-soft: #edf1f3;
  --status-todo: #979fa1;
  --status-in-progress: #6f8795;
  --status-in-review: #ad8951;
  --status-blocked: #b56b64;
  --status-rework: #9c8150;
  --status-done: #66816f;
  --radius-tile: 3px;
  --radius-control: 3px;
  --radius-button: 3px;
  --radius-chip: 2px;
  --radius-overlay: 5px;
  --radius: var(--radius-tile);
  --radius-compact: var(--radius-chip);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --control-height: 34px;
  --button-height: 34px;
  --input-height: 34px;
  --table-row-height: 38px;
  --row-height: var(--table-row-height);
  --font-body: 13px;
  --font-secondary: 12px;
  --font-meta: 11px;
  --font-table-header: 12px;
  --font-section: 15px;
  --font-page-title: 23px;
  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --focus-width: 2px;
  --focus-offset: 2px;
}

body { background: var(--canvas); color: var(--ink); font-size: 13px; }
.app-shell { overflow-x: hidden; }
html { overflow-x: hidden; }
.nav-rail { background: #fff; border-right-color: var(--line); box-shadow: none; padding: 16px 11px 12px; }
.workspace-brand { margin-bottom: 19px; }
.workspace-brand strong { color: #26343b; font-size: 14px; font-weight: 600; }
.workspace-brand small { color: var(--muted); font-size: 10px; }
.brand-mark { background: var(--primary); border: 1px solid var(--primary-hover); border-radius: var(--radius-control); box-shadow: none; height: 34px; width: 34px; }
.nav-section-label, .nav-project-heading > span { color: #727f83; font-size: 10px; letter-spacing: .04em; }
.rail-nav { gap: 2px; }
.rail-link { border-radius: 4px; color: #48575d; height: 37px; }
.rail-link:hover { background: #f1f4f3; color: #26343b; }
.rail-link.is-active { background: var(--selected-surface); color: var(--primary); font-weight: var(--weight-semibold); }
.rail-link.is-active::before { background: var(--primary); border-radius: 0; height: 20px; }
.rail-link svg { height: 16px; width: 16px; }
.nav-label { font-size: 12px; }
.rail-count { border: 1px solid currentColor; border-radius: 3px; font-variant-numeric: tabular-nums; height: 18px; min-width: 20px; }
.nav-project-heading { margin-top: 16px; }
.project-shortcut { border-radius: 3px; min-height: 32px; }
.project-shortcut:hover { background: #f1f4f3; }
.project-shortcut.is-active { background: var(--selected-surface); color: var(--primary); }
.project-shortcut-mark { background: #e8eef2; border-radius: 3px; }
.local-storage-status { background: #efeee9; border-color: #dce5df; border-radius: 4px; box-shadow: none; }
.local-storage-status strong { color: #436653; }

.topbar { background: #fff; backdrop-filter: none; border-bottom-color: var(--line); box-shadow: none; height: 54px; padding-inline: 24px; }
.topbar-scope select { border-radius: 3px; }
.global-search { background: #f8f7f3; border-color: #e4e2dc; border-radius: 4px; }
.global-search:focus-within { border-color: #93aeb9; box-shadow: 0 0 0 2px rgba(69,107,124,.12); }
.button { border-radius: var(--radius-button); box-shadow: none; font-size: 12px; font-weight: var(--weight-semibold); min-height: var(--button-height); padding: 6px 10px; transition: background .12s ease, border-color .12s ease, color .12s ease; }
.button.primary { background: var(--primary); border-color: var(--primary); box-shadow: none; color: #fff; }
.button.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.button:active { transform: none; }
.button.subtle { border-color: #d9dfdc; color: #4d5d62; }
.button.subtle:hover { background: #eef2f0; border-color: #c6cfcb; color: #26343b; }
.utility-popover { border-color: var(--line-strong); border-radius: 4px; box-shadow: 0 8px 20px rgba(25,38,43,.12); }
.utility-popover button { border-radius: 3px; }
.page-head { margin-bottom: 13px; }
.page-head h1, .workspace > h1, .dashboard-heading h1 { color: #25343b; font-size: var(--font-page-title); font-weight: var(--weight-semibold); letter-spacing: -.02em; }
.dashboard-heading h1 { font-size: 23px; }
.page-head p { color: #627076; font-size: 12px; }
.section-title h2, .section-title h3, .workspace-section-head h2 { font-size: var(--font-section); font-weight: var(--weight-semibold); }
.section-title p, .workspace-section-head p, .panel-description { color: #66747a; font-size: var(--font-meta); }
.eyebrow { color: #778489; font-size: 9px; letter-spacing: .055em; }
.field input, .field select, .field textarea, .toolbar input, .toolbar select, .inline-control,
.backlog-item select, .board-status-select, .task-card-quick-actions input, .task-card-quick-actions select {
  background-color: #fff; border-color: #cbd4d0; border-radius: var(--radius-control); box-shadow: none; font-size: var(--font-secondary); min-height: var(--input-height);
}
.field input:focus, .field select:focus, .field textarea:focus, .toolbar input:focus, .toolbar select:focus,
.inline-control:focus, .backlog-item select:focus, .board-status-select:focus {
  border-color: var(--focus-ring); box-shadow: 0 0 0 2px rgba(49,95,103,.12); outline: 0;
}
.toast { border-radius: 4px; box-shadow: 0 4px 14px rgba(25,38,43,.16); }

/* A shared square-corner rule covers nested controls, tiles, menus and dialogs. */
:where(.app-shell *, #detailPanel *, #formDialog *, #formDialog, #detailPanel) { border-radius: var(--radius-tile) !important; }
:where(.app-shell svg, .app-shell svg *, #detailPanel svg, #detailPanel svg *, #formDialog svg, #formDialog svg *,
  .app-shell table, .app-shell thead, .app-shell tbody, .app-shell tr, .app-shell th, .app-shell td) { border-radius: 0 !important; }
:where(.app-shell .task-donut, .app-shell .task-donut::after, .app-shell .legend-dot, .app-shell .status-dot,
  .app-shell .pulse-dot, .app-shell .rail-local-dot, .app-shell .project-shortcut > i, .app-shell .health-pill i,
  .app-shell .task-card-assignee::before, .app-shell .timeline-dot) { border-radius: 50% !important; }
.task-donut::after { background: #fff; }

/* Flat work tiles: structure comes from aligned borders and section headers. */
:where(.metric-card, .delivery-flow-card, .dashboard-panel, .overview-card, .run-list-panel, .project-progress-hero,
  .project-health-summary, .project-health-card, .project-directory-card, .run-summary-card, .run-workspace-row,
  .review-workspace, .review-row, .review-action-box, .panel, .backlog-section, .planning-sprint, .sprint-card,
  .milestone-card, .doc-card, .task-card, .board-column, .gantt-wrap, .calendar-grid, .form-dialog, .detail-panel,
  .utility-popover, .empty-state, .onboarding-card, .table-wrap, .detail-pane-inline) {
  border-radius: var(--radius-tile) !important;
  box-shadow: none !important;
}
.metric-card, .delivery-flow-card, .dashboard-panel, .overview-card, .run-list-panel, .project-progress-hero,
.project-health-summary, .project-directory-card, .run-summary-card, .review-workspace, .panel, .backlog-section,
.sprint-card, .milestone-card, .doc-card, .gantt-wrap, .calendar-grid, .form-dialog, .detail-panel, .table-wrap {
  background: #fff; border-color: var(--line); box-shadow: none;
}
.metric-card { min-height: 146px; padding: 12px 13px; }
button.metric-card { transition: background .12s ease, border-color .12s ease; }
button.metric-card:hover, .project-directory-card:hover { background: #faf9f6; border-color: #aebdb7; box-shadow: none; transform: none; }
.metric-card-heading { min-height: 21px; }
.metric-icon { background: #e8eef2; border: 1px solid #e0e7e3; border-radius: 3px; color: #516f61; height: 23px; width: 23px; }
.metric-icon-violet, .metric-icon-blue, .metric-icon-amber { background: #eef2f3; border-color: #e0e7e8; color: #536f7b; }
.metric-card-value { color: #25343b; font-size: 25px; font-weight: 600; margin: 8px 0 3px; }
.metric-big-copy > strong { color: #25343b; font-size: 20px; }
.metric-label { color: #526167; font-size: 11px; font-weight: 600; }
.metric-card-note, .metric-big-copy > span { color: #718087; font-size: 10px; }
.metric-legend { border-color: #e4e9e6; color: #66747a; font-size: 9px; }
.metric-sparkline i { background: #a6b8af; border-radius: 1px 1px 0 0; }
.metric-sparkline i:last-child { background: #5d8070; }
.metric-review-card { border-top: 3px solid #b98c56; }
.metric-ai-card { border-top: 3px solid #748d99; }
.metric-release-card { border-top: 3px solid #81958a; }
.metric-progress-card { border-top: 3px solid #688a75; }
.task-donut { box-shadow: inset 0 0 0 1px rgba(41,64,55,.06); }
.progress-track, .review-evidence-track, .project-status-bar { background: #e7ece9; border-radius: 2px !important; }
.progress-track > span, .progress-track > i { background: #648472; border-radius: 0 !important; }
.project-status-bar { height: 7px; }
.delivery-flow-card { padding: 12px 14px; }
.delivery-flow-heading { border-bottom: 1px solid #e3e8e5; padding-bottom: 8px; }
.delivery-flow-heading h2 { color: #2d3d43; font-size: 14px; }
.flow-caption { color: #748187; }
.flow-step { background: #f8f7f3; border-color: #e4e2dc; border-radius: 3px !important; }
.flow-step:hover { background: #e8eef2; border-color: #c7d2cd; }
.flow-step-number { background: #e4eae7; border-radius: 3px !important; color: #53655c; }
.flow-step-ai strong, .flow-step-ai .flow-step-number { color: #466b5a; }
.flow-step-ai .flow-step-number { background: #e7efeb; }
.flow-step-attention { background: #f6f2e9; border-color: #e8dcc4; }
.flow-step-attention .flow-step-number { background: #eee4cf; color: #866127; }
.flow-step-attention strong, .flow-step-attention small { color: #765c30; }
.dashboard-content-grid { gap: 10px; }
.dashboard-primary-column, .dashboard-side-column { gap: 10px; }
.dashboard-panel { padding: 12px 13px; }
.dashboard-panel-head { border-bottom: 1px solid #e2e7e4; margin-bottom: 9px; padding-bottom: 8px; }
.dashboard-panel-head h2 { color: #2d3b41; font-size: 14px; }
.project-health-grid { gap: 6px; }
.project-health-card { background: #faf9f6; border-color: #e4e2dc; padding: 8px; }
.project-health-card:hover { background: #efeee9; border-color: #bdcbc4; }
.project-card-orb, .activity-icon, .attention-symbol, .attention-count, .run-status-icon, .run-summary-icon,
.run-result-icon, .task-type-mark, .milestone-icon, .project-directory-icon {
  background: #e8eef2; border-color: #dce5e0; border-radius: 3px !important; color: #4b695a;
}
.attention-count { background: #f4f1e9; color: #866127; }
.week-bar-track { background: #edf1ef; border-radius: 2px 2px 0 0; }
.week-bar-track i { background: #819b8c; border-radius: 1px 1px 0 0; }
.week-day.is-today .week-bar-track { background: #e8eef0; }
.week-day.is-today .week-bar-track i { background: #55788a; }
.activity-item { border-bottom-color: #e6ebe8; }
.ai-status-pills > span { border: 1px solid #dfe6e2; border-radius: 3px !important; }
.ai-running-pill, .ai-failed-pill, .ai-done-pill { background: #f2f5f3; color: #52645a; }
.pulse-dot { animation: none; background: #607f70; }
.release-progress .progress-track { height: 5px; }
.review-empty, .empty-state, .onboarding-card { background: #f8f7f3; border-color: #d9e1dd; }
.onboarding-card { border-radius: 4px; }
.project-advanced-fields { border: 1px solid var(--line); border-radius: var(--radius-control); padding: 9px 11px; }
.project-advanced-fields > summary { color: var(--ink); cursor: pointer; font-size: 12px; font-weight: 600; }
.project-advanced-fields[open] > .form-grid { margin-top: 10px; }
.project-empty-card .page-actions { flex-wrap: wrap; justify-content: center; }
.onboarding-illustration, .onboarding-steps b, .empty-check { background: #e8eef2; border-color: #dce5e0; border-radius: 4px !important; color: #4f6e5e; }
.attention-clear { background: #f3f7f4; border-color: #e4e2dc; }

/* Review: compact queue tiles and a calm, explicit decision area. */
.review-workspace { border-color: #cfd8d4; }
.master-pane-head, .inline-detail-toolbar { background: #f8f7f3; border-color: var(--line); }
.review-row { background: #fff; border: 1px solid #e4e2dc; border-left: 3px solid transparent; margin: 5px 0; padding: 8px 9px; }
.review-row:hover { background: #f8faf9; border-color: #c5d0ca; }
.review-row.is-selected { background: #e8eef2; border-color: #8da99a; border-left-color: #5d806d; box-shadow: none; }
.review-meta .status-tag, .review-meta .risk-tag, .evidence-count-pill { border-radius: 3px !important; }
.review-workflow-strip { background: #f8f7f3; border-color: #e4e2dc; border-radius: 3px !important; }
.review-workflow-step i { background: #e5ebe8; }
.review-action-box { background: #fff; border-color: #cbd5d0; border-top: 2px solid #8b9d93; }
.review-workspace .decision-action-grid .button { border-radius: 3px !important; box-shadow: none; }
.review-workspace .decision-action-grid .button.positive { background: #4a775e; border-color: #4a775e; }
.review-workspace .decision-action-grid .button.warning { background: #f5f1e8; border-color: #dfcfaf; color: #785e2e; }
.review-workspace .decision-action-grid .button.danger { background: #f7efed; border-color: #e4ccc7; color: #9c4b43; }
.decision-action-grid .hold-action { background: #efeee9; border-color: #d5ddda; color: #546267; }
.review-action-box .field textarea { min-height: 40px; }

/* Project pages and planning tiles. */
.project-head, .project-context-bar { border-color: var(--line); }
.project-group { border-radius: 0 !important; color: #627176; }
.project-group.is-active { color: #355d6e; }
.project-tab { background: transparent; border-radius: 3px !important; color: #5c6a70; }
.project-tab:hover { background: #efeee9; }
.project-tab.is-active, .project-tab[aria-selected="true"] { background: #e9eff1; color: #365d6e; }
.project-progress-hero, .project-health-summary { box-shadow: none; }
.health-pill { background: #edf3ef; border-radius: 3px !important; color: #4f735d; }
.project-summary-grid { gap: 6px; }
.summary-box { background: #fff; border: 1px solid #e4e2dc; border-radius: 4px !important; padding: 9px 10px; }
.summary-box:first-child { padding-left: 10px; }
.split-grid { gap: 10px; grid-template-columns: repeat(auto-fit,minmax(min(100%,390px),1fr)); }
.sprint-card, .milestone-card, .doc-card { background: #fff; border: 1px solid var(--line); padding: 12px; }
.milestone-card > .section-title, .sprint-card > .section-title { border-bottom: 1px solid #e4e2dc; margin-bottom: 8px; padding-bottom: 8px; }
.milestone-card h3, .sprint-card h3 { font-size: 15px; }
.milestone-card p, .sprint-card p { color: #66747a; font-size: 12px; }
.card-meta { border-block: 1px solid #e4e9e6; color: #657379; gap: 7px 12px; margin: 8px 0; padding: 7px 0; }
.release-readiness-line { align-items: flex-start; display: grid; gap: 6px; grid-template-columns: repeat(auto-fit,minmax(125px,1fr)); }
.release-readiness-line > * { background: #f4f6f5; border-left: 2px solid #c8d2cd; color: #59676c; padding: 6px 7px; }
.release-readiness-line > strong.signal-success { background: #edf3ef; border-left-color: #648a71; color: #466c54; }
.release-readiness-line > strong.signal-danger { background: #f7efed; border-left-color: #b97870; color: #914c45; }
.release-notes { background: #f8f7f3; border: 1px solid #e1e7e4; margin-top: 8px; padding: 8px; }
.planning-readiness { display: flex; flex-wrap: wrap; gap: 0; margin: 8px 0; }
.planning-readiness > span { background: #efeee9; border: 1px solid #e4e2dc; border-radius: 0 !important; color: #56656a; padding: 5px 9px; }
.planning-sprint { background: #fff; border: 1px solid var(--line); margin-top: 10px; padding: 12px; }
.planning-sprint-head { border-bottom: 1px solid #e4e2dc; padding-bottom: 9px; }
.backlog-item { background: #fff; border: 1px solid #e4e2dc; border-bottom: 1px solid #e4e2dc; gap: 8px; margin: 4px 0; padding: 8px; }
.backlog-column-head { color: #68777c; display: grid; font-size: 10px; font-weight: 600; gap: 8px; grid-template-columns: 54px minmax(190px,1fr) 104px 145px 145px; padding: 6px 8px 3px; }
.backlog-item:hover { background: #f8f7f3; }
.backlog-section .panel-header { background: #f8f7f3; border-bottom-color: #e4e2dc; padding: 10px 12px; }
.backlog-section .panel-header h2 { font-size: 14px; font-weight: 600; }
.backlog-section .muted-small { color: #69777c; }
.board { align-items: stretch; gap: 8px; }
.board-column { background: #efeee9; border: 1px solid #e4e2dc; border-top: 2px solid #9aa9a1; flex-basis: 210px; padding: 0 6px 6px; }
.board-column[data-status="in_progress"] { border-top-color: #6e8b7a; }
.board-column[data-status="in_review"] { border-top-color: #b38a4c; }
.board-column[data-status="blocked"] { border-top-color: #b56b63; }
.board-column[data-status="done"] { border-top-color: #557e65; }
.board-column-head { background: transparent; border-bottom: 1px solid #e4e2dc; margin: 0 -6px 5px; padding: 7px 7px; }
.board-column-head strong { color: #33444a; font-size: 12px; font-weight: 600; }
.board-count { background: #fff; border: 1px solid #d6dfda; border-radius: 3px !important; }
.task-card { background: #fff; border-color: #d5ded9; border-radius: 3px !important; margin: 0; padding: 7px; }
.task-card:hover, .task-card:focus-within { border-color: #aebdb5; box-shadow: none; }
.task-card .task-title-button { font-size: 12px; font-weight: 600; line-height: 1.35; }
.task-card-head .type-tag, .task-card-labels, .task-card-signals, .task-card-foot > small { display: none; }
.task-card-meta, .task-card-foot small { font-size: 10px; }
.task-card-foot { border-top: 0; margin-top: 3px; padding-top: 0; }
.task-card-signals { border-top: 1px solid #e5e9e7; font-size: 10px; margin-top: 6px; padding-top: 5px; }
.board-status-select { background: #f8f7f3; border: 1px solid #d8e0dc; color: #42535a; font-size: 10px; }
.backlog-sprint { background: #f8faf9; border: 1px solid #e4e2dc; padding: 8px; }
.gantt-wrap { border-color: #cfd8d3; }
.gantt-axis { background: #eef2f0; }
.gantt-axis-day.is-today { background: #456b7c; }
.gantt-track { background-image: none; }
.gantt-bar, .gantt-bar.status-done, .gantt-bar.status-in_progress, .gantt-bar.status-active { background: #718c7d; border-radius: 2px !important; }
.gantt-bar.status-blocked { background: #a9776f; }
.gantt-bar.milestone-bar { background: #9b8256; }
.calendar-grid { border-color: #cfd8d3; }
.calendar-weekday { background: #eef2f0; }

/* Rows and overlays share the same dense, workmanlike visual language. */
.data-table { border-collapse: collapse; }
.data-table thead { background: #efeee9; }
.data-table th { color: #5c6b70; font-size: 10px; font-weight: 600; }
.data-table td { border-bottom-color: #e1e7e3; }
.data-table tbody tr:nth-child(even) { background: #faf9f6; }
.data-table tbody tr:hover { background: #e8eef2; }
.task-master-table .data-table td { font-size: 12px; padding-block: 5px; }
.status-tag, .risk-tag, .type-tag, .priority-text, .label-chip, .directory-alert { border: 1px solid rgba(75,95,84,.12); border-radius: 3px !important; font-size: 10px; font-weight: 600; padding: 2px 5px; }
.status-tag.status-done, .status-tag.status-complete, .status-tag.status-shipped { background: #edf3ef; color: #4b7259; }
.status-tag.status-blocked, .risk-tag.risk-high { background: #f6eeec; color: #995047; }
.status-tag.status-in_review, .risk-tag.risk-medium { background: #f5f1e8; color: #87672e; }
.status-tag.status-in_progress { background: #edf2f3; color: #4f7180; }
.detail-panel, .form-dialog { background: #fff; border-color: #cbd5d0; border-radius: var(--radius-overlay) !important; box-shadow: 0 4px 14px rgba(29,42,47,.12); }
.form-dialog::backdrop { background: rgba(27,39,43,.32); backdrop-filter: none; }
.detail-section { border-top-color: #e4e2dc; }
.detail-field label, .detail-field dt { color: #65747a; font-size: 10px; }
.detail-field strong { color: #2f4046; font-size: 12px; }
.detail-grid { gap: 5px; }
.detail-field { background: #f8f7f3; border: 1px solid #e4e2dc; min-width: 0; padding: 6px 7px; }
.detail-field > span { color: #627176; font-size: 10px; font-weight: 600; }
.detail-field > strong { color: #2f4046; font-size: 12px; overflow-wrap: anywhere; }

.table-wrap, .gantt-wrap { max-width: 100%; overflow: auto; }

/* Final design tokens: compact hierarchy, muted work colors, and consistent states. */
body { font-size: var(--font-body); font-weight: var(--weight-normal); line-height: 1.45; }
.nav-rail, .topbar, .workspace, .metric-card, .dashboard-panel, .overview-card, .review-workspace,
.project-progress-hero, .project-health-summary, .run-list-panel, .milestone-card, .planning-sprint,
.backlog-section, .board-column, .task-card, .detail-panel, .form-dialog {
  border-radius: var(--radius-tile) !important;
  box-shadow: none;
}
.button, .global-search, .topbar-scope select, .field input, .field select, .field textarea,
.toolbar input, .toolbar select, .inline-control, .backlog-item select, .board-status-select {
  border-radius: var(--radius-control) !important;
}
.inline-control, .backlog-item select, .board-status-select, .task-card-quick-actions input, .task-card-quick-actions select {
  height: 28px;
  min-height: 0;
  padding-block: 3px;
}
.task-master-table .inline-control { height: 26px; }
.status-tag, .risk-tag, .type-tag, .priority-text, .label-chip, .directory-alert,
.rail-count, .board-count, .evidence-count-pill, .health-pill, .ai-status-pills > span {
  border-radius: var(--radius-chip) !important;
}
.detail-panel, .form-dialog { border-radius: var(--radius-overlay) !important; }
.detail-panel:not(.open) { display: none; }
.detail-panel.open { display: block; transform: none; }
.board-scroll { box-sizing: border-box; contain: layout paint; min-width: 0; width: 100%; max-width: 100%; overflow-x: auto; overflow-y: hidden; }
.board { max-width: none; min-width: max-content; overflow: visible; width: max-content; }

.rail-link:focus-visible, .project-shortcut:focus-visible, .project-tab:focus-visible,
.project-group:focus-visible, .button:focus-visible, .icon-button:focus-visible,
.task-title-button:focus-visible, .metric-card:focus-visible, .project-health-card:focus-visible,
.review-row:focus-visible, .run-workspace-row:focus-visible, .work-queue-row:focus-visible,
.recent-task-row:focus-visible, .next-task-row:focus-visible, .activity-item:focus-visible,
.detail-list-item:focus-visible, .resolved-review-row:focus-visible, .attention-summary-row:focus-visible,
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible,
.toolbar input:focus-visible, .toolbar select:focus-visible, .inline-control:focus-visible,
.global-search input:focus-visible, #scopeSelect:focus-visible, .board-status-select:focus-visible {
  outline: var(--focus-width) solid var(--focus-ring) !important;
  outline-offset: var(--focus-offset);
  box-shadow: none;
}
.field input:focus, .field select:focus, .field textarea:focus, .toolbar input:focus,
.toolbar select:focus, .inline-control:focus, .backlog-item select:focus, .board-status-select:focus {
  border-color: var(--focus-ring);
}
.button:active, .rail-link:active, .project-shortcut:active, .project-tab:active { background-color: #e5eae7; }
.button:disabled, button[disabled], input:disabled, select:disabled, textarea:disabled {
  cursor: not-allowed;
  opacity: .58;
}
.loading-state[aria-busy="true"], [aria-busy="true"] { cursor: progress; }
.server-alert, .form-error, [role="alert"] { border-radius: var(--radius-tile); }

.button.primary { background: var(--primary); border-color: var(--primary); }
.button.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.rail-link.is-active, .project-shortcut.is-active, .project-tab.is-active,
.project-tab[aria-selected="true"] { background: var(--selected-surface); color: var(--primary); }
.metric-card-value, .metric-big-copy > strong, .project-health-title > span,
.project-progress-hero .progress-hero-value strong { font-variant-numeric: tabular-nums; }
.metric-card-value { font-size: 24px; font-weight: var(--weight-semibold); }
.metric-card-value small { font-size: var(--font-secondary); font-weight: var(--weight-medium); }
.metric-label, .dashboard-panel-head h2, .section-title h2, .section-title h3 { font-weight: var(--weight-semibold); }
.metric-card-note, .metric-big-copy > span, .panel-description, .section-title p,
.project-health-stats, .card-meta, .detail-field label, .detail-field dt,
.task-card-meta, .task-card-foot small, .task-card-signals, .run-signal-meta {
  font-size: var(--font-meta);
}
.data-table th, .backlog-column-head { font-size: var(--font-table-header); }
.status-tag, .risk-tag, .type-tag, .priority-text, .label-chip { font-size: 11px; font-weight: var(--weight-medium); }

.project-status-bar { border-radius: var(--radius-chip) !important; }
.project-status-segment.status-todo { background: var(--status-todo); }
.project-status-segment.status-in_progress { background: var(--status-in-progress); }
.project-status-segment.status-in_review { background: var(--status-in-review); }
.project-status-segment.status-blocked { background: var(--status-blocked); }
.project-status-segment.status-rework { background: var(--status-rework); }
.project-status-segment.status-done { background: var(--status-done); }
.progress-track > span, .progress-track > i { background: var(--status-done); }
.project-progress-hero .progress-hero-value strong { color: var(--ink); font-size: 28px; font-weight: var(--weight-semibold); }
.status-breakdown-legend { color: var(--muted); font-size: var(--font-meta); }
.health-review { background: var(--warning-soft); color: var(--warning); }
.health-alert.review-alert { color: var(--warning); }
.dot-active { background: var(--status-in-progress); }
.dot-complete { background: var(--status-done); }
.dot-warning { background: var(--warning); }
.dot-failed { background: var(--danger); }
.project-tab.is-active, .project-tab[aria-selected="true"] { border-bottom: 2px solid var(--primary); }
.project-group.is-active { border-bottom-color: var(--primary); color: var(--primary); }
.project-shortcut.is-active .project-shortcut-mark { background: #e2e9e5; border-color: #d2dcd6; color: var(--primary); }
.project-health-name, .project-health-title strong, .task-title-button { color: var(--ink); }
.project-health-name:hover, .task-title-button:hover { color: var(--primary); }
.metric-open-arrow, .metric-link { color: var(--muted); }
.task-master-table .task-title-button { display: inline-block; max-width: calc(100% - 92px); overflow: hidden; text-overflow: ellipsis; vertical-align: middle; white-space: nowrap; }
.ai-workflow-explainer { background: var(--surface-subtle); border-color: var(--line); border-radius: var(--radius-tile) !important; box-shadow: none; }
.ai-workflow-spark { background: #e9eeeb; border-radius: var(--radius-chip) !important; color: var(--primary); font-weight: var(--weight-semibold); }
.ai-workflow-explainer strong { color: var(--ink); }
.ai-workflow-explainer small { color: var(--muted); }
.attention-count { background: var(--warning-soft); border: 1px solid #e6dbc4; border-radius: var(--radius-chip) !important; color: var(--warning); font-weight: var(--weight-semibold); }
.review-row.is-selected { background: var(--selected-surface); border-color: #8fa29a; border-left-color: var(--primary); }
.review-action-box { border-top-color: var(--primary); }
.detail-panel, .form-dialog { box-shadow: 0 4px 14px rgba(29,42,47,.12); }
.utility-popover, .toast { box-shadow: 0 3px 10px rgba(29,42,47,.10); }
.empty-state, .review-empty, .onboarding-card { border-radius: var(--radius-tile) !important; }
.metric-icon-violet, .metric-icon-blue { color: var(--info); }
.metric-review-card { border-top-color: var(--warning); }
.metric-ai-card { border-top-color: var(--info); }
.metric-release-card, .metric-progress-card { border-top-color: var(--success); }
.gantt-axis-day.is-today { background: var(--primary); }

@media (max-width: 760px) {
  .page-head h1, .workspace > h1, .dashboard-heading h1 { font-size: 20px; }
  .metric-card { min-height: 132px; }
  .task-card-meta, .task-card-foot small, .task-card-signals, .run-signal-meta { font-size: 11px; }
}

@media (max-width: 1100px) {
  .workspace { padding: 18px 18px 34px; }
  .topbar { padding-inline: 18px; }
  .dashboard-metrics { gap: 8px; }
  .dashboard-content-grid { grid-template-columns: minmax(0,1fr) minmax(285px,.8fr); }
  .review-workspace { min-height: 560px; }
}

@media (max-width: 760px) {
  .nav-rail { background: #fff; box-shadow: none; }
  .workspace { padding: 14px 12px calc(80px + env(safe-area-inset-bottom)); }
  .topbar { background: #fff; backdrop-filter: none; height: 48px; padding-inline: 10px; }
  .page-head { align-items: flex-start; gap: 9px; }
  .page-head h1, .workspace > h1 { font-size: 19px; }
  .dashboard-heading { align-items: flex-start; }
  .dashboard-heading h1 { font-size: 20px; }
  .dashboard-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .metric-card { min-height: 136px; }
  .delivery-flow-card { overflow: hidden; }
  .delivery-flow { grid-template-columns: repeat(7,minmax(98px,1fr)); overflow-x: auto; padding-bottom: 4px; }
  .dashboard-content-grid { grid-template-columns: minmax(0,1fr); }
  .dashboard-side-column { grid-template-columns: minmax(0,1fr); }
  .project-health-grid { grid-template-columns: minmax(0,1fr); }
  .project-summary-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .summary-box, .summary-box:first-child { border: 1px solid #e4e2dc; padding: 8px; }
  .split-grid { grid-template-columns: minmax(0,1fr); }
  .backlog-column-head { display: none; }
  .backlog-item { grid-template-columns: 38px minmax(0,1fr); }
  .backlog-item > select { min-width: 0; }
  .backlog-item > select:nth-last-child(3) { grid-column: 2; }
  .backlog-item > select:nth-last-child(2), .backlog-item > select:last-child { grid-column: span 1; }
  .review-workspace { min-height: 0; }
}

@media (max-width: 430px) {
  .topbar-scope { flex-basis: 84px; }
  .topbar { gap: 4px; padding-inline: 6px; }
  .workspace { padding-inline: 10px; }
  .dashboard-metrics { gap: 6px; }
  .metric-card { min-height: 132px; padding: 9px; }
  .metric-card-value { font-size: 22px; }
  .metric-label { font-size: 10px; }
  .metric-progress-content { gap: 8px; }
  .task-donut { flex-basis: 58px; height: 58px; width: 58px; }
  .task-donut::after { height: 43px; width: 43px; }
  .task-donut strong { font-size: 14px; }
  .dashboard-panel { padding: 10px; }
  .dashboard-panel-head { align-items: flex-start; }
  .panel-head-actions { flex-wrap: wrap; justify-content: flex-end; }
  .review-workspace .review-action-box { border-radius: 4px !important; margin: 10px -8px -10px; }
}

/* Work filters stay compact on mobile and remain a full toolbar on desktop. */
@media (min-width: 621px) {
  #taskFilters > .task-filter-toggle { display: none; }
  #taskFilters > .task-filter-controls { display: contents; }
}
@media (max-width: 620px) {
  #taskFilters { align-items: start; gap: 8px; }
  #taskFilters > .search-field { grid-column: 1 / -1; }
  #taskFilters > .task-filter-toggle { grid-column: 1 / -1; justify-content: flex-start; min-height: 34px; }
  #taskFilters > .task-filter-controls { display: none; grid-column: 1 / -1; }
  #taskFilters.mobile-filters-open > .task-filter-controls { display: grid; gap: 8px 6px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #taskFilters .task-filter-controls > .field { min-width: 0; }
  #taskFilters .task-filter-controls > .field label { font-size: 10px; margin-bottom: 3px; }
  #taskFilters .task-filter-controls > .button { font-size: 11px; min-height: 32px; padding-inline: 5px; }
  #taskFilters .task-filter-controls > .filter-more,
  #taskFilters .task-filter-controls > .filter-columns { grid-column: 1 / -1; }
}
