/* Layout and visual tokens aligned with PayrollRecon (imported into this repo only). */

:root,
[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e6eef8;
  --muted: #93a8c4;
  --bg: #0a1628;
  --bg-2: #0f1f35;
  --surface: #132a45;
  --surface-2: #1a3555;
  --line: #2a4a6e;
  --accent: #5eb3ff;
  --accent-2: #3b9eff;
  --accent-link: #7cc4ff;
  --accent-hover: #a8d4ff;
  --on-accent: #031528;
  --info: #38bdf8;
  --warning: #fbbf24;
  --blocking: #f87171;
  --ok: #34d399;
  --focus: #60a5fa;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
  --header-bg: rgba(10, 22, 40, 0.9);
  --code-bg: #0c1a2e;
  --code-ink: #cbd5e1;
  --placeholder: #5c7a9a;
  --bg-glow-a: rgba(59, 158, 255, 0.16);
  --bg-glow-b: rgba(94, 179, 255, 0.08);
  --tab-bar-bg: rgba(19, 42, 69, 0.88);
  --missing-bg: rgba(248, 113, 113, 0.08);
  --diff-remove: rgba(248, 113, 113, 0.12);
  --diff-add: rgba(52, 211, 153, 0.12);
}

[data-theme="light"] {
  color-scheme: light;
  --ink: #0f172a;
  --muted: #475569;
  --bg: #e8eef4;
  --bg-2: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --line: #cbd5e1;
  --accent: #0369a1;
  --accent-2: #0284c7;
  --accent-link: #0369a1;
  --accent-hover: #0c4a6e;
  --on-accent: #ffffff;
  --info: #0369a1;
  --warning: #b45309;
  --blocking: #b91c1c;
  --ok: #047857;
  --focus: #2563eb;
  --shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
  --header-bg: rgba(248, 250, 252, 0.92);
  --code-bg: #f1f5f9;
  --code-ink: #0f172a;
  --placeholder: #64748b;
  --bg-glow-a: rgba(2, 132, 199, 0.08);
  --bg-glow-b: rgba(148, 163, 184, 0.2);
  --tab-bar-bg: rgba(241, 245, 249, 0.95);
  --missing-bg: rgba(185, 28, 28, 0.06);
  --diff-remove: rgba(185, 28, 28, 0.1);
  --diff-add: rgba(4, 120, 87, 0.1);
}

[data-theme="slate"] {
  color-scheme: dark;
  --ink: #e8ebe6;
  --muted: #9aa39a;
  --bg: #14181f;
  --bg-2: #1a2029;
  --surface: #212833;
  --surface-2: #2a3340;
  --line: #3d4a57;
  --accent: #7dd3b0;
  --accent-2: #5cb896;
  --accent-link: #8ee4c3;
  --accent-hover: #b2f0d7;
  --on-accent: #0f1f18;
  --info: #67b8e8;
  --warning: #e8b86b;
  --blocking: #e88a7a;
  --ok: #6bc99a;
  --focus: #7dd3b0;
  --shadow: 0 16px 44px rgba(0, 0, 0, 0.35);
  --header-bg: rgba(20, 24, 31, 0.92);
  --code-bg: #181d26;
  --code-ink: #d4ddd6;
  --placeholder: #6b7780;
  --bg-glow-a: rgba(92, 184, 150, 0.12);
  --bg-glow-b: rgba(120, 140, 130, 0.1);
  --tab-bar-bg: rgba(33, 40, 51, 0.9);
  --missing-bg: rgba(232, 138, 122, 0.1);
  --diff-remove: rgba(232, 138, 122, 0.14);
  --diff-add: rgba(107, 201, 154, 0.14);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body,
.app-shell {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, var(--bg-glow-a), transparent 50%),
    radial-gradient(900px 400px at 90% 0%, var(--bg-glow-b), transparent 45%),
    var(--bg);
  line-height: 1.55;
}

.app-shell-backdrop {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  background: linear-gradient(180deg, rgba(6, 16, 24, 0.2), transparent 40%);
}

.wrap {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
}

.app-main {
  position: relative;
  z-index: 1;
  padding: 1rem 0 3rem;
  display: grid;
  gap: 1rem;
}

.skip {
  position: absolute;
  left: 0.75rem;
  top: -3rem;
  background: var(--accent-2);
  color: var(--on-accent);
  padding: 0.5rem 0.75rem;
  z-index: 30;
  border-radius: 8px;
}

.skip:focus { top: 0.75rem; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: var(--header-bg);
  backdrop-filter: blur(10px);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  min-height: 4.25rem;
  padding: 0.35rem 0;
}

.nav-spacer { flex: 1; }

.theme-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}

