/* LIA-Integrate — design tokens, layout and components.
   Light and dark, responsive to ~360px, and a print stylesheet so the register
   can go into a pack without a screenshot. */

:root {
  color-scheme: light;

  --wipro-purple: #301157;
  --wipro-teal: #3498b3;
  --wipro-lilac: #746fa7;
  --wipro-pink: #be266a;
  --wipro-orange: #f57f2a;
  --wipro-yellow: #ffcd2e;
  --wipro-green: #5e9e42;

  --paper: #f5f4f8;
  --surface: #ffffff;
  --surface-2: #faf9fc;
  --surface-sunken: #efedf4;
  --ink: #1e1a2b;
  --ink-mute: #5f5b6b;
  --ink-faint: #85818f;
  --line: #dad6e2;
  --line-strong: #c3bcd2;

  --brand: var(--wipro-purple);
  --brand-ink: #ffffff;
  --brand-soft: #ece6f3;
  --acq: #301157;
  --acq-soft: #ece6f3;
  --tgt: #1c7c96;
  --tgt-soft: #e4f1f5;

  --high: #be266a;
  --medium: #b45f11;
  --low: #4b8034;
  --danger: #b3123f;
  --danger-soft: #fdecf1;
  --warn-soft: #fff4e4;
  --ok-soft: #e9f4e4;
  --info-soft: #e9f1f6;

  --radius: 8px;
  --radius-sm: 5px;
  --shadow: 0 1px 2px rgba(30, 26, 43, 0.06), 0 6px 20px rgba(30, 26, 43, 0.06);
  --shadow-lg: 0 12px 40px rgba(30, 26, 43, 0.22);
  --font: "Wipro Sans", "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --rail: 232px;
}

/* Dark palette. Plain CSS has no way to define a token block once and apply it
   under two different selectors, so it is written twice on purpose: once for the
   system preference (unless the reviewer has explicitly chosen light) and once
   for an explicit dark choice, which must win in both directions. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #15121d;
    --surface: #1d1928;
    --surface-2: #232032;
    --surface-sunken: #14111c;
    --ink: #f0eef5;
    --ink-mute: #b0aabf;
    --ink-faint: #8b8599;
    --line: #322c42;
    --line-strong: #453d59;
    --brand: #8f7bc0;
    --brand-ink: #14111c;
    --brand-soft: #2a2140;
    --acq: #b6a3dd;
    --acq-soft: #2a2140;
    --tgt: #6fc2d9;
    --tgt-soft: #16323b;
    --high: #ff87b3;
    --medium: #f0a95c;
    --low: #8fd070;
    --danger: #ff7d9e;
    --danger-soft: #3a1622;
    --warn-soft: #3a2a12;
    --ok-soft: #17301a;
    --info-soft: #152833;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 6px 20px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #15121d;
  --surface: #1d1928;
  --surface-2: #232032;
  --surface-sunken: #14111c;
  --ink: #f0eef5;
  --ink-mute: #b0aabf;
  --ink-faint: #8b8599;
  --line: #322c42;
  --line-strong: #453d59;
  --brand: #8f7bc0;
  --brand-ink: #14111c;
  --brand-soft: #2a2140;
  --acq: #b6a3dd;
  --acq-soft: #2a2140;
  --tgt: #6fc2d9;
  --tgt-soft: #16323b;
  --high: #ff87b3;
  --medium: #f0a95c;
  --low: #8fd070;
  --danger: #ff7d9e;
  --danger-soft: #3a1622;
  --warn-soft: #3a2a12;
  --ok-soft: #17301a;
  --info-soft: #152833;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 6px 20px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.25; }
p { margin: 0 0 10px; }
a { color: var(--brand); }
code { font-family: var(--mono); font-size: 0.92em; }

:focus-visible {
  outline: 2px solid var(--wipro-lilac);
  outline-offset: 2px;
  border-radius: 3px;
}

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--brand);
  color: var(--brand-ink);
  padding: 10px 16px;
  border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

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

/* ------------------------------------------------------------------ shell */

