:root {
  --ink: #141923;
  --muted: #607084;
  --subtle: #8a97a8;
  --line: #dde4ee;
  --panel: #ffffff;
  --surface: #f3f7fb;
  --sidebar: #0d1728;
  --sidebar-2: #111f35;
  --blue: #315fba;
  --teal: #07838f;
  --green: #1d8a5a;
  --amber: #b76a14;
  --red: #bf3d35;
  --violet: #6d54ad;
  --shadow: 0 18px 50px rgba(23, 32, 46, 0.13);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--surface);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

body.auth-locked {
  background: #0d1728;
}

body.error-page {
  background: #f4f7fb;
}

body.auth-locked .app-shell {
  display: none;
}

body:not(.auth-locked) .login-screen {
  display: none;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(135deg, rgba(13, 23, 40, 0.96), rgba(17, 31, 53, 0.95)),
    radial-gradient(circle at 20% 10%, rgba(49, 95, 186, 0.25), transparent 34%);
}

.login-panel {
  width: min(100%, 438px);
  display: grid;
  gap: 24px;
  padding: 30px;
  background: #ffffff;
  border: 1px solid rgba(221, 228, 238, 0.9);
  border-radius: 8px;
  box-shadow: 0 28px 80px rgba(4, 10, 21, 0.34);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.login-logo {
  width: 142px;
  height: auto;
}

.login-product {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.login-copy {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.login-form input {
  min-height: 44px;
  width: 100%;
  padding: 10px 12px;
  color: #142033;
  background: #f9fbfe;
  border: 1px solid #d8e1ed;
  border-radius: 6px;
  outline: none;
}

.login-form input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(49, 95, 186, 0.12);
}

.login-error {
  min-height: 18px;
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
}

.login-submit {
  min-height: 44px;
  padding: 10px 14px;
  color: #ffffff;
  background: #0d1728;
  border: 1px solid #0d1728;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 900;
}

.login-submit:hover {
  background: #172846;
}

.error-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 18px 24px 22px;
  background:
    linear-gradient(#e7eef8 1px, transparent 1px),
    linear-gradient(90deg, #e7eef8 1px, transparent 1px),
    #f4f7fb;
  background-size: 28px 28px;
}

.error-header {
  width: min(1120px, calc(100vw - 48px));
  min-height: 58px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 12px 10px 20px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(203, 214, 228, 0.9);
  border-radius: 8px;
  box-shadow: 0 18px 42px rgba(23, 32, 46, 0.08);
}

.error-brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: #243047;
  text-decoration: none;
}

.error-brand img {
  width: 142px;
  height: auto;
}

.error-brand span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.error-header-action,
.error-primary,
.error-secondary {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

.error-header-action,
.error-primary {
  color: #ffffff;
  background: #0d1728;
  border: 1px solid #0d1728;
}

.error-header-action:hover,
.error-primary:hover {
  background: #172846;
}

.error-secondary {
  color: #16243a;
  background: #ffffff;
  border: 1px solid rgba(203, 214, 228, 0.95);
}

.error-secondary:hover {
  border-color: #9eb0c8;
  background: #f8fbff;
}

.error-main {
  width: min(1120px, calc(100vw - 48px));
  margin: 58px auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  align-items: stretch;
}

.error-hero {
  min-height: 440px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  padding: 44px;
  color: #ffffff;
  background:
    linear-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.055) 1px, transparent 1px),
    linear-gradient(135deg, #0d1728, #13243f);
  background-size: 34px 34px, 34px 34px, auto;
  border: 1px solid rgba(13, 23, 40, 0.95);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.18);
}

.error-hero::after {
  content: "";
  position: absolute;
  inset: auto 38px 38px auto;
  width: min(42%, 300px);
  height: 8px;
  background: linear-gradient(90deg, #315fba 0%, #07838f 52%, #ffffff 52%, #ffffff 100%);
  opacity: 0.92;
}

.error-hero-content {
  width: min(100%, 650px);
  position: relative;
  z-index: 1;
}

.error-kicker {
  margin-bottom: 18px;
  color: #a9bee3;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.error-code {
  margin-bottom: 18px;
  color: #ffffff;
  font-size: clamp(74px, 12vw, 128px);
  line-height: 0.9;
  font-weight: 950;
}

.error-hero h1 {
  max-width: 640px;
  margin: 0;
  color: #ffffff;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 0.98;
  font-weight: 950;
}

.error-hero p {
  max-width: 560px;
  margin: 18px 0 0;
  color: #c5d2e4;
  font-size: 16px;
  line-height: 1.6;
}

.error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.error-card {
  display: grid;
  align-content: start;
  gap: 22px;
  padding: 26px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(203, 214, 228, 0.95);
  border-radius: 8px;
  box-shadow: 0 22px 60px rgba(23, 32, 46, 0.1);
}

.error-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.error-card-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.error-card-header strong {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 6px 10px;
  color: #5b4221;
  background: #fff8e8;
  border: 1px solid #ead8ab;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.error-status-list {
  display: grid;
  gap: 0;
  margin: 0;
}

.error-status-list div {
  display: grid;
  gap: 5px;
  padding: 16px 0;
  border-bottom: 1px solid #e7edf5;
}

.error-status-list div:first-child {
  padding-top: 0;
}

.error-status-list dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.error-status-list dd {
  margin: 0;
  color: #16243a;
  font-size: 16px;
  font-weight: 850;
  line-height: 1.35;
}

.error-note {
  padding: 14px;
  color: #315e68;
  background: #eef8f8;
  border: 1px solid #cde9e8;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.45;
}

.error-footer {
  width: min(1120px, calc(100vw - 48px));
  margin: 0 auto;
  color: var(--muted);
  font-size: 11px;
}

.login-footer {
  color: var(--subtle);
  font-size: 10px;
  line-height: 1.45;
}

.app-shell {
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr) 382px;
  min-height: 100vh;
  transition: grid-template-columns 180ms ease;
}

.app-shell.detail-collapsed {
  grid-template-columns: 276px minmax(0, 1fr) 0;
}

.app-shell.detail-collapsed .detail-rail {
  width: 0;
  padding: 0;
  border-left: 0;
  overflow: hidden;
}

.app-shell.dictionary-view .filter-band {
  display: none;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 22px 18px;
  background: var(--sidebar);
  color: #eaf0f8;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.brand-logo {
  display: block;
  width: 132px;
  height: auto;
  filter: brightness(0) invert(1);
}

.brand-subtitle {
  margin-top: 2px;
  color: #a8b6c8;
  font-size: 12px;
  font-weight: 700;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-btn {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  color: #cdd7e6;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  text-align: left;
  text-decoration: none;
}

.nav-btn:hover,
.nav-btn.is-active {
  color: #ffffff;
  background: var(--sidebar-2);
  border-color: rgba(255, 255, 255, 0.1);
}

.nav-btn.is-tour-target {
  color: #ffffff;
  background: #1d3356;
  border-color: rgba(255, 255, 255, 0.24);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), 0 10px 28px rgba(49, 95, 186, 0.18);
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 28px;
  border-radius: 6px;
  color: #9bc8ff;
  background: rgba(255, 255, 255, 0.08);
  font-size: 11px;
  font-weight: 800;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 12px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

.system-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #33c783;
  box-shadow: 0 0 0 4px rgba(51, 199, 131, 0.16);
}

.small-muted {
  color: #aab7c7;
  font-size: 12px;
  line-height: 1.45;
}

.copyright {
  color: #7f8da1;
  font-size: 10px;
  line-height: 1.45;
}

.workspace {
  min-width: 0;
  padding: 26px 28px 44px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.eyebrow {
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  margin-top: 6px;
  color: #111827;
  font-size: 30px;
  line-height: 1.05;
}

#viewSubtitle {
  max-width: 760px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.security-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 12px;
  background: #eaf7f3;
  color: #176846;
  border: 1px solid #c7e9dc;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
}

.lock-shape {
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-radius: 3px;
  position: relative;
}

.lock-shape::before {
  content: "";
  position: absolute;
  width: 8px;
  height: 6px;
  left: 0;
  right: 0;
  top: -8px;
  margin: auto;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
}

.secondary-btn {
  min-height: 36px;
  padding: 8px 12px;
  color: #162033;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 8px 22px rgba(27, 38, 56, 0.06);
}

.secondary-btn:hover {
  border-color: #bcc8d9;
}

.filter-band {
  display: grid;
  grid-template-columns: minmax(220px, 1.6fr) repeat(3, minmax(118px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(38, 48, 66, 0.07);
}

.filter-band label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.filter-band input,
.filter-band select {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  color: #142033;
  background: #f9fbfe;
  border: 1px solid #d8e1ed;
  border-radius: 6px;
  outline: none;
}

.filter-band input:focus,
.filter-band select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(49, 95, 186, 0.12);
}

.filter-reset {
  grid-column: 4;
  justify-self: end;
  align-self: end;
  min-width: 112px;
  white-space: nowrap;
}

.app-shell.detail-collapsed .filter-band {
  grid-template-columns: minmax(260px, 1.2fr) repeat(3, minmax(140px, 0.5fr)) auto;
}

.app-shell.detail-collapsed .filter-reset {
  grid-column: auto;
  justify-self: auto;
}

@media (min-width: 1540px) {
  .filter-band {
    grid-template-columns: minmax(260px, 1.2fr) repeat(3, minmax(140px, 0.5fr)) auto;
  }

  .filter-reset {
    grid-column: auto;
    justify-self: auto;
  }
}

.content-region {
  min-height: 520px;
  min-width: 0;
}

.grid {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.grid > *,
.panel,
.metric-card {
  min-width: 0;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(38, 48, 66, 0.07);
}

.panel-pad {
  padding: 18px;
}

.section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.section-title h2 {
  font-size: 17px;
}

.section-title p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.metric-card {
  min-height: 124px;
  padding: 16px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(31, 43, 62, 0.06);
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.metric-value {
  margin-top: 12px;
  color: #111827;
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
}

.metric-note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.accent-blue {
  border-top: 4px solid var(--blue);
}

.accent-teal {
  border-top: 4px solid var(--teal);
}

.accent-amber {
  border-top: 4px solid var(--amber);
}

.accent-red {
  border-top: 4px solid var(--red);
}

.bar-list {
  display: grid;
  gap: 11px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(96px, 0.7fr) minmax(130px, 1fr) 54px;
  gap: 10px;
  align-items: center;
}

.bar-label,
.bar-count {
  color: #34445a;
  font-size: 12px;
  font-weight: 700;
}

.bar-count {
  text-align: right;
}

.bar-track {
  height: 9px;
  background: #edf2f8;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--teal);
  border-radius: 999px;
}

.table-wrap {
  overflow: auto;
  max-width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: #ffffff;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid #edf1f6;
  text-align: left;
  vertical-align: top;
  font-size: 12px;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: #506178;
  background: #f6f9fd;
  font-weight: 900;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.row-btn {
  color: var(--blue);
  font-weight: 900;
  background: none;
  border: 0;
  padding: 0;
}

.row-btn:hover {
  text-decoration: underline;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.pill.high {
  color: #8b1e18;
  background: #ffedea;
}

.pill.moderate {
  color: #88500f;
  background: #fff2df;
}

.pill.unresolved {
  color: #4a3d84;
  background: #efecff;
}

.pill.lower {
  color: #196c4a;
  background: #e7f7ef;
}

.pill.neutral {
  color: #42526a;
  background: #edf2f8;
}

.muted-copy {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.feature-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.feature-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  color: #334155;
  background: #eef4fb;
  font-size: 11px;
  font-weight: 800;
}

.feature-chip.critical {
  color: #9f241d;
  background: #ffe8e5;
}

.feature-chip.attention {
  color: #81500f;
  background: #fff0d8;
}

.feature-chip.high {
  color: #9f241d;
  background: #ffe8e5;
}

.feature-chip.moderate {
  color: #81500f;
  background: #fff0d8;
}

.feature-chip.unresolved {
  color: #6d4d0f;
  background: #fff6dd;
}

.feature-chip.lower {
  color: #176846;
  background: #eaf7f3;
}

.detail-rail {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 18px;
  background: #ffffff;
  border-left: 1px solid var(--line);
}

.detail-reopen {
  position: fixed;
  right: 0;
  top: 50%;
  z-index: 30;
  min-height: 118px;
  width: 42px;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 10px 7px;
  color: #ffffff;
  background: #0d1728;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-right: 0;
  border-radius: 8px 0 0 8px;
  box-shadow: 0 14px 34px rgba(13, 23, 40, 0.22);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.1;
  text-orientation: mixed;
  transform: translateY(-50%);
  writing-mode: vertical-rl;
}

.app-shell.detail-collapsed .detail-reopen {
  display: flex;
}

.detail-reopen:hover {
  background: #172846;
}

.tour-layer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  pointer-events: none;
}

.tour-layer.is-active {
  display: block;
}

.tour-dim {
  position: absolute;
  inset: 0;
  background: rgba(13, 23, 40, 0.22);
  backdrop-filter: blur(1px);
}

.tour-spotlight {
  position: fixed;
  border: 2px solid #ffffff;
  border-radius: 10px;
  box-shadow: 0 0 0 9999px rgba(13, 23, 40, 0.16), 0 18px 48px rgba(13, 23, 40, 0.24);
  pointer-events: none;
  transition: top 160ms ease, left 160ms ease, width 160ms ease, height 160ms ease;
}

.detail-rail.is-tour-target {
  outline: 2px solid rgba(49, 95, 186, 0.24);
  outline-offset: -4px;
}

.tour-card {
  position: fixed;
  z-index: 2;
  display: grid;
  gap: 10px;
  max-width: calc(100vw - 32px);
  padding: 16px;
  color: #142033;
  background: #ffffff;
  border: 1px solid #d7e0ec;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(13, 23, 40, 0.28);
  pointer-events: auto;
}

.tour-card h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.2;
}

.tour-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.tour-kicker {
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.tour-progress {
  display: flex;
  gap: 6px;
}

.tour-progress span {
  width: 22px;
  height: 4px;
  background: #dbe4ef;
  border-radius: 999px;
}

.tour-progress span.is-active {
  background: var(--blue);
}

.tour-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tour-actions > div {
  align-items: center;
  display: flex;
  gap: 8px;
}

.tour-primary {
  color: #ffffff;
  background: var(--blue);
  border-color: var(--blue);
}

.tour-primary:hover {
  color: #ffffff;
  background: #154fc2;
}

.tour-link {
  min-height: 34px;
  padding: 7px 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  font-size: 12px;
  font-weight: 900;
}

.tour-link:hover {
  color: #142033;
}

.tour-action-note {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  color: #174ea6;
  background: #eef5ff;
  border: 1px solid #c9dcfb;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 900;
}

.detail-empty {
  display: grid;
  gap: 8px;
  min-height: 180px;
  align-content: center;
  padding: 18px;
  color: var(--muted);
  background: #f8fbff;
  border: 1px dashed #cad5e4;
  border-radius: 8px;
}

.detail-empty-title {
  color: #142033;
  font-size: 18px;
  font-weight: 900;
}

.detail-header {
  display: grid;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.detail-kicker {
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.detail-id {
  font-size: 22px;
  font-weight: 900;
  line-height: 1.1;
}

.risk-meter {
  display: grid;
  gap: 8px;
}

.risk-meter-track {
  height: 10px;
  background: #edf2f8;
  border-radius: 999px;
  overflow: hidden;
}

.risk-meter-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--amber), var(--red));
  border-radius: 999px;
}

.detail-section {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.detail-section h3 {
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

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

.detail-close,
.detail-wide-action {
  width: 100%;
  justify-content: center;
}

.detail-split {
  display: grid;
  gap: 14px;
}

.field-list {
  display: grid;
  gap: 9px;
}

.fact-grid {
  display: grid;
  gap: 0;
  border: 1px solid #dfe7f2;
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
}

.fact-row {
  display: grid;
  grid-template-columns: minmax(110px, 0.8fr) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 34px;
  padding: 8px 10px;
  border-bottom: 1px solid #e9eef5;
}

.fact-row:last-child {
  border-bottom: 0;
}

.fact-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.fact-value {
  color: #111827;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.fact-high .fact-value {
  color: #9f241d;
}

.fact-moderate .fact-value {
  color: #81500f;
}

.fact-unresolved .fact-value {
  color: #6d4d0f;
}

.fact-lower .fact-value {
  color: #176846;
}

.field-row {
  display: grid;
  gap: 3px;
}

.field-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.field-value {
  color: #182235;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.source-box {
  padding: 12px;
  color: #334155;
  background: #f8fbff;
  border: 1px solid #dfe7f2;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.5;
}

.signal-box {
  padding: 10px;
  color: #176846;
  background: #f0faf5;
  border: 1px solid #ccebdd;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
}

.scope-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.family-rank {
  display: grid;
  gap: 10px;
}

.rank-row {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  background: #fbfcff;
  border: 1px solid #e1e8f2;
  border-radius: 8px;
}

.rank-id {
  font-weight: 900;
}

.rank-meta {
  color: var(--muted);
  font-size: 12px;
}

.record-list {
  display: grid;
  gap: 10px;
}

.record-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  width: 100%;
  padding: 12px;
  color: inherit;
  background: #ffffff;
  border: 1px solid #dfe7f2;
  border-radius: 8px;
  text-align: left;
  box-shadow: 0 8px 22px rgba(27, 38, 56, 0.04);
}

.record-card:hover,
.record-card.is-selected {
  border-color: #8fb1ff;
  box-shadow: 0 0 0 3px rgba(49, 95, 186, 0.1);
}

.record-card.is-tour-target {
  border-color: #315fba;
  box-shadow: 0 0 0 3px rgba(49, 95, 186, 0.14), 0 14px 36px rgba(24, 42, 72, 0.12);
}

.record-card-main {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.record-card-side {
  display: grid;
  justify-items: end;
  gap: 6px;
  min-width: 150px;
}

.record-title {
  font-size: 14px;
  font-weight: 900;
}

.record-meta {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.compact-list,
.evidence-stack {
  display: grid;
  gap: 8px;
}

.compact-row,
.evidence-row,
.compact-person {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 9px;
  background: #f8fbff;
  border: 1px solid #dfe7f2;
  border-radius: 8px;
}

.compact-marker {
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.compact-title {
  color: #182235;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.35;
}

.compact-meta,
.compact-more {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.compact-more {
  padding: 4px 2px;
  font-weight: 800;
}

.compact-person {
  grid-template-columns: minmax(0, 1fr) auto;
  width: 100%;
  color: inherit;
  text-align: left;
}

.compact-person small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.evidence-row {
  grid-template-columns: minmax(0, 1fr);
}

.evidence-value {
  color: #111827;
  font-size: 12px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.graph-panel {
  position: relative;
  min-height: 620px;
  overflow: hidden;
}

#relationshipCanvas {
  display: block;
  width: 100%;
  height: 620px;
  background: #0e1727;
}

.svg-graph {
  display: block;
  width: 100%;
  height: 640px;
  background: #0e1727;
}

.svg-graph svg {
  display: block;
  width: 100%;
  height: 100%;
}

.svg-label {
  fill: #d8e5f8;
  font-size: 11px;
  font-weight: 800;
  pointer-events: none;
}

.graph-legend {
  position: absolute;
  left: 16px;
  bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: calc(100% - 32px);
  padding: 10px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(4, 10, 21, 0.18);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #263447;
  font-size: 11px;
  font-weight: 800;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.tooltip {
  position: absolute;
  display: none;
  max-width: 240px;
  padding: 8px 10px;
  color: #ffffff;
  background: rgba(10, 18, 31, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  font-size: 12px;
  pointer-events: none;
}

.dictionary-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px 190px;
  gap: 10px;
  margin-bottom: 12px;
}

.dictionary-controls input,
.dictionary-controls select {
  min-height: 40px;
  padding: 9px 11px;
  background: #f9fbfe;
  border: 1px solid #d8e1ed;
  border-radius: 6px;
}

.loading-panel {
  display: grid;
  gap: 12px;
  padding: 20px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.loading-line {
  height: 16px;
  width: 80%;
  background: linear-gradient(90deg, #edf2f8, #f7faff, #edf2f8);
  border-radius: 999px;
}

.loading-line.short {
  width: 44%;
}

.loading-line.wide {
  width: 96%;
}

.empty-state {
  padding: 24px;
  color: var(--muted);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.review-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.review-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.flag-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.event-list {
  display: grid;
  gap: 9px;
}

.event-card {
  padding: 10px;
  background: #f8fbff;
  border: 1px solid #dfe7f2;
  border-radius: 8px;
}

.event-title {
  color: #182235;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.35;
}

.event-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

code {
  color: #174ea6;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

@media (max-width: 1320px) {
  .app-shell {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .detail-rail {
    position: fixed;
    right: 18px;
    top: 18px;
    bottom: 18px;
    z-index: 20;
    width: min(380px, calc(100vw - 36px));
    height: auto;
    box-shadow: var(--shadow);
    transform: translateX(calc(100% + 28px));
    transition: transform 180ms ease;
  }

  .detail-rail.has-record {
    transform: translateX(0);
  }

  .app-shell:not(.detail-collapsed) .detail-reopen {
    display: flex;
  }

  .detail-rail.has-record ~ .detail-reopen {
    display: none;
  }

  .error-main {
    margin: 42px auto;
  }
}

@media (max-width: 980px) {
  .error-main {
    grid-template-columns: 1fr;
  }

  .error-hero {
    min-height: 380px;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace {
    padding: 20px;
  }

  .topbar {
    display: grid;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
    width: 100%;
  }

  .security-pill {
    grid-column: 1 / -1;
    justify-content: center;
    min-width: 0;
  }

  .topbar-actions .secondary-btn {
    width: 100%;
    min-width: 0;
  }

  .filter-band,
  .grid.two,
  .grid.three,
  .grid.four,
  .dictionary-controls,
  .review-grid {
    grid-template-columns: 1fr;
  }

  .filter-band label,
  .filter-band input,
  .filter-band select {
    min-width: 0;
  }

  .filter-reset {
    grid-column: auto;
    justify-self: stretch;
    width: 100%;
  }
}

@media (max-width: 620px) {
  .error-shell {
    padding: 12px;
  }

  .error-header {
    width: calc(100vw - 24px);
    min-height: 0;
    display: grid;
    align-items: flex-start;
    padding: 14px;
  }

  .error-brand {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .error-brand img {
    width: 132px;
  }

  .error-header-action {
    min-height: 38px;
    width: 100%;
    padding: 8px 10px;
    font-size: 12px;
  }

  .error-main {
    width: calc(100vw - 24px);
    margin: 18px auto;
    gap: 14px;
  }

  .error-footer {
    width: calc(100vw - 24px);
  }

  .error-hero,
  .error-card {
    min-width: 0;
    padding: 22px;
  }

  .error-hero {
    min-height: 0;
  }

  .error-hero::after {
    right: 22px;
    bottom: 22px;
    width: 160px;
  }

  .error-code {
    font-size: 68px;
  }

  .error-hero h1 {
    font-size: 28px;
    line-height: 1.06;
    overflow-wrap: anywhere;
  }

  .error-hero p {
    max-width: 280px;
    font-size: 14px;
    line-height: 1.55;
    overflow-wrap: anywhere;
  }

  .error-actions {
    display: grid;
  }

  .error-primary,
  .error-secondary {
    width: 100%;
  }

  .error-card-header {
    display: grid;
    justify-content: start;
  }

  .error-card-header strong {
    justify-self: start;
  }

  h1 {
    font-size: 24px;
  }

  .nav-list {
    grid-template-columns: 1fr;
  }

  .workspace {
    padding: 16px;
  }

  .metric-card {
    min-height: 112px;
  }

  .tour-card {
    left: 16px !important;
    right: 16px;
    width: calc(100vw - 32px) !important;
  }

  .tour-spotlight {
    display: none;
  }
}