.theme-picker .nav-pill {
  min-height: 34px;
  padding: 0.25rem 0.65rem;
  font-size: 0.8rem;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.brand-mark {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  box-shadow: 0 0 0 1px var(--line);
}

.brand-block { min-width: 12rem; }

.brand-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.section-title,
.eyebrow {
  margin: 0 0 0.15rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent);
}

.policy-pill,
.pill,
.badge {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  background: var(--surface);
  font-size: 0.8rem;
  color: var(--muted);
}

.mast-actions.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  justify-content: flex-end;
}

.status {
  position: relative;
  z-index: 1;
  margin: 0.35rem auto 0.15rem;
  min-height: 1.25rem;
  font-weight: 600;
  color: var(--accent-link);
}

h1, h2, h3 {
  line-height: 1.2;
  margin: 0.2rem 0;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h2 { font-size: 1.5rem; }

.page-hero {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.25rem 1.35rem;
  background: linear-gradient(135deg, var(--surface) 0%, var(--bg-2) 100%);
  box-shadow: var(--shadow);
}

.grid, .metrics, .split, .compare { display: grid; gap: 0.85rem; }

.metrics { grid-template-columns: repeat(4, 1fr); }

.split { grid-template-columns: 1.2fr 0.8fr; }

.compare { grid-template-columns: 1fr 1fr 0.8fr 1fr; }

.card,
form,
table:not(.data-table) {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.card,
form { padding: 1.1rem 1.2rem; }

.stack { display: grid; gap: 0.85rem; }

label { display: grid; gap: 0.3rem; font-weight: 600; font-size: 0.92rem; }

input, select, textarea {
  font: inherit;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0.55rem 0.65rem;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

input:not([type="radio"]):not([type="checkbox"]), select, textarea { width: 100%; }

input::placeholder, textarea::placeholder { color: var(--placeholder); }

fieldset label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 550;
  margin: 0.2rem 0;
}

input[type="radio"], input[type="checkbox"] { width: 1.1rem; height: 1.1rem; padding: 0; }

textarea { min-height: 6rem; }

.formula-paste textarea { min-height: 14rem; }

button,
.button,
.nav-pill {
  font: inherit;
  min-height: 40px;
  border-radius: 9px;
  border: none;
  background: var(--accent-2);
  color: var(--on-accent);
  padding: 0.45rem 0.9rem;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

button:hover:not(:disabled),
.button:hover {
  background: var(--accent);
}

button.secondary,
.button.secondary,
.nav-pill.secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--line);
  font-weight: 600;
}

button.secondary:hover:not(:disabled),
.nav-pill.secondary:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent-hover);
}

button[aria-current="page"]:not(.secondary),
.nav-pill[aria-current="page"]:not(.secondary) {
  background: var(--accent-2);
  color: var(--on-accent);
  box-shadow: 0 0 0 1px rgba(45, 212, 191, 0.35);
}

.nav-pill { min-height: 38px; padding: 0.35rem 0.85rem; }

button:disabled { opacity: 0.5; cursor: not-allowed; }

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

a { color: var(--accent-link); text-decoration: none; }
a:hover { color: #99f6e4; text-decoration: underline; }

.steps { display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0; margin: 0 0 1rem; list-style: none; }

.steps li { padding: 0; }

.steps li > span,
.steps button.step {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  min-height: 40px;
}

.steps button.step { color: var(--accent); cursor: pointer; }

.steps [aria-current="step"] > span { border-color: var(--accent); font-weight: 700; }

.card { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

th, td { text-align: left; padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--line); vertical-align: top; }

th { background: var(--surface-2); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }

.severity-informational { box-shadow: inset 4px 0 var(--info); }
.severity-warning { box-shadow: inset 4px 0 var(--warning); }
.severity-blocking { box-shadow: inset 4px 0 var(--blocking); }

.missing { border: 1px dashed var(--blocking); background: var(--missing-bg); padding: 0.75rem; border-radius: 8px; }

.note { color: var(--muted); font-size: 0.92rem; }

.row-actions, .case-row { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }

.case-row > button:first-child { flex: 1; text-align: left; }

.application { border: 1px solid var(--line); border-radius: 10px; padding: 0.75rem; display: grid; gap: 0.35rem; background: var(--surface-2); }

.application h3, .application p { margin: 0; }

.evidence-grid, .check-grid, .reference-filters { display: grid; gap: 0.75rem; }

.evidence-grid, .check-grid { grid-template-columns: repeat(3, 1fr); }

.reference-filters { grid-template-columns: 1.4fr 0.7fr 0.8fr auto; align-items: end; }

.evidence-grid button {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: left;
  padding: 0.9rem;
  min-height: 0;
  font-weight: 550;
}

.badge.documented { color: var(--ok); border-color: rgba(52, 211, 153, 0.45); }
.badge.reported { color: var(--warning); border-color: rgba(251, 191, 36, 0.45); }
.badge.diagnostic { color: var(--info); border-color: rgba(56, 189, 248, 0.45); }

details.issue { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0.35rem 0.9rem; }

details.issue summary { cursor: pointer; display: flex; gap: 0.75rem; align-items: center; min-height: 44px; }

details.issue summary strong { display: block; }

.issue-no { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 1.6rem; }

.issue-body { display: grid; grid-template-columns: 1.4fr 0.8fr; gap: 1rem; padding: 0.2rem 0 0.8rem; }

.issue-body h3 { font-size: 1rem; }

.tab-bar,
.formula-nav,
.workbench-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--tab-bar-bg);
}