.app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.brand-strip { display: flex; height: 4px; flex-shrink: 0; }
.brand-strip span { flex: 1; }

.topbar {
  background: var(--wipro-purple);
  color: #fff;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
:root[data-theme="dark"] .topbar { background: #241040; }

.logo { display: flex; align-items: center; gap: 10px; }
.logo-word { font-size: 20px; font-weight: 700; letter-spacing: -0.4px; }
.logo-div { width: 1px; height: 22px; background: rgba(255, 255, 255, 0.35); }
.logo-unit { font-size: 13px; font-weight: 600; }
.logo-sub { font-size: 12px; color: rgba(255, 255, 255, 0.7); }

.product { display: flex; align-items: baseline; gap: 9px; min-width: 0; }
.product-name { font-size: 17px; font-weight: 700; }
.product-sub { font-size: 12px; color: rgba(255, 255, 255, 0.78); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.env-chip {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}
.env-chip[data-env="production"] { background: #1f7a4d; }
.env-chip[data-env="uat"] { background: var(--wipro-orange); color: #28150a; }
.env-chip[data-env="development"], .env-chip[data-env="preview"] { background: var(--wipro-yellow); color: #3a2b00; }
.env-chip[data-env="unknown"] { background: rgba(255, 255, 255, 0.16); }

.topbar-meta { font-size: 11px; color: rgba(255, 255, 255, 0.72); }

.icon-btn {
  background: transparent;
  border: 0;
  color: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
}
.icon-btn:hover { background: rgba(127, 127, 127, 0.16); }

.topbar .icon-btn { color: #fff; }

.noticebar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 7px 20px;
  font-size: 12px;
  color: var(--ink-mute);
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.banner {
  padding: 9px 20px;
  font-size: 12.5px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
}
.banner-warn { background: var(--warn-soft); color: var(--ink); }
.banner-danger { background: var(--danger-soft); color: var(--ink); }
.banner-info { background: var(--info-soft); color: var(--ink); }
.banner strong { font-weight: 700; }
.banner-actions { margin-left: auto; display: flex; gap: 8px; }

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

/* -------------------------------------------------------------------- nav */

.rail {
  width: var(--rail);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 12px 0;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 9px 18px;
  border: 0;
  border-left: 3px solid transparent;
  background: transparent;
  color: var(--ink-mute);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item[aria-current="page"] {
  background: var(--paper);
  border-left-color: var(--brand);
  color: var(--brand);
  font-weight: 700;
}
.nav-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-sunken);
  color: var(--ink-mute);
  padding: 1px 7px;
  border-radius: 999px;
}
.nav-item[aria-current="page"] .nav-count { background: var(--brand-soft); color: var(--brand); }

.rail-section {
  margin-top: auto;
  padding: 14px 18px 4px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-mute);
}
.rail-section + .rail-section { border-top: 0; margin-top: 0; }
.rail-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--ink-faint); margin-bottom: 5px; }

.identity { display: flex; align-items: center; gap: 8px; }
.identity-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.identity-name { font-size: 12.5px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.identity-src { font-size: 11px; color: var(--ink-faint); }

.save-state { font-size: 11px; color: var(--ink-faint); display: flex; align-items: center; gap: 5px; }
.save-state[data-status="error"] { color: var(--danger); font-weight: 600; }

.main {
  flex: 1;
  min-width: 0;
  padding: 20px 22px 48px;
  overflow-y: auto;
}

.page-head { margin-bottom: 16px; }
.page-head h1 { font-size: 21px; margin-bottom: 4px; }
.page-lede { color: var(--ink-mute); font-size: 13.5px; max-width: 72ch; margin: 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.mobile-nav { display: none; }

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }

.btn-primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn-primary:not(:disabled):hover { filter: brightness(1.12); }
.btn-quiet { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-quiet:not(:disabled):hover { background: var(--surface-2); border-color: var(--brand); }
.btn-ghost { background: transparent; color: var(--ink-mute); border-color: transparent; }
.btn-ghost:not(:disabled):hover { background: var(--surface-sunken); color: var(--ink); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:not(:disabled):hover { filter: brightness(1.1); }
.btn-accent { background: var(--wipro-yellow); color: #3a2b00; border-color: var(--wipro-yellow); }
.btn-accent:not(:disabled):hover { filter: brightness(1.06); }

/* ----------------------------------------------------------------- inputs */

.field { margin-bottom: 12px; }
.field-label { display: block; font-size: 12px; color: var(--ink-mute); margin-bottom: 4px; font-weight: 600; }
.field-hint { font-size: 11.5px; color: var(--ink-faint); margin: 4px 0 0; }
.field-error { font-size: 11.5px; color: var(--danger); margin: 4px 0 0; font-weight: 600; }

.input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--surface);
}
.input::placeholder { color: var(--ink-faint); }
.input:focus { border-color: var(--brand); }
.input-error { border-color: var(--danger); }
.textarea { resize: vertical; min-height: 64px; line-height: 1.55; }
.select { cursor: pointer; }
.input-inline { width: auto; }

/* ------------------------------------------------------------------ chips */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-sunken);
  color: var(--ink-mute);
  border: 1px solid transparent;
}
.chip-brand { background: var(--brand-soft); color: var(--brand); }
.chip-danger { background: var(--danger-soft); color: var(--danger); }
.chip-warn { background: var(--warn-soft); color: var(--medium); }
.chip-ok { background: var(--ok-soft); color: var(--low); }
.chip-outline { background: transparent; border-color: var(--line-strong); }

.sev { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; }
.sev-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.sev-high { color: var(--high); }
.sev-medium { color: var(--medium); }
.sev-low { color: var(--low); }

.side-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 3px;
}
.side-acq { background: var(--acq-soft); color: var(--acq); }
.side-tgt { background: var(--tgt-soft); color: var(--tgt); }
.side-sm { font-size: 10px; padding: 1px 6px; }

.status { font-size: 12px; font-weight: 600; white-space: nowrap; }
.status-open { color: var(--ink); }
.status-progress { color: var(--wipro-teal); }
.status-done { color: var(--low); }
.status-muted { color: var(--ink-faint); }

/* --------------------------------------------------------------- surfaces */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 16px; }
.card-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.card-head h2 { font-size: 14px; }
.card-head-actions { margin-left: auto; display: flex; gap: 8px; }

.rows > * + * { border-top: 1px solid var(--line); }
.row { padding: 12px 14px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stack > * + * { margin-top: 14px; }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { margin-left: auto; }
.muted { color: var(--ink-mute); }
.faint { color: var(--ink-faint); font-size: 12px; }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }

/* ------------------------------------------------------------------ stats */

.stat-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
  min-width: 108px;
  text-align: left;
  font: inherit;
}
.stat-clickable { cursor: pointer; }
.stat-clickable:hover { border-color: var(--brand); }
.stat-active { border-color: var(--brand); background: var(--brand-soft); }
.stat-value { font-size: 23px; font-weight: 700; line-height: 1.1; }
.stat-label { font-size: 11.5px; color: var(--ink-mute); }
.stat-high .stat-value { color: var(--high); }
.stat-warn .stat-value { color: var(--medium); }
.stat-ok .stat-value { color: var(--low); }

