:root {
  font-family: Inter, Geist, "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --sidebar-width: 232px;
  --inspector-width: 344px;
  --topbar-height: 48px;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --ease-enter: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-exit: cubic-bezier(0.23, 1, 0.32, 1);
}

[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #08090a;
  --sidebar: #0b0c0d;
  --surface-1: #0f1011;
  --surface-2: #141516;
  --surface-3: #191a1c;
  --hover: rgb(255 255 255 / 0.045);
  --selected: rgb(94 106 210 / 0.12);
  --text: #f4f5f7;
  --text-2: #c9cbd1;
  --muted: #8b8f98;
  --disabled: #62666d;
  --line: rgb(255 255 255 / 0.075);
  --line-strong: rgb(255 255 255 / 0.14);
  --accent: #5e6ad2;
  --accent-hover: #626dcc;
  --monitor: #4fd0de;
  --positive: #50ad7d;
  --warning: #c69a45;
  --negative: #d26a5c;
  --shadow: 0 16px 44px rgb(0 0 0 / 0.22), 0 3px 10px rgb(0 0 0 / 0.14);
}

[data-theme="light"] {
  color-scheme: light;
  --canvas: #f6f7f8;
  --sidebar: #f0f1f3;
  --surface-1: #ffffff;
  --surface-2: #f4f5f6;
  --surface-3: #eceef0;
  --hover: rgb(20 22 26 / 0.045);
  --selected: rgb(82 94 196 / 0.1);
  --text: #18191c;
  --text-2: #494c53;
  --muted: #6b7079;
  --disabled: #a1a5ad;
  --line: rgb(20 22 26 / 0.085);
  --line-strong: rgb(20 22 26 / 0.16);
  --accent: #5360c5;
  --accent-hover: #4653b7;
  --monitor: #167f8d;
  --positive: #247b56;
  --warning: #8e650f;
  --negative: #a94838;
  --shadow: 0 16px 40px rgb(27 35 48 / 0.1), 0 2px 8px rgb(27 35 48 / 0.06);
}

[data-theme="dark"][data-contrast="more"] {
  --canvas: #000000;
  --sidebar: #000000;
  --surface-1: #08090a;
  --surface-2: #101214;
  --surface-3: #16181b;
  --hover: rgb(255 255 255 / 0.12);
  --selected: rgb(94 106 210 / 0.28);
  --text: #ffffff;
  --text-2: #e1e4e8;
  --muted: #c4c8d0;
  --disabled: #a5aab4;
  --line: #747a86;
  --line-strong: #b7bdc8;
}

[data-theme="light"][data-contrast="more"] {
  --canvas: #ffffff;
  --sidebar: #f3f4f5;
  --surface-1: #ffffff;
  --surface-2: #eff0f2;
  --surface-3: #e5e7ea;
  --hover: rgb(8 9 10 / 0.1);
  --selected: rgb(57 70 184 / 0.18);
  --text: #08090a;
  --text-2: #343840;
  --muted: #454a53;
  --disabled: #5d626c;
  --line: #6a707a;
  --line-strong: #343840;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
[data-workspace-view="entity"] [data-view="risk-queue"],
[data-workspace-view="entity"] [data-view="investigation"],
[data-workspace-view="risk-queue"] [data-view="entity"],
[data-workspace-view="risk-queue"] [data-view="investigation"],
[data-workspace-view="investigation"] [data-view="entity"],
[data-workspace-view="investigation"] [data-view="risk-queue"] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  overflow: hidden;
  background: var(--canvas);
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}

body.inspector-modal-open { overflow: hidden; }

button, a { -webkit-tap-highlight-color: transparent; }

svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

button {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text-2);
  font: inherit;
  cursor: pointer;
}

button:hover { border-color: var(--line-strong); color: var(--text); }

button:active { background: var(--hover); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-color: color-mix(in srgb, var(--accent) 84%, white);
  outline-offset: 2px;
}

a { color: inherit; text-decoration: none; }

.skip-link {
  position: fixed;
  z-index: 20;
  top: 8px;
  left: 8px;
  translate: 0 -180%;
  padding: 8px 12px;
  border-radius: 5px;
  background: var(--surface-3);
  box-shadow: var(--shadow);
}

.skip-link:focus { translate: 0; }

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr) minmax(0, var(--inspector-width));
  height: 100dvh;
}

.app-shell.inspector-closed { grid-template-columns: var(--sidebar-width) minmax(0, 1fr) minmax(0, 0px); }
.app-shell:is(.inspector-closing, .inspector-closed) .inspector {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateX(16px);
}

.sidebar, .inspector { min-width: 0; overflow: auto; }

.inspector-scrim { display: none; }

.sidebar {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--topbar-height);
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--text);
  font-weight: 650;
}

