/* SheetTrack's task pane, in Microsoft's Fluent 2 look so it feels part of Excel (redesign spec section 6, slice 1).
   Rules use the tokens below; colours are never written into a rule. The older names (--bg-*, --text-*, --accent-*)
   are kept as aliases of the Fluent tokens, so both read the same values. */

/* The hidden attribute always wins over component display rules (buttons, banners, lists). */
[hidden] {
  display: none !important;
}

/* The pane's Sign in while the approval message, with its own Sign in again, shows on Changes (UI-306). */
.approval-wall-hidden {
  display: none !important;
}

/* Dark: Fluent webDarkTheme neutrals. The pane follows Excel's theme unless Settings chooses one. */
:root {
  /* Native scrollbars and form controls follow the theme (UI-29). */
  color-scheme: dark;
  --neutral-fg1: #ffffff;
  --neutral-fg2: #d6d6d6;
  --neutral-fg3: #adadad;
  --neutral-fg-disabled: #5c5c5c;
  --neutral-fg-on-brand: #ffffff;
  --neutral-bg-canvas: #1f1f1f;
  --neutral-bg1: #292929;
  --neutral-bg1-hover: #3d3d3d;
  --neutral-bg1-pressed: #1f1f1f;
  --neutral-bg2: #292929;
  --neutral-bg-disabled: #141414;
  --subtle-bg-hover: #383838;
  --subtle-bg-pressed: #2e2e2e;
  --neutral-stroke1: #666666;
  --neutral-stroke1-hover: #757575;
  --neutral-stroke2: #525252;
  --neutral-stroke3: #3d3d3d;
  --neutral-stroke-disabled: #424242;
  /* Excel's green: the single primary button, the selected tab, focus rings and the add icon only. */
  --brand-bg: #107c41;
  --brand-bg-hover: #0c6b37;
  --brand-bg-pressed: #0a5a2e;
  /* Brand text and strokes on dark use the lighter step (5:1 or more on the canvas and surface). */
  --brand-fg: #5fbf5f;
  --brand-stroke: #5fbf5f;
  --brand-tint-bg: rgba(95, 191, 95, 0.16);
  --focus-ring: #5fbf5f;
  /* Fluent status tokens. Deltas stay neutral (a fall is not always bad). */
  --status-danger-bg: #3b0509;
  --status-danger-stroke: #6e0811;
  --status-danger-fg: #eb8f92;
  --status-warning-bg: #4a1e04;
  --status-warning-stroke: #8a3707;
  --status-warning-fg: #faa06b;
  --status-success-bg: #052505;
  --status-success-stroke: #107c10;
  --status-success-fg: #5fbf5f;
  --shadow-4: 0 0 2px rgba(0, 0, 0, 0.24), 0 2px 4px rgba(0, 0, 0, 0.28);
  --shadow-16: 0 0 2px rgba(0, 0, 0, 0.24), 0 8px 16px rgba(0, 0, 0, 0.28);
  --shadow-64: 0 0 8px rgba(0, 0, 0, 0.24), 0 32px 64px rgba(0, 0, 0, 0.28);
  --scrim: rgba(0, 0, 0, 0.5);

  /* Aliases (the pane's older names). */
  --bg-primary: var(--neutral-bg-canvas);
  --bg-secondary: var(--neutral-bg2);
  --bg-tertiary: var(--neutral-bg1);
  --bg-elevated: var(--neutral-bg1-hover);
  --bg-surface: var(--neutral-bg1);
  --bg-card: var(--neutral-bg1);
  --bg-hover: var(--subtle-bg-hover);
  --border: 1px solid var(--neutral-stroke2);
  --border-subtle: 1px solid var(--neutral-stroke3);
  --border-color: var(--neutral-stroke2);
  --border-primary: var(--neutral-stroke2);
  --accent-indigo: var(--brand-bg);
  --accent-indigo-hover: var(--brand-bg-hover);
  --accent-indigo-glow: var(--brand-tint-bg);
  --accent-text: var(--brand-fg);
  --accent-green: var(--status-success-fg);
  --added-text: var(--status-success-fg);
  --accent-green-dim: var(--status-success-fg);
  --accent-green-glow: var(--status-success-bg);
  --accent-secondary: var(--brand-bg);
  --accent-secondary-hover: var(--brand-bg-hover);
  --text-primary: var(--neutral-fg1);
  --text-secondary: var(--neutral-fg2);
  --text-muted: var(--neutral-fg3);
  --error: var(--status-danger-fg);
  --error-bg: var(--status-danger-bg);
  --error-text: var(--status-danger-fg);
  --warning: var(--status-warning-fg);
  --warning-bg: var(--status-warning-bg);
  --warning-text: var(--status-warning-fg);
  --success: var(--status-success-fg);
  /* The changed part of a formula (N3a); muted text on these stays at 5:1 or more. */
  --mark-del-bg: rgba(220, 98, 109, 0.2);
  --mark-ins-bg: rgba(95, 191, 95, 0.16);
  /* The first run's picture (slice 8): the highlight on its changed cell. */
  --sample-mark-bg: rgba(250, 204, 21, 0.18);

  /* Look C (docs/ux/2026-10-22-look-c-colour-and-density.md): colour as signal, one meaning per colour. Green: a cell
     you can go to, something saved or added. Blue: a formula, a sent version, information. Orange: worth a look.
     Red: an Excel error, and nothing else. Purple: saved before an AI edit. Teal: a go-back point. Grey: automatic,
     cleared, optional. Deltas, body text and buttons stay neutral. */
  --c-cell: #6ccb6c;
  --c-old: #adadad;
  --c-new: #ffffff;
  --c-line: #4a4a4a;
  --c-green-fg: #6ccb6c;
  --c-green-bg: rgba(108, 203, 108, 0.14);
  --c-blue-fg: #8cc3f7;
  --c-blue-bg: rgba(71, 158, 245, 0.16);
  --c-orange-fg: #f8a26a;
  --c-orange-bg: rgba(247, 99, 12, 0.16);
  --c-orange-edge: #e3721f;
  --c-red-fg: #f4959a;
  --c-red-bg: rgba(209, 52, 56, 0.18);
  --c-red-edge: #e0464e;
  --c-purple-fg: #c8a7ef;
  --c-purple-bg: rgba(140, 92, 210, 0.2);
  --c-teal-fg: #57c4c4;
  --c-teal-bg: rgba(3, 131, 135, 0.2);
  --c-grey-fg: #c2c2c2;
  --c-grey-bg: rgba(255, 255, 255, 0.08);

  /* Type: Segoe UI Variable / Segoe UI, Fluent's ramp, compact since look C (owner, 2026-10-23: the larger sizes still
     looked text heavy): 12 px body, 13 px section headings, 16 px only for the first run's title. Mono only for cells
     and formulas. */
  --font-sans:
    "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue",
    sans-serif;
  --font-mono: "Cascadia Mono", Consolas, ui-monospace, monospace;
  --font-caption2: 10px;
  --font-caption1: 11px;
  --font-body-dense: 12px;
  --font-body1: 12px;
  --font-subtitle2: 13px;
  --font-title3: 16px;
  --font-size-base: 12px;
  --weight-regular: 400;
  --weight-semibold: 600;

  /* Corners: 2 px small, 4 px controls, 8 px dialogs and popovers. */
  --radius-sm: 2px;
  --radius: 4px;
  --radius-lg: 8px;

  /* Spacing (4px grid) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 10px;
  --space-4: 12px;
  --space-5: 16px;
  --space-6: 24px;

  /* Transitions */
  --transition-fast: 0.1s ease;
  --transition-normal: 0.15s ease;
}

/* Light: Fluent webLightTheme neutrals. */
[data-theme="light"] {
  color-scheme: light;
  --neutral-fg1: #242424;
  --neutral-fg2: #424242;
  --neutral-fg3: #616161;
  --neutral-fg-disabled: #bdbdbd;
  --neutral-bg-canvas: #fafafa;
  --neutral-bg1: #ffffff;
  --neutral-bg1-hover: #f5f5f5;
  --neutral-bg1-pressed: #e0e0e0;
  --neutral-bg2: #f5f5f5;
  --neutral-bg-disabled: #f0f0f0;
  --subtle-bg-hover: #f5f5f5;
  --subtle-bg-pressed: #e0e0e0;
  --neutral-stroke1: #d1d1d1;
  --neutral-stroke1-hover: #c7c7c7;
  --neutral-stroke2: #e0e0e0;
  --neutral-stroke3: #f0f0f0;
  --neutral-stroke-disabled: #e0e0e0;
  --brand-bg: #107c41;
  --brand-bg-hover: #0c6b37;
  --brand-bg-pressed: #0a5a2e;
  --brand-fg: #0e6e3a;
  --brand-stroke: #107c41;
  --brand-tint-bg: rgba(16, 124, 65, 0.08);
  --focus-ring: #107c41;
  --status-danger-bg: #fdf3f4;
  --status-danger-stroke: #eeacb2;
  --status-danger-fg: #b10e1c;
  --status-warning-bg: #fff9f5;
  --status-warning-stroke: #fdcfb4;
  --status-warning-fg: #bc4b09;
  --status-success-bg: #f1faf1;
  --status-success-stroke: #9fd89f;
  --status-success-fg: #0e700e;
  --shadow-4: 0 0 2px rgba(0, 0, 0, 0.12), 0 2px 4px rgba(0, 0, 0, 0.14);
  --shadow-16: 0 0 2px rgba(0, 0, 0, 0.12), 0 8px 16px rgba(0, 0, 0, 0.14);
  --shadow-64: 0 0 8px rgba(0, 0, 0, 0.12), 0 32px 64px rgba(0, 0, 0, 0.14);
  --scrim: rgba(0, 0, 0, 0.4);
  --mark-del-bg: rgba(177, 14, 28, 0.1);
  --mark-ins-bg: rgba(14, 112, 14, 0.1);
  --sample-mark-bg: rgba(250, 204, 21, 0.35);
  --c-cell: #0e6e3a;
  --c-old: #6b6b6b;
  --c-new: #1a1a1a;
  --c-line: #d6d6d6;
  --c-green-fg: #0b6a37;
  --c-green-bg: #e6f3ea;
  --c-blue-fg: #0f548c;
  --c-blue-bg: #e8f1fb;
  --c-orange-fg: #9a3b06;
  --c-orange-bg: #fdefe3;
  --c-orange-edge: #e3721f;
  --c-red-fg: #a4111e;
  --c-red-bg: #fbe9eb;
  --c-red-edge: #d13438;
  --c-purple-fg: #5c2e91;
  --c-purple-bg: #f1eaf9;
  --c-teal-fg: #00666d;
  --c-teal-bg: #e3f4f4;
  --c-grey-fg: #4f4f4f;
  --c-grey-bg: #efefef;
}

/* Badges whose words come in lower case ("value", "hardcoded") read in sentence case: labels are no longer
   UPPERCASE (slice 1); the words themselves change in the string table (slice 2). */
.change-type::first-letter,
.issue-card .issue-severity::first-letter,
.comparison-tag::first-letter,
.key-number-why-badge::first-letter,
.pr-status-badge::first-letter,
.stat-label::first-letter {
  text-transform: uppercase;
}

/* SVG Icon system */
.icon-svg {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  pointer-events: none;
}
.icon-8 {
  width: 8px;
  height: 8px;
}
.icon-12 {
  width: 12px;
  height: 12px;
}
.icon-14 {
  width: 14px;
  height: 14px;
}
.icon-16 {
  width: 16px;
  height: 16px;
}
.icon-24 {
  width: 24px;
  height: 24px;
}

/* A dialog's invisible end stops (focusGuard.js, UI-40): the keyboard reaching one goes to the dialog's other end. */
.focus-end {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  outline: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==================== Simple/Advanced Mode Toggle ==================== */

/* Mode toggle pill in pulse header */
.mode-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: 4px;
}
.mode-label {
  font-size: var(--font-caption1);
  color: var(--text-muted);
  font-weight: 400;
  user-select: none;
}
.mode-switch {
  position: relative;
  width: 30px;
  height: 17px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: 9px;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast);
}
.mode-switch:hover {
  border-color: var(--accent-indigo);
}
.mode-switch[aria-checked="true"] {
  background: var(--accent-indigo);
  border-color: var(--accent-indigo);
}
.mode-switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 11px;
  height: 11px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition:
    transform var(--transition-fast),
    background var(--transition-fast);
  pointer-events: none;
}
.mode-switch[aria-checked="true"] .mode-switch-thumb {
  transform: translateX(13px);
  background: var(--neutral-fg-on-brand);
}

/* Collaboration visibility */
[data-collab="false"] .collab-only {
  display: none !important;
}
/* Settings › Model checks off (look D): no Check tab, no New issues (on Changes and in Compare), no check profile. */
[data-checks="off"] .model-checks-only,
[data-checks="off"] .changes-problems:not(.own-edits) {
  display: none !important;
}
/* Settings › Model checks › Check my edits off (owner, 2026-11-30): no New issues on Changes or in Compare; the Check
   tab stays. */
[data-check-edits="off"] .changes-problems:not(.own-edits) {
  display: none !important;
}

[data-theme="light"] .theme-toggle {
  opacity: 0.7;
}

[data-theme="light"] .theme-toggle:hover {
  opacity: 1;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
  font-size: 13px;
  font-size: var(--font-body-dense);
  -webkit-font-smoothing: antialiased;
}

/* Controls take the pane's typeface: the browser's default made Settings' theme buttons Arial, and "Match Excel"
   wrapped at 320 px (E5, 2026-10-20). Sizes stay each control's own. */
button,
input,
select,
textarea {
  font-family: inherit;
}
/* Tick boxes and choices in the pane's green, not the browser's blue (two rules did it for some; E5). */
input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--accent-indigo);
}

.sheettrack-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-width: 0;
  min-height: 0;
  width: 100%;
}

@supports (height: 100dvh) {
  .sheettrack-container {
    height: 100dvh;
  }
}

/* boot.js's message when the pane cannot start (Plan 7 A6). Each colour and font is given plainly first,
   for Internet Explorer, which ignores var(). */
.start-problem {
  padding: 24px 16px;
  font-family:
    "Segoe UI",
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  font-family: var(--font-sans);
  color: #242424;
  color: var(--text-primary);
}

.start-problem-title {
  margin: 0 0 8px;
  font-size: 16px;
  font-size: var(--font-subtitle2);
  font-weight: 600;
  line-height: 1.35;
}

.start-problem-text {
  margin: 0 0 8px;
  font-size: 13px;
  font-size: var(--font-body-dense);
  line-height: 1.5;
  color: #424242;
  color: var(--text-secondary);
}

.start-problem-retry {
  margin-top: 8px;
}

/* boot.js's start watchdog (COR-101): this stylesheet has loaded, so the page can be drawn. */
:root {
  --sheettrack-styles: loaded;
}

/* While its "taking longer than usual" shows, the unstarted pane is hidden; it comes back if the pane starts. */
html[data-start-slow] body > :not(.start-main) {
  display: none !important;
}

.workspace-surface {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
}
/* History not shared: the notice alone, not cards of "Not available" (E5, run 76). */
.workspace-surface.history-not-shared > .surface-card {
  display: none;
}

.surface-card {
  background: var(--bg-surface);
  border: var(--border);
  border-radius: var(--radius);
  padding: 12px;
}

.surface-actions {
  display: flex;
  gap: 8px;
}

.surface-summary {
  font-size: var(--font-caption1);
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.audit-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.audit-metric-card {
  padding: 4px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.audit-metric-label {
  font-size: var(--font-caption1);
  color: var(--text-muted);
}

/* What scored the latest change risk, under it (F2 round 7, S18). */
.audit-metric-detail {
  font-size: var(--font-caption1);
  line-height: 1.35;
  color: var(--text-secondary);
}

.audit-metric-detail[hidden] {
  display: none;
}

/* Make … a Manager in the request window (F2 rounds 6 and 7, S18). */
.pr-reviewer-promote {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 2px 0 6px;
}

.pr-reviewer-promote[hidden] {
  display: none;
}

/* The review window's values under its Results line (F2 rounds 6 and 7, S18). */
.pr-outputs-values {
  margin-top: 6px;
}

.pr-outputs-values[hidden] {
  display: none;
}

/* ——— Pulse header ——— */
/* The header (redesign slice 3): the tabs on the left, the cloud status, Help and More on the right, 40 px. */
.pulse-header {
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 4px;
  height: 40px;
  padding: 0 4px 0 4px;
  background: var(--neutral-bg1);
  border-bottom: var(--border);
  flex-shrink: 0;
}

.pulse-left,
.pulse-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pulse-left {
  overflow: hidden;
  min-width: 0;
}

.pulse-right {
  flex-shrink: 0;
  min-width: 0;
  gap: 0;
}

.pulse-right .header-icon-btn {
  position: relative;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  color: var(--text-secondary);
}

.icon-20 {
  width: 20px;
  height: 20px;
}

/* The cloud's dot means only "not backed up" (section 10). */
.cloud-status-dot {
  position: absolute;
  top: 6px;
  right: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-warning-fg);
  box-shadow: 0 0 0 2px var(--neutral-bg1);
}

.cloud-status-dot[hidden] {
  display: none;
}

/* The Help and More menus and the cloud popover open under the header's right end. */
.header-menu,
.header-popover {
  position: absolute;
  top: 38px;
  right: 4px;
  z-index: 900;
  min-width: 200px;
  max-width: calc(100vw - 16px);
  padding: 4px;
  background: var(--neutral-bg1);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-16);
}

.header-menu[hidden],
.header-popover[hidden] {
  display: none;
}

.header-menu {
  display: flex;
  flex-direction: column;
}

.header-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 32px;
  padding: 0 8px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--font-body-dense);
  text-align: left;
  cursor: pointer;
}

.header-menu-item:hover,
.header-menu-item:focus-visible {
  background: var(--subtle-bg-hover);
}

.header-menu-item:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -2px;
}

.header-menu-item[aria-checked="true"]::after {
  content: "✓";
  color: var(--brand-fg);
}

.header-menu-keys {
  color: var(--text-muted);
  font-size: var(--font-caption1);
}

.header-popover {
  width: 288px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.header-popover[hidden] {
  display: none;
}

.header-popover-title {
  color: var(--text-primary);
  font-size: var(--font-body1);
  font-weight: 600;
}

.header-popover-text {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--font-caption1);
  line-height: 16px;
}

.header-popover-actions {
  display: flex;
  gap: 8px;
}

.header-popover .btn-link {
  align-self: flex-start;
  padding: 0;
}

/* History's empty state, and its Auto versions line (slice 3). */
.history-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-3);
  padding: var(--space-6) var(--space-4);
  color: var(--text-secondary);
}

.history-empty[hidden] {
  display: none;
}

.history-empty strong {
  color: var(--text-primary);
}

.history-empty p {
  margin: 0;
}

.history-empty-icon {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
}

.history-auto-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin: 12px 0 0;
}

.history-auto-line[hidden] {
  display: none;
}

/* Team's two views, under the header while Team is open. */
.team-views {
  display: flex;
  gap: 4px;
  padding: 8px 12px 0;
  flex-shrink: 0;
}

.team-views[hidden] {
  display: none;
}

.team-view-btn {
  min-height: 28px;
  padding: 0 10px;
  border: var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: var(--font-caption1);
  cursor: pointer;
}

.team-view-btn[aria-pressed="true"] {
  color: var(--text-primary);
  font-weight: 600;
  border-color: var(--brand-stroke);
  background: var(--brand-tint-bg);
}

.team-view-btn:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.surface-empty {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  color: var(--text-secondary);
  font-size: var(--font-caption1);
  line-height: 16px;
  background: var(--neutral-bg1);
  border: var(--border);
  border-radius: var(--radius);
}

.surface-empty[hidden] {
  display: none;
}

.surface-empty strong {
  color: var(--text-primary);
}

.pulse-brand {
  margin: 0;
  line-height: inherit;
  color: var(--text-primary);
  font-size: var(--font-caption1);
  font-weight: 600;
  letter-spacing: 0;
  white-space: nowrap;
}

.header-icon-btn,
.theme-toggle {
  background: none;
  border: none;
  padding: 2px 6px;
  margin: 0;
  margin-left: 4px;
  font-size: var(--font-body1);
  cursor: pointer;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    color var(--transition-fast),
    background-color var(--transition-fast);
}

.header-icon-btn:hover,
.theme-toggle:hover {
  color: var(--text-primary);
  background: var(--subtle-bg-hover);
}

.header-icon-btn:active,
.theme-toggle:active {
  background: var(--subtle-bg-pressed);
}

/* ——— Tabs ——— */
/* The tabs and their panels: the pane's main landmark. */
.pane-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
}

.tabs {
  display: flex;
  min-width: 0;
  overflow: hidden;
}

.tab-button {
  flex: 0 1 auto;
  min-width: 0;
  padding: 0 8px;
  white-space: nowrap;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: var(--font-body-dense);
  font-weight: 400;
  transition:
    color var(--transition-fast),
    background-color var(--transition-fast);
  border-bottom: 2px solid transparent;
}

.tab-button:hover {
  color: var(--text-primary);
  border-bottom-color: var(--neutral-stroke1);
}