/* --------------------------------------------------------------- feedback */

.spinner {
  width: 13px; height: 13px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinner-inline { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-mute); }

.progress {
  height: 6px;
  background: var(--surface-sunken);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar { height: 100%; background: var(--brand); transition: width 0.25s ease; }

.callout {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 13px;
}
.callout-title { font-weight: 700; margin: 0 0 3px; }
.callout-text p:last-child { margin-bottom: 0; }
.callout-action { margin-left: auto; flex-shrink: 0; }
.callout-info { background: var(--info-soft); border-color: transparent; }
.callout-warn { background: var(--warn-soft); border-color: transparent; }
.callout-danger { background: var(--danger-soft); border-color: transparent; }
.callout-ok { background: var(--ok-soft); border-color: transparent; }

.empty {
  max-width: 560px;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 28px;
}
.empty-title { font-size: 18px; margin-bottom: 8px; }
.empty-body { color: var(--ink-mute); font-size: 13.5px; }
.empty-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

.quote {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  padding-left: 10px;
  border-left: 2px solid var(--line-strong);
  color: var(--ink);
}

/* ----------------------------------------------------------------- toasts */

.toast-host {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(400px, calc(100vw - 32px));
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 11px 12px;
  font-size: 13px;
  animation: toast-in 0.18s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }
.toast-danger { border-left-color: var(--danger); }
.toast-warn { border-left-color: var(--wipro-orange); }
.toast-ok { border-left-color: var(--low); }
.toast-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.toast-detail { font-size: 11px; color: var(--ink-faint); word-break: break-all; }
.toast-action { background: none; border: 0; color: var(--brand); font: inherit; font-weight: 700; font-size: 12px; cursor: pointer; padding: 0; }
.toast-close { background: none; border: 0; color: var(--ink-faint); font-size: 16px; line-height: 1; cursor: pointer; margin-left: auto; padding: 0 2px; }

/* ----------------------------------------------------------------- dialog */

.dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 17, 28, 0.55);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 70;
}
.dialog {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: min(520px, 100%);
  max-height: min(86vh, 760px);
  display: flex;
  flex-direction: column;
}
.dialog-wide { width: min(860px, 100%); }
.dialog-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.dialog-head h2 { font-size: 15px; flex: 1; }
.dialog-body { padding: 16px; overflow-y: auto; font-size: 13.5px; }
.dialog-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
}