.brand strong, .brand small { display: block; }
.brand strong { line-height: 1.2; }
.brand small { margin-top: 1px; color: var(--muted); font-size: 11px; }

.primary-nav { padding: 10px 8px 4px; }

.primary-nav a, .saved-views a {
  display: flex;
  align-items: center;
  min-height: 34px;
  border-radius: 5px;
  color: var(--muted);
}

.primary-nav a { gap: 9px; padding: 0 9px; }
.primary-nav a svg { color: var(--disabled); }
.primary-nav a[aria-current="page"] svg { color: var(--accent); }
.primary-nav a:hover, .saved-views a:hover { background: var(--hover); color: var(--text-2); }
.primary-nav a[aria-current="page"] { background: var(--selected); color: var(--text); }

.saved-views { padding: 18px 8px 8px; }
.saved-views h2 { margin: 0 9px 6px; color: var(--disabled); font-size: 11px; font-weight: 550; }
.saved-views a { justify-content: space-between; padding: 0 9px; }
.saved-views a b { color: var(--disabled); font-weight: 450; font-variant-numeric: tabular-nums; }

.sidebar-footer { margin-top: auto; padding: 8px; border-top: 1px solid var(--line); }
.account-button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px; border-color: transparent; background: transparent; text-align: left; }
.account-button small { display: block; color: var(--muted); font-size: 11px; }
.avatar { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-3); color: var(--text-2); font-size: 10px; }

.workspace { min-width: 0; overflow: auto; background: var(--surface-1); }

.workspace-bar {
  position: sticky;
  z-index: 4;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--topbar-height);
  padding: 0 14px 0 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-1);
}

.location-identity { display: flex; min-width: 0; flex: 1; gap: 7px; color: var(--muted); }
.location-identity strong { overflow: hidden; color: var(--text-2); font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }
.workspace-actions { display: flex; flex-shrink: 0; align-items: center; gap: 5px; }
.workspace-actions > button, .workspace-actions > .language-control > button, .workspace-actions > .theme-control > button, .workspace-actions > .location-overflow > button { height: 30px; padding: 0 8px; background: transparent; }
.search-button, .icon-label-button { display: inline-flex; align-items: center; gap: 7px; }
.search-button { color: var(--muted); }
kbd { margin-left: 8px; color: var(--disabled); font-family: inherit; font-size: 11px; }

.language-control, .theme-control, .location-overflow { position: relative; }
.theme-control { display: inline-flex; align-items: center; gap: 1px; }
.language-menu, .location-overflow-menu {
  position: absolute;
  z-index: 12;
  top: calc(100% + 7px);
  right: 0;
  width: 150px;
  padding: 4px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-3);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px) scale(0.985);
  transform-origin: top right;
}
.language-menu[data-state="open"], .location-overflow-menu[data-state="open"] { opacity: 1; pointer-events: auto; transform: none; }
.location-overflow-menu { width: 190px; }
.language-menu button { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 34px; padding: 0 9px; border: 0; background: transparent; }
.language-menu button:hover { background: var(--hover); }
.language-menu button svg { visibility: hidden; color: var(--accent); }
.language-menu button[aria-current="true"] { color: var(--text); }
.language-menu button[aria-current="true"] svg { visibility: visible; }
.location-overflow-menu button { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 34px; padding: 0 9px; border: 0; background: transparent; text-align: left; }
.location-overflow-menu button:hover, .location-overflow-menu button:focus-visible { background: var(--hover); }
.location-overflow-menu button[aria-checked="true"] svg { color: var(--accent); }

.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 74px;
  padding: 0 6px !important;
  border-color: transparent;
}
.theme-switch-icon { display: grid; place-items: center; color: var(--disabled); }
.theme-switch-icon svg { width: 13px; height: 13px; }
.theme-switch[aria-checked="false"] .theme-switch-icon:first-child,
.theme-switch[aria-checked="true"] .theme-switch-icon:last-child { color: var(--text-2); }
.theme-switch-track { position: relative; width: 24px; height: 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface-3); }
.theme-switch-track span { position: absolute; top: 2px; left: 2px; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); transform: translateX(0); }
.theme-switch[aria-checked="true"] .theme-switch-track span { background: var(--accent); transform: translateX(10px); }
.theme-menu-trigger { width: 26px; min-width: 26px; padding: 0 !important; }
.theme-menu-trigger svg { width: 13px; height: 13px; }
.theme-menu-appearance-icon { display: none; }
.theme-menu-chevron { display: block; }
.theme-menu { width: 160px; }

.view-bar {
  position: sticky;
  z-index: 3;
  top: var(--topbar-height);
  display: flex;
  gap: 20px;
  height: 40px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-1);
}

.view-bar a { position: relative; display: grid; place-items: center; color: var(--muted); }
.view-bar a[aria-current="page"] { color: var(--text); }
.view-bar a[aria-current="page"]::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; background: var(--accent); content: ""; }