.tab-button:focus-visible,
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-icon:focus-visible,
.header-icon-btn:focus-visible,
.modal-close:focus-visible,
.command-result-item:focus-visible,
.settings-acc-btn:focus-visible,
.settings-help-item:focus-visible,
.settings-switch:focus-visible,
.filter-btn:focus-visible,
/* Scrollable Team lists reached by the keyboard (axe scrollable-region-focusable, F2 round 6). */
#audit-events-list:focus-visible,
#pr-detail-comments:focus-visible,
#comment-thread:focus-visible,
.changes-problem-cell:focus-visible,
.changes-problem-more:focus-visible,
.changes-problem-undo:focus-visible,
.changes-problem-mark:focus-visible,
.changes-problems-intended-toggle:focus-visible,
.changes-problems-summary:focus-visible,
.key-number-go:focus-visible,
.key-numbers-watch:focus-visible,
.key-number-suggest-check:focus-visible,
.key-number-action:focus-visible,
.key-numbers-more:focus-visible,
.key-number-why-summary:focus-visible,
.key-number-why-item:focus-visible,
.key-number-why-more:focus-visible,
.diff-watch-btn:focus-visible,
.key-number-remove:focus-visible,
#key-number-use:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.tab-button.active {
  color: var(--text-primary);
  font-weight: 600;
  border-bottom-color: var(--brand-stroke);
}

/* Tabs and the header's buttons draw their focus ring inside, as Fluent's do: outside, the header's edge cut it off. */
.tab-button:focus-visible,
.pulse-right .header-icon-btn:focus-visible,
.settings-acc-btn:focus-visible,
.settings-view-bar .header-icon-btn:focus-visible {
  outline-offset: -2px;
}

.tab-icon {
  font-size: var(--font-caption1);
  opacity: 0.9;
}

/* ——— Command palette hint & input ——— */
/* Command hint now embedded in results header as a kbd pill */
.command-hint-kbd {
  font-family: var(--font-mono);
  font-size: var(--font-caption2);
  padding: 2px 6px;
  background: var(--bg-tertiary);
  border: var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  display: none; /* shown after first analysis via JS */
}
.command-hint-kbd:hover {
  color: var(--text-secondary);
}

.command-input {
  display: none;
  width: 100%;
  padding: 8px 12px;
  margin: 0;
  border: none;
  border-bottom: var(--border);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--font-body-dense);
  outline: none;
}

.command-input::placeholder {
  color: var(--text-muted);
}

.command-input.visible {
  display: block;
}

/* ——— Tab content ——— */
.tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  min-height: 0;
  position: relative;
}

.tab-content.active {
  display: flex;
  flex-direction: column;
}

/* ——— Buttons ——— */
.btn-primary,
.btn-secondary,
.btn-subtle,
.btn-transparent {
  min-height: 32px;
  padding: 5px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: var(--font-body-dense);
  line-height: 20px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition:
    background-color var(--transition-normal),
    border-color var(--transition-normal),
    color var(--transition-normal);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
}

.btn-primary {
  background: var(--brand-bg);
  color: var(--neutral-fg-on-brand);
  border-color: transparent;
}

.btn-primary:hover {
  background: var(--brand-bg-hover);
}

.btn-primary:active {
  background: var(--brand-bg-pressed);
}

.btn-primary:disabled,
.btn-subtle:disabled,
.btn-transparent:disabled {
  background: var(--neutral-bg-disabled);
  color: var(--neutral-fg-disabled);
  border-color: var(--neutral-stroke-disabled);
  cursor: not-allowed;
}

.btn-subtle,
.btn-transparent {
  width: auto;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 400;
}

.btn-subtle:hover {
  background: var(--subtle-bg-hover);
  color: var(--text-primary);
}

.btn-subtle:active {
  background: var(--subtle-bg-pressed);
}

.btn-transparent:hover {
  color: var(--brand-fg);
}

/* Busy with the keyboard on it (setButtonBusy, E4): looks unavailable, its focus ring kept readable. */
.btn-primary[data-busy="true"],
.btn-secondary[data-busy="true"] {
  opacity: 0.7;
  cursor: progress;
}

.btn-secondary {
  background: var(--neutral-bg1);
  color: var(--text-primary);
  border-color: var(--neutral-stroke1);
}

.btn-secondary:hover {
  background: var(--neutral-bg1-hover);
  border-color: var(--neutral-stroke1-hover);
}

.btn-secondary:active {
  background: var(--neutral-bg1-pressed);
}

/* A disabled secondary button looks it, as a primary one does (F2 round 7, S18: Request Changes looked clickable
   beside a greyed Approve). */
.btn-secondary:disabled,
.btn-secondary:disabled:hover {
  background: var(--neutral-bg-disabled);
  color: var(--neutral-fg-disabled);
  border-color: var(--neutral-stroke-disabled);
  cursor: not-allowed;
}

.btn-small {
  min-height: 24px;
  padding: 1px 8px;
  font-size: var(--font-caption1);
  line-height: 16px;
}

.btn-icon {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: var(--font-body1);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius);
  transition:
    background-color var(--transition-fast),
    color var(--transition-fast);
}

.btn-icon:hover {
  background: var(--subtle-bg-hover);
  color: var(--text-primary);
}

.btn-icon:active {
  background: var(--subtle-bg-pressed);
}

.btn-primary .btn-icon,
.btn-secondary .btn-icon {
  border: none;
  background: none;
  padding: 0;
  color: inherit;
}

.btn-primary .btn-icon:hover,
.btn-secondary .btn-icon:hover {
  background: none;
  color: inherit;
}

/* ——— Quick actions ——— */
.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

/* ——— Loading ——— */
.loading {
  text-align: center;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* Overlay positioning to prevent layout shift */
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  background: var(--bg-secondary);
  opacity: 0.92;
}

.spinner {
  border: 2px solid var(--bg-elevated);
  border-top-color: var(--accent-indigo);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  animation: spin 0.7s linear infinite;
  margin-bottom: 10px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading p {
  color: var(--text-muted);
  font-size: var(--font-caption1);
}

/* ——— Statistics ——— */
.statistics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.stat-box {
  padding: 10px 12px;
  border-radius: var(--radius);
  border: var(--border-subtle);
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.stat-box:hover {
  border-color: var(--neutral-stroke1-hover);
}

.stat-total .stat-number {
  color: var(--text-primary);
}
.stat-errors .stat-number {
  color: var(--error-text);
}
.stat-warnings .stat-number {
  color: var(--warning-text);
}
.stat-health .stat-number {
  color: var(--accent-green);
}

.stat-number {
  font-family: var(--font-mono);
  font-size: 1.25em;
  font-weight: 600;
}

.stat-label {
  font-size: var(--font-caption2);
  color: var(--text-muted);
}

/* ——— Results & issue cards (code-snippet style) ——— */
.results-container {
  background: var(--bg-secondary);
  border: var(--border-subtle);
  border-radius: var(--radius);
  padding: 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: var(--border-subtle);
}

.results-header h2,
.results-header h3 {
  font-size: var(--font-body1);
  font-weight: 600;
  color: var(--text-primary);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-buttons {
  display: flex;
  gap: 4px;
}

.filter-btn {
  padding: 4px 8px;
  border: var(--border-subtle);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-size: var(--font-caption1);
  font-family: var(--font-sans);
  cursor: pointer;
  transition:
    background-color var(--transition-fast),
    color var(--transition-fast),
    border-color var(--transition-fast);
}

.filter-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.filter-btn.active {
  background: var(--accent-indigo-glow);
  color: var(--accent-text);
  border-color: var(--accent-indigo);
}

.linter-filter-summary {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--font-caption1);
  line-height: 1.5;
}

.issues-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Analyze uses the tab as its single scroll owner. Nested flex scrolling made
   the issue list collapse to a filter-only sliver in short Excel windows. */
#check-tab .results-container {
  flex: 0 0 auto;
  min-height: auto;
}

#check-tab .issues-list {
  flex: none;
  overflow: visible;
}

#check-tab .results-header {
  position: sticky;
  top: -12px;
  z-index: 4;
  background: var(--bg-secondary);
}

/* Issue card = code-snippet look, hover glow */
.issue-card {
  padding: 10px 12px;
  border-radius: var(--radius);
  border: var(--border-subtle);
  background: var(--bg-tertiary);
  cursor: pointer;
  transition:
    border-color var(--transition-normal),
    box-shadow var(--transition-normal),
    background-color var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.issue-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 2px 0 0 2px;
  transition: box-shadow var(--transition-normal);
}

.issue-card:hover {
  border-color: var(--neutral-stroke1-hover);
  background: var(--neutral-bg1-hover);
}

.issue-card.error::before {
  background: var(--error);
}

.issue-card.warning::before {
  background: var(--warning);
}

.issue-card .issue-location {
  font-family: var(--font-mono);
  font-size: var(--font-caption1);
  font-weight: 600;
  color: var(--accent-text);
  margin-bottom: 4px;
}

.issue-card .issue-severity {
  display: inline-block;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: var(--font-caption2);
  font-weight: 600;
  margin-bottom: 6px;
}

.issue-card .issue-severity.error {
  background: var(--error-bg);
  color: var(--error-text);
}

.issue-card .issue-severity.warning {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.issue-card .issue-message {
  color: var(--text-secondary);
  font-size: var(--font-caption1);
  margin-bottom: 6px;
  line-height: 1.4;
}

.issue-card .issue-snippet {
  font-family: var(--font-mono);
  font-size: var(--font-caption1);
  color: var(--text-muted);
  padding: 8px 10px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  border: var(--border-subtle);
  word-break: break-all;
  line-height: 1.4;
}

/* Legacy .issue-item support (if JS still uses it) */
.issue-item {
  padding: 10px 12px;
  border-radius: var(--radius);
  border: var(--border-subtle);
  background: var(--bg-tertiary);
  cursor: pointer;
  transition:
    border-color var(--transition-normal),
    box-shadow var(--transition-normal);
  border-left: 3px solid var(--text-muted);
}

.issue-item:hover {
  background: var(--neutral-bg1-hover);
}

.issue-item.error {
  border-left-color: var(--error);
}
.issue-item.warning {
  border-left-color: var(--warning);
}

.issue-location {
  font-family: var(--font-mono);
  font-size: var(--font-caption1);
  color: var(--accent-text);
  margin-bottom: 4px;
}
.issue-severity.error {
  background: var(--error-bg);
  color: var(--error-text);
}
.issue-severity.warning {
  background: var(--warning-bg);
  color: var(--warning-text);
}
.issue-message {
  color: var(--text-secondary);
  font-size: var(--font-caption1);
  margin: 4px 0;
}
.issue-snippet {
  font-family: var(--font-mono);
  font-size: var(--font-caption1);
  color: var(--text-muted);
  padding: 6px 8px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  margin-top: 6px;
}

/* ——— No issues (Matrix Green success) ——— */
.no-issues {
  text-align: center;
  padding: 32px 16px;
  background: var(--bg-secondary);
  border: var(--border-subtle);
  border-radius: var(--radius);
}

.no-issues .success-icon {
  color: var(--accent-green);
  margin-bottom: 8px;
  display: block;
}

.no-issues h2,
.no-issues h3 {
  color: var(--accent-green);
  font-size: var(--font-body1);
  font-weight: 600;
  margin-bottom: 4px;
}

.no-issues p {
  color: var(--text-muted);
  font-size: var(--font-caption1);
}

/* ——— Error message ——— */
.error-message {
  background: var(--error-bg);
  color: var(--error-text);
  padding: 10px 12px;
  border-radius: var(--radius);
  border: var(--border-subtle);
  border-left: 3px solid var(--error);
  font-size: var(--font-caption1);
  margin-bottom: 12px;
}

/* ——— Success message ——— */
.success-message {
  background: var(--status-success-bg);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--status-success-stroke);
  font-size: var(--font-caption1);
  margin-bottom: 12px;
}

/* ——— Version Control ——— */
.repo-status {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.repo-status > div {
  margin-bottom: 12px;
}

.init-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.init-buttons .btn-small {
  flex: 1;
  min-width: 0;
}

/* Cloud auth prompt and badge */
.cloud-connected-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-secondary);
  border-radius: 6px;
  font-size: var(--font-caption1);
  margin-bottom: 12px;
}

.autogit-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.autogit-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: var(--font-caption1);
  color: var(--text-secondary);
}

.autogit-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  opacity: 0;
  pointer-events: none;
}

.autogit-slider {
  width: 30px;
  height: 16px;
  border-radius: 999px;
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--neutral-fg3);
  position: relative;
  transition: background-color var(--transition-fast);
}

.autogit-slider::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--neutral-fg3);
  transition:
    transform var(--transition-fast),
    background-color var(--transition-fast);
}

.autogit-toggle input:checked + .autogit-slider {
  background: var(--brand-bg);
  box-shadow: none;
}

.autogit-toggle input:focus-visible + .autogit-slider {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
}

.autogit-toggle input:checked + .autogit-slider::before {
  transform: translateX(14px);
  background: var(--neutral-fg-on-brand);
}

.autogit-label {
  font-weight: 400;
  font-size: var(--font-caption2);
}

.section-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
}

.indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background-color var(--transition-normal);
}

.status-indicator.active .indicator-dot {
  background: var(--accent-green);
}

.changes-section,
.history-section {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.history-section {
  flex: 1;
}

/* Let the Changes and History tabs scroll as one surface. Nested flex scrollers can
   collapse baseline warnings and version history to zero in a short pane (and squashed
   a comparison under Activity once History became its own tab, slice 3). */
#versions-tab > *,
#history-tab > * {
  flex-shrink: 0;
}

#versions-tab .history-section,
#history-tab .history-section {
  flex: none;
}

#versions-tab .changes-list,
#history-tab .history-timeline {
  flex: none;
  min-height: auto;
  overflow-y: visible;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: var(--border-subtle);
}

.section-header {
  gap: 8px;
}

.section-header h2,
.section-header h3 {
  font-size: var(--font-body1);
  font-weight: 600;
  color: var(--text-primary);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-header .btn-secondary,
.section-header .btn-icon {
  flex-shrink: 0;
  width: auto;
}

.changes-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

/* history-list is the legacy card view — history-timeline is the active UI */
.history-list {
  display: none !important;
}

/* Where this workbook's history is kept (N2), under the Version History heading. */
.history-place {
  margin: 0 0 6px;
}

.diff-base-select {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  font-size: var(--font-caption1);
}

/* Inline text-level diff spans (xltrail style) */
.diff-inline-del {
  background: var(--mark-del-bg);
  color: var(--status-danger-fg);
  padding: 2px;
  border-radius: 2px;
}

.diff-inline-ins {
  background: var(--mark-ins-bg);
  color: var(--status-success-fg);
  padding: 2px;
  border-radius: 2px;
}

.diff-cells-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 8px;
}

.diff-cell-item {
  font-family: var(--font-mono);
  font-size: var(--font-caption1);
  max-width: 100%;
  overflow-wrap: break-word;
}

.diff-cell-item .cell-loc {
  color: var(--text-muted);
  margin-bottom: 2px;
}

.diff-cell-item .cell-content {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 4px;
}

.commit-diff-summary {
  padding: 8px 10px;
  margin-bottom: 8px;
  border-radius: var(--radius);
  border: var(--border-subtle);
  background: var(--bg-tertiary);
  font-size: var(--font-caption1);
  color: var(--text-secondary);
}

.commit-diff-summary strong {
  color: var(--text-primary);
}

.commit-diff-summary .summary-metrics {
  margin-bottom: 4px;
}

.commit-diff-summary .summary-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
}

.commit-diff-summary .summary-item {
  cursor: pointer;
  text-decoration: underline;
}