/* --------------------------------------------------------------- register */

.register-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.register-layout.has-detail { grid-template-columns: minmax(320px, 1fr) minmax(400px, 1.15fr); }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filters .input { width: auto; min-width: 130px; }
.search-wrap { flex: 1; min-width: 190px; }
.search-wrap .input { width: 100%; }

.finding-row {
  display: grid;
  grid-template-columns: 24px 88px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 11px 13px;
  cursor: pointer;
  background: var(--surface);
  border: 0;
  border-top: 1px solid var(--line);
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
}
.rows > .finding-row:first-child { border-top: 0; }
.finding-row:hover { background: var(--surface-2); }
.finding-row[aria-selected="true"] { background: var(--brand-soft); }
.finding-row[data-focused="true"] { box-shadow: inset 3px 0 0 var(--brand); }
.finding-title { font-size: 13.5px; font-weight: 600; line-height: 1.35; }
.finding-meta { font-size: 11.5px; color: var(--ink-mute); margin-top: 3px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.finding-check { margin-top: 3px; }

.bulkbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 13px;
  background: var(--brand-soft);
  border: 1px solid var(--brand);
  border-radius: var(--radius);
  margin-bottom: 10px;
  font-size: 12.5px;
  flex-wrap: wrap;
}

.detail {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  position: sticky;
  top: 0;
  align-self: start;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}
.detail-head { display: flex; align-items: flex-start; gap: 10px; }
.detail-head h2 { font-size: 16px; margin: 4px 0 6px; line-height: 1.3; }
.detail-id { font-size: 11.5px; color: var(--ink-mute); }

.evidence { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.evidence-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-top: 3px solid var(--acq);
  border-radius: var(--radius-sm);
  padding: 11px;
  min-height: 110px;
}
.evidence-card.is-tgt { border-top-color: var(--tgt); }
.evidence-doc { font-size: 11.5px; color: var(--ink-mute); margin: 8px 0 6px; }
.evidence-src { font-size: 11px; color: var(--ink-faint); margin-top: 8px; }