.entity-content { width: min(100%, 940px); margin: 0 auto; padding: 38px 40px 64px; }
.entity-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.object-id { margin: 0 0 5px; color: var(--muted); font: 500 11px/1.4 "Geist Mono", ui-monospace, monospace; }
h1 { margin: 0; font-size: 22px; line-height: 1.25; letter-spacing: -0.015em; }
.entity-header p:last-child { max-width: 560px; margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.entity-actions { display: flex; gap: 7px; }
.entity-actions button { display: inline-flex; align-items: center; gap: 7px; min-height: 32px; padding: 0 11px; white-space: nowrap; }
.primary-action { border-color: var(--accent); background: var(--accent); color: white; }
.primary-action:hover { background: var(--accent-hover); color: white; }

.metric-strip { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 34px; border-block: 1px solid var(--line); }
.metric-strip div { min-width: 0; padding: 15px 16px; }
.metric-strip div:first-child { padding-left: 0; }
.metric-strip div + div { border-left: 1px solid var(--line); }
.metric-strip span, .metric-strip strong { display: block; }
.metric-strip span { margin-bottom: 4px; color: var(--muted); font-size: 11px; }
.metric-strip strong { overflow: hidden; color: var(--text-2); font-weight: 550; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }

.status-dot { display: inline-block; width: 6px; height: 6px; margin-right: 7px; border-radius: 50%; vertical-align: 1px; }
.status-dot.positive { background: var(--positive); }
.status-dot.warning { background: var(--warning); }

.summary, .activity-section { padding-top: 30px; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.section-heading h2 { margin: 0; font-size: 14px; font-weight: 600; }
.section-heading p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.section-heading time { color: var(--disabled); font-size: 11px; }
.summary-text { max-width: 720px; margin: 16px 0 0; color: var(--text-2); font-size: 14px; line-height: 1.65; }
.text-button { border: 0; background: transparent; color: var(--muted); }

.activity-section { margin-top: 28px; border-top: 1px solid var(--line); }
.activity-list { margin: 16px 0 0; padding: 0; list-style: none; }
.activity-list li { display: grid; grid-template-columns: 98px minmax(0, 1fr) 90px; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.activity-list time, .activity-list > li > span { color: var(--disabled); font-size: 11px; }
.activity-list > li > span { text-align: right; }
.activity-list strong { color: var(--text-2); font-weight: 550; }
.activity-list p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }

.feedback-section { margin-top: 28px; padding-top: 30px; border-top: 1px solid var(--line); }
.library-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.library-link:hover { color: var(--text-2); }
.library-link svg { width: 12px; height: 12px; }
.feedback-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 16px; border-block: 1px solid var(--line); }
.feedback-example { min-width: 0; padding: 18px 20px 18px 0; }
.feedback-example:nth-child(even) { padding-right: 0; padding-left: 20px; border-left: 1px solid var(--line); }
.feedback-example:nth-child(n + 3) { border-top: 1px solid var(--line); }
.example-label { display: block; margin-bottom: 10px; color: var(--disabled); font-size: 10px; font-weight: 550; }
.feedback-example p { max-width: 320px; margin: 9px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.motion-button { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-width: 126px; min-height: 34px; padding: 0 11px; overflow: hidden; }
.motion-button::after { position: absolute; inset: auto 0 0; height: 2px; background: var(--accent); opacity: 0; transform: scaleX(0); transform-origin: left; content: ""; }
.motion-button:active:not(:disabled) { transform: translateY(0.5px) scale(0.99); }
.motion-button[aria-pressed="true"] { border-color: color-mix(in srgb, var(--accent) 56%, var(--line)); background: var(--selected); color: var(--text); }
.motion-button[aria-pressed="true"] svg { color: var(--accent); fill: color-mix(in srgb, var(--accent) 26%, transparent); }
.button-icon-loading, .button-icon-success, .paired-icon-active { display: none; }
.motion-button[aria-pressed="true"] .paired-icon-default { display: none; }
.motion-button[aria-pressed="true"] .paired-icon-active { display: block; }
.motion-button.is-loading::after { opacity: 1; transform: scaleX(0.78); transition-duration: 650ms; }
.motion-button.is-loading .button-icon-default { display: none; }
.motion-button.is-loading .button-icon-loading { display: block; animation: button-spin 720ms linear infinite; }
.motion-button.is-success { border-color: color-mix(in srgb, var(--positive) 56%, var(--line)); color: var(--positive); }
.motion-button.is-success .button-icon-default { display: none; }
.motion-button.is-success .button-icon-success { display: block; animation: button-confirm 180ms var(--ease); }
.danger-button:hover { border-color: color-mix(in srgb, var(--negative) 58%, var(--line)); color: var(--negative); }

@keyframes button-spin { to { transform: rotate(360deg); } }
@keyframes button-confirm { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: scale(1); } }

.investigation-content { width: 100%; padding: 30px 32px 56px; }
.investigation-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.investigation-header h1 { font-size: 20px; }
.investigation-header p:last-child { max-width: 680px; margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.investigation-refresh { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 7px; min-height: 32px; padding: 0 10px; }
.investigation-content .fixture-note { margin: 20px 0 0; padding: 9px 11px; border-left: 2px solid var(--line-strong); background: var(--surface-2); color: var(--muted); font-size: 11px; }
.investigation-context { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 18px 0 0; border-block: 1px solid var(--line); }
.investigation-context div { min-width: 0; padding: 12px 16px; }
.investigation-context div:first-child { padding-left: 0; }
.investigation-context div + div { border-left: 1px solid var(--line); }
.investigation-context dt { margin-bottom: 3px; color: var(--muted); font-size: 11px; }
.investigation-context dd { overflow: hidden; margin: 0; color: var(--text-2); font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.investigation-state-messages { margin-top: 16px; }
.investigation-state-message { display: flex; align-items: center; gap: 9px; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line); border-left: 2px solid var(--warning); background: var(--surface-2); color: var(--muted); font-size: 12px; }
.investigation-state-message strong { color: var(--text-2); font-weight: 600; }
.investigation-state-message span { flex: 1; }
.investigation-state-message button { min-height: 30px; padding-inline: 10px; }
.investigation-state-message.positive-message { border-left-color: var(--positive); }
.investigation-state-message.error-message { border-left-color: var(--negative); }
.investigation-region { margin-top: 28px; }
.investigation-heading { align-items: end; }
.investigation-count { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.investigation-empty { margin-top: 12px; padding: 34px 0; border-block: 1px solid var(--line); }
.investigation-empty strong { color: var(--text-2); }
.investigation-empty p { margin: 5px 0 0; color: var(--muted); }
.investigation-chronology { margin-top: 12px; border-block: 1px solid var(--line); }
.investigation-day > h3 { margin: 0; padding: 10px 0 7px; color: var(--disabled); font-size: 10px; font-weight: 550; }
.investigation-day ol { margin: 0; padding: 0; list-style: none; }
.investigation-day li { border-top: 1px solid var(--line); }
.investigation-day li[data-selected="true"] { background: var(--selected); }
.investigation-day li > button { display: grid; grid-template-columns: 108px minmax(0, 1fr) 148px 112px; gap: 14px; width: 100%; min-height: 68px; align-items: center; padding: 9px 10px 9px 0; border: 0; border-radius: 0; background: transparent; text-align: left; }
.investigation-time, .investigation-event-copy, .investigation-source { display: grid; min-width: 0; gap: 3px; }
.investigation-time time { color: var(--text-2); font: 500 11px/1.4 "Geist Mono", ui-monospace, monospace; }
.investigation-time small, .investigation-event-copy small, .investigation-source small { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.investigation-event-copy strong, .investigation-source strong { overflow: hidden; color: var(--text-2); font-size: 12px; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }
.investigation-source .source-unavailable { color: var(--negative); }
.investigation-inspector > section { padding-block: 16px; }
.investigation-excerpt { margin: 0 0 11px; color: var(--text-2); font-size: 12px; line-height: 1.55; }
.investigation-provenance { padding-top: 8px; border-top: 1px solid var(--line); }
.investigation-finding-section form, .investigation-finding-section fieldset { margin: 0; padding: 0; border: 0; }
.investigation-finding-section [data-investigation-fields] { display: grid; gap: 14px; }
.investigation-decision-group, .investigation-support-group { display: grid !important; gap: 7px !important; }
.investigation-decision-group legend, .investigation-support-group legend { margin-bottom: 5px; color: var(--muted); font-size: 11px; }
.investigation-decision-group label, .investigation-support-group label { display: flex; align-items: flex-start; gap: 7px; min-height: 26px; color: var(--text-2); font-size: 12px; }
.investigation-decision-group input, .investigation-support-group input { flex: 0 0 auto; margin: 2px 0 0; accent-color: var(--accent); }
.investigation-field { display: grid; gap: 5px; color: var(--muted); font-size: 11px; }
.investigation-field textarea { width: 100%; min-height: 86px; padding: 8px; resize: vertical; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-2); color: var(--text); font: inherit; }
.investigation-field textarea::placeholder { color: var(--disabled); }
.investigation-field textarea[aria-invalid="true"] { border-color: var(--negative); }
.investigation-support-group[aria-invalid="true"] { margin: -7px !important; padding: 6px !important; border: 1px solid var(--negative); border-radius: 5px; }
.investigation-field-error { color: var(--negative); font-size: 10px; line-height: 1.4; }
.investigation-submit { min-height: 34px; }
.investigation-finding-section fieldset:disabled { opacity: 0.62; }
.investigation-commit-record > strong { display: block; margin-bottom: 10px; color: var(--text-2); }
.investigation-commit-record dl { margin-bottom: 12px; }
.investigation-commit-record dl div { align-items: start; padding-block: 5px; }
.investigation-commit-record dd { overflow-wrap: anywhere; }
.investigation-commit-record button { display: inline-flex; align-items: center; gap: 7px; min-height: 32px; padding-inline: 10px; }

@media (hover: hover) and (pointer: fine) {
  .investigation-day li:hover { background: var(--hover); }
  .investigation-day li[data-selected="true"]:hover { background: var(--selected); }
}

.risk-queue-content { width: 100%; padding: 30px 32px 56px; }
.risk-queue-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.risk-queue-header h1 { font-size: 20px; }
.risk-queue-header p:last-child { max-width: 660px; margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.queue-refresh { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 7px; min-height: 32px; padding: 0 10px; }
.risk-queue-content .fixture-note { margin: 20px 0 0; padding: 9px 11px; border-left: 2px solid var(--line-strong); background: var(--surface-2); color: var(--muted); font-size: 11px; }
.queue-scope { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 18px 0 0; border-block: 1px solid var(--line); }
.queue-scope div { min-width: 0; padding: 12px 16px; }
.queue-scope div:first-child { padding-left: 0; }
.queue-scope div + div { border-left: 1px solid var(--line); }
.queue-scope dt { margin-bottom: 3px; color: var(--muted); font-size: 11px; }
.queue-scope dd { overflow: hidden; margin: 0; color: var(--text-2); font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.risk-state-messages { margin-top: 16px; }
.risk-state-messages:empty { display: none; }
.risk-state-message { display: flex; align-items: center; gap: 9px; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line); border-left: 2px solid var(--warning); background: var(--surface-2); color: var(--muted); font-size: 12px; }
.risk-state-message strong { color: var(--text-2); font-weight: 600; }
.risk-state-message span { flex: 1; }
.risk-state-message button { min-height: 30px; padding-inline: 10px; }
.risk-state-message.positive-message { border-left-color: var(--positive); }
.risk-state-message.error-message { border-left-color: var(--negative); }
.risk-table-region { margin-top: 28px; }
.queue-heading { align-items: end; }
.queue-count { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.risk-table-scroll { margin-top: 12px; overflow: auto; border-block: 1px solid var(--line); }
.risk-table { width: 100%; min-width: 770px; border-collapse: collapse; table-layout: fixed; }
.risk-table th { height: 34px; padding: 0 10px; color: var(--disabled); font-size: 10px; font-weight: 550; text-align: left; }
.risk-table th:first-child, .risk-table td:first-child { width: 29%; padding-left: 0; }
.risk-table th:nth-child(2), .risk-table td:nth-child(2) { width: 10%; }
.risk-table th:nth-child(3), .risk-table td:nth-child(3) { width: 17%; }
.risk-table th:nth-child(4), .risk-table td:nth-child(4) { width: 13%; }
.risk-table th:nth-child(5), .risk-table td:nth-child(5) { width: 15%; }
.risk-table th:last-child, .risk-table td:last-child { width: 16%; padding-right: 0; text-align: right; }
.risk-table td { height: 48px; padding: 0 10px; border-top: 1px solid var(--line); color: var(--text-2); font-size: 12px; vertical-align: middle; }
.risk-table tr[data-selected="true"] { background: var(--selected); }
.risk-row-button { display: grid; width: 100%; min-height: 40px; align-content: center; padding: 0 8px 0 0; border: 0; background: transparent; color: var(--text-2); text-align: left; }
.risk-row-button strong { font: 500 11px/1.4 "Geist Mono", ui-monospace, monospace; }
.risk-row-button span { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.semantic-status { display: inline-flex; align-items: center; gap: 7px; color: var(--text-2); white-space: nowrap; }
.semantic-status i { width: 6px; height: 6px; border: 1px solid currentColor; border-radius: 50%; background: currentColor; }
.severity-critical { color: var(--negative); }
.severity-high, .evidence-conflict, .evidence-pending { color: var(--warning); }
.severity-medium { color: var(--monitor); }
.severity-low, .evidence-confirmed { color: var(--positive); }
.risk-empty { margin-top: 12px; padding: 34px 0; border-block: 1px solid var(--line); }
.risk-empty strong { color: var(--text-2); }
.risk-empty p { margin: 5px 0 0; color: var(--muted); }
.risk-inspector > section { padding-block: 16px; }
.risk-evidence-list { margin: 0; padding: 0; list-style: none; }
.risk-evidence-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.risk-evidence-list li:first-child { border-top: 0; }
.risk-evidence-list strong { color: var(--text-2); font-size: 12px; font-weight: 550; }
.risk-evidence-list span { grid-column: 1; color: var(--muted); font-size: 11px; }
.risk-evidence-list time { grid-column: 2; grid-row: 1 / span 2; color: var(--disabled); font-size: 10px; font-variant-numeric: tabular-nums; }
.risk-review-section form, .risk-review-section fieldset { margin: 0; padding: 0; border: 0; }
.risk-review-section [data-risk-review-fields] { display: grid; gap: 13px; }
.risk-field { display: grid; gap: 5px; color: var(--muted); font-size: 11px; }
.risk-field select, .risk-field textarea { width: 100%; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-2); color: var(--text); font: inherit; }
.risk-field select { min-height: 34px; padding: 0 8px; }
.risk-field textarea { min-height: 78px; padding: 8px; resize: vertical; }
.risk-field textarea::placeholder { color: var(--disabled); }
.risk-field :is(select, textarea)[aria-invalid="true"] { border-color: var(--negative); }
.risk-field-error { color: var(--negative); font-size: 10px; line-height: 1.4; }
.risk-decision-group { display: grid !important; gap: 7px !important; }
.risk-decision-group legend { margin-bottom: 5px; color: var(--muted); font-size: 11px; }
.risk-decision-group label { display: flex; align-items: center; gap: 7px; min-height: 26px; color: var(--text-2); font-size: 12px; }
.risk-decision-group input { margin: 0; accent-color: var(--accent); }
.risk-submit { min-height: 34px; }
.risk-review-section fieldset:disabled { opacity: 0.62; }
.risk-commit-record > strong { display: block; margin-bottom: 10px; color: var(--text-2); }
.risk-commit-record dl { margin-bottom: 12px; }
.risk-commit-record dl div { align-items: start; padding-block: 5px; }
.risk-commit-record dd { overflow-wrap: anywhere; }
.risk-commit-record button { display: inline-flex; align-items: center; gap: 7px; min-height: 32px; padding-inline: 10px; }

@media (hover: hover) and (pointer: fine) {
  .risk-table tbody tr:hover { background: var(--hover); }
  .risk-table tbody tr[data-selected="true"]:hover { background: var(--selected); }
}

.inspector {
  position: relative;
  z-index: 9;
  visibility: visible;
  border-left: 1px solid var(--line);
  background: var(--surface-1);
  opacity: 1;
  overscroll-behavior: contain;
  transform: translateX(0);
}
.inspector > header { display: flex; align-items: center; justify-content: space-between; min-height: var(--topbar-height); padding: 0 12px 0 16px; border-bottom: 1px solid var(--line); }
.inspector > header span { color: var(--disabled); font-size: 10px; }
.inspector h2 { margin: 1px 0 0; font-size: 13px; font-weight: 600; }
.icon-button { width: 28px; height: 28px; border-color: transparent; background: transparent; font-size: 18px; }
.icon-button { display: inline-grid; place-items: center; padding: 0 !important; }
.inspector section { padding: 18px 16px; border-bottom: 1px solid var(--line); }
.inspector h3 { margin: 0 0 10px; color: var(--muted); font-size: 11px; font-weight: 550; }
.inspector dl { margin: 0; }
.inspector dl div { display: grid; grid-template-columns: 1fr minmax(0, 1.25fr); gap: 16px; min-height: 31px; align-items: center; }
.inspector dt { color: var(--muted); }
.inspector dd { margin: 0; color: var(--text-2); text-align: right; font-variant-numeric: tabular-nums; }
.inspector dd a { color: var(--accent); }
.definition { margin: 10px 0 0; padding-top: 10px; border-top: 1px solid var(--line); color: var(--disabled); font-size: 11px; line-height: 1.55; }

[data-sonner-toaster] [data-sonner-toast].kin-toast {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--text);
  box-shadow: var(--shadow);
  font-family: inherit;
}
[data-sonner-toast] .kin-toast__title { font-size: 13px; font-weight: 600; }
[data-sonner-toast] .kin-toast__description { color: var(--muted); font-size: 12px; }
[data-sonner-toast] .kin-toast__action { border-radius: 5px; background: var(--surface-1); color: var(--text-2); font-size: 12px; }
[data-sonner-toast] .kin-toast__close { border-color: var(--line); background: var(--surface-2); color: var(--text-2); }
[data-sonner-toast][data-type="success"] [data-icon] { color: var(--positive); }
[data-sonner-toast][data-type="error"] [data-icon] { color: var(--negative); }

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 210px minmax(0, 1fr); }
  .app-shell.inspector-closed { grid-template-columns: 210px minmax(0, 1fr); }
  .inspector-scrim {
    position: fixed;
    z-index: 8;
    inset: 0;
    display: block;
    visibility: hidden;
    background: rgb(0 0 0 / 0.42);
    opacity: 0;
    pointer-events: none;
  }
  .inspector {
    position: fixed;
    inset: 0 0 0 auto;
    width: min(344px, calc(100vw - 48px));
    visibility: hidden;
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transform: translateX(100%);
  }
  .app-shell.inspector-open .inspector-scrim { visibility: visible; opacity: 1; pointer-events: auto; }
  .app-shell.inspector-open .inspector { visibility: visible; opacity: 1; pointer-events: auto; transform: translateX(0); }
  .app-shell.inspector-closing .inspector-scrim { visibility: visible; opacity: 0; pointer-events: none; }
  .app-shell.inspector-closing .inspector { visibility: visible; opacity: 0; pointer-events: none; transform: translateX(100%); }
  .entity-content { padding-inline: 32px; }
  .investigation-content { padding-inline: 24px; }
  .risk-queue-content { padding-inline: 24px; }
}

@media (max-width: 760px) {
  body { overflow: auto; }
  .app-shell { display: block; min-height: 100dvh; }
  .sidebar { display: none; }
  .workspace { min-height: 100dvh; overflow: visible; }
  .workspace-bar { padding-inline: 14px; }
  .location-identity { min-width: 72px; margin-right: 8px; }
  .location-identity > span { display: none; }
  .location-identity strong { display: block; }
  .workspace-actions { margin-left: auto; }
  .workspace-actions > button, .workspace-actions > .language-control > button, .workspace-actions > .theme-control > button, .workspace-actions > .location-overflow > button { min-width: 44px; min-height: 44px; padding-inline: 8px; }
  .language-menu button, .location-overflow-menu button { min-height: 44px; }
  .workspace-actions .search-button span, .workspace-actions .search-button kbd, .workspace-actions .icon-label-button span { display: none; }
  .workspace-actions .search-button { justify-content: center; }
  /* The compact menu keeps light, dark, and system reachable without
     forcing the location bar past the mobile viewport. */
  .workspace-actions .theme-switch { display: none; }
  .workspace-actions .theme-control { gap: 0; }
  .workspace-actions .theme-menu-appearance-icon { display: block; }
  .workspace-actions .theme-menu-chevron { display: none; }
  .view-bar { top: var(--topbar-height); height: 44px; gap: 0; overflow-x: auto; padding-inline: 8px; }
  .view-bar a { min-width: 44px; min-height: 44px; padding-inline: 8px; }
  .entity-content { padding: 26px 16px 52px; }
  .investigation-content { padding: 24px 16px 48px; }
  .investigation-header { display: block; }
  .investigation-refresh { min-width: 44px; min-height: 44px; margin-top: 16px; }
  .investigation-context { grid-template-columns: 1fr; }
  .investigation-context div, .investigation-context div:first-child { padding: 10px 0; }
  .investigation-context div + div { border-top: 1px solid var(--line); border-left: 0; }
  .investigation-context dd { white-space: normal; }
  .investigation-state-message { align-items: flex-start; flex-wrap: wrap; }
  .investigation-state-message strong { width: 100%; }
  .investigation-state-message button { min-width: 44px; min-height: 44px; }
  .investigation-heading { align-items: flex-start; }
  .investigation-day li > button { grid-template-columns: 74px minmax(0, 1fr); gap: 8px 12px; min-height: 88px; padding: 10px 8px; }
  .investigation-source, .investigation-day .semantic-status { grid-column: 2; }
  .investigation-day .semantic-status { min-height: 24px; }
  .investigation-decision-group label, .investigation-support-group label { min-height: 44px; align-items: center; }
  .investigation-decision-group input, .investigation-support-group input { margin-top: 0; }
  .investigation-submit, .investigation-commit-record button { min-height: 44px; }
  .risk-queue-content { padding: 24px 16px 48px; }
  .risk-queue-header { display: block; }
  .queue-refresh { min-width: 44px; min-height: 44px; margin-top: 16px; }
  .queue-scope { grid-template-columns: 1fr; }
  .queue-scope div, .queue-scope div:first-child { padding: 10px 0; }
  .queue-scope div + div { border-top: 1px solid var(--line); border-left: 0; }
  .queue-scope dd { white-space: normal; }
  .risk-state-message { align-items: flex-start; flex-wrap: wrap; }
  .risk-state-message strong { width: 100%; }
  .risk-state-message button { min-width: 44px; min-height: 44px; }
  .queue-heading { align-items: flex-start; }
  .risk-table-scroll { overflow: visible; }
  .risk-table { min-width: 0; }
  .risk-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .risk-table, .risk-table tbody { display: block; }
  .risk-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 10px 0; border-top: 1px solid var(--line); }
  .risk-table tr:first-child { border-top: 0; }
  .risk-table td, .risk-table td:first-child, .risk-table td:nth-child(2), .risk-table td:nth-child(3), .risk-table td:nth-child(4), .risk-table td:nth-child(5), .risk-table td:last-child { display: grid; width: auto; height: auto; min-height: 44px; align-content: center; padding: 5px 8px; border: 0; text-align: left; }
  .risk-table td:first-child { grid-column: 1 / -1; padding-inline: 0; }
  .risk-table td::before { margin-bottom: 2px; color: var(--disabled); font-size: 10px; content: attr(data-label); }
  .risk-table td:first-child::before { display: none; }
  .risk-row-button { min-height: 44px; padding-left: 8px; }
  .risk-field select, .risk-submit, .risk-commit-record button { min-height: 44px; }
  .entity-header { display: block; }
  .entity-actions { margin-top: 20px; }
  .entity-actions button { min-height: 44px; }
  .text-button { min-width: 44px; min-height: 44px; }
  .metric-strip { grid-template-columns: repeat(2, 1fr); }
  .metric-strip div { padding-left: 12px; }
  .metric-strip div:nth-child(odd) { padding-left: 0; border-left: 0; }
  .metric-strip div:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .activity-list li { grid-template-columns: 78px minmax(0, 1fr); gap: 12px; }
  .activity-list > li > span { grid-column: 2; text-align: left; }
  .feedback-grid { grid-template-columns: 1fr; }
  .feedback-example, .feedback-example:nth-child(even) { padding: 16px 0; border-left: 0; }
  .feedback-example + .feedback-example { border-top: 1px solid var(--line); }
  .motion-button { min-height: 44px; }
  .inspector {
    position: fixed;
    z-index: 8;
    inset: auto 0 0;
    width: 100%;
    max-height: min(78dvh, 640px);
    overflow: auto;
    border-top: 1px solid var(--line-strong);
    border-left: 0;
    border-radius: 10px 10px 0 0;
    box-shadow: var(--shadow);
    transform: translateY(100%);
  }
  .app-shell.inspector-open .inspector { transform: translateY(0); }
  .app-shell.inspector-closing .inspector { transform: translateY(100%); }
  .app-shell.inspector-open .icon-button { width: 44px; height: 44px; }
}

@media (prefers-reduced-motion: no-preference) {
  button, a, .skip-link, .theme-switch-track span, .motion-button::after { transition: background-color 140ms var(--ease), border-color 140ms var(--ease), color 140ms var(--ease), opacity 140ms var(--ease), translate 180ms var(--ease), transform 180ms var(--ease); }
  .language-menu, .location-overflow-menu { transition: opacity 140ms var(--ease), transform 160ms var(--ease); }
  .motion-button.is-loading::after { transition-duration: 650ms; }
  .inspector {
    transition: transform 240ms var(--ease-enter), opacity 180ms var(--ease), visibility 0s linear;
  }
  .app-shell:is(.inspector-closing, .inspector-closed) .inspector {
    transition: transform 180ms var(--ease-exit), opacity 140ms var(--ease-exit), visibility 0s linear 180ms;
  }
  .inspector-scrim { transition: opacity 180ms var(--ease), visibility 0s linear 180ms; }
  .app-shell.inspector-open .inspector-scrim { transition: opacity 180ms var(--ease), visibility 0s linear; }
}

@media (prefers-reduced-motion: reduce) {
  [data-sonner-toast] { transition: none !important; }
  .motion-button, .motion-button::after { transition: none !important; }
  .motion-button.is-loading .button-icon-loading, .motion-button.is-success .button-icon-success { animation: none; }
  .inspector { transform: none !important; transition: opacity 80ms linear, visibility 0s linear; }
  .app-shell:is(.inspector-closing, .inspector-closed) .inspector { transition: opacity 80ms linear, visibility 0s linear 80ms; }
  .inspector-scrim { transition: opacity 80ms linear, visibility 0s linear 80ms; }
  .app-shell.inspector-open .inspector-scrim { transition: opacity 80ms linear, visibility 0s linear; }
  .language-menu, .location-overflow-menu { transition: opacity 80ms linear; transform: none; }
}

@media (forced-colors: active) {
  :focus-visible { outline: 2px solid Highlight !important; outline-offset: 2px; }
  .primary-action { border: 1px solid ButtonText; }
  [aria-current="page"], [aria-selected="true"], [aria-pressed="true"] { outline: 1px solid Highlight; outline-offset: -1px; }
  .status-dot, .status-text i { border: 1px solid CanvasText; background: CanvasText; }
  .chart-line, .chart-points circle { stroke: CanvasText; }
  .chart-points circle { fill: Canvas; }
}

@media (prefers-contrast: more) {
  [data-theme] { --line: var(--line-strong); }
  :focus-visible { outline-width: 3px; }
}