/* Diff summary grid: cells/columns count and lists */
/* A comparison sits on the pane, not in a box: its key numbers and issues are the cards (no card in a card). */
.comparison-panel {
  padding: 4px 0 0;
  border: none;
  background: transparent;
}
.comparison-header,
.comparison-legend,
.comparison-filters,
.comparison-paging {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.comparison-header strong {
  font-size: var(--font-body-dense);
}
.comparison-close {
  background: none;
  border: 0;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: var(--font-title3);
}
/* Copy summary sits beside the close button (N8a). */
.comparison-copy {
  margin-left: auto;
  min-height: 24px;
  font-size: var(--font-caption1);
  color: var(--text-secondary);
}
.comparison-copy:hover,
.comparison-copy:focus-visible {
  color: var(--text-primary);
}
/* A comparison with the open workbook after the workbook changed (F2): said at its top, with Compare again. */
.comparison-stale {
  margin: 8px 0;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--warning-bg);
  color: var(--text-primary);
  font-size: var(--font-caption1);
  line-height: 1.4;
}
.comparison-stale .btn-link {
  min-height: 24px;
  padding: 0;
}
/* New problems in a comparison sit under its direction line, as at the top of Changes. */
.comparison-panel > .changes-problems {
  margin-bottom: 10px;
}
.comparison-direction {
  margin: 4px 0 10px;
  font-size: var(--font-caption1);
  overflow-wrap: anywhere;
}
.comparison-legend {
  flex-wrap: wrap;
  justify-content: flex-start;
  font-size: var(--font-caption2);
  margin-bottom: 10px;
}
.comparison-legend span {
  padding: 3px 5px;
  border-radius: 4px;
}
.comparison-added {
  --diff-color: var(--status-success-fg);
  --diff-bg: var(--status-success-bg);
}
.comparison-deleted {
  --diff-color: var(--status-danger-fg);
  --diff-bg: var(--status-danger-bg);
}
.comparison-modified {
  --diff-color: var(--status-warning-fg);
  --diff-bg: var(--status-warning-bg);
}
.comparison-mixed {
  --diff-color: var(--text-secondary);
  --diff-bg: var(--neutral-bg2);
}
.comparison-legend span {
  color: var(--diff-color);
  background: var(--diff-bg);
}
/* What moved, and Show all (N3b). */
.comparison-moves {
  margin: 6px 0;
  padding: 6px 8px;
  font-size: var(--font-caption1);
  line-height: 1.4;
  color: var(--text-primary);
  background: var(--accent-indigo-glow);
  border-radius: var(--radius-sm);
  overflow-wrap: anywhere;
}
.comparison-moves p {
  margin: 0 0 4px;
}
/* A cell's row and column names under its address (N3b). */
.comparison-row span.comparison-label {
  display: block;
  font-size: var(--font-caption2);
  font-weight: 400;
  white-space: normal;
}
.comparison-note,
.comparison-status {
  font-size: var(--font-caption2);
  line-height: 1.5;
  color: var(--text-secondary);
  margin: 6px 0;
}
.comparison-status:empty {
  display: none;
}
.comparison-filters {
  margin: 12px 0 8px;
}
.comparison-filters select {
  min-width: 0;
  width: 50%;
  padding: 5px;
  font: inherit;
  font-size: var(--font-caption1);
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
}
.comparison-map-caption {
  font-size: var(--font-caption2);
  margin-bottom: 4px;
  overflow-wrap: anywhere;
}
.comparison-map-grid {
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  gap: 2px;
  margin: 6px 0 12px;
}
.comparison-map-empty,
.comparison-map-tile {
  height: 8px;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 1px;
  background: var(--border-color);
}
.comparison-map-tile {
  background: var(--diff-color);
  cursor: pointer;
}
.comparison-map-tile.comparison-added {
  background: var(--status-success-fg);
}
.comparison-map-tile.comparison-deleted {
  background: var(--status-danger-fg);
}
.comparison-map-tile.comparison-modified {
  background: var(--status-warning-fg);
}
.comparison-table-head,
.comparison-row {
  display: grid;
  grid-template-columns: minmax(46px, 0.7fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px;
  width: 100%;
  text-align: left;
}
.comparison-table-head {
  font-size: var(--font-caption2);
  padding: 5px 7px;
  box-sizing: border-box;
  color: var(--text-secondary);
}
.comparison-row {
  font: inherit;
  font-size: var(--font-caption1);
  color: var(--text-primary);
  background: transparent;
  border: 0;
  border-left: 3px solid var(--diff-color);
  border-bottom: 1px solid var(--border-color);
  padding: 7px 5px;
  cursor: pointer;
}
.comparison-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.comparison-row span:first-child {
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.comparison-row[aria-pressed="true"] {
  background: var(--diff-bg);
  color: var(--text-primary);
}
.comparison-row[aria-pressed="true"] span:not(:first-child) {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 140px;
  overflow: auto;
}
/* Compare cells (N3a): the part around a change on one line, the whole value once the row is chosen; screen
   readers always read the whole value. */
.comparison-row span.comparison-clip {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  white-space: normal;
  overflow-wrap: anywhere;
  overflow: hidden;
}
.comparison-row:not([aria-pressed="true"]) span.comparison-full {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.comparison-row[aria-pressed="true"] span.comparison-clip {
  display: none;
}
/* A Before or After value gets two lines before it is cut, as an edited formula's does ("(22,500) · =-Inp…" stopped
   at one at 320 px, E5, 2026-10-20). */
.comparison-row:not([aria-pressed="true"])
  > span:not(:first-child):not(.sr-only):not(.comparison-full) {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  white-space: normal;
  overflow-wrap: anywhere;
}
.comparison-list {
  max-height: 290px;
  overflow-y: auto;
}
.comparison-paging {
  margin: 8px 0;
  font-size: var(--font-caption2);
}
.comparison-paging button {
  margin: 0;
  font-size: var(--font-caption2);
  padding: 4px 6px;
}
.diff-summary-grid {
  display: flex;
  flex-direction: column;
  gap: 6px 0;
  margin-bottom: 8px;
  position: relative;
}

.diff-summary-close {
  position: absolute;
  top: -2px;
  right: -2px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: var(--font-subtitle2);
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition:
    color var(--transition-fast),
    background-color var(--transition-fast);
}

.diff-summary-close:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.diff-summary-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-height: 0;
}

.diff-summary-row.diff-summary-full {
  flex-wrap: wrap;
  align-items: flex-start;
}

.diff-summary-label {
  flex-shrink: 0;
  font-size: var(--font-caption1);
  font-weight: 600;
  color: var(--text-muted);
  min-width: 100px;
}

.diff-summary-value {
  font-size: var(--font-caption1);
  color: var(--text-primary);
  word-break: break-word;
}

.diff-summary-value.diff-summary-list {
  flex: 1;
  font-family: var(--font-mono);
  font-size: var(--font-caption2);
}

.diff-summary-cells {
  overflow-wrap: anywhere;
}

.diff-clear-btn {
  margin-top: 8px;
  padding: 6px 10px;
  border: var(--border-subtle);
  border-radius: var(--radius);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: var(--font-caption1);
  font-family: var(--font-sans);
  cursor: pointer;
  transition:
    background-color var(--transition-fast),
    color var(--transition-fast);
  align-self: flex-start;
}

.diff-clear-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.change-item,
.history-item {
  padding: 10px 12px;
  margin-bottom: 6px;
  background: var(--bg-tertiary);
  border: var(--border-subtle);
  border-radius: var(--radius);
  cursor: pointer;
  transition:
    background-color var(--transition-fast),
    border-color var(--transition-fast);
}

.change-item:hover,
.history-item:hover {
  background: var(--bg-elevated);
  border-color: var(--neutral-stroke1-hover);
}

.change-cell {
  font-family: var(--font-mono);
  font-size: var(--font-caption1);
  font-weight: 600;
  color: var(--accent-text);
  margin-bottom: 4px;
}

.change-type {
  display: inline-block;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: var(--font-caption2);
  font-weight: 600;
  margin-right: 6px;
}

.change-type.added {
  background: var(--status-success-bg);
  color: var(--added-text);
}
.change-type.modified {
  background: var(--warning-bg);
  color: var(--warning-text);
}
.change-type.deleted {
  background: var(--error-bg);
  color: var(--error-text);
}

.change-value {
  font-size: var(--font-caption1);
  color: var(--text-muted);
  margin-top: 4px;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 20px 12px;
  font-size: var(--font-caption1);
}

.commit-section {
  margin-top: 10px;
  padding-top: 10px;
  border-top: var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.commit-input {
  padding: 8px 10px;
  border: var(--border-subtle);
  border-radius: var(--radius);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--font-caption1);
  outline: none;
  transition: border-color var(--transition-fast);
}

.commit-input:focus {
  border-color: var(--accent-indigo);
}

.commit-input::placeholder {
  color: var(--text-muted);
}

.history-info {
  flex: 1;
}
.history-hash {
  font-family: var(--font-mono);
  font-size: var(--font-caption2);
  color: var(--text-muted);
  margin-bottom: 2px;
}
.history-message {
  font-weight: 600;
  color: var(--text-primary);
  font-size: var(--font-caption1);
  margin-bottom: 2px;
}
.history-date {
  font-size: var(--font-caption1);
  color: var(--text-muted);
}
.history-actions {
  display: flex;
  gap: 4px;
}
.history-btn {
  padding: 4px 8px;
  border: var(--border-subtle);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-size: var(--font-caption1);
  font-family: var(--font-sans);
  cursor: pointer;
  transition:
    background-color var(--transition-fast),
    color var(--transition-fast);
}
.history-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

/* ——— Diff modal + minimap ——— */
.modal {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: var(--neutral-bg1);
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 560px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-64);
}

.modal-diff .modal-header {
  padding: 10px 12px;
  border-bottom: var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Dialog titles are Subtitle2 (spec section 6; slice 9). */
.modal-header h2,
.modal-header h3 {
  font-size: var(--font-subtitle2);
  line-height: 22px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: var(--font-title3);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: var(--radius);
  transition:
    background-color var(--transition-fast),
    color var(--transition-fast);
}

.modal-close:hover {
  background: var(--subtle-bg-hover);
  color: var(--text-primary);
}

.modal-settings .modal-header {
  padding: 10px 12px;
  border-bottom: var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-settings .modal-body {
  padding: 12px;
  overflow-y: auto;
  max-height: 60vh;
}

/* A Fluent Dialog (spec 4.7; slice 9): no rules between its title, body and buttons, 16 px gutters. */
.modal-confirm .modal-header {
  padding: 12px 8px 4px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.confirm-message {
  padding: 8px 16px;
  margin: 0;
  font-size: var(--font-body-dense);
  color: var(--text-primary);
  white-space: pre-line;
}

#confirm-modal-message {
  min-height: 0;
  overflow-y: auto;
  overflow-wrap: anywhere;
}

.modal-confirm .modal-header,
.modal-confirm .confirm-actions {
  flex-shrink: 0;
}

/* Right-aligned and side by side, the primary first, at every width (spec 4.7); a long row wraps. */
.confirm-actions {
  padding: 12px 16px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.confirm-actions .btn-primary,
.confirm-actions .btn-secondary {
  width: auto;
}

/* A confirmation can be asked from Settings, so it sits above the other dialogs (UI-36). */
#confirm-modal {
  z-index: 1100;
}

/* A question with answers or a reason scrolls as a whole, its title and buttons kept in view (round 4, S13). */
.modal-content.modal-confirm.confirm-has-form {
  overflow-y: auto;
}

.modal-confirm.confirm-has-form #confirm-modal-message {
  flex-shrink: 0;
  overflow: visible;
}

.modal-confirm.confirm-has-form .modal-header,
.modal-confirm.confirm-has-form .confirm-actions {
  position: sticky;
  z-index: 1;
  /* The dialog's own surface: no grey bands above and below (slice 9). */
  background: var(--neutral-bg1);
}

.modal-confirm.confirm-has-form .modal-header {
  top: 0;
}

.modal-confirm.confirm-has-form .confirm-actions {
  bottom: 0;
}

.modal-confirm .issue-review-field {
  margin: 8px 16px;
}

/* Which findings Accept takes: this one, or the same check's findings in its column or row (round 4, S13). */
.confirm-scope {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  margin: 0 12px;
  padding: 0;
  border: 0;
  flex-shrink: 0;
}

.confirm-scope-legend {
  margin-bottom: 4px;
  padding: 0;
  font-size: var(--font-caption1);
  font-weight: 600;
  color: var(--text-secondary);
}

.confirm-scope-choice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 8px;
  align-items: start;
  min-height: 32px;
  padding: 6px 8px;
  border: var(--border);
  border-radius: var(--radius);
  font-size: var(--font-body-dense);
  color: var(--text-primary);
  cursor: pointer;
}

.confirm-scope-choice:has(input:checked) {
  border-color: var(--accent-indigo);
  background: var(--bg-tertiary);
}

.confirm-scope-choice input {
  margin: 2px 0 0;
  accent-color: var(--accent-indigo);
}

.confirm-scope-label {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.confirm-scope-hint {
  grid-column: 2;
  font-size: var(--font-caption1);
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

/* Answers listed one per line, each with what it means (the copy question, N13). */
.confirm-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 12px 12px;
  flex-shrink: 0;
}

.confirm-choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: var(--border);
  border-radius: var(--radius);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  text-align: left;
  cursor: pointer;
  transition: background-color var(--transition-normal);
}

.confirm-choice:hover {
  background: var(--bg-elevated);
}

.confirm-choice:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.confirm-choice-label {
  font-size: var(--font-body-dense);
  font-weight: 600;
}

.confirm-choice-hint {
  font-size: var(--font-caption1);
  color: var(--text-muted);
}

.diff-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* Mini-map: grid-dot pattern for changed ranges */
.diff-minimap {
  width: 80px;
  min-width: 80px;
  border-right: var(--border);
  background: var(--bg-primary);
  padding: 8px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.diff-minimap-grid {
  display: grid;
  gap: 2px;
  grid-template-columns: repeat(var(--cols, 10), 4px);
  grid-template-rows: repeat(var(--rows, 10), 4px);
}

.diff-minimap-cell {
  width: 4px;
  height: 4px;
  border-radius: 1px;
  background: var(--bg-tertiary);
  transition: background-color var(--transition-fast);
}

.diff-minimap-cell.changed {
  background: var(--accent-indigo);
}

.diff-minimap-cell.added {
  background: var(--accent-green);
}

.diff-minimap-cell.removed {
  background: var(--error);
}

.diff-content {
  padding: 12px;
  overflow-y: auto;
  flex: 1;
}

.diff-cell {
  margin-bottom: 12px;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border: var(--border-subtle);
  border-radius: var(--radius);
}

.typed-diff-details {
  min-width: 0;
  width: 100%;
  grid-column: 1 / -1;
}

.typed-diff-details summary {
  cursor: pointer;
  margin-bottom: 8px;
}

.typed-diff-details .diff-cell {
  min-width: 0;
  overflow-wrap: anywhere;
}

.diff-old,
.diff-new {
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.diff-old.diff-formula,
.diff-new.diff-formula {
  word-break: break-all;
}

.diff-cell-header {
  font-family: var(--font-mono);
  font-size: var(--font-caption1);
  font-weight: 600;
  color: var(--accent-text);
  margin-bottom: 8px;
}

.diff-label {
  font-size: var(--font-caption2);
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

/* A side named after a version keeps its name as written ("In “v6 after the client call”", "Now"). */
.diff-label--named {
  font-size: var(--font-caption1);
  text-transform: none;
  letter-spacing: 0;
}

.diff-old,
.diff-new {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: var(--font-caption1);
  border: var(--border-subtle);
}

.diff-old {
  background: var(--error-bg);
  color: var(--error-text);
}

.diff-new {
  background: var(--status-success-bg);
  /* UI-23: #22c55e measured 1.98:1 here in the light theme; the text accent is 5:1 or more in both. */
  color: var(--accent-text);
}

/* ——— Settings ——— */
.settings-section {
  padding: 12px 0;
  border-bottom: var(--border-subtle);
}

.settings-heading {
  font-size: var(--font-caption1);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.settings-label {
  font-size: var(--font-caption1);
  color: var(--text-primary);
  flex-shrink: 0;
}

.settings-select {
  flex: 1;
  max-width: 220px;
  padding: 6px 10px;
  border: var(--border-subtle);
  border-radius: var(--radius);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--font-caption1);
  outline: none;
  transition: border-color var(--transition-fast);
}

.settings-select:focus {
  border-color: var(--accent-indigo);
}

/* Text fields and lists show where the keyboard is with a ring like the buttons', not only a 1 px border colour (E4).
   The accent text colour keeps it at 3:1 or more on every background in both themes. */
.commit-input:focus-visible,
.settings-select:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
}

.command-input:focus-visible {
  box-shadow: inset 0 0 0 2px var(--accent-text);
}
/* The request window's reviewer list: chosen names stay marked once the keyboard leaves it, where the browser's own
   grey was hard to see (F2 round 9, S18's preparer). A gradient, as list boxes ignore a plain background colour. */
#pr-target-branch option:checked {
  background: var(--brand-bg) linear-gradient(0deg, var(--brand-bg) 0%, var(--brand-bg) 100%);
  color: var(--neutral-fg-on-brand);
}

.settings-hint {
  font-size: var(--font-caption1);
  color: var(--text-muted);
  margin-top: 4px;
}

/* Room between a line of text and the controls under it, and before a sub-section (E5, 2026-10-20: buttons sat
   on the text above them in Settings → Backup). */
.settings-section .settings-hint + .settings-row,
.settings-section .settings-hint + div > .settings-row:first-child,
.settings-row--spaced {
  margin-top: 10px;
}
#settings-share-history {
  margin-top: 16px;
}
/* Links in Settings in the pane's own link colour, not the browser's blue and lavender. */
.settings-hint a {
  color: var(--accent-text);
}

.settings-hint--error {
  color: var(--error-text);
}

/* ——— Settings, a full-pane view (redesign slice 7, spec 4.5) ——— */
/* While it is open it takes the header's and the tabs' place; the dialogs and messages stay above it. */
.sheettrack-container.settings-open > .pulse-header,
.sheettrack-container.settings-open > .pane-main {
  display: none;
}
.settings-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
}
.settings-view[hidden] {
  display: none;
}
.settings-view-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 40px;
  padding: 0 var(--space-2);
  border-bottom: var(--border-subtle);
  flex-shrink: 0;
}
.settings-view-title {
  margin: 0;
  font-size: var(--font-subtitle2);
  line-height: 22px;
  font-weight: 600;
  color: var(--text-primary);
}
.settings-view-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
/* Accordions: a row per section, its chevron turning as it opens; the state at the row's end. */
.settings-acc {
  border-bottom: var(--border-subtle);
}
.settings-acc-heading {
  margin: 0;
}
.settings-acc-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-height: 40px;
  padding: 0 var(--space-4) 0 var(--space-3);
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--font-body1);
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.settings-acc-btn:hover {
  background: var(--subtle-bg-hover);
}
.settings-acc-chevron {
  flex-shrink: 0;
  color: var(--text-secondary);
  transition: transform var(--transition-fast);
}
.settings-acc-btn[aria-expanded="true"] .settings-acc-chevron {
  transform: rotate(90deg);
}
.settings-acc-title {
  flex: 1;
  min-width: 0;
}
.settings-acc-status {
  flex-shrink: 0;
  font-size: var(--font-caption1);
  font-weight: 400;
  color: var(--text-secondary);
}
.settings-acc-status.is-warning {
  color: var(--status-warning-fg);
}
.settings-acc-panel {
  padding: 0 var(--space-4) var(--space-3);
}
/* Rows drawn as flex boxes still hide with the hidden attribute. */
.settings-acc-panel[hidden],
.settings-actions[hidden] {
  display: none;
}
/* A setting: its name on the left, its control on the right. */
.settings-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 36px;
}
.settings-field-label {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px var(--space-1);
  min-width: 0;
  font-size: var(--font-body-dense);
  color: var(--text-primary);
}
.settings-field-label--sub {
  color: var(--text-secondary);
}
.settings-field-value {
  flex-basis: 100%;
  font-size: var(--font-caption1);
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}
.settings-field-value:empty {
  display: none;
}
.settings-field .settings-select {
  flex: 0 1 auto;
  max-width: 160px;
}
.settings-field .btn-primary,
.settings-field .btn-secondary {
  width: auto;
  flex-shrink: 0;
}
.settings-acc-panel > .settings-hint,
.settings-acc-panel .settings-more {
  margin: 0 0 var(--space-2);
}
.settings-hint .info-btn {
  vertical-align: middle;
  min-width: 24px;
  min-height: 24px;
}
.settings-more p {
  margin: 0 0 var(--space-1);
}
.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin: var(--space-1) 0 var(--space-2) calc(-1 * var(--space-2));
}
.settings-actions .btn-subtle,
.settings-actions .btn-secondary {
  width: auto;
  min-height: 32px;
}
/* Delete history in the danger colour, without the box (the mockup's subtle danger button). */
.settings-actions .btn-danger-subtle {
  border-color: transparent;
}
.settings-actions .btn-danger-subtle:hover {
  border-color: var(--status-danger-stroke);
}
/* Fluent's Switch: a 40 × 20 track, the thumb moving to the end when on. */
.settings-switch {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex-shrink: 0;
  width: 40px;
  height: 20px;
  margin: 6px 0;
  border: 1px solid var(--neutral-stroke1);
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast);
}
.settings-switch::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-secondary);
  transition: transform var(--transition-fast);
}
.settings-switch:hover {
  border-color: var(--neutral-stroke1-hover);
}
.settings-switch:checked {
  background: var(--brand-bg);
  border-color: transparent;
}
.settings-switch:checked::before {
  transform: translateX(20px);
  background: var(--neutral-fg-on-brand);
}
.settings-switch:disabled {
  cursor: default;
  border-color: var(--neutral-stroke-disabled);
}
.settings-switch:disabled::before {
  background: var(--neutral-fg-disabled);
}
/* Help: one row per item, as a menu reads. */
.settings-help-list {
  display: flex;
  flex-direction: column;
  padding-left: var(--space-1);
  padding-right: var(--space-1);
}
.settings-help-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  column-gap: var(--space-2);
  width: 100%;
  min-height: 36px;
  padding: 6px var(--space-3);
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--font-body-dense);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.settings-help-item:hover {
  background: var(--subtle-bg-hover);
}
.settings-help-tip {
  flex-basis: 100%;
  font-size: var(--font-caption1);
  color: var(--text-secondary);
}
.settings-help-keys {
  font-size: var(--font-caption1);
  color: var(--text-secondary);
}
.settings-help-list .help-diagnostics {
  margin: var(--space-1) var(--space-3);
}
/* The guide, shown only when the clipboard is blocked: a box to select from, not to read. */
.settings-help-list .help-guide-text {
  display: block;
  box-sizing: border-box;
  width: calc(100% - 2 * var(--space-3));
  height: 160px;
  resize: vertical;
}
.settings-help-list .help-guide-text[hidden] {
  display: none;
}
/* Help › Where is my data?: a row per place, its icon first. */
.where-data-list {
  list-style: none;
  margin: 0;
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-size: var(--font-body-dense);
  color: var(--text-primary);
  overflow-y: auto;
}
.where-data-row {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
}
.where-data-icon {
  flex-shrink: 0;
  display: inline-flex;
  margin-top: 2px;
  color: var(--text-secondary);
}

.selected-change-row {
  margin-top: 6px;
  font-size: var(--font-caption1);
  color: var(--text-primary);
  font-family: var(--font-mono);
}

/* ——— Footer ——— */
/* ——— Scrollbars ——— */
.issues-list::-webkit-scrollbar,
.changes-list::-webkit-scrollbar,
.history-list::-webkit-scrollbar,
.history-timeline::-webkit-scrollbar,
.activity-list::-webkit-scrollbar,
.collaborator-list::-webkit-scrollbar,
.pr-list::-webkit-scrollbar,
.diff-content::-webkit-scrollbar,
.tab-content::-webkit-scrollbar {
  width: 6px;
}

.issues-list::-webkit-scrollbar-track,
.changes-list::-webkit-scrollbar-track,
.history-list::-webkit-scrollbar-track,
.history-timeline::-webkit-scrollbar-track,
.activity-list::-webkit-scrollbar-track,
.collaborator-list::-webkit-scrollbar-track,
.pr-list::-webkit-scrollbar-track,
.diff-content::-webkit-scrollbar-track,
.tab-content::-webkit-scrollbar-track {
  background: var(--bg-primary);
  border-radius: 3px;
}

.issues-list::-webkit-scrollbar-thumb,
.changes-list::-webkit-scrollbar-thumb,
.history-list::-webkit-scrollbar-thumb,
.history-timeline::-webkit-scrollbar-thumb,
.activity-list::-webkit-scrollbar-thumb,
.collaborator-list::-webkit-scrollbar-thumb,
.pr-list::-webkit-scrollbar-thumb,
.diff-content::-webkit-scrollbar-thumb,
.tab-content::-webkit-scrollbar-thumb {
  background: var(--bg-elevated);
  border-radius: 3px;
}

.issues-list::-webkit-scrollbar-thumb:hover,
.changes-list::-webkit-scrollbar-thumb:hover,
.history-list::-webkit-scrollbar-thumb:hover,
.history-timeline::-webkit-scrollbar-thumb:hover,
.activity-list::-webkit-scrollbar-thumb:hover,
.collaborator-list::-webkit-scrollbar-thumb:hover,
.pr-list::-webkit-scrollbar-thumb:hover,
.diff-content::-webkit-scrollbar-thumb:hover,
.tab-content::-webkit-scrollbar-thumb:hover {
  background: var(--neutral-stroke1-hover);
}

/* ——— Command palette results ——— */
.command-results {
  position: relative;
  width: 100%;
  background: var(--bg-secondary);
  border-bottom: var(--border);
  max-height: 220px;
  overflow-y: auto;
  z-index: 100;
}

.command-result-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: var(--font-caption1);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
  transition:
    background-color var(--transition-fast),
    color var(--transition-fast);
}

.command-result-item:hover,
.command-result-item.active {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.command-result-icon {
  font-size: var(--font-body1);
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

/* ——— vc-advanced ——— */
.vc-advanced {
  margin-top: 4px;
  margin-bottom: 12px;
}

/* ——— Danger-subtle button (Clear History) ——— */
.btn-danger-subtle {
  color: var(--status-danger-fg);
  border-color: var(--status-danger-stroke);
}

/* ==================== LOCATION STATUS ==================== */

.location-status-label {
  font-size: var(--font-caption2);
  color: var(--text-muted);
}

.location-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: var(--font-caption2);
  font-weight: 600;
  border: 1px solid transparent;
}

.location-chip--local,
.location-chip--github,
.location-chip--cloud,
.location-chip--onedrive,
.location-chip--gdrive {
  background: var(--neutral-bg2);
  color: var(--text-secondary);
  border-color: var(--neutral-stroke2);
}

.btn-link {
  background: none;
  border: none;
  padding: 0 4px;
  color: var(--text-muted);
  font-size: var(--font-caption1);
  cursor: pointer;
  text-decoration: underline;
  font-family: var(--font-sans);
  transition: color var(--transition-fast);
}

.btn-link:hover {
  color: var(--text-secondary);
}

/* ==================== Health Ring ==================== */
.health-ring-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-4) 0 var(--space-3);
  gap: var(--space-2);
}