.tab-bar button:not(.secondary),
.formula-nav button:not(.secondary),
.workbench-actions button[aria-current="page"] {
  background: var(--accent-2);
  color: var(--on-accent);
  border: none;
  box-shadow: 0 2px 8px rgba(20, 184, 166, 0.35);
}

.tab-bar button.secondary,
.formula-nav button.secondary,
.workbench-actions button.secondary {
  background: transparent;
  border: none;
  color: var(--muted);
  font-weight: 600;
}

.tab-bar button.secondary:hover,
.formula-nav button.secondary:hover,
.workbench-actions button.secondary:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.reading p, .reading li { max-width: 78ch; }

.reading hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }

.reading ol.wrong { padding-left: 1.2rem; }

.reading ol.wrong > li { margin: 0.8rem 0 1rem; }

table.dead-code { width: 100%; border-collapse: collapse; background: var(--surface); }

table.dead-code th, table.dead-code td { text-align: left; border-bottom: 1px solid var(--line); padding: 0.45rem 0.6rem; vertical-align: top; }

table.dead-code th { font-size: 0.85rem; color: var(--muted); }

table.dead-code .code-block {
  max-height: none;
  overflow: visible;
}

table.dead-code .code-block .code-gutter,
table.dead-code .code-block pre.formula {
  white-space: pre-wrap;
  overflow: visible;
  word-break: break-word;
}

details.inventory { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0.35rem 0.9rem; }

details.inventory summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }

details.show-all { margin-top: 0.35rem; }

details.show-all summary { cursor: pointer; color: var(--accent-link); }

.code-block {
  display: grid;
  grid-template-columns: 3.2rem 1fr;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
}

.code-block .code-gutter, .code-block pre.formula {
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0.75rem 0.45rem;
  line-height: 1.45;
  white-space: pre;
}

.code-block .code-gutter {
  color: var(--muted);
  text-align: right;
  user-select: none;
  -webkit-user-select: none;
}

.problem-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  margin: 0.75rem 0;
  background: var(--surface-2);
}

.problem-card h3 { margin: 0 0 0.35rem; }

.fix-pair { margin-top: 0.6rem; }

.formula-summary { margin: 0.5rem 0 1rem; padding-left: 1.2rem; }

table.rate-tiers { width: auto; margin: 0.35rem 0 0.75rem; }

pre.formula {
  white-space: pre-wrap;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.85rem;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem;
  margin: 0;
  color: var(--code-ink);
}

fieldset { border: 1px solid var(--line); border-radius: 10px; margin: 0; padding: 0.75rem; }

.workbench-layout { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 0.85rem; align-items: start; }

.line-link {
  background: none;
  border: 0;
  color: var(--accent-link);
  cursor: pointer;
  font: inherit;
  min-height: 2.2rem;
  padding: 0 0.2rem;
  text-decoration: underline;
}

.editor-shell {
  display: grid;
  grid-template-columns: 3.2rem 1fr;
  max-height: 32rem;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--code-bg);
}

.editor-shell .gutter, .editor-shell textarea {
  margin: 0;
  border: 0;
  padding: 0.55rem 0.4rem;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.45;
  white-space: pre;
  tab-size: 2;
  color: var(--code-ink);
}

.editor-shell .gutter { color: var(--muted); text-align: right; background: var(--surface); }

.editor-shell textarea { min-height: 16rem; resize: vertical; overflow: hidden; border-radius: 0; background: transparent; }

.diff-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

.diff-line { display: grid; grid-template-columns: 2.4rem 1fr; gap: 0.35rem; font-family: ui-monospace, Consolas, monospace; font-size: 0.8rem; white-space: pre-wrap; }

.diff-line span { color: var(--muted); text-align: right; }

.diff-line.remove { background: var(--diff-remove); }

.diff-line.add, .diff-line.change { background: var(--diff-add); }


@media (max-width: 860px) {
  .metrics, .split, .compare, .evidence-grid, .check-grid, .reference-filters, .issue-body, .workbench-layout, .diff-grid {
    grid-template-columns: 1fr;
  }
  .brand-title { font-size: 1.15rem; }
  .policy-pill { width: 100%; text-align: center; }
  .mast-actions.nav-links { width: 100%; justify-content: flex-start; }
  .theme-picker { width: 100%; justify-content: center; }
}