.detail-section { margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--line); }
.detail-section h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--ink-faint); margin-bottom: 8px; }

.statusbtns { display: flex; gap: 6px; flex-wrap: wrap; }
.statusbtn {
  padding: 6px 11px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.statusbtn[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.statusbtn:disabled { opacity: 0.4; cursor: not-allowed; }

.authority-list { font-size: 12.5px; }
.authority-list > * + * { border-top: 1px dashed var(--line); }
.authority-item { padding: 5px 0; }

/* ------------------------------------------------------------------ delta */

.area-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
}
.area-name { font-size: 13.5px; font-weight: 600; }
.area-focus { font-size: 12px; color: var(--ink-mute); margin-top: 2px; line-height: 1.45; }
.area-status { display: flex; align-items: center; gap: 10px; }
.area-note { font-size: 12px; margin-top: 5px; }
.area-note-error { color: var(--danger); }

.runbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--brand-soft);
  border: 1px solid var(--brand);
  border-radius: var(--radius);
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.runbar .progress { flex: 1; min-width: 160px; }

/* -------------------------------------------------------------------- ask */

.ask-form { display: flex; gap: 8px; align-items: flex-start; }
.ask-form .input { flex: 1; }
.suggestions { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 18px; }
.suggestion {
  font: inherit;
  font-size: 12px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}
.suggestion:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.suggestion:disabled { opacity: 0.5; cursor: not-allowed; }

.answer { margin-bottom: 14px; }
.answer-q { font-size: 13.5px; font-weight: 700; margin-bottom: 8px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.answer-body { font-size: 14px; line-height: 1.6; }
.answer-streaming::after {
  content: "▍";
  animation: blink 1s steps(2) infinite;
  color: var(--brand);
}
@keyframes blink { 50% { opacity: 0; } }
.citations { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.citation-col {
  background: var(--surface-2);
  border-top: 3px solid var(--acq);
  border-radius: var(--radius-sm);
  padding: 10px;
}
.citation-col.is-tgt { border-top-color: var(--tgt); }
.citation { font-size: 12.5px; margin-top: 8px; line-height: 1.45; }
.citation-src { font-size: 11px; color: var(--ink-faint); }

/* ---------------------------------------------------------------- corpora */

.dropzone {
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 22px;
  text-align: center;
  color: var(--ink-mute);
  font-size: 13px;
  background: var(--surface-2);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone.is-over { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }

.doc-row { padding: 10px 12px; }
.doc-title { font-size: 13px; font-weight: 600; text-align: left; background: none; border: 0; color: inherit; font-family: inherit; cursor: pointer; padding: 0; }
.doc-title:hover { color: var(--brand); }
.doc-meta { font-size: 11px; color: var(--ink-faint); margin-top: 2px; }
.doc-text {
  white-space: pre-wrap;
  font-size: 12.5px;
  line-height: 1.6;
  margin-top: 9px;
  padding: 10px;
  background: var(--surface-sunken);
  border-radius: var(--radius-sm);
  max-height: 340px;
  overflow-y: auto;
}

/* ------------------------------------------------------------------ audit */

.audit-row {
  display: grid;
  grid-template-columns: 46px 160px 150px minmax(0, 1fr);
  gap: 10px;
  padding: 9px 13px;
  font-size: 12.5px;
  align-items: baseline;
}
.audit-seq { color: var(--ink-faint); font-family: var(--mono); font-size: 11px; }
.audit-ts { color: var(--ink-mute); }
.audit-event { font-weight: 600; }
.audit-actor { color: var(--ink-faint); font-size: 11px; margin-top: 2px; }

/* --------------------------------------------------------------- overview */

.steps { counter-reset: step; }
.step { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 12px; padding: 12px 14px; align-items: start; }
.step-num {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--brand); color: var(--brand-ink);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
}
.step-title { font-size: 13.5px; font-weight: 600; }
.step-text { font-size: 13px; color: var(--ink-mute); line-height: 1.55; margin-top: 3px; }

.area-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--wipro-lilac);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.area-card .area-name { font-size: 13px; }

.rules { background: var(--brand-soft); border-radius: var(--radius); padding: 14px 16px; }
.rule { display: flex; gap: 10px; font-size: 13px; line-height: 1.55; padding: 4px 0; }
.rule::before { content: "–"; color: var(--brand); font-weight: 700; }

.bars { display: flex; flex-direction: column; gap: 7px; }
.bar-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 34px; gap: 10px; align-items: center; font-size: 12.5px; }
.bar-track { height: 16px; background: var(--surface-sunken); border-radius: 3px; overflow: hidden; display: flex; }
.bar-seg { height: 100%; }
.bar-seg-high { background: var(--high); }
.bar-seg-medium { background: var(--medium); }
.bar-seg-low { background: var(--low); }
.bar-count { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-mute); }

.legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--ink-mute); flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 5px; }
.legend-swatch { width: 10px; height: 10px; border-radius: 2px; }

/* --------------------------------------------------------------- settings */

.setting-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 16px;
  padding: 14px;
  align-items: start;
}
.setting-title { font-size: 13.5px; font-weight: 600; }
.setting-desc { font-size: 12.5px; color: var(--ink-mute); margin-top: 3px; line-height: 1.5; }
.setting-row .field { margin-bottom: 0; }

.kv { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 6px 14px; font-size: 13px; }
.kv dt { color: var(--ink-mute); }
.kv dd { margin: 0; font-family: var(--mono); font-size: 12px; word-break: break-all; }

.meter { height: 8px; background: var(--surface-sunken); border-radius: 999px; overflow: hidden; margin-top: 6px; }
.meter-fill { height: 100%; background: var(--brand); }
.meter-fill[data-level="warn"] { background: var(--wipro-orange); }
.meter-fill[data-level="danger"] { background: var(--danger); }

/* ------------------------------------------------------------ responsive */

@media (max-width: 900px) {
  .register-layout.has-detail { grid-template-columns: minmax(0, 1fr); }
  .detail { position: static; max-height: none; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .setting-row { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 720px) {
  .body { flex-direction: column; }
  .rail { display: none; }
  .mobile-nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 8px 12px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    -webkit-overflow-scrolling: touch;
  }
  .mobile-nav .nav-item {
    width: auto;
    white-space: nowrap;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 13px;
  }
  .mobile-nav .nav-item[aria-current="page"] { border-color: var(--brand); background: var(--brand-soft); }
  .main { padding: 16px 14px 40px; }
  .grid-2, .grid-3, .evidence, .citations { grid-template-columns: 1fr; }
  .finding-row { grid-template-columns: 24px minmax(0, 1fr); }
  .finding-row .sev-cell { grid-column: 2; }
  .finding-row .status { grid-column: 2; }
  .audit-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .bar-row { grid-template-columns: 96px minmax(0, 1fr) 30px; }
  .kv { grid-template-columns: 1fr; }
  .kv dd { margin-bottom: 8px; }
  .topbar { padding: 9px 14px; }
  .product-sub, .logo-sub { display: none; }
}

/* ---------------------------------------------------------------- print */

@media print {
  .rail, .mobile-nav, .topbar-right, .toast-host, .page-actions,
  .filters, .bulkbar, .runbar, .btn, .noticebar .chip, .no-print { display: none !important; }
  body, .app { background: #fff; color: #000; }
  .main { overflow: visible; padding: 0; }
  .card, .detail { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  .register-layout.has-detail { grid-template-columns: 1fr; }
  .finding-row { break-inside: avoid; }
  a[href]::after { content: " (" attr(href) ")"; font-size: 10px; color: #555; }
}