.linter-coverage {
  padding: 14px 16px;
  margin-bottom: 16px;
  border: var(--border);
  border-radius: var(--radius);
  font-size: var(--font-caption1);
  line-height: 1.5;
}

.linter-coverage summary {
  cursor: pointer;
}

.linter-coverage-note {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: var(--font-caption1);
}

.linter-coverage ul {
  padding-left: 18px;
  margin: 6px 0 0;
}

.issue-evidence {
  margin-top: 8px;
  font-size: var(--font-caption1);
}

.issue-evidence summary {
  cursor: pointer;
}

.issue-evidence pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 240px;
  overflow: auto;
}
.health-ring-container.health-ring-container--partial {
  grid-template-columns: minmax(0, 1fr);
}
.health-ring-container--partial .health-ring-summary,
.health-ring-container--partial .health-ring-context,
.health-ring-container--partial .health-ring-details {
  grid-column: 1;
}
.health-ring-summary {
  font-size: var(--font-body-dense);
  color: var(--text-secondary);
  text-align: center;
  margin: 0;
  font-weight: 400;
}
.health-ring-context {
  font-size: var(--font-caption1);
  color: var(--text-muted);
  text-align: center;
  margin-top: 4px;
  display: block;
}
.health-ring-details {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  column-gap: var(--space-3);
  row-gap: 2px;
  font-size: var(--font-caption1);
  color: var(--text-muted);
}
.health-detail-error {
  color: var(--error-text);
}
.health-detail-warning {
  color: var(--warning-text);
}

/* ==================== Issue Accordion ==================== */
.issue-category-group {
  border: var(--border);
  border-radius: var(--radius);
  margin-bottom: var(--space-2);
  overflow: hidden;
}
.issue-category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-secondary);
  cursor: pointer;
  user-select: none;
  font-size: var(--font-caption1);
  font-weight: 600;
  color: var(--text-secondary);
  border: none;
  width: 100%;
  text-align: left;
  transition: background var(--transition-fast);
}
.issue-category-header:hover {
  background: var(--bg-tertiary);
}
.issue-category-header.open {
  border-bottom: var(--border-subtle);
}
.issue-category-badge {
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: var(--font-caption2);
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}
/* Mark as sent from the Save row (S05) and a file to compare with from Compare (S08). */
.mark-sent-more {
  margin-top: 4px;
}
.mark-sent-summary {
  display: inline-block;
  padding: 2px 0;
  cursor: pointer;
  list-style: none;
}
.mark-sent-summary::-webkit-details-marker {
  display: none;
}
.mark-sent-hint {
  margin: 4px 0;
}
/* Notes in a category beside its count of items to review (UI-166). */
.issue-cat-notes {
  font-size: var(--font-caption2);
  color: var(--text-muted);
  white-space: nowrap;
}
.issue-category-chevron {
  transition: transform var(--transition-fast);
  color: var(--text-muted);
}
.issue-category-header.open .issue-category-chevron {
  transform: rotate(180deg);
}
.issue-category-body {
  display: none;
}
.issue-category-body.open {
  display: block;
}
.issue-card-v2 {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-bottom: var(--border-subtle);
  cursor: pointer;
  transition: background var(--transition-fast);
}
.issue-card-v2:last-child {
  border-bottom: none;
}
.issue-card-v2:hover {
  background: var(--bg-secondary);
}
.issue-severity-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  color: var(--text-muted);
}
.issue-severity-icon.error {
  color: var(--status-danger-fg);
}
.issue-severity-icon.warning {
  color: var(--status-warning-fg);
}
.issue-card-body {
  flex: 1;
  min-width: 0;
}
.issue-card-title {
  font-size: var(--font-caption1);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.issue-cell-chip {
  display: inline-block;
  font-size: var(--font-caption2);
  font-family: var(--font-mono);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: var(--border-subtle);
  border-radius: 3px;
  padding: 0 4px;
  margin-left: 4px;
  cursor: pointer;
  vertical-align: middle;
}
.issue-cell-chip:hover {
  background: var(--bg-tertiary);
  color: var(--accent-text);
}
.issue-card-message {
  font-size: var(--font-caption1);
  color: var(--text-secondary);
  line-height: 1.4;
  margin-top: 2px;
}
.issue-fix-suggestion {
  font-size: var(--font-caption1);
  color: var(--text-secondary);
  line-height: 1.4;
  margin-top: 7px;
  padding-top: 6px;
  border-top: var(--border-subtle);
}

.issue-fix-suggestion span {
  display: block;
  margin-bottom: 2px;
  color: var(--text-muted);
  font-size: var(--font-caption2);
  font-weight: 600;
}

/* ==================== Empty State Illustration ==================== */
.no-issues-illustration,
.check-empty-icon,
.timeline-empty-icon {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.no-issues-illustration {
  margin-bottom: var(--space-2);
}

/* ==================== Simple Init Card ==================== */
.simple-init-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-5) var(--space-4);
  border: var(--border);
  border-radius: var(--radius);
  margin: var(--space-3) 0;
  background: var(--bg-secondary);
  gap: var(--space-2);
}
.simple-init-illustration {
  margin-bottom: var(--space-2);
  opacity: 0.8;
}
.simple-init-title {
  font-size: var(--font-subtitle2);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}
.simple-init-desc {
  font-size: var(--font-caption1);
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}
.simple-init-btn {
  width: 100%;
  margin-top: var(--space-2);
}

/* ==================== Save Version Row ==================== */
.save-version-row {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  margin-top: var(--space-2);
}
.save-version-input {
  flex: 1;
  min-width: 80px;
}
.save-version-btn {
  flex-shrink: 0;
  white-space: nowrap;
  width: auto;
}
/* Save Version before AI (N6): a quieter second action under the Save row. */
/* Save Version before AI, what it is for, and Mark as sent… each on its own line: without wrapping the three shared
   one line and ran into each other at 320 px ("go Mark as back to", F2 round 6: S03, S12, S18). */
.save-version-more {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-top: 2px;
}
.save-version-more .mark-sent-more {
  flex-basis: 100%;
  text-align: right;
}
.save-version-more .mark-sent-more[open] {
  text-align: left;
}
.save-version-more .mark-sent-more[open] > .mark-sent-summary {
  display: block;
  text-align: right;
}
.before-ai-btn {
  min-height: 24px;
  padding: 0 4px;
  font-size: var(--font-caption1);
  color: var(--text-secondary);
}
.before-ai-btn:hover,
.before-ai-btn:focus-visible {
  color: var(--text-primary);
}
/* "Copy summary" in the Changes header (N8a): a quiet text button beside Refresh. */
.changes-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 24px;
  padding: 0 4px;
  font-size: var(--font-caption1);
  color: var(--text-secondary);
  text-decoration: none;
  white-space: nowrap;
}
.changes-copy-btn:hover,
.changes-copy-btn:focus-visible {
  color: var(--text-primary);
}
.changes-copy-btn[hidden] {
  display: none;
}
.auto-versions-line {
  margin-top: 2px;
  overflow-wrap: anywhere;
}
/* "Since you opened SheetTrack" (N14): a workbook with no history lists what changed since the pane opened.
   There is nothing to save a version to, so the Save row gives way to Start Tracking above. */
.changes-section.since-opened-mode .save-version-more,
.changes-section.since-opened-mode .auto-versions-line {
  display: none;
}
.since-opened {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 var(--space-2);
  margin-bottom: var(--space-2);
}
.since-opened-line {
  margin: 0;
  font-size: var(--font-caption1);
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}
.since-opened-note {
  overflow-wrap: anywhere;
}
/* "Since:" (N4): the moment Changes lists changes from, on one line above the list. */
.changes-since-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}
.changes-since-label {
  flex: none;
  font-size: var(--font-caption1);
  color: var(--text-secondary);
}
.changes-since-select {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  min-height: 24px;
  text-overflow: ellipsis;
}
/* The chosen moment in full, under the picker that cuts long names (F2 round 7). */
.changes-since-full {
  margin: calc(var(--space-1) * -1) 0 var(--space-2);
  font-size: var(--font-caption1);
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}
.changes-since-full[hidden] {
  display: none;
}
/* Sheets to track (T6): the lines that say which sheets are tracked, and the dialog that chooses them. */
.changes-scope,
.tracked-sheets {
  margin: 0 0 var(--space-2);
  overflow-wrap: anywhere;
}
.changes-scope[hidden],
.tracked-sheets[hidden],
.auto-versions-choose[hidden] {
  display: none;
}
/* The list is behind the workbook: said where the reader is, at the top of the view while they scroll the list
   (F2 round 6, S16: UI-195, the notice sat at the top while they were far down a long list). */
.changes-stale {
  position: sticky;
  top: -12px;
  z-index: 3;
  margin: 0 0 var(--space-2);
  padding: 6px 8px;
  border: var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}
.changes-stale[hidden] {
  display: none;
}
/* A new Since choice is being read: the list shown is the one before it, so a line above it says so until the new one
   lands (UI-195: the old numbers read as the new ones for seconds on a large model). Not dimmed: dimmed text fails
   contrast. */
.changes-pending {
  position: sticky;
  top: -12px;
  z-index: 3;
  margin: 0 0 var(--space-2);
  padding: 6px 8px;
  border: var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: var(--font-caption1);
}
/* At least 24 px tall to click or tap (WCAG 2.2 target size), as the error messages' buttons. */
.choose-sheets-btn {
  min-height: 24px;
  vertical-align: baseline;
}
.changes-section.since-opened-mode .auto-versions-choose {
  display: none;
}
.sheets-fieldset {
  margin: 8px 0 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
.sheets-fieldset[hidden] {
  display: none;
}
.sheets-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 260px;
  overflow-y: auto;
  border: var(--border-subtle);
  border-radius: var(--radius);
}
.sheets-list li + li {
  border-top: var(--border-subtle);
}
.sheets-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 32px;
  padding: 4px 8px;
  font-size: var(--font-caption1);
  color: var(--text-primary);
  cursor: pointer;
}
.sheets-row input {
  flex: none;
  margin: 0;
}
.sheets-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sheets-size {
  flex: none;
  color: var(--text-secondary);
  font-size: var(--font-caption1);
  font-variant-numeric: tabular-nums;
}
.sheets-status:empty {
  display: none;
}
/* OneDrive versions (L1b): the dialog's sign-in step and its list of versions, one button each. */
.onedrive-signin {
  padding: 4px 0 8px;
}
.onedrive-signin[hidden],
.onedrive-list[hidden] {
  display: none;
}
.onedrive-signin .dialog-caption {
  margin: 0 0 var(--space-2);
}
/* In a short pane the dialog scrolls as a whole: the list keeps room for a few rows (it was squeezed to one, seen
   live in Excel on the web), and up to six show before it scrolls on its own. */
.onedrive-list {
  flex-shrink: 0;
  margin: 8px 0 4px;
  width: auto;
  max-height: 196px;
}
.onedrive-signin {
  flex-shrink: 0;
}
.onedrive-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  width: 100%;
  min-height: 32px;
  padding: 4px 8px;
  border: 0;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: var(--font-caption1);
  text-align: left;
  cursor: pointer;
}
.onedrive-row:hover,
.onedrive-row:focus-visible {
  background: var(--bg-elevated);
}
/* The pane's focus ring, inside the row: the list scrolls, so an outer one was cut off (E5, run 76). */
.onedrive-row:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -2px;
}
.onedrive-row[aria-current="true"] {
  font-weight: 600;
}
.onedrive-when {
  flex: none;
  font-variant-numeric: tabular-nums;
}
.onedrive-by {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
}
/* Compare with a file (L1c): a file that cannot be read is an error MessageBar (spec 4.7; slice 9). */
#file-compare-status.is-problem {
  margin-top: 8px;
  padding: 8px 12px;
  border: 1px solid var(--status-danger-stroke);
  border-radius: var(--radius);
  background: var(--status-danger-bg);
  color: var(--status-danger-fg);
}
#local-history-status.is-problem {
  color: var(--error-text);
}
/* A version's kind (Opened, Auto, Before AI) before its note in Version History. */
.version-kind {
  display: inline-block;
  /* With the space after it (UI-164), as far from the note as before. */
  margin-right: 3px;
  padding: 0 6px;
  border: var(--border-subtle);
  border-radius: 999px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: var(--font-caption2);
  font-weight: 600;
  line-height: 16px;
  vertical-align: 1px;
}

/* ==================== History (redesign slice 5, spec 4.3) ==================== */
/* The toolbar: Versions / Activity, Compare ▾ and Refresh on one 32 px line. */
.history-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 32px;
  margin-bottom: var(--space-2);
}
.segmented {
  display: inline-flex;
  flex-shrink: 0;
  border: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.segmented-btn {
  min-height: 28px;
  padding: 0 10px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: var(--font-caption1);
  cursor: pointer;
}
.segmented-btn + .segmented-btn {
  border-left: var(--border);
}
.segmented-btn[aria-pressed="true"] {
  color: var(--text-primary);
  font-weight: 600;
  background: var(--brand-tint-bg);
}
.segmented-btn:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -2px;
}
.history-compare {
  position: relative;
  margin-left: auto;
}
.history-compare-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 32px;
}
/* Compare's menu opens under its button, right-aligned with it. */
.history-compare .history-compare-menu {
  top: 34px;
  right: 0;
}
#refresh-history-btn {
  flex-shrink: 0;
  min-width: 32px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Versions or Activity, by the switch. */
#history-tab.history-show-activity .history-versions-view {
  display: none;
}
#history-tab:not(.history-show-activity) #activity-section {
  display: none !important;
}

/* The workbook now, pinned and shaded above the versions (pass 1). */
.history-now {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 40px;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius);
  background: var(--neutral-bg2);
  border: var(--border-subtle);
}
.history-now[hidden] {
  display: none;
}
.history-now-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.history-now-name {
  font-size: var(--font-body-dense);
}
.history-now-detail {
  font-size: var(--font-caption1);
  color: var(--text-secondary);
}

/* A version: name and badge, then who · when · changes; ⋯ at its right. 52 px, no dot, no bold newest row. */
.history-timeline {
  padding: var(--space-1) 0;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.timeline-item {
  position: relative;
  border-bottom: var(--border-subtle);
}
.timeline-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-1);
  min-height: 52px;
}
.timeline-toggle {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-height: 44px;
  padding: var(--space-1) var(--space-2);
  margin: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.timeline-toggle[hidden] {
  display: none;
}
.timeline-toggle:hover {
  background: var(--subtle-bg-hover);
}
.timeline-toggle:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -2px;
}
.timeline-title {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.timeline-note {
  min-width: 0;
  font-size: var(--font-body-dense);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* An opened version shows its whole name: a sent version's "to Dana Whitfield (CFO): September board pack" was cut at
   one line even when open (E5, run 76). */
.timeline-toggle[aria-expanded="true"] .timeline-note {
  white-space: normal;
  overflow-wrap: anywhere;
}
.timeline-meta,
.timeline-time {
  font-size: var(--font-caption1);
  color: var(--text-secondary);
}
.timeline-meta {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* A version's badge after its name: Auto, Sent, Before AI, Saved for you. */
.version-badge {
  flex-shrink: 0;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--neutral-bg1-hover);
  color: var(--text-secondary);
  font-size: var(--font-caption1);
  line-height: 16px;
  white-space: nowrap;
}
.timeline-more-btn {
  flex-shrink: 0;
  min-width: 32px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
/* Who saved it, when and what changed, under its row once opened (F2 round 3). */
.timeline-detail {
  margin: 0 var(--space-2) var(--space-2);
}
.timeline-detail[hidden] {
  display: none;
}
/* A version's ⋯ menu, under its row at the right; each item with its second line. */
.timeline-row .version-menu {
  top: 46px;
  right: 0;
  min-width: 232px;
}
.version-menu-item {
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-2);
  min-height: 40px;
  padding: 4px 8px;
}
/* An icon column on every item (most empty), so the labels line up (owner, 2026-11-30). */
.version-menu-icon {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  display: inline-flex;
}
.version-menu-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}
.version-menu-hint {
  color: var(--text-secondary);
  font-size: var(--font-caption1);
}
/* Go back stands out in the accent colour; Delete in the danger colour, under a line. */
.version-menu-item--accent .version-menu-icon {
  color: var(--accent-text);
}
.version-menu-item--danger .header-menu-label,
.version-menu-item--danger .version-menu-icon {
  color: var(--status-danger-fg);
}
.version-menu-separator {
  margin: 4px 0;
  border-top: var(--border-subtle);
}
.version-menu-item[aria-disabled="true"] {
  cursor: default;
}
.version-menu-item[aria-disabled="true"] .header-menu-label,
.version-menu-item[aria-disabled="true"] .version-menu-icon {
  color: var(--text-muted);
}
/* Rename in its row (spec 4.3). */
.timeline-rename {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-1) var(--space-2);
}
.timeline-rename-input {
  width: 100%;
  min-height: 32px;
  box-sizing: border-box;
}
.timeline-rename-status {
  font-size: var(--font-caption1);
}
.timeline-rename-status--warning {
  color: var(--error-text);
}
.timeline-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-3);
  color: var(--text-muted);
  text-align: center;
}
.timeline-empty-state p {
  font-size: var(--font-caption1);
  margin: 0;
  line-height: 1.5;
}
/* The footer's captions: where versions are, Auto versions, the sheets tracked; Delete history last. */
.history-footer {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: var(--space-3);
}
.history-footer .settings-hint {
  margin: 0;
}
/* Delete history: a quiet link among the captions, not a card (until Settings takes it, slice 7). */
.history-footer .vc-tools {
  margin: var(--space-1) 0 0;
  padding: 0;
  background: none;
  border: none;
}

/* Changes while it shows a comparison (slice 5): the Tag where Since was, the comparison where the list was; the Save
   row stays. */
.compare-tag {
  flex: 1;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  padding: 0 4px 0 10px;
  border: var(--border);
  border-radius: var(--radius);
  background: var(--brand-tint-bg);
  font-size: var(--font-body-dense);
}
.compare-tag[hidden] {
  display: none;
}
/* Both sides read whole at 320 px (two lines at most; the tooltip has them in full). */
.compare-tag-text {
  flex: 1;
  min-width: 0;
  padding: 3px 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.compare-tag-close {
  flex-shrink: 0;
  min-width: 24px;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
}
.compare-tag-close:hover {
  background: var(--subtle-bg-hover);
}
.compare-tag-close:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
}
.changes-section.is-comparing .changes-since-row,
.changes-section.is-comparing .changes-refresh-btn,
.changes-section.is-comparing > :not(.changes-context):not(.commit-diff-summary):not(.save-version-row) {
  display: none !important;
}

/* Go back's question (spec 4.3): the cells that change back, then where today's work is. */
.go-back-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0 12px 12px;
  font-size: var(--font-body-dense);
}
.go-back-body .confirm-line {
  margin: 0;
}
.go-back-cells {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.go-back-cells li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
}
.go-back-cell-ref {
  font-family: var(--font-mono);
  font-size: var(--font-caption1);
  color: var(--text-secondary);
}
.go-back-cell-label {
  min-width: 0;
  overflow-wrap: anywhere;
}
.go-back-cell-values {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.go-back-more,
.go-back-caption {
  color: var(--text-secondary);
  font-size: var(--font-caption1);
}

/* Compare ▾ › Two versions…: From and To, each a full-width box. */
.compare-two-fields {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 16px 4px;
}
.compare-two-status {
  margin: 0;
  padding: 0 16px 8px;
}
/* Kept in the page while empty, so its words are announced when they come. */
.compare-two-status:empty {
  padding: 0;
}
.compare-two-label {
  font-size: var(--font-caption1);
  color: var(--text-secondary);
}
.compare-two-select {
  width: 100%;
  min-height: 32px;
}

/* ==================== Toast Notifications ==================== */
/* Messages sit in the pane's layout above the footer, so the tab above gets shorter while one shows and nothing is
   covered: floating over the pane, they hid buttons, Version History's rows and Key numbers (F2 round 5: UI-162).
   Dialogs and the first run, which float above the pane, stay above them. */
.toast-container {
  position: relative;
  z-index: 5;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  padding: 0 8px 8px;
}
.toast-container:empty {
  display: none;
}
.toast {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: var(--font-body-dense);
  font-weight: 400;
  box-shadow: var(--shadow-16);
  animation: toast-in 0.25s ease forwards;
  max-width: 100%;
  text-align: left;
}
.toast--success {
  border-left: 3px solid var(--accent-green);
}
.toast--error {
  border-left: 3px solid var(--error);
}
.toast--warning {
  border-left: 3px solid var(--warning);
}
.toast--info {
  border-left: 3px solid var(--accent-secondary);
}
.toast--fadeout {
  animation: toast-out 0.3s ease forwards;
}
/* The message takes the whole width beside the close button and its action goes under it: beside it, at 320 px a
   long message became a column eleven lines tall over half the pane (E5, 2026-10-20). */
.toast {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  column-gap: 8px;
  row-gap: 6px;
  padding: 8px 6px 8px 12px;
}
.toast-message {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  padding-top: 2px;
  overflow-wrap: anywhere;
}
.toast .toast-close-btn {
  grid-column: 2;
  grid-row: 1;
}
.toast .toast-action-btn {
  grid-column: 1;
  grid-row: 2;
  justify-self: start;
}
/* Every message can be closed at once (UI-162). */
.toast-close-btn {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--font-subtitle2);
  line-height: 24px;
  cursor: pointer;
}
.toast-close-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}
.toast-close-btn:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
}
.toast-action-btn {
  background: transparent;
  border: 1px solid currentColor;
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  font-size: var(--font-caption1);
  font-weight: 600;
  color: var(--accent-text);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ==================== Check Tab Empty State ==================== */
.check-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-6) var(--space-4);
  color: var(--text-muted);
  gap: var(--space-3);
}
.check-empty-state p,
.check-empty-state .empty-state-subtext {
  font-size: var(--font-caption1);
  line-height: 1.5;
  max-width: 220px;
  margin: 0;
  color: var(--text-muted);
}
.empty-state-heading {
  font-size: var(--font-body1);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

/* ==================== Onboarding Tooltips ==================== */
.onboarding-tip {
  background: var(--bg-elevated);
  border: 1px solid var(--accent-indigo);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-3);
  margin: var(--space-2) 0;
  animation: tip-fadein 0.3s ease forwards;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.onboarding-tip--hiding {
  animation: tip-fadeout 0.3s ease forwards;
}
.onboarding-tip-text {
  flex: 1;
  font-size: var(--font-caption1);
  color: var(--text-primary);
  margin: 0;
  line-height: 1.4;
}
.onboarding-tip-dismiss {
  flex-shrink: 0;
  font-size: var(--font-caption1);
  font-weight: 600;
}
@keyframes tip-fadein {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes tip-fadeout {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-4px);
  }
}

/* ── Presence Avatars ─────────────────────────────────────────────────── */
.presence-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--bg-primary);
  object-fit: cover;
  background: var(--accent-indigo);
  color: var(--neutral-fg-on-brand);
  font-size: var(--font-caption2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

/* ── Activity Feed ────────────────────────────────────────────────────── */
.activity-section {
  background: var(--bg-secondary);
  border: var(--border-subtle);
  border-radius: var(--radius);
  padding: 10px;
  margin-bottom: 8px;
}
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 0;
  max-height: 180px;
  overflow-y: auto;
}
/* What happened wraps and its time sits beside it, or under it when there is no room: at 320 px a long date cut every
   event to "Lakshay Goel started tr…" (E5, run 76). */
.activity-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 8px;
  row-gap: 0;
  padding: 4px 0;
  font-size: var(--font-caption1);
}
.activity-text {
  flex: 1 1 160px;
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text-primary);
}
.activity-time {
  font-size: var(--font-caption2);
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  margin-right: 4px;
}

/* ── Team ─────────────────────────────────────────────────────────────── */
.team-section {
  background: var(--bg-secondary);
  border: var(--border-subtle);
  border-radius: var(--radius);
  padding: 10px;
  margin-bottom: 16px;
}
.collaborator-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 0;
  max-height: 160px;
  overflow-y: auto;
}
.collaborator-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.collaborator-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--border-color);
  /* A person without a photo shows their initials, not an empty circle (E5, run 76). */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-caption2);
  font-weight: 600;
  color: var(--text-primary);
}
.collaborator-info {
  flex: 1;
  min-width: 0;
}
.collaborator-name {
  font-size: var(--font-caption1);
  font-weight: 400;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.collaborator-role {
  font-size: var(--font-caption2);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.role-select {
  flex-shrink: 0;
  max-width: 108px;
  min-height: 24px;
  padding: 2px 4px;
  font-size: var(--font-caption1);
  color: var(--text-primary);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
}
.role-select:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
}
.review-waiting-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  padding: 8px 10px;
  font-size: var(--font-caption1);
  color: var(--text-primary);
  background: var(--accent-indigo-glow);
  border: 1px solid var(--border-color);
  border-radius: 6px;
}
.review-waiting-notice[hidden] {
  display: none;
}
.review-waiting-text {
  flex: 1;
  min-width: 0;
}
/* Buttons are full width by default, which squeezed the text to nothing. */
.review-waiting-notice .btn-secondary {
  width: auto;
  flex: none;
  white-space: nowrap;
}
.role-badge {
  font-size: var(--font-caption2);
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 400;
}
.role-badge--owner,
.role-badge--editor {
  background: var(--accent-indigo-glow);
  color: var(--accent-text);
}
.role-badge--viewer {
  background: var(--neutral-bg2);
  color: var(--text-muted);
}

/* ── Review Requests ──────────────────────────────────────────────────── */
.pr-section {
  background: var(--bg-secondary);
  border: var(--border-subtle);
  border-radius: var(--radius);
  padding: 10px;
  margin-bottom: 16px;
}
.pr-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 0;
  max-height: 160px;
  overflow-y: auto;
}
.pr-card {
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.pr-card:hover {
  background: var(--subtle-bg-hover);
}
.pr-card-title {
  font-size: var(--font-caption1);
  font-weight: 400;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.pr-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--font-caption1);
  color: var(--text-muted);
  flex-wrap: wrap;
}
/* The version under review, its whole note on its own lines (E5, run 76). */
.pr-card-version {
  margin: 4px 0 2px;
  font-size: var(--font-caption1);
  color: var(--text-muted);
  overflow-wrap: anywhere;
}
.pr-status-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: var(--font-caption2);
  font-weight: 600;
}
.pr-status--open {
  background: var(--status-success-bg);
  /* Green on its pale green, as the "added" badge (UI-38): #22c55e measured 2.01:1 in the light theme (UI-205). */
  color: var(--added-text);
}
.pr-status--merged {
  background: var(--accent-indigo-glow);
  color: var(--accent-text);
}
.pr-status--closed {
  background: var(--neutral-bg2);
  color: var(--text-muted);
}
.pr-textarea {
  width: 100%;
  resize: vertical;
  min-height: 60px;
  font-family: inherit;
  margin-bottom: 8px;
}

/* Review forms share settings styling but must fit every Excel pane width. */
#pr-modal .modal-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

#pr-modal .settings-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  margin: 0;
}

#pr-modal .commit-input,
#pr-modal .settings-select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin: 0;
}

#pr-modal .settings-hint,
#pr-modal .error-text {
  margin: 0 0 var(--space-2);
  overflow-wrap: anywhere;
  /* In the error colour, like the pane's other problems (E5, run 76: it read as body text). */
  color: var(--error-text);
  font-size: var(--font-caption1);
}

#pr-modal .confirm-actions {
  margin: 0;
}

.pr-detail-info {
  padding: 8px 0;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
  font-size: var(--font-caption1);
}
.pr-review-actions {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
}
/* The reviewed version's changes in words, then "See every changed cell" (F2 round 6, S18). */
.pr-change-lines {
  margin: 0 0 8px;
  padding-left: 18px;
  font-size: var(--font-caption1);
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.pr-change-lines li + li {
  margin-top: 2px;
}
/* The reviewed version's first changed cells, old → new (UI-250). */
.pr-first-cells-title {
  margin: 0 0 4px;
  font-size: var(--font-caption1);
}
.pr-first-cells .settings-hint {
  margin: 0 0 8px;
}
.pr-compare-btn {
  margin-bottom: 4px;
}
/* See every changed cell and Save review record (UI-199): side by side, wrapping in a narrow pane. */
.pr-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}
.pr-detail-actions .btn-small {
  width: auto;
  flex: none;
  margin-bottom: 0;
}
.pr-record-status:empty {
  display: none;
}

/* ── Comments ─────────────────────────────────────────────────────────── */
.comments-thread {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 8px;
}
.comment-item {
  padding: 6px 8px;
  background: var(--neutral-bg2);
  border-radius: 6px;
}
.comment-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.comment-author {
  font-size: var(--font-caption1);
  font-weight: 600;
  color: var(--text-primary);
}
.comment-time {
  font-size: var(--font-caption2);
  color: var(--text-muted);
}
.comment-body {
  font-size: var(--font-caption1);
  color: var(--text-primary);
}
.comment-input-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.comment-input-row .commit-input {
  flex: 1;
}

/* ── OAuth Connected Cards ────────────────────────────────────────────── */
@keyframes pop-in {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }
  80% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}
@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── VC Tools ─────────────────────────────────────────────────────────── */
.vc-tools {
  background: var(--bg-secondary);
  border: var(--border-subtle);
  border-radius: var(--radius);
  padding: 10px;
  margin-bottom: 8px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.vc-tools .btn-secondary {
  width: auto;
  flex: 1;
}

/* ── Workspace Protection ─────────────────────────────────────────────── */
.branch-protection-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--font-caption1);
}

/* ── Collapsible Section ──────────────────────────────────────────────── */
.section-header.collapsible {
  cursor: pointer;
  user-select: none;
}
/* The heading's fold button (UI-25): looks like the heading text. */
.section-toggle {
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.section-toggle:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: 2px;
}
.section-header.collapsible:hover {
  opacity: 0.8;
}
.collapse-chevron {
  transition: transform 0.2s;
}
.section-header.collapsible.collapsed .collapse-chevron {
  transform: rotate(-90deg);
}
/* A folded section is its heading alone: no rule and empty space under it (E5, 2026-10-20). */
.section-header.collapsible.collapsed {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

/* ==================== Welcome Overlay ==================== */
.welcome-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg-primary);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--space-4);
}
/* Top-aligned, never centred (spec 4.1); taller than the pane, the window scrolls. */
.welcome-card {
  max-width: 360px;
  width: 100%;
  margin: 0;
  position: relative;
}
.welcome-skip {
  min-height: 24px;
  margin-left: auto;
}
/* The IT admin page's address after an admin-approval message (N11): the message's own colour, underlined. */
.admin-help-link {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  /* One piece, so the address reads as one (it broke at its hyphen at 320 px). */
  white-space: nowrap;
}
/* Retry beside an error message. */
.error-retry {
  margin-left: 8px;
  vertical-align: baseline;
  /* At least 24 px tall to click or tap (WCAG 2.2 target size; "Keep history on this computer" measured 15). */
  min-height: 24px;
}
/* Help & feedback: details for a support email, selectable when the clipboard is blocked. */
.help-diagnostics {
  margin: 8px 0;
  padding: 8px 10px;
  font-family: var(--font-mono, Consolas, monospace);
  font-size: var(--font-caption1);
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  user-select: text;
}
/* Count of review requests waiting for the signed-in reviewer. */
.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  margin-left: 4px;
  border-radius: 8px;
  background: var(--status-warning-bg);
  color: var(--status-warning-fg);
  box-shadow: inset 0 0 0 1px var(--status-warning-stroke);
  font-size: var(--font-caption2);
  font-weight: 600;
  line-height: 1;
}
.welcome-heading {
  font-size: var(--font-subtitle2);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}
.welcome-desc {
  font-size: var(--font-body-dense);
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

/* The first run (slice 8, spec 4.1): one screen, top-aligned, its picture first. */
.first-run-start {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
/* Excel for Mac's personality menu covers the pane's top-right 34 x 32 px (set from Office.onReady; F5). */
html[data-mac] .pulse-header {
  padding-right: 40px;
}
html[data-mac] .first-run-top,
html[data-mac] .tour-top {
  padding-right: 24px;
}
.first-run-top {
  display: flex;
  justify-content: flex-end;
  margin-bottom: calc(-1 * var(--space-2));
}
.first-run-picture {
  margin: 0;
  border: var(--border);
  border-radius: var(--radius);
  background: var(--bg-surface);
  overflow: hidden;
}
.first-run-grid {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: var(--font-caption1);
  font-variant-numeric: tabular-nums;
}
.first-run-grid th,
.first-run-grid td {
  padding: 3px 6px;
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  font-weight: 400;
  text-align: left;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.first-run-grid tr > :last-child {
  border-right: none;
}
.first-run-grid th {
  background: var(--bg-elevated);
  color: var(--text-muted);
  text-align: center;
  font-size: var(--font-caption2);
}
.first-run-grid tr > :first-child {
  width: 22px;
}
.first-run-grid .first-run-num {
  text-align: right;
}
.first-run-grid .first-run-cell--changed {
  background: var(--sample-mark-bg);
}
.first-run-grid .first-run-cell--typed {
  box-shadow: inset 0 0 0 2px var(--status-danger-stroke);
}
/* What SheetTrack would list for it: two rows, as Changes draws them. */
.first-run-listed {
  list-style: none;
  margin: 0;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: var(--font-caption1);
  color: var(--text-secondary);
}
.first-run-listed li {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}
.first-run-listed .change-type {
  margin: 0 0 0 auto;
  white-space: nowrap;
}
.first-run-ref {
  font-family: var(--font-mono);
  color: var(--text-muted);
  min-width: 20px;
}
.first-run-delta {
  margin-left: auto;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.first-run-start .welcome-heading {
  font-size: var(--font-title3);
  line-height: 28px;
}
.first-run-button {
  width: 100%;
  min-height: 32px;
}
.first-run-hint {
  margin: 0;
  font-size: var(--font-caption1);
  line-height: 1.45;
  color: var(--text-muted);
}
/* "Check for issues, or compare with a file or a OneDrive version.": links inside the sentence. */
.first-run-link {
  padding: 0;
  min-height: 24px;
  font-size: inherit;
  line-height: inherit;
  vertical-align: baseline;
}
.first-run-foot {
  padding-top: var(--space-3);
  border-top: var(--border-subtle);
}
.first-run-safe {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: var(--font-caption1);
  color: var(--text-secondary);
}
.first-run-shield {
  flex-shrink: 0;
  color: var(--text-muted);
}
.first-run-info-btn {
  flex-shrink: 0;
  margin-left: auto;
}
.first-run-where {
  margin-top: var(--space-2);
}
@media (forced-colors: active) {
  .first-run-grid .first-run-cell--changed,
  .first-run-grid .first-run-cell--typed {
    outline: 2px dashed CanvasText;
    outline-offset: -3px;
  }
}

/* The tour (slice 8, spec section 5, tour.js): a scrim with a cut-out around the real control, and a popover beside
   it. The layer takes clicks so nothing under the scrim runs; messages stay above it. */
.tour-layer {
  position: fixed;
  inset: 0;
  z-index: 400;
}
.tour-spot {
  position: fixed;
  z-index: 401;
  border-radius: var(--radius);
  box-shadow:
    0 0 0 2px var(--brand-stroke),
    0 0 0 9999px var(--scrim);
  pointer-events: none;
}
.tour-popover {
  position: fixed;
  z-index: 402;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4) var(--space-4);
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--neutral-stroke2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-16);
}
body:has(.tour-popover) .toast-container {
  z-index: 410;
}
.tour-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-right: -8px;
}
.tour-count {
  font-size: var(--font-caption1);
  color: var(--text-muted);
}
.tour-title {
  margin: 0;
  font-size: var(--font-subtitle2);
  font-weight: 600;
  line-height: 22px;
}
.tour-title:focus {
  outline: none;
}
.tour-body {
  margin: 0;
  font-size: var(--font-body-dense);
  line-height: 1.45;
  color: var(--text-secondary);
}
/* The issues step's Check my edits switch (owner, 2026-11-30). */
.tour-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-top: var(--space-2);
  font-size: var(--font-body-dense);
  color: var(--text-primary);
  cursor: pointer;
}
.tour-switch[hidden] {
  display: none;
}
.tour-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-1);
}
/* One row: Skip tour at the left, the step's button at the right (buttons are full width elsewhere in the pane). */
.tour-actions .btn-small {
  width: auto;
  min-height: 28px;
}
.tour-skip {
  margin-right: auto;
}
/* The sample change (step 1's Show a sample): the pane's own rows, labelled as not the user's workbook. */
.tour-sample {
  border: 1px solid var(--neutral-stroke2);
  background: var(--bg-elevated);
  border-radius: var(--radius);
  padding: 4px 0;
}
.tour-sample-title {
  padding: 2px 8px 4px;
  font-size: var(--font-caption1);
  font-weight: 600;
  color: var(--text-secondary);
}
@media (forced-colors: active) {
  .tour-spot {
    outline: 3px solid Highlight;
  }
  .tour-popover {
    border-color: CanvasText;
  }
}

/* ==================== Grouped Changes Table ==================== */
.changes-sheet-group {
  margin-bottom: 6px;
}
.changes-sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 8px;
  font-size: var(--font-caption1);
  font-weight: 600;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  color: var(--text-primary);
}
.changes-sheet-header:hover {
  background: var(--bg-elevated);
}
.changes-sheet-header .collapse-chevron {
  transition: transform 0.2s;
  flex-shrink: 0;
}
.changes-sheet-header.collapsed .collapse-chevron {
  transform: rotate(-90deg);
}
.changes-sheet-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--accent-indigo-glow);
  color: var(--accent-text);
  font-size: var(--font-caption2);
  font-weight: 600;
  margin-left: 4px;
}
.changes-table {
  padding: 2px 0 2px 4px;
}
.changes-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 6px;
  font-size: var(--font-caption1);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background-color var(--transition-fast);
}
.changes-row:hover {
  background: var(--bg-elevated);
}
.change-ref {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent-text);
  min-width: 52px;
  flex-shrink: 0;
}
/* Up to two lines, so both sides of a change stay visible in a narrow pane (N3a). */
.change-summary {
  flex: 1;
  min-width: 0;
  color: var(--text-muted);
  overflow: hidden;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
.change-arrow {
  color: var(--text-muted);
  margin: 0 2px;
}
/* An edited formula's two sides, one line each (N3a). */
.change-summary .change-side {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* The changed part of a formula (N3a), in Changes, its detail and Compare: a line as well as a colour. */
.change-mark {
  color: inherit;
  border-radius: 2px;
}
del.change-mark {
  background: var(--mark-del-bg);
  text-decoration: line-through;
}
ins.change-mark {
  background: var(--mark-ins-bg);
  text-decoration: underline;
}
/* Inside the already coloured detail boxes, weight carries the mark instead of a second background. */
.diff-old .change-mark,
.diff-new .change-mark {
  background: none;
  font-weight: 600;
}
.diff-note {
  font-size: var(--font-caption1);
  line-height: 1.4;
  color: var(--text-primary);
  margin: 0 0 8px;
}
.diff-exact {
  font-family: var(--font-mono);
  font-size: var(--font-caption2);
  color: var(--text-muted);
  margin: -2px 0 8px;
  overflow-wrap: anywhere;
}
/* The values behind the outputs line, one per row (F2 round 2); smaller moves under their own heading (round 3). */
.diff-output-list {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
}
.diff-output-heading {
  margin: 12px 0 4px;
  font-size: var(--font-caption1);
  font-weight: 600;
  color: var(--text-secondary);
}
/* The outputs line is about many cells: no map of one. */
.diff-minimap[hidden] {
  display: none;
}
.diff-output-item {
  padding: 6px 0;
  border-top: 1px solid var(--border-subtle);
  font-size: var(--font-caption1);
  line-height: 1.4;
  color: var(--text-primary);
}
.diff-output-name {
  font-weight: 600;
}
.diff-output-where {
  font-family: var(--font-mono);
  font-size: var(--font-caption2);
  color: var(--text-muted);
}
.diff-output-values {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--font-caption1);
  overflow-wrap: anywhere;
}
.comparison-tag {
  display: block;
  font-size: var(--font-caption2);
  font-weight: 600;
  color: var(--error-text);
}
.comparison-row[aria-pressed="true"] .comparison-tag {
  color: var(--status-danger-fg);
}
/* A word the pane adds about a row ("Not in this copy", compare/ownEdits.js): a note, not a warning. */
.comparison-tag.comparison-tag-note,
.comparison-row[aria-pressed="true"] .comparison-tag.comparison-tag-note {
  color: inherit;
}
/* Whole, on as many lines as it takes: a row's spans are cut to one line ("NOT IN THI…" in a 320 px pane). */
.comparison-row span.comparison-tag-note {
  white-space: normal;
  overflow: visible;
  overflow-wrap: anywhere;
}
.changes-more-btn {
  display: block;
  width: 100%;
  min-height: 24px; /* UI-26: WCAG 2.2 target size; it measured 21 px */
  padding: 4px 6px;
  font-size: var(--font-caption1);
  color: var(--accent-text);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  border-radius: var(--radius-sm);
  transition: background-color var(--transition-fast);
}
.changes-more-btn:hover {
  background: var(--bg-elevated);
}
/* A change's row and column names above its values (N3b), on one line. */
.change-body {
  flex: 1;
  min-width: 0;
}
.change-label {
  display: block;
  color: var(--text-primary);
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* What moved on a sheet, above its changes, with Show all (N3b). */
.changes-move-note {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  margin: 2px 0 4px;
  padding: 6px 8px;
  font-size: var(--font-caption1);
  line-height: 1.4;
  color: var(--text-primary);
  background: var(--accent-indigo-glow);
  border-radius: var(--radius-sm);
}
.changes-move-text {
  flex: 1 1 180px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.changes-move-toggle {
  min-height: 24px; /* WCAG 2.2 target size */
  padding: 4px 6px;
  color: var(--accent-text);
  white-space: nowrap;
}
.changes-move-toggle:hover {
  color: var(--accent-text);
  background: var(--bg-elevated);
}
/* New problems since the chosen moment (N7), at the top of the Changes list. Found problems take the warning
   look; "No new problems" stays quiet, with a check mark only when every check ran. */
.changes-problems {
  margin: 0 0 var(--space-2);
  padding: 6px 8px;
  font-size: var(--font-caption1);
  line-height: 1.4;
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border: var(--border-subtle);
  border-radius: var(--radius-sm);
}
.changes-problems--found {
  background: var(--warning-bg);
  border-color: transparent;
  border-left: 3px solid var(--warning);
}
.changes-problems-head {
  display: flex;
  align-items: center;
  gap: 6px;
}
.changes-problems-icon {
  color: var(--text-secondary);
}
.changes-problems--found .changes-problems-icon {
  color: var(--warning-text);
}
.changes-problems--clean .changes-problems-icon {
  color: var(--accent-text);
}
.changes-problems-title {
  margin: 0;
  font-size: var(--font-caption1);
  font-weight: 600;
  color: var(--text-primary);
}
.changes-problems-list {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}
.changes-problem {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}
.changes-problem-text {
  margin-right: 4px;
}
.changes-problem-cells {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  vertical-align: middle;
}
.changes-problem-cell,
.changes-problem-more {
  min-height: 24px; /* WCAG 2.2 target size */
  padding: 2px 6px;
  font-size: var(--font-caption1);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.changes-problem-cell {
  font-family: var(--font-mono);
  color: var(--accent-text);
  background: var(--bg-surface);
  border: var(--border-subtle);
}
.changes-problem-cell:hover {
  background: var(--bg-elevated);
}
.changes-problem-more {
  color: var(--accent-text);
  background: transparent;
  border: none;
}
.changes-problem-more:hover {
  background: var(--bg-elevated);
}
/* What the pane's recalculation adds under a line (L9b): its own line, at the line's size. */
.changes-problem-extra {
  display: block;
  margin-top: 2px;
}
.changes-problem-unlisted {
  font-size: var(--font-caption1);
  color: var(--text-muted);
}
/* --text-muted, not --text-secondary: on the found box's amber the lighter grey measured 4.44:1 (light theme). */
.changes-problems-note {
  margin: 4px 0 0;
  font-size: var(--font-caption1);
  color: var(--text-muted);
  overflow-wrap: anywhere;
}
.changes-problems-checks {
  margin-top: 4px;
  font-size: var(--font-caption1);
  color: var(--text-muted);
}
/* Check the whole workbook, kept in view under New problems (F2 round 7, S03). */
.changes-problems-whole {
  margin: 2px 0 0;
}
/* Check the whole workbook at 24 px tall (axe target-size, E5, 2026-10-20: 15 px under New problems). */
.changes-problems-whole .btn-link,
.changes-empty-check .btn-link {
  min-height: 24px;
}
/* What Changes compares, under its list (F2 round 7, S08, S11). */
.changes-compared {
  margin: 10px 0 0;
}
/* A list item keeps the disclosure triangle (flex would hide it); 24 px tall for the target size. */
.changes-problems-summary {
  display: list-item;
  padding: 4px 0;
  line-height: 16px;
  color: var(--accent-text);
  cursor: pointer;
}
.changes-problems-checklist {
  margin: 2px 0 0;
  padding-left: 16px;
}
.changes-problems-scope {
  margin: 2px 0 0;
}
/* Undo This Change (T1) for formulas replaced by typed values, after the line's cells. */
.changes-problem-undo {
  min-height: 24px; /* WCAG 2.2 target size */
  margin-left: 2px;
  padding: 4px 6px;
  color: var(--accent-text);
  vertical-align: middle;
}
.changes-problem-undo:hover {
  color: var(--accent-text);
  background: var(--bg-elevated);
}
/* Mark as intended (N7b), after the cells and Undo; on a marked line, Not intended. */
.changes-problem-mark,
.changes-problems-intended-toggle {
  min-height: 24px; /* WCAG 2.2 target size */
  margin-left: 2px;
  padding: 4px 6px;
  color: var(--accent-text);
  vertical-align: middle;
}
.changes-problem-mark:hover,
.changes-problems-intended-toggle:hover {
  color: var(--accent-text);
  background: var(--bg-elevated);
}
/* A returned copy's box of the user's own edits since sending it (compare/ownEdits.js), quiet like New problems'
   "No new problems". */
.own-edits-lead {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}
.own-edits-compare {
  min-height: 24px; /* WCAG 2.2 target size */
  margin-top: 2px;
  padding: 4px 6px 4px 0;
  color: var(--accent-text);
}
.own-edits-compare:hover {
  color: var(--accent-text);
  background: var(--bg-elevated);
}
/* Problems open when the version compared with was saved, still there (N7b), under the new ones. */
.changes-problems-subhead {
  margin: 8px 0 0;
  font-size: var(--font-caption1);
  font-weight: 600;
  color: var(--text-primary);
}
/* "2 marked as intended" with Show: quiet, under the problems still open. */
.changes-problems-intended {
  margin-top: 4px;
  font-size: var(--font-caption1);
  color: var(--text-muted);
}
.changes-problems-intended-row {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
}
.changes-problems-list--intended .changes-problem {
  color: var(--text-muted);
}
.changes-problems-title:focus {
  outline: none;
}
.changes-problems-title:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
/* Key numbers (N5): the numbers a reader checks first, old → new, above New problems. Up and down take no colour
   (up is not always good); only a value that became an error takes the warning colour. */
.key-numbers {
  margin: 0 0 var(--space-2);
  padding: 6px 8px;
  font-size: var(--font-caption1);
  line-height: 1.4;
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border: var(--border-subtle);
  border-radius: var(--radius-sm);
}
.key-numbers-head {
  display: flex;
  align-items: center;
  gap: 6px;
}
.key-numbers-head > .icon-svg {
  flex-shrink: 0;
  color: var(--accent-text);
}
.key-numbers-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: var(--font-caption1);
  font-weight: 600;
  color: var(--text-primary);
}
.key-numbers-watch,
.key-number-action,
.key-numbers-more {
  min-height: 24px; /* WCAG 2.2 target size */
  padding: 4px 6px;
  color: var(--accent-text);
  white-space: nowrap;
}
.key-numbers-watch:hover,
.key-number-action:hover,
.key-numbers-more:hover {
  color: var(--accent-text);
  background: var(--bg-elevated);
}
.key-numbers-hide,
.key-number-edit {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 24px;
  padding: 4px;
  border-color: transparent;
}
.key-numbers-tip-text {
  margin: 4px 0 0;
  font-size: var(--font-caption1);
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}
/* One line until opened (UI-165), styled as "N changes feed it" is. */
.key-numbers-suggest-summary {
  display: list-item;
  margin-top: 2px;
  padding: 4px 0;
  font-size: var(--font-caption1);
  line-height: 16px;
  color: var(--accent-text);
  cursor: pointer;
  overflow-wrap: anywhere;
}
/* The outputs that moved most, offered in the tip before any number is watched (F2 round 4, S09). */
.key-numbers-suggested {
  min-width: 0;
  margin: 4px 0 0;
  padding: 0;
  border: 0;
}
.key-numbers-suggested-title {
  padding: 0;
  font-size: var(--font-caption1);
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}
/* Two classes: .key-number-body, further down, stacks its children. */
.key-number-body.key-number-suggestion {
  flex-direction: row;
  align-items: flex-start;
  gap: 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.key-number-suggestion:hover {
  background: var(--bg-elevated);
}
.key-number-suggest-check {
  flex: none;
  width: 14px;
  height: 14px;
  margin: 2px 0 0;
  accent-color: var(--accent-indigo);
}
.key-number-suggestion-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.btn-secondary.key-numbers-suggested-watch {
  width: auto;
  min-height: 24px; /* WCAG 2.2 target size */
  margin: 4px 0 0 4px;
}
.key-numbers-suggested-watch[aria-disabled="true"] {
  opacity: 0.6;
  cursor: not-allowed;
}
/* Why Watch selected cells did nothing, under its button (F2 round 2). */
.key-numbers-notice {
  margin: 4px 0 0;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: var(--font-caption1);
  line-height: 1.4;
  background: var(--warning-bg);
  color: var(--warning-text);
  overflow-wrap: anywhere;
}
.key-numbers-list {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}
.key-number {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 4px;
  border-top: 1px solid var(--border-color);
}
.key-number:first-child {
  border-top: 0;
}
.key-number-go,
.key-number-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 4px;
}
.key-number-go {
  font: inherit;
  text-align: left;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.key-number-go:hover {
  background: var(--bg-elevated);
}
.key-number-head {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}
.key-number-name {
  flex: 1;
  min-width: 0;
  font-weight: 400;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.key-number-where {
  flex-shrink: 1;
  max-width: 45%;
  font-family: var(--font-mono);
  font-size: var(--font-caption2);
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.key-number-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0 8px;
  font-size: var(--font-caption1);
  font-variant-numeric: tabular-nums;
}
.key-number-values {
  min-width: 0;
  overflow-wrap: anywhere;
}
.key-number-before {
  color: var(--text-muted);
}
.key-number-after {
  font-weight: 600;
  color: var(--text-primary);
}
.key-number-arrow {
  margin: 0 4px;
  color: var(--text-muted);
}
.key-number-blank {
  font-style: italic;
  font-weight: 400;
  color: var(--text-muted);
}
.key-number-change {
  color: var(--text-secondary);
  white-space: nowrap;
}
.key-number-change--warning {
  font-weight: 600;
  color: var(--warning-text);
}
.key-number-missing-text {
  font-size: var(--font-caption1);
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}
.key-number-action {
  align-self: flex-start;
}
.key-numbers-note {
  margin: 4px 0 0;
  font-size: var(--font-caption1);
  color: var(--text-muted);
  overflow-wrap: anywhere;
}
/* Why it moved (L9): under a number that moved, the listed changes it reads, each opening its change. */
.key-number-why {
  flex-basis: 100%;
  min-width: 0;
  margin: 0 4px 4px;
  font-size: var(--font-caption1);
}
/* A list item keeps the disclosure triangle; 24 px tall for the target size. */
.key-number-why-summary {
  display: list-item;
  padding: 4px 0;
  line-height: 16px;
  color: var(--accent-text);
  cursor: pointer;
}
.key-number-why-summary--count {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  color: var(--text-secondary);
}
.key-number-why-summary--count::-webkit-details-marker {
  display: none;
}
.key-number-why-summary--count .count-badge {
  height: 18px;
  min-width: 18px;
  color: var(--accent-text);
}
.key-number-why--none > .key-number-why-summary {
  color: var(--text-secondary);
}
.key-number-why-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.key-number-why-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 100%;
  min-height: 24px;
  padding: 3px 6px;
  font: inherit;
  text-align: left;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.key-number-why-item:hover {
  background: var(--bg-elevated);
}
.key-number-why-head {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}
.key-number-why-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.key-number-why-where {
  flex-shrink: 1;
  max-width: 45%;
  font-family: var(--font-mono);
  font-size: var(--font-caption2);
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* A row of cells that changed alike: the range, then "· 12 cells" whole, on a line of its own when it must wrap
   (F2 round 7, S02 read "· 12 ce…"). */
.key-number-why-where--group {
  flex-shrink: 0;
  max-width: 50%;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: right;
}
.key-number-why-cells {
  white-space: nowrap;
}
.key-number-why-values {
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
/* Each change's share of the move (L9b): the values at the left, the share at the right. */
.key-number-why-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0 8px;
  min-width: 0;
}
.key-number-why-share {
  margin-left: auto;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.key-number-why-share--none {
  font-weight: 400;
  color: var(--text-muted);
}
.key-number-why-earlier,
.key-number-why-alone,
.key-number-why-takenin {
  font-size: var(--font-caption2);
  color: var(--text-muted);
}
.key-number-why-takenin {
  overflow-wrap: anywhere;
}
.key-number-why-other {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0 8px;
  min-height: 24px;
  padding: 3px 6px;
  color: var(--text-secondary);
}
.key-number-why-badge {
  align-self: flex-start;
  padding: 0 6px;
  font-size: var(--font-caption2);
  font-weight: 600;
  color: var(--error-text);
  background: var(--error-bg);
  border-radius: var(--radius-sm);
}
.key-number-why-rows {
  display: block;
  padding: 3px 6px;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}
.key-number-why-more {
  min-height: 24px; /* WCAG 2.2 target size */
  padding: 4px 6px;
  color: var(--accent-text);
}
.key-number-why-more:hover {
  color: var(--accent-text);
  background: var(--bg-elevated);
}
.key-number-why-reason {
  margin: 2px 0 0;
  padding: 0 6px;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}
/* The change dialog's Watch this number (N5), under its Undo buttons. */
.diff-watch {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  padding: 8px 12px 10px;
  font-size: var(--font-caption1);
  color: var(--text-secondary);
  border-top: var(--border);
}
.diff-watch[hidden] {
  display: none;
}
.diff-watch-btn {
  min-height: 24px;
  padding: 4px 6px;
  color: var(--accent-text);
}
.diff-watch-btn[aria-disabled="true"] {
  color: var(--text-secondary);
  text-decoration: none;
  cursor: default;
}
.diff-watch-status {
  min-width: 0;
  overflow-wrap: anywhere;
}
/* Rename a version (round 4: S01, S04, S05). */
.rename-form {
  padding: 4px 16px 0;
}
.rename-input {
  display: block;
  box-sizing: border-box;
  width: 100%;
}
.rename-status {
  margin: 6px 0 0;
  color: var(--text-primary);
}
.rename-status:empty {
  display: none;
}
.rename-status--warning {
  color: var(--warning-text);
}
/* The key number popover (N5; slice 9). */
.key-number-field-label {
  display: block;
  margin: 8px 0 4px;
  font-size: var(--font-caption1);
  font-weight: 600;
  color: var(--text-secondary);
}
.key-number-cell-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  margin-top: 10px;
}
.key-number-cell-row .key-number-field-label {
  display: inline;
  margin: 0;
}
.key-number-cell {
  font-family: var(--font-mono);
  font-size: var(--font-caption1);
  color: var(--text-primary);
  overflow-wrap: anywhere;
}
#key-number-use {
  margin-left: auto;
}
.key-number-status {
  margin: 6px 0 0;
  color: var(--text-primary);
}
.key-number-status:empty {
  display: none;
}
.key-number-status--warning {
  color: var(--warning-text);
}
/* Stop watching at the row's start, apart from Save and Cancel. */
.key-number-actions .key-number-remove {
  margin-right: auto;
  color: var(--error-text);
}
/* Undo This Change (T1) for the chosen row of a comparison with the open workbook. */
.comparison-undo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: var(--font-caption1);
  color: var(--text-secondary);
}
.comparison-undo:empty {
  display: none;
}
.comparison-undo-cell {
  font-family: var(--font-mono);
  overflow-wrap: anywhere;
}
.comparison-undo .comparison-undo-btn {
  width: auto;
  min-height: 24px;
}
.comparison-undo-note {
  margin: 0;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}
/* Undo This Change (T1) under the change dialog's values: the cell, or the block around it. */
.diff-undo {
  flex-shrink: 0;
  padding: 10px 12px;
  border-top: var(--border);
}
.diff-undo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.diff-undo-actions .btn-primary,
.diff-undo-actions .btn-secondary {
  width: auto;
  min-height: 24px;
}
.diff-undo-note {
  margin: 6px 0 0;
  font-size: var(--font-caption1);
  line-height: 1.4;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}
.diff-undo-actions[hidden] + .diff-undo-note {
  margin-top: 0;
}
.diff-cell-label {
  font-size: var(--font-caption1);
  color: var(--text-primary);
  margin: -4px 0 8px;
  overflow-wrap: anywhere;
}

/* ==================== Tooltip ==================== */
#sheettrack-tooltip {
  position: fixed;
  z-index: 300;
  background: var(--bg-elevated, var(--bg-secondary));
  border: var(--border);
  border-radius: var(--radius-sm, 4px);
  padding: 6px 10px;
  font-size: var(--font-caption1);
  color: var(--text-primary);
  max-width: 200px;
  pointer-events: none;
  box-shadow: var(--shadow-16);
  display: none;
}

/* ==================== Simplified Init Flow ==================== */
.init-start-hint {
  margin: 6px 0 0;
}
.init-start-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3) 0;
}
.init-locations-details {
  border: var(--border-subtle);
  border-radius: var(--radius);
  overflow: hidden;
}
.init-locations-details summary {
  cursor: pointer;
  font-size: var(--font-caption1);
  font-weight: 400;
  color: var(--text-muted);
  padding: var(--space-2) var(--space-3);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 4px;
  user-select: none;
}
.init-locations-details summary::-webkit-details-marker {
  display: none;
}
.init-locations-details[open] summary {
  color: var(--text-primary);
}

/* ==================== Issue Dismiss Button ==================== */
/* "Accept": a word on every card, not a × that read as "close" (F2 rounds 1 and 3). */
.issue-dismiss-btn {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--accent-text);
  font-size: var(--font-caption1);
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  padding: 3px 6px;
  min-height: 24px;
  border-radius: 4px;
  opacity: 1;
  transition:
    opacity var(--transition-fast),
    color var(--transition-fast);
  align-self: flex-start;
}
.issue-dismiss-btn:hover {
  background: var(--accent-indigo-glow);
}
.issue-review-error {
  display: block;
  margin-top: 4px;
  color: var(--error-text);
  font-size: var(--font-caption1);
}
.issue-review-error:empty {
  display: none;
}
/* Touch screens have no hover: the button is always visible there (Store policy 1120.3). */
@media (hover: none) {
  .issue-dismiss-btn {
    opacity: 1;
    min-width: 32px;
    min-height: 32px;
  }
}

.dismissed-issues-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  margin-bottom: 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-size: var(--font-caption1);
}

.dismissed-issues-summary[hidden] {
  display: none;
}

/* ==================== Check Workbook review (Plan 7 T7) ==================== */
/* What is new and resolved since the last check here, under the headline. */
.linter-since {
  margin: 0 0 var(--space-2);
  font-size: var(--font-caption1);
  line-height: 1.5;
  color: var(--text-secondary);
}
.linter-since[hidden],
.filter-buttons[hidden] {
  display: none;
}
.linter-since-line {
  margin: 0;
}
.linter-since-resolved {
  margin-top: 4px;
  font-size: var(--font-caption1);
  color: var(--text-muted);
}
.linter-since-resolved summary {
  cursor: pointer;
}
.linter-since-note {
  margin: 4px 0 0;
}
.linter-since-resolved ul {
  margin: 4px 0 0;
  padding-left: 18px;
  overflow-wrap: anywhere;
}
/* A finding new since the last check, beside its check's name (the active filter's colours, AA in both themes). */
.issue-new-badge {
  display: inline-block;
  padding: 0 6px;
  border: 1px solid var(--accent-indigo);
  border-radius: 999px;
  background: var(--accent-indigo-glow);
  color: var(--accent-text);
  font-size: var(--font-caption2);
  font-weight: 600;
  line-height: 16px;
  vertical-align: 1px;
}
/* The cell's row and column names ("Revenue · FY27"), under the check's name. */
.issue-card-label {
  font-size: var(--font-caption1);
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}
/* Why an accepted finding was accepted, with Show again. */
.issue-accepted-reason {
  margin: 6px 0 4px;
  font-size: var(--font-caption1);
  line-height: 1.4;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

/* ==================== Responsive Layout ==================== */

/* Keep overlays and popovers inside the actual task-pane viewport. */
.modal {
  padding: 8px;
}

.modal-content {
  width: calc(100vw - 16px);
  max-width: 560px;
  max-height: calc(100vh - 16px);
  overflow: hidden;
}

@supports (height: 100dvh) {
  .modal-content {
    max-height: calc(100dvh - 16px);
  }
}

.modal-body {
  min-height: 0;
  overflow-y: auto;
}

.modal-settings .modal-body {
  max-height: none;
}

.welcome-overlay {
  overflow-y: auto;
}

/* Short Excel windows need information density, not collapsed content. */
@media (max-height: 600px) {
  .tab-content {
    padding: 8px;
  }

  #check-tab .results-header,
  .changes-stale,
  .changes-pending {
    top: -8px;
  }

  .quick-actions {
    margin-bottom: 8px;
  }

  .health-ring-container {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    width: 100%;
    padding: 4px 0 8px;
    column-gap: 12px;
    row-gap: 3px;
    align-items: center;
  }

  .health-ring-summary,
  .health-ring-context,
  .health-ring-details {
    grid-column: 1;
    text-align: left;
    justify-content: flex-start;
    min-width: 0;
  }

  .health-ring-summary {
    font-size: var(--font-caption1);
  }

  .health-ring-context {
    margin-top: 0;
  }

  .health-ring-details {
    gap: 8px;
    flex-wrap: wrap;
  }

  .check-empty-state {
    padding-block: 12px;
  }

  .check-empty-icon,
  .no-issues-illustration {
    width: 40px;
    height: 40px;
  }
}

@media (max-height: 480px) {
  .pulse-header {
    min-height: 32px;
  }

  .tab-button {
    padding-top: 7px;
    padding-bottom: 7px;
  }

  .modal-header,
  .modal-body,
  .modal-actions,
  .confirm-actions {
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .welcome-overlay {
    padding: 8px;
  }
}

/* Ultra-narrow pane (<280px) */
@media (max-width: 280px) {
  .save-version-row {
    flex-direction: column;
    align-items: stretch;
  }

  .save-version-input {
    min-width: 0;
    width: 100%;
  }

  .save-version-btn {
    width: 100%;
  }

  .tab-content {
    padding: 8px;
  }
}

/* Narrow pane (<320px) — stack commit row */
@media (max-width: 320px) {
  .save-version-row {
    flex-direction: column;
    align-items: stretch;
  }

  .save-version-input {
    min-width: 0;
    width: 100%;
  }

  .save-version-btn {
    width: 100%;
  }

  /* Four tabs and three header buttons fit at 320 px (slice 3). */
  .tab-button {
    min-width: 0;
    padding-left: 6px;
    padding-right: 6px;
    gap: 2px;
  }

  .pulse-right .header-icon-btn {
    width: 28px;
  }

  .tab-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .results-header {
    flex-wrap: wrap;
    gap: 6px 8px;
  }

  .command-hint-kbd {
    margin-left: auto;
  }

  .filter-buttons {
    flex: 1 1 100%;
    display: grid;
    /* Four filters on one row at 320 px (three left Warnings alone on a second row, E5, 2026-10-20). */
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
  }

  .filter-btn {
    min-width: 0;
    padding-left: 4px;
    padding-right: 4px;
  }

  .settings-row {
    align-items: stretch;
    flex-direction: column;
  }

  /* Checkbox labels keep the box beside its text. */
  label.settings-row {
    align-items: center;
    flex-direction: row;
  }

  .settings-select,
  .settings-row > .commit-input {
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  .comment-input-row {
    align-items: stretch;
    flex-direction: column;
  }

  .comment-input-row button {
    width: 100%;
  }

  .diff-minimap {
    display: none;
  }

  .diff-summary-row {
    align-items: stretch;
    flex-direction: column;
  }

  .diff-summary-label {
    min-width: 0;
  }

  .dismissed-issues-summary {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .dismissed-issues-summary .btn-link {
    flex-basis: 100%;
    text-align: left;
  }
}

.workspace-status {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin: 10px 12px 0;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-secondary);
  box-shadow: var(--shadow-4);
}

.workspace-status[hidden] {
  display: none;
}

.workspace-status__icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: var(--text-muted);
}

.workspace-status__content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: var(--font-caption1);
  line-height: 1.35;
}

.workspace-status__content strong {
  color: var(--text-primary);
  font-size: var(--font-caption1);
}

.workspace-status__actions {
  display: flex;
  gap: 4px;
}

.workspace-status[data-state="ready"] {
  border-color: var(--status-success-stroke);
}

.workspace-status[data-state="ready"] .workspace-status__icon {
  color: var(--success);
}

.workspace-status[data-state="loading"] .workspace-status__icon {
  color: var(--accent-text);
}

.workspace-status[data-state="auth-required"],
.workspace-status[data-state="admin-required"],
.workspace-status[data-state="error"] {
  border-color: var(--status-warning-stroke);
  background: var(--warning-bg);
}

.workspace-status[data-state="auth-required"] .workspace-status__icon,
.workspace-status[data-state="admin-required"] .workspace-status__icon,
.workspace-status[data-state="error"] .workspace-status__icon {
  color: var(--warning-text);
}

@media (max-width: 340px) {
  .workspace-status {
    grid-template-columns: 22px minmax(0, 1fr);
  }

  .workspace-status__actions {
    grid-column: 2;
    justify-content: flex-start;
  }

  .audit-metrics {
    grid-template-columns: 1fr;
  }

  .surface-card .section-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .surface-actions,
  .surface-actions .btn-secondary {
    width: 100%;
  }

  .surface-actions {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 380px) {
  .header-icon-btn,
  .theme-toggle {
    padding: 2px 4px;
    margin-left: 0;
  }
}

/* Wide pane (>500px) */
@media (min-width: 500px) {
  .tab-content {
    padding: 16px;
  }
}

/* Review reasons use the same spacing and controls as other task-pane cards. */
.issue-review-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
  font-size: var(--font-body-dense);
}
.issue-review-field textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px;
  border: 1px solid var(--neutral-stroke1);
  border-radius: var(--radius);
  font: inherit;
  color: inherit;
  background: var(--neutral-bg1);
  resize: vertical;
}

/* What Save Version before AI is for, under it (F2 round 3), read from the left like Mark as sent's (a right-aligned
   two-line paragraph at 320 px: E5, run 76). */
.before-ai-hint {
  flex-basis: 100%;
  text-align: left;
  display: block;
  margin-top: 2px;
}

/* A tab given the keyboard after a message closed (UI-162) shows no outline of its own. */
.tab-content[tabindex="-1"]:focus {
  outline: none;
}

/* ==================== Redesign slice 4: the Changes tab (spec 4.2) ==================== */
/* Sections are separated by space and 1 px dividers, never cards inside the tab (spec section 6). */

/* The context row: Since, then Refresh. */
.changes-context {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 32px;
  margin-bottom: var(--space-3);
}
.changes-context .changes-since-row {
  flex: 1;
  min-width: 0;
  margin: 0;
}
.changes-context .changes-since-label {
  font-size: var(--font-body-dense);
}
.changes-context .changes-since-select {
  min-height: 32px;
  font-size: var(--font-body-dense);
}
.changes-refresh-btn {
  flex-shrink: 0;
  margin-left: auto;
  min-width: 32px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Key numbers: two lines a row, the name and the value now, the cell and its change (spec 4.2, item 2). */
.key-numbers {
  margin: 0 0 var(--space-3);
  padding: 0;
  font-size: var(--font-body-dense);
  background: transparent;
  border: 0;
  border-radius: 0;
}
.key-numbers-head {
  min-height: 32px;
}
.key-numbers-title {
  font-size: var(--font-body1);
}
.key-numbers-watch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 32px;
  color: var(--text-primary);
}
.key-numbers-watch:hover {
  color: var(--text-primary);
}
.key-numbers-watch .icon-svg {
  color: var(--brand-fg);
}
.key-number {
  border-top: 0;
}
.key-number-go {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: var(--space-2);
  row-gap: 0;
  padding: 6px 4px;
  align-items: baseline;
}
.key-number-go > .key-number-head,
.key-number-go > .key-number-line {
  display: contents;
}
.key-number-go .key-number-name {
  grid-column: 1;
  grid-row: 1;
  font-size: var(--font-body1);
}
.key-number-go .key-number-values {
  grid-column: 2;
  grid-row: 1;
  text-align: right;
  font-size: var(--font-body1);
  font-variant-numeric: tabular-nums;
}
.key-number-go .key-number-where {
  grid-column: 1;
  grid-row: 2;
  max-width: none;
  font-size: var(--font-caption1);
}
.key-number-go .key-number-change {
  grid-column: 2;
  grid-row: 2;
  text-align: right;
  font-size: var(--font-caption1);
  font-variant-numeric: tabular-nums;
}
/* The value it was is read by screen readers and named in the change's tooltip; on screen, the value now. */
.key-number-go .key-number-before,
.key-number-go .key-number-arrow {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.key-number--up .key-number-change::before {
  content: "\25B2\00A0" / "";
}
.key-number--down .key-number-change::before {
  content: "\25BC\00A0" / "";
}

/* New issues: a warning MessageBar when found; one quiet line when none (spec 4.2, item 3). */
.changes-problems {
  margin: 0 0 var(--space-3);
  padding: 0;
  font-size: var(--font-body-dense);
  background: transparent;
  border: 0;
  border-radius: 0;
}
.changes-problems--found {
  padding: 8px 12px;
  background: var(--status-warning-bg);
  border: 1px solid var(--status-warning-stroke);
  border-radius: var(--radius);
}
.changes-problems-head {
  gap: var(--space-2);
  min-height: 24px;
}
.changes-problems-title {
  flex: 1;
  min-width: 0;
  font-size: var(--font-body-dense);
}
.changes-problems--clean .changes-problems-title,
.changes-problems--partial .changes-problems-title {
  font-weight: 400;
}
.changes-problems--found .changes-problems-icon {
  color: var(--status-warning-fg);
}
.info-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 24px;
  padding: 2px;
  color: var(--text-secondary);
  border-color: transparent;
  background: transparent;
}
.info-btn[aria-expanded="true"] {
  color: var(--brand-fg);
}
.changes-problem {
  margin: 6px 0 0;
}
.changes-problem-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}
.changes-problem-actions .changes-problem-undo,
.changes-problem-actions .changes-problem-mark,
.changes-problem-actions .changes-problem-undo:hover,
.changes-problem-actions .changes-problem-mark:hover {
  width: auto;
  margin: 0;
  min-height: 28px;
  padding: 3px 10px;
  color: var(--text-primary);
}
.changes-problem-scope {
  display: block;
  margin-top: 4px;
  font-size: var(--font-caption1);
  color: var(--text-muted);
}
.changes-problems-checks {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--neutral-stroke3);
}

/* The list's head: "Changes", its count, the ⓘ and Copy summary; the outputs line under it (spec 4.2, item 4). */
.changes-list-head {
  margin: 0 0 var(--space-2);
}
/* A divider between the sections above (Key numbers, New issues) and the list. */
.key-numbers ~ .changes-list-head,
.changes-problems ~ .changes-list-head {
  padding-top: var(--space-3);
  border-top: 1px solid var(--neutral-stroke3);
}
.changes-list-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 32px;
}
.changes-list-title {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.changes-list-heading {
  margin: 0;
  font-size: var(--font-body1);
  font-weight: 600;
  color: var(--text-primary);
}
.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  font-size: var(--font-caption1);
  font-weight: 600;
  color: var(--text-primary);
  background: var(--neutral-bg2);
  border: 1px solid var(--neutral-stroke3);
}
.changes-copy-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto;
}
.changes-list-head .changes-compared {
  margin: 4px 0 0;
}
.changes-outputs {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  margin-top: 4px;
  padding: 4px;
  font-size: var(--font-body-dense);
  line-height: 1.4;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.changes-outputs:hover,
.changes-outputs[aria-expanded="true"] {
  background: var(--subtle-bg-hover);
}
.changes-outputs:focus-visible,
.changes-row:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -2px;
}
.changes-outputs-text {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Sheet groups: an accordion header, "Valuation · 2 changes". */
.changes-sheet-group {
  margin-bottom: 0;
}
.changes-sheet-header {
  justify-content: flex-start;
  min-height: 28px;
  padding: 4px 8px;
  font-size: var(--font-body-dense);
  border-radius: 0;
  background: var(--neutral-bg2);
  border-top: 1px solid var(--neutral-stroke3);
  border-bottom: 1px solid var(--neutral-stroke3);
}
.changes-sheet-header .collapse-chevron {
  order: -1;
  margin-right: 6px;
}
.changes-sheet-count {
  min-width: 0;
  height: auto;
  padding: 0;
  margin-left: 4px;
  font-size: var(--font-body-dense);
  font-weight: 400;
  color: var(--text-secondary);
  background: transparent;
  border-radius: 0;
}
.changes-sheet-count::before {
  content: "\00B7\00A0" / "";
}
.changes-table {
  padding: 0;
}

/* Rows: the cell, then the names and a tag, and old → new under them; a chevron that opens the change. */
.changes-row {
  align-items: flex-start;
  gap: var(--space-2);
  min-height: 36px;
  padding: 6px 4px 6px 8px;
  font-size: var(--font-body-dense);
  border-radius: 0;
  border-bottom: 1px solid var(--neutral-stroke3);
}
.changes-row:hover,
.changes-row[aria-expanded="true"] {
  background: var(--subtle-bg-hover);
}
.changes-row[aria-expanded="true"] {
  border-bottom-color: transparent;
}
.change-ref {
  min-width: 36px;
  padding-top: 1px;
  font-weight: 400;
  font-size: var(--font-caption1);
  color: var(--text-secondary);
}
.change-head {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.change-head .change-label {
  flex: 0 1 auto;
  min-width: 0;
}
.change-head .change-type {
  flex-shrink: 0;
  margin-right: 0;
  padding: 0 6px;
  border-radius: 10px;
  font-size: var(--font-caption1);
  font-weight: 400;
  line-height: 18px;
}
.changes-row .change-summary {
  font-family: var(--font-mono);
  font-size: var(--font-caption1);
  color: var(--text-secondary);
}
.change-chevron {
  flex-shrink: 0;
  margin-top: 4px;
  color: var(--text-muted);
  transform: rotate(-90deg);
  transition: transform var(--transition-fast);
}
[aria-expanded="true"] > .change-chevron {
  transform: none;
}

/* A change opened under its row: Before and Now, then Undo change (or Restore formula) and Watch. */
.diff-detail--inline {
  padding: 4px 8px 10px 52px;
  background: var(--subtle-bg-hover);
  border-bottom: 1px solid var(--neutral-stroke3);
}
.diff-detail--inline .diff-minimap,
.diff-detail--inline .diff-cell-header,
.diff-detail--inline .diff-cell-label {
  display: none;
}
.diff-detail--inline .diff-body {
  display: block;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
}
.diff-detail--inline .diff-content {
  max-height: none;
  overflow: visible;
  padding: 0;
}
.diff-detail--inline .diff-cell {
  padding: 0;
  border: 0;
  background: transparent;
}
.diff-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
}
.diff-actions .diff-undo,
.diff-actions .diff-watch {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.diff-actions .diff-undo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.diff-actions .btn-secondary,
.diff-actions .btn-subtle,
.changes-copy-btn,
.key-numbers-watch {
  width: auto;
}
.diff-detail .diff-undo-note {
  margin: 4px 0 0;
  font-size: var(--font-caption1);
  color: var(--text-muted);
}

/* The empty state (spec 4.2, item 7). */
.changes-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: var(--space-5) var(--space-2);
  text-align: center;
}
.changes-empty-icon {
  color: var(--text-muted);
}
.changes-empty .empty-state {
  margin: 0;
  padding: 0;
  font-size: var(--font-body1);
  color: var(--text-primary);
}
.changes-empty-hint {
  margin: 0;
}

/* The backup offer: one line (spec 4.2, item 8). */
.backup-offer-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 var(--space-2);
  margin: var(--space-2) 0 0;
  font-size: var(--font-body-dense);
  color: var(--text-secondary);
}
.backup-offer-line .btn-link {
  min-height: 24px;
}

/* Save: a name and the split button, the tab's only filled button, kept in view at the bottom (spec 4.2, item 6).
   Since slice 5 it is the tab's footer below the part that scrolls, not a sticky row over it: a row half under it
   was too small to press (axe's target-size, both themes). */
#changes-section {
  flex: 1 0 auto;
  margin-bottom: 0;
}
/* Clipped, never scrolled: a hidden box still scrolls for scrollIntoView and focus, and Changes then showed only white
   under the tabs until a card was closed (F2 round 15, D05: UI-458). `hidden` where `clip` is not known. */
#versions-tab.tab-content {
  padding: 0;
  overflow: hidden;
  overflow: clip;
}
#versions-tab > .tab-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 12px;
}
#versions-tab > .tab-scroll > * {
  flex-shrink: 0;
}
#versions-tab > .save-version-row {
  flex-shrink: 0;
  margin: 0;
  padding: 10px 12px;
  background: var(--neutral-bg-canvas);
  border-top: 1px solid var(--neutral-stroke2);
}
#versions-tab > .save-version-row[hidden] {
  display: none;
}
/* The tab's own padding, as .tab-content has it in short and narrow panes, and in a wide one. */
@media (max-height: 600px), (max-width: 280px) {
  #versions-tab > .tab-scroll {
    padding: 8px;
  }
  #versions-tab > .save-version-row {
    padding: 8px;
  }
}
@media (min-width: 500px) {
  #versions-tab > .tab-scroll {
    padding: 16px;
  }
  #versions-tab > .save-version-row {
    padding: 10px 16px;
  }
}
.split-button {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}
.split-button > .save-version-btn {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.split-button-menu {
  min-width: 32px;
  padding: 0 8px;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-left: 1px solid var(--neutral-bg-canvas);
}
.save-menu {
  top: auto;
  bottom: calc(100% + 4px);
  right: 0;
}
@media (min-width: 281px) and (max-width: 320px) {
  #versions-tab > .save-version-row {
    flex-direction: row;
    align-items: center;
  }
  #versions-tab > .save-version-row .save-version-input {
    width: auto;
  }
  #versions-tab > .save-version-row .save-version-btn {
    width: auto;
  }
}
@media (max-width: 280px) {
  .split-button {
    width: 100%;
  }
  .split-button > .save-version-btn {
    flex: 1;
  }
}

/* ==================== Check tab (redesign slice 6, spec 4.4) ==================== */
/* One Check workbook button: centred under the empty state before the first check, the toolbar's Check again after. */
.check-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0 0 var(--space-2);
}
.check-toolbar--ran {
  justify-content: flex-start;
  padding: var(--space-3) 0 var(--space-2);
}
.check-toolbar #analyze-btn {
  flex: 0 0 auto;
  width: auto;
  white-space: nowrap;
  min-height: 32px;
  padding: 0 var(--space-4);
}
.check-toolbar .check-profile {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 180px;
  min-height: 32px;
}
.check-toolbar .check-export-btn {
  margin-left: auto;
  min-width: 32px;
  min-height: 32px;
}
#check-tab .analyze-data-notice {
  text-align: center;
  margin: 0 0 var(--space-3);
}
.check-verdict {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-2) 0;
}
.check-verdict-icon {
  flex-shrink: 0;
  display: inline-flex;
  padding-top: 1px;
}
.check-verdict[data-tone="error"] .check-verdict-icon {
  color: var(--status-danger-fg);
}
.check-verdict[data-tone="warning"] .check-verdict-icon {
  color: var(--status-warning-fg);
}
.check-verdict[data-tone="partial"] .check-verdict-icon {
  color: var(--text-secondary);
}
.check-verdict[data-tone="clean"] .check-verdict-icon {
  color: var(--status-success-fg);
}
.check-verdict-text {
  min-width: 0;
}
.check-verdict-title {
  margin: 0;
  font-size: var(--font-subtitle2);
  line-height: 22px;
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}
.check-verdict-sentence {
  margin: 2px 0 0;
  font-size: var(--font-body-dense);
  line-height: 18px;
  color: var(--text-secondary);
}
/* The captions under the verdict: plain lines, no box (no card inside a card). */
#check-tab .linter-coverage {
  padding: 0;
  margin: 0 0 var(--space-1);
  border: 0;
  color: var(--text-secondary);
}
#check-tab .linter-coverage strong {
  font-weight: var(--weight-regular);
}
.linter-coverage-line {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  min-width: 0;
}
.linter-coverage-line .check-about-btn {
  min-width: 24px;
  min-height: 24px;
  padding: 0;
}
.check-about {
  margin: var(--space-1) 0 0;
}
#check-tab .linter-since {
  margin: 0 0 var(--space-1);
  font-size: var(--font-caption1);
  color: var(--text-secondary);
}
#check-tab .linter-since-line {
  margin: 0;
}
/* The list is the tab's own section under a divider, not a card. */
#check-tab .results-container {
  margin-top: var(--space-2);
  padding: var(--space-2) 0 0;
  border: 0;
  border-top: var(--border-subtle);
  border-radius: 0;
  background: transparent;
}
.check-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}
.check-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: 28px;
  padding: 0 var(--space-2);
  border: 1px solid var(--neutral-stroke2);
  border-radius: 999px;
  background: var(--neutral-bg1);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--font-caption1);
  cursor: pointer;
}
.check-chip:hover {
  background: var(--neutral-bg1-hover);
}
.check-chip.active {
  border-color: var(--brand-stroke);
  background: var(--brand-tint-bg);
  font-weight: var(--weight-semibold);
}
.check-chip-count {
  font-variant-numeric: tabular-nums;
}
#check-tab .linter-filter-summary:empty {
  display: none;
}
#check-tab .linter-filter-summary {
  margin: var(--space-1) 0 0;
  font-size: var(--font-caption1);
  color: var(--text-secondary);
}
.check-groups {
  display: flex;
  flex-direction: column;
}
.check-group {
  border-bottom: var(--border-subtle);
}
.check-group-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-height: 36px;
  padding: 0 var(--space-1);
  border: 0;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--font-body-dense);
  font-weight: var(--weight-semibold);
  text-align: left;
  cursor: pointer;
}
.check-group-header:hover {
  background: var(--subtle-bg-hover);
}
.check-group-chevron {
  flex-shrink: 0;
  transition: transform var(--transition-normal);
}
.check-group-header[aria-expanded="false"] .check-group-chevron {
  transform: rotate(-90deg);
}
.check-group-name {
  flex: 1;
  min-width: 0;
}
.check-group-count {
  flex-shrink: 0;
  color: var(--text-secondary);
  font-weight: var(--weight-regular);
  font-variant-numeric: tabular-nums;
}
.check-group-body {
  padding: 0 0 var(--space-2);
}
.check-group-why {
  margin: 0 0 var(--space-1) 24px;
  font-size: var(--font-caption1);
  color: var(--text-secondary);
}
/* What every row of a type says, said once (run 120) */
.check-group-said {
  margin: 0 0 var(--space-1) 24px;
  font-size: var(--font-caption1);
  color: var(--text-primary);
  overflow-wrap: anywhere;
}
.check-group-body > .check-show-next {
  margin: var(--space-1) 0 0 24px;
}
.check-row-head {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  width: 100%;
  min-height: 36px;
  padding: var(--space-1);
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-sans);
  text-align: left;
  cursor: pointer;
}
.check-row-head:hover {
  background: var(--subtle-bg-hover);
}
.check-row-head[aria-expanded="true"] {
  background: var(--neutral-bg1);
}
.check-row-icon {
  flex-shrink: 0;
  margin-top: 2px;
}
.check-row-icon.error {
  color: var(--status-danger-fg);
}
.check-row-icon.warning {
  color: var(--status-warning-fg);
}
.check-row-icon.note {
  color: var(--text-secondary);
}
.check-row-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.check-row-title {
  font-size: var(--font-body-dense);
  line-height: 18px;
  overflow-wrap: anywhere;
}
.check-row-meta {
  display: flex;
  gap: var(--space-2);
  min-width: 0;
  font-size: var(--font-caption1);
  line-height: 16px;
  color: var(--text-secondary);
}
.check-row-cell {
  flex-shrink: 0;
  font-family: var(--font-mono);
}
.check-row-detail-text {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
/* An open row's detail goes under its cell, the pane's full width, not in a narrow column beside a long sheet name
   (run 120: "Typed 11.00% · was =B23+C59*B2 / 6" at 320 px). */
.check-row-head[aria-expanded="true"] .check-row-meta {
  flex-wrap: wrap;
  row-gap: 0;
}
.check-row-head[aria-expanded="true"] .check-row-detail-text {
  flex-basis: 100%;
}
.check-row-body {
  padding: 0 var(--space-1) var(--space-2) 28px;
  font-size: var(--font-caption1);
  line-height: 16px;
  color: var(--text-secondary);
}
.check-row-body p {
  margin: var(--space-1) 0 0;
  overflow-wrap: anywhere;
}
.check-row-message {
  color: var(--text-primary);
}
.check-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}
.check-row-actions button {
  width: auto;
  min-height: 32px;
}
.check-row-actions .issue-cell-chip {
  display: flex;
  margin: 0;
  padding: 1px 8px;
  border: 1px solid var(--neutral-stroke1);
  border-radius: var(--radius);
  background: var(--neutral-bg1);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--font-caption1);
}
.check-row-actions .issue-cell-chip:hover {
  background: var(--neutral-bg1-hover);
  color: var(--text-primary);
}
.check-row-actions .issue-dismiss-btn {
  border-color: var(--neutral-stroke1);
  color: var(--text-primary);
  font-weight: var(--weight-regular);
  padding: 1px 8px;
  align-self: auto;
}
/* Show all n and Dismiss all (or Show all n again) on one line under a type's rows (UI-425) */
.check-group-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 var(--space-3);
  margin: var(--space-1) 0 0 24px;
}
.check-group-more,
.check-group-dismiss,
.check-group-restore {
  min-height: 24px;
}
.check-show-next,
.check-collapse-patterns {
  margin: var(--space-2) 0;
}
/* "3 dismissed · Show": one caption line, not a box. */
#check-tab .dismissed-issues-summary {
  flex-wrap: nowrap;
  align-items: baseline;
  justify-content: flex-start;
  margin: var(--space-2) 0 0;
  padding: 0;
  background: transparent;
  color: var(--text-secondary);
}
#check-tab .dismissed-issues-summary[hidden] {
  display: none;
}
#check-tab .dismissed-issues-summary .btn-link {
  flex: 0 0 auto;
  width: auto;
  min-height: 24px;
}

/* ==================== Dialogs, sheets and popovers (redesign slice 9, spec 4.7) ==================== */
/* A dialog's body: one scrolling block between its title and its buttons, which stay in view. */
.dialog-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 16px 0;
}
.modal-content.sheets-modal-content,
.modal-content.summary-modal-content {
  overflow: hidden;
}
.dialog-text {
  margin: 0 0 8px;
  font-size: var(--font-body-dense);
  line-height: 18px;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}
.dialog-text .info-btn {
  vertical-align: middle;
}
.dialog-caption {
  margin: 4px 0;
  font-size: var(--font-caption1);
  line-height: 16px;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}
.dialog-caption[hidden],
.dialog-status:empty {
  display: none;
}
.dialog-status {
  margin: 4px 0;
  font-size: var(--font-caption1);
  line-height: 16px;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}
.dialog-field-label {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 8px 0 4px;
  font-size: var(--font-caption1);
  font-weight: 600;
  color: var(--text-primary);
}
.dialog-optional {
  font-weight: 400;
  color: var(--text-secondary);
}
.dialog-input {
  display: block;
  box-sizing: border-box;
  width: 100%;
}

/* A sheet: rises from the pane's bottom, full width, for lightweight tasks (the copied summary, Choose sheets). */
.modal.modal-sheet {
  align-items: flex-end;
  padding: 0;
}
.modal-sheet .modal-content {
  width: 100%;
  max-width: none;
  max-height: calc(100vh - 40px);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
@supports (height: 100dvh) {
  .modal-sheet .modal-content {
    max-height: calc(100dvh - 40px);
  }
}

/* A popover: under the control that opened it (placed by dialogFrame.js), no dimmed page behind it. */
.modal.modal-popover:not(.popover-free) {
  display: block;
  padding: 0;
  background: transparent;
}
.modal-popover:not(.popover-free) .modal-content {
  position: absolute;
  width: min(288px, calc(100vw - 16px));
  max-width: none;
  border: 1px solid var(--neutral-stroke2, transparent);
  box-shadow: var(--shadow-16);
}

/* The "Summary copied" sheet (spec 4.2). */
.summary-covers {
  margin-bottom: 2px;
}
.summary-status {
  margin-top: 0;
  color: var(--text-secondary);
}
.summary-status--warning {
  color: var(--warning-text);
}
.summary-length {
  display: flex;
  gap: 16px;
  margin: 8px 0 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
.summary-length[hidden] {
  display: none;
}
.summary-length-option,
.summary-part {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  font-size: var(--font-caption1);
  color: var(--text-primary);
  cursor: pointer;
}
.summary-length-option input,
.summary-part input {
  flex: none;
  margin: 0;
}
.summary-text {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-height: 96px;
  margin: 8px 0 0;
  resize: vertical;
  font-size: var(--font-caption1);
  line-height: 16px;
}
.summary-include {
  margin-top: 8px;
}
.summary-include[hidden] {
  display: none;
}
.summary-include-toggle {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  font-size: var(--font-caption1);
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
}
/* A disclosure arrow, as the pane's other toggles have (its native marker is hidden by inline-flex). */
.summary-include-toggle::before {
  content: "\25B8" / "";
  display: inline-block;
  width: 14px;
  color: var(--text-secondary);
}
.summary-include[open] > .summary-include-toggle::before {
  content: "\25BE" / "";
}
.summary-include-toggle::-webkit-details-marker {
  display: none;
}
.summary-include-toggle:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
.summary-parts {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  margin: 4px 0 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
.summary-parts[hidden],
.summary-part[hidden] {
  display: none;
}
.summary-mark-sent {
  display: inline-block;
  min-height: 24px;
  margin-top: 4px;
  padding: 0;
}
.summary-mark-sent[hidden] {
  display: none;
}
/* Copy again at the row's start, Save as file and Done at its end. */
.summary-actions .summary-copy-again {
  margin-right: auto;
}

/* The Team tab (spec 4.6): its empty state, and flat sections, not cards in a card. */
.team-views {
  padding: 8px 16px 0;
}
.team-views.team-views--unshared {
  display: none;
}
.team-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px 8px 8px;
  text-align: center;
}
.team-empty[hidden] {
  display: none;
}
.team-empty-icon {
  color: var(--text-secondary);
}
.team-empty-title {
  font-size: var(--font-subtitle2);
  line-height: 22px;
  font-weight: 600;
  color: var(--text-primary);
}
.team-empty-text {
  max-width: 260px;
  font-size: var(--font-body-dense);
  line-height: 18px;
  color: var(--text-secondary);
}
.team-empty .share-history-btn {
  margin-top: 4px;
}
/* A greyed example of what Team lists, never a control: secondary text on a grey surface (opacity failed axe's
   contrast check, live run 105). */
.team-example {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  gap: 2px;
  margin-top: 16px;
  padding: 8px 12px;
  border: var(--border-subtle);
  border-radius: var(--radius);
  background: var(--bg-tertiary);
  text-align: left;
}
.team-example-tag {
  align-self: flex-start;
  margin-bottom: 2px;
  font-size: var(--font-caption1);
  font-weight: 600;
  color: var(--text-secondary);
}
.team-example-name {
  font-size: var(--font-body-dense);
  color: var(--text-secondary);
}
.team-example-meta {
  font-size: var(--font-caption1);
  color: var(--text-secondary);
}
.workspace-surface > .surface-card.team-section {
  padding: 0;
  border: 0;
  background: transparent;
}
.workspace-surface > .team-section + .team-section {
  padding-top: 12px;
  border-top: var(--border-subtle);
}
.team-section-title {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.audit-about p {
  margin: 0 0 4px;
}
/* Team's section heads stay one row at 320 px: the name, then its buttons at their own width (the pane's narrow
   rule stacks other cards' heads and stretches their buttons). */
.workspace-surface > .team-section .section-header {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
}
.team-section .section-header .btn-primary,
.team-section .surface-actions,
.team-section .surface-actions .btn-secondary {
  width: auto;
}
.team-section .surface-actions {
  flex-direction: row;
}
/* Buttons in a dialog keep their own width (the pane's buttons are full width elsewhere). */
.confirm-actions .btn-subtle,
.dialog-body .btn-subtle,
.dialog-body .btn-link,
.team-empty .btn-primary,
.onedrive-signin .btn-primary {
  width: auto;
}

/* A first-use hint (tips.js): a TeachingPopover beside its control, without a scrim. */
.tip-popover {
  position: fixed;
  z-index: 390;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  width: min(260px, calc(100vw - 16px));
  padding: var(--space-2) var(--space-3) var(--space-3);
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--brand-stroke, var(--neutral-stroke2));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-16);
}
.tip-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-right: -6px;
}
.tip-title {
  font-size: var(--font-body-dense);
  font-weight: 600;
  line-height: 18px;
}
.tip-body {
  margin: 0;
  font-size: var(--font-caption1);
  line-height: 16px;
  color: var(--text-primary);
}
.tip-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: 2px;
}
.tip-actions .btn-small {
  width: auto;
  min-height: 28px;
}
.tip-count {
  margin-right: auto;
  font-size: var(--font-caption1);
  color: var(--text-secondary);
}
@media (forced-colors: active) {
  .tip-popover {
    border-color: CanvasText;
  }
}

/* ── Look C: colour as signal and compact density (owner, 2026-10-23; docs/ux/2026-10-22-look-c-colour-and-density.md).
   One meaning per colour (the --c-* tokens at the top); the markup carries the kind (changes-row--formula,
   timeline-item[data-kind], changes-problem--error, check-chip--warning…). Last in the file, so it wins over the
   rules above of the same weight. ── */
body {
  line-height: 1.35;
}
.pulse-header {
  min-height: 36px;
}

/* Cell addresses are green everywhere: somewhere you can go. */
.change-ref,
.key-number-where,
.check-row-cell,
.changes-problem-cell,
.go-back-cell-ref {
  color: var(--c-cell);
  font-weight: var(--weight-semibold);
}
/* Old value muted, new value strong. */
.change-old,
.key-number-before {
  color: var(--c-old);
}
.change-new,
.key-number-after {
  color: var(--c-new);
  font-weight: var(--weight-semibold);
}

/* Changes: a sheet's count as a green pill; rows tighter, the names on the first line, the kind's badge on the
   second beside old → new (supervisor's fix 2: a badge beside the names cut them at 320 px). */
.changes-sheet-count {
  display: inline-flex;
  align-items: center;
  height: 17px;
  padding: 0 7px;
  border-radius: 9px;
  background: var(--c-green-bg);
  color: var(--c-green-fg);
  font-size: var(--font-caption1);
  font-weight: var(--weight-semibold);
}
.changes-sheet-count::before {
  content: none;
}
/* One sheet: its count is the list's own count, said once (minimal text, run 124). */
.changes-list:not(:has(.changes-sheet-group ~ .changes-sheet-group)) .changes-sheet-count {
  display: none;
}
/* Changes' own count, as the sheets' counts. */
.count-badge {
  border-color: transparent;
  background: var(--c-green-bg);
  color: var(--c-green-fg);
}
.changes-row {
  min-height: 0;
  padding-top: 3px;
  padding-bottom: 3px;
}
.change-line {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}
.change-line .change-summary {
  flex: 1;
}
.change-line .change-type {
  flex-shrink: 0;
  margin-right: 0;
}
.change-type[class*="change-kind--"] {
  display: inline-flex;
  align-items: center;
  height: 16px;
  padding: 0 6px;
  border-radius: 3px;
  font-family: var(--font-sans);
  font-size: var(--font-caption2);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 16px;
  text-transform: uppercase;
  white-space: nowrap;
}
.change-kind--formula {
  background: var(--c-blue-bg);
  color: var(--c-blue-fg);
}
.change-kind--typed,
.change-kind--text {
  background: var(--c-orange-bg);
  color: var(--c-orange-fg);
}
.change-kind--added {
  background: var(--c-green-bg);
  color: var(--c-green-fg);
}
.change-kind--cleared {
  background: var(--c-grey-bg);
  color: var(--c-grey-fg);
}
.changes-row--typed,
.changes-row--text {
  box-shadow: inset 3px 0 0 var(--c-orange-edge);
}
.changes-row--formula {
  box-shadow: inset 3px 0 0 var(--c-blue-fg);
}
.key-number-why-badge {
  background: var(--c-orange-bg);
  color: var(--c-orange-fg);
}

/* New issues: an orange bar with an edge, red when it holds Excel errors; each type's sentence in its colour. */
.changes-problems.message-bar.changes-problems--found:not(.own-edits) {
  border: 0;
  border-left: 4px solid var(--c-orange-edge);
  border-radius: var(--radius);
  background: var(--c-orange-bg);
}
/* Weighed above the rule before it, which sets the whole border. */
.changes-problems.message-bar.changes-problems--found.changes-problems--has-error:not(.own-edits) {
  border-left-color: var(--c-red-edge);
}
.changes-problem--error .changes-problem-text {
  color: var(--c-red-fg);
  font-weight: var(--weight-semibold);
}
.changes-problem--warning .changes-problem-text {
  color: var(--c-orange-fg);
  font-weight: var(--weight-semibold);
}
.changes-problem + .changes-problem {
  border-top: 1px solid var(--c-line);
}
.changes-problem-cell {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
/* Many issues fold to one line per type with its count (supervisor's fix 1): the line opens its cells and buttons. */
.changes-problem-toggle {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  min-height: 24px;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.changes-problem-toggle:hover .changes-problem-text {
  text-decoration: underline;
}
.changes-problem-toggle:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
}
.changes-problem-chevron {
  flex-shrink: 0;
  margin-top: 3px;
  transform: rotate(-90deg);
  transition: transform var(--transition-fast);
}
.changes-problem-toggle[aria-expanded="true"] .changes-problem-chevron {
  transform: none;
}
.changes-problem-toggle .changes-problem-text {
  flex: 1;
  min-width: 0;
}
.changes-problem-detail {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 0 0 4px 18px;
}
.changes-problem-detail[hidden] {
  display: none;
}

/* History: a dot per version on a line, coloured by its kind; its badge in the same colour. */
.timeline-row {
  min-height: 40px;
}
.timeline-toggle {
  min-height: 36px;
  padding-top: 5px;
  padding-bottom: 5px;
}
#history-timeline .timeline-item {
  padding-left: 18px;
}
#history-timeline .timeline-item::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--c-line);
}
#history-timeline .timeline-item:first-child::before {
  top: 16px;
}
#history-timeline .timeline-item:last-child::before {
  bottom: calc(100% - 16px);
}
#history-timeline .timeline-item:only-child::before {
  display: none;
}
#history-timeline .timeline-item::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 11px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--version-dot, var(--c-grey-fg));
  box-shadow: 0 0 0 2px var(--neutral-bg-canvas);
}
.timeline-item[data-kind="saved"],
.timeline-item[data-kind="first"] {
  --version-dot: var(--c-green-fg);
}
.timeline-item[data-kind="sent"] {
  --version-dot: var(--c-blue-fg);
  --version-badge-bg: var(--c-blue-bg);
  --version-badge-fg: var(--c-blue-fg);
}
.timeline-item[data-kind="ai"] {
  --version-dot: var(--c-purple-fg);
  --version-badge-bg: var(--c-purple-bg);
  --version-badge-fg: var(--c-purple-fg);
}
.timeline-item[data-kind="goback"] {
  --version-dot: var(--c-teal-fg);
  --version-badge-bg: var(--c-teal-bg);
  --version-badge-fg: var(--c-teal-fg);
}
.timeline-item[data-kind="auto"] {
  --version-dot: var(--c-grey-fg);
}
.timeline-item[data-kind] .version-badge {
  font-weight: var(--weight-semibold);
  background: var(--version-badge-bg, var(--c-grey-bg));
  color: var(--version-badge-fg, var(--c-grey-fg));
}
.timeline-note {
  font-weight: var(--weight-semibold);
}

/* Check: counts and groups in their severity's colour. */
.check-chip-count {
  padding: 0 4px;
  border-radius: 8px;
  font-weight: 700;
}
.check-chip--error .check-chip-count {
  background: var(--c-red-bg);
  color: var(--c-red-fg);
}
.check-chip--warning .check-chip-count {
  background: var(--c-orange-bg);
  color: var(--c-orange-fg);
}
.check-chip--note .check-chip-count {
  background: var(--c-grey-bg);
  color: var(--c-grey-fg);
}
.check-group--error > .check-group-header {
  box-shadow: inset 3px 0 0 var(--c-red-edge);
  background: var(--c-red-bg);
}
.check-group--warning > .check-group-header {
  box-shadow: inset 3px 0 0 var(--c-orange-edge);
  background: var(--c-orange-bg);
}
.check-group--note > .check-group-header {
  box-shadow: inset 3px 0 0 var(--c-grey-fg);
}
.check-group--error .check-group-count {
  color: var(--c-red-fg);
  font-weight: var(--weight-semibold);
}
.check-group--warning .check-group-count {
  color: var(--c-orange-fg);
  font-weight: var(--weight-semibold);
}
.check-row-icon.error {
  color: var(--c-red-fg);
}
.check-row-icon.warning {
  color: var(--c-orange-fg);
}
.check-row-head {
  min-height: 28px;
  padding-top: 4px;
  padding-bottom: 4px;
}
.check-group-header {
  min-height: 30px;
}
.check-verdict-title {
  font-size: 15px;
}

/* Team: review states and roles. */
.pr-status--open {
  background: var(--c-blue-bg);
  color: var(--c-blue-fg);
}
.pr-status--pending_review {
  background: var(--c-blue-bg);
  color: var(--c-blue-fg);
}
.pr-status--merged,
.pr-status--approved {
  background: var(--c-green-bg);
  color: var(--c-green-fg);
}
.pr-status--changes_requested,
.pr-status--rejected {
  background: var(--c-orange-bg);
  color: var(--c-orange-fg);
}
.pr-status--closed {
  background: var(--c-grey-bg);
  color: var(--c-grey-fg);
}
.role-badge--owner {
  background: var(--c-purple-bg);
  color: var(--c-purple-fg);
}
.role-badge--editor {
  background: var(--c-blue-bg);
  color: var(--c-blue-fg);
}
.role-badge--viewer {
  background: var(--c-grey-bg);
  color: var(--c-grey-fg);
}

/* Compare: the Comparing tag is information (blue); Changed is blue (orange means "worth a look"). */
.compare-tag {
  border-color: transparent;
  background: var(--c-blue-bg);
  color: var(--c-blue-fg);
}
.comparison-modified {
  --diff-color: var(--c-blue-fg);
  --diff-bg: var(--c-blue-bg);
}
.comparison-map-tile.comparison-modified {
  background: var(--c-blue-fg);
}

/* Settings: Backup and storage's state with a dot, orange when not backed up, green when it is. */
.settings-acc-status.is-warning,
.settings-acc-status.is-ok {
  font-weight: var(--weight-semibold);
}
.settings-acc-status.is-warning {
  color: var(--c-orange-fg);
}
.settings-acc-status.is-ok {
  color: var(--c-green-fg);
}
.settings-acc-status.is-warning::before,
.settings-acc-status.is-ok::before {
  content: "\25CF" / "";
  margin-right: 4px;
  font-size: 9px;
  vertical-align: 1px;
}

/* Dialogs and the tour: compact titles. */
.tour-title,
[role="dialog"] h2,
[role="alertdialog"] h2 {
  font-size: 14px;
}
@media (forced-colors: active) {
  #history-timeline .timeline-item::after {
    background: CanvasText;
  }
  .changes-row--typed,
  .changes-row--text,
  .changes-row--formula {
    box-shadow: none;
    border-left: 3px solid CanvasText;
  }
}

/* Cut lines open (cutText.js, COR-103): a row that opens shows its cut lines in full; any other cut line opens in place
   when clicked or chosen, and shows in full while its control has the keyboard's focus. */
.check-row-head[aria-expanded="true"] .check-row-detail-text,
.changes-row[aria-expanded="true"] .change-label,
.changes-row[aria-expanded="true"] .change-summary,
.changes-row[aria-expanded="true"] .change-side,
.timeline-toggle[aria-expanded="true"] .timeline-meta,
button:focus-visible [data-cut],
[role="button"]:focus-visible [data-cut],
[data-cut]:focus-visible,
[data-cut-open] {
  display: block;
  white-space: normal;
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  -webkit-line-clamp: unset;
  line-clamp: unset;
  max-width: none;
}
[data-cut] {
  cursor: pointer;
}
