:root {
  color-scheme: dark;
  --canvas: #061015;
  --canvas-deep: #040b0f;
  --rail: #08151b;
  --surface: #0c1b22;
  --surface-raised: #10232b;
  --surface-soft: #132a33;
  --surface-hover: #17333d;
  --line: #1d3943;
  --line-strong: #2a4b56;
  --text: #e8f4f4;
  --text-soft: #bfd0d3;
  --muted: #839ca4;
  --teal: #2dd4bf;
  --teal-soft: #8af1e2;
  --cyan: #38bdf8;
  --amber: #f6b84a;
  --green: #34d399;
  --red: #fb7185;
  --shadow: 0 24px 70px rgb(0 0 0 / 28%);
  --shadow-soft: 0 14px 36px rgb(0 0 0 / 18%);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 13px;
  --rail-width: 252px;
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  background: var(--canvas);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 86% 4%, rgb(45 212 191 / 9%), transparent 28rem),
    linear-gradient(145deg, var(--canvas-deep), var(--canvas) 48%, #08171c);
  color: var(--text);
  font-family: "Segoe UI Variable", "Segoe UI", Inter, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input { font: inherit; }

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

button { border: 0; }

[hidden] { display: none !important; }

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 14px;
  left: 14px;
  padding: 10px 14px;
  transform: translateY(-160%);
  border-radius: 8px;
  background: var(--teal);
  color: #03110f;
  font-weight: 800;
  transition: transform 160ms ease;
}

.skip-link:focus { transform: translateY(0); }

.boot-screen {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-content: center;
  min-height: 100vh;
  background: var(--canvas-deep);
  color: var(--text-soft);
  text-align: center;
}

.spinner {
  width: 38px;
  height: 38px;
  margin: 0 auto 18px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 850ms linear infinite;
}

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

.eyebrow,
.summary-label,
.system-label,
.scan-meta dt {
  margin: 0;
  color: var(--teal);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.muted { color: var(--muted); }

.button {
  min-height: 46px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
  font-weight: 750;
  letter-spacing: 0.01em;
  transition: transform 160ms ease, border-color 160ms ease,
    background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:active:not(:disabled) { transform: translateY(0); }

.button:disabled {
  cursor: not-allowed;
  opacity: 0.54;
}

.button-primary,
.button-scan {
  background: linear-gradient(135deg, var(--teal), #1db4b0);
  box-shadow: 0 10px 28px rgb(45 212 191 / 18%);
  color: #031614;
}

.button-primary:hover:not(:disabled),
.button-scan:hover:not(:disabled) {
  box-shadow: 0 12px 34px rgb(45 212 191 / 27%);
}

.button-secondary {
  border-color: var(--line);
  background: rgb(255 255 255 / 3%);
  color: var(--text-soft);
}

.button-secondary:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: var(--surface-soft);
  color: var(--text);
}

/* Login */
.login-view {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
}

.login-view::before,
.dashboard-view::before {
  position: fixed;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgb(56 189 248 / 3%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(56 189 248 / 3%) 1px, transparent 1px);
  background-size: 34px 34px;
  content: "";
  mask-image: linear-gradient(to bottom, black, transparent 84%);
}

.login-view::after {
  position: fixed;
  z-index: 0;
  top: -13rem;
  right: -9rem;
  width: 34rem;
  height: 34rem;
  border: 1px solid rgb(45 212 191 / 16%);
  border-radius: 50%;
  box-shadow: 0 0 0 80px rgb(45 212 191 / 2%),
    0 0 0 160px rgb(56 189 248 / 1.5%);
  content: "";
}

.login-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.72fr);
  align-items: center;
  gap: clamp(48px, 8vw, 120px);
  width: min(1160px, calc(100% - 48px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 56px 0;
}

.login-intro { max-width: 680px; }

.login-intro::before {
  display: block;
  width: 84px;
  height: 4px;
  margin-bottom: 34px;
  background: linear-gradient(90deg, var(--teal), var(--cyan));
  content: "";
}

.login-intro h1 {
  max-width: 650px;
  margin: 14px 0 22px;
  font-size: clamp(3.2rem, 7vw, 6.4rem);
  font-weight: 780;
  letter-spacing: -0.065em;
  line-height: 0.92;
}

.login-intro .lead {
  max-width: 590px;
  margin: 0;
  color: var(--text-soft);
  font-size: clamp(1.05rem, 2vw, 1.27rem);
}

.feature-list {
  display: grid;
  gap: 12px;
  margin: 40px 0 0;
  padding: 0;
  list-style: none;
}

.feature-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-soft);
}

.feature-list li::before {
  width: 8px;
  height: 8px;
  border: 2px solid var(--teal);
  border-radius: 2px;
  content: "";
  transform: rotate(45deg);
}

.login-card {
  position: relative;
  padding: clamp(30px, 4vw, 44px);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xl);
  background: linear-gradient(145deg, rgb(255 255 255 / 5%), transparent 38%),
    var(--surface);
  box-shadow: var(--shadow);
}

.login-card::after {
  position: absolute;
  top: 0;
  right: 0;
  width: 44%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--teal));
  content: "";
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 28px;
  border-radius: 17px;
  box-shadow: 0 12px 26px rgb(0 0 0 / 24%);
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
}

.login-card h2 {
  margin: 7px 0 4px;
  font-size: 2rem;
  letter-spacing: -0.035em;
}

.login-card p { margin-top: 0; }

#login-form {
  display: grid;
  gap: 9px;
  margin-top: 30px;
}

#login-form label {
  margin-top: 10px;
  color: var(--text-soft);
  font-size: 0.83rem;
  font-weight: 700;
}

#login-form input {
  width: 100%;
  min-height: 50px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  background: var(--canvas);
  color: var(--text);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

#login-form input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgb(45 212 191 / 12%);
}

#login-form .button { margin-top: 18px; }

.form-error {
  margin: 10px 0 0;
  padding: 12px 14px;
  border: 1px solid rgb(251 113 133 / 38%);
  border-radius: 10px;
  background: rgb(127 29 45 / 27%);
  color: #fecdd6;
  font-size: 0.88rem;
}

.login-note {
  margin: 24px 0 0 !important;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

/* Dashboard rail */
.dashboard-view {
  position: relative;
  min-height: 100vh;
  background: transparent;
}

.app-header {
  position: fixed;
  z-index: 20;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  width: var(--rail-width);
  min-height: 100vh;
  padding: 28px 22px 22px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgb(45 212 191 / 5%), transparent 22%),
    rgb(8 21 27 / 96%);
  box-shadow: 16px 0 48px rgb(0 0 0 / 16%);
  backdrop-filter: blur(18px);
}

.app-header::after {
  position: absolute;
  top: 28px;
  right: -1px;
  width: 2px;
  height: 92px;
  background: linear-gradient(var(--teal), transparent);
  content: "";
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 13px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark-small {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  margin: 0;
  border-radius: 13px;
}

.app-brand strong,
.app-brand small { display: block; }

.app-brand strong {
  font-size: 0.96rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.app-brand small {
  margin-top: 6px;
  color: var(--teal);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 0.59rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.app-system {
  margin-top: 54px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.system-label {
  color: var(--muted);
  font-size: 0.62rem;
}

.system-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 11px;
  color: var(--text-soft);
  font-size: 0.8rem;
  font-weight: 700;
}

.system-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgb(52 211 153 / 10%), 0 0 18px var(--green);
}

.app-system small {
  display: block;
  margin: 8px 0 0 18px;
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.55;
}

.account-area {
  display: grid;
  gap: 16px;
  margin-top: auto;
  padding-top: 26px;
}

.account-copy { min-width: 0; }

.account-copy span,
.account-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-copy span {
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 750;
  white-space: nowrap;
}

.account-copy small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.68rem;
}

.account-area .button { width: 100%; }

/* Dashboard working surface */
.dashboard-shell {
  position: relative;
  z-index: 1;
  width: calc(100% - var(--rail-width));
  max-width: 1600px;
  min-height: 100vh;
  margin-left: calc(
    var(--rail-width) + max(0px, (100vw - var(--rail-width) - 1600px) / 2)
  );
  padding: 38px clamp(28px, 4vw, 64px) 64px;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 28px;
}

.page-heading h1 {
  margin: 7px 0;
  font-size: clamp(2rem, 4vw, 3.25rem);
  font-weight: 760;
  letter-spacing: -0.05em;
  line-height: 1;
}

.page-heading .muted {
  margin: 0;
  font-size: 0.95rem;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.connection-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid rgb(52 211 153 / 22%);
  border-radius: 11px;
  background: rgb(52 211 153 / 7%);
  color: #7ee7bd;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.connection-pill span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgb(52 211 153 / 10%);
}

.button-scan {
  min-height: 48px;
  padding-inline: 22px;
}

.scan-command-card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
  padding: 17px 18px;
  overflow: hidden;
  border: 1px solid rgb(56 189 248 / 28%);
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, rgb(56 189 248 / 10%), rgb(56 189 248 / 3%));
}

.scan-command-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--cyan);
  content: "";
}

.scan-command-indicator {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 6px rgb(56 189 248 / 10%);
}

.scan-command-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.scan-command-copy strong { font-size: 0.9rem; }

.scan-command-copy span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.76rem;
  text-overflow: ellipsis;
}

.scan-command-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.scan-command-state,
.scan-command-cancel,
.scan-command-dismiss {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgb(255 255 255 / 4%);
  color: var(--text-soft);
  font-size: 0.69rem;
  font-weight: 800;
}

.scan-command-state {
  display: inline-grid;
  place-items: center;
  padding: 0 11px;
  white-space: nowrap;
}

.scan-command-cancel,
.scan-command-dismiss { cursor: pointer; }

.scan-command-cancel { padding: 0 11px; }

.scan-command-dismiss {
  width: 32px;
  padding: 0;
  font-size: 1.12rem;
}

.scan-command-cancel:hover,
.scan-command-dismiss:hover {
  border-color: var(--text-soft);
  color: var(--text);
}

.scan-command-card[data-status="completed"] {
  border-color: rgb(52 211 153 / 28%);
  background: linear-gradient(90deg, rgb(52 211 153 / 10%), rgb(52 211 153 / 3%));
}

.scan-command-card[data-status="completed"]::before,
.scan-command-card[data-status="completed"] .scan-command-indicator {
  background: var(--green);
}

.scan-command-card[data-status="failed"],
.scan-command-card[data-status="expired"],
.scan-command-card[data-status="cancelled"] {
  border-color: rgb(251 113 133 / 30%);
  background: linear-gradient(90deg, rgb(251 113 133 / 10%), rgb(251 113 133 / 3%));
}

.scan-command-card[data-status="failed"]::before,
.scan-command-card[data-status="expired"]::before,
.scan-command-card[data-status="cancelled"]::before,
.scan-command-card[data-status="failed"] .scan-command-indicator,
.scan-command-card[data-status="expired"] .scan-command-indicator,
.scan-command-card[data-status="cancelled"] .scan-command-indicator {
  background: var(--red);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.summary-card {
  position: relative;
  min-height: 156px;
  padding: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, rgb(255 255 255 / 3%), transparent 55%),
    var(--surface);
  box-shadow: var(--shadow-soft);
}

.summary-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--line), var(--cyan), transparent 70%);
  content: "";
}

.summary-card::after {
  position: absolute;
  right: 18px;
  bottom: 16px;
  color: rgb(255 255 255 / 3%);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 4.2rem;
  font-weight: 900;
  line-height: 1;
  content: "//";
}

.summary-card-latest::before {
  background: linear-gradient(90deg, var(--line), var(--teal), transparent 70%);
}

.summary-card-accent {
  border-color: rgb(246 184 74 / 25%);
  background: linear-gradient(145deg, rgb(246 184 74 / 7%), transparent 58%),
    #101e22;
}

.summary-card-accent::before {
  background: linear-gradient(90deg, var(--amber), transparent 78%);
}

.summary-card-accent .summary-label { color: var(--amber); }

.summary-card strong,
.summary-card small {
  position: relative;
  z-index: 1;
  display: block;
}

.summary-card strong {
  margin-top: 23px;
  overflow-wrap: anywhere;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: clamp(1.8rem, 3vw, 2.35rem);
  line-height: 1;
}

.summary-card small {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.73rem;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(250px, 0.68fr) minmax(0, 2fr);
  align-items: start;
  gap: 16px;
}

.side-column {
  display: grid;
  gap: 16px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgb(12 27 34 / 92%);
  box-shadow: var(--shadow-soft);
}

.side-column .panel { padding: 20px; }

.panel-heading,
.detail-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.panel-heading h2,
.detail-heading h2,
.empty-state h2 {
  margin: 5px 0 0;
  letter-spacing: -0.035em;
}

.panel-heading h2 { font-size: 1.25rem; }

.count-badge {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 28px;
  padding: 0 9px;
  border: 1px solid rgb(45 212 191 / 22%);
  border-radius: 7px;
  background: rgb(45 212 191 / 8%);
  color: var(--teal-soft);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 800;
}

.vehicle-list,
.history-list {
  display: grid;
  gap: 9px;
  margin-top: 17px;
}

.vehicle-button,
.history-button {
  position: relative;
  width: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--canvas);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.vehicle-button:hover,
.history-button:hover {
  border-color: var(--line-strong);
  background: var(--surface-raised);
  transform: translateX(2px);
}

.vehicle-button[aria-pressed="true"],
.history-button[aria-pressed="true"] {
  border-color: rgb(45 212 191 / 52%);
  background: linear-gradient(90deg, rgb(45 212 191 / 12%), rgb(45 212 191 / 3%));
  box-shadow: inset 3px 0 0 var(--teal);
}

.vehicle-button strong,
.vehicle-button span,
.history-button strong,
.history-button > span:last-child { display: block; }

.vehicle-button strong { font-size: 0.88rem; }

.vehicle-button span,
.history-button > span:last-child {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.45;
}

.history-list { position: relative; }

.history-list::before {
  position: absolute;
  z-index: 0;
  top: 8px;
  bottom: 8px;
  left: 6px;
  width: 1px;
  background: var(--line);
  content: "";
}

.history-button {
  z-index: 1;
  padding-left: 19px;
}

.history-button::before {
  position: absolute;
  top: 19px;
  left: -2px;
  width: 8px;
  height: 8px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--line-strong);
  content: "";
}

.history-button[aria-pressed="true"]::before {
  background: var(--teal);
  box-shadow: 0 0 12px rgb(45 212 191 / 60%);
}

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

.history-topline strong {
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 0.72rem;
}

.dtc-mini-badge {
  flex: 0 0 auto;
  padding: 3px 6px;
  border-radius: 5px;
  background: rgb(246 184 74 / 11%);
  color: var(--amber);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 0.61rem;
  font-weight: 800;
}

.list-empty {
  margin: 14px 0 0;
  padding: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.78rem;
}

.detail-panel {
  min-height: 450px;
  padding: 22px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 390px;
  color: var(--muted);
  text-align: center;
}

.empty-state h2 { color: var(--text); }

.empty-state p {
  margin: 6px 0 0;
  font-size: 0.84rem;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin-bottom: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--surface-raised);
  color: var(--teal);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.detail-heading h2 { font-size: clamp(1.35rem, 2.4vw, 1.85rem); }

.detail-heading .muted {
  margin: 5px 0 0;
  font-size: 0.78rem;
}

.detail-total {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 78px;
  min-height: 70px;
  padding: 10px;
  border: 1px solid rgb(246 184 74 / 30%);
  border-radius: 13px;
  background: rgb(246 184 74 / 8%);
  color: var(--amber);
}

.detail-total strong {
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 1.6rem;
  line-height: 1;
}

.detail-total span {
  margin-top: 4px;
  font-size: 0.62rem;
}

.scan-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 22px 0 24px;
}

.scan-meta > div {
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--canvas);
}

.scan-meta dt {
  color: var(--muted);
  font-size: 0.6rem;
}

.scan-meta dd {
  margin: 7px 0 0;
  overflow: hidden;
  color: var(--text-soft);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 0.69rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expert-analysis {
  position: relative;
  margin: 0 0 24px;
  padding: 18px;
  overflow: hidden;
  border: 1px solid rgb(45 212 191 / 28%);
  border-radius: 13px;
  background:
    linear-gradient(135deg, rgb(45 212 191 / 7%), transparent 42%),
    var(--canvas);
}

.expert-analysis::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--teal);
  content: "";
}

.expert-analysis[data-state="error"] {
  border-color: rgb(251 113 133 / 32%);
}

.expert-analysis[data-state="error"]::before { background: #fb7185; }

.expert-header,
.expert-finding-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.expert-finding-header { cursor: pointer; }
.expert-finding-header:focus-visible { outline: 2px solid var(--teal); outline-offset: 5px; }
.expert-expand-hint { display: block; margin-top: 7px; color: var(--muted); font-size: 0.75rem; }
.expert-finding[open] .expert-expand-hint { display: none; }
.expert-finding-header > div { flex: 1 1 230px; min-width: 0; }

.expert-header h3 {
  margin: 5px 0 0;
  color: var(--text);
  font-size: 1.05rem;
}

.expert-priority,
.expert-confidence {
  flex: 0 0 auto;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 0.61rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.priority-high {
  border-color: rgb(251 113 133 / 42%);
  background: rgb(251 113 133 / 11%);
  color: #fda4af;
}

.priority-medium {
  border-color: rgb(246 184 74 / 42%);
  background: rgb(246 184 74 / 10%);
  color: var(--amber);
}

.priority-low,
.priority-informational {
  border-color: rgb(56 189 248 / 32%);
  background: rgb(56 189 248 / 8%);
  color: var(--cyan);
}

.priority-loading,
.priority-undetermined { color: var(--text-soft); }

.priority-error {
  border-color: rgb(251 113 133 / 36%);
  color: #fda4af;
}

.expert-summary {
  margin: 14px 0 0;
  color: var(--text-soft);
  font-size: 0.8rem;
  line-height: 1.6;
}

.expert-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 13px;
}

.expert-metrics span {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 0.62rem;
}

.expert-metrics strong { color: var(--teal-soft); }

.expert-findings {
  display: grid;
  gap: 11px;
  margin-top: 15px;
}

.expert-loading,
.expert-error {
  margin: 0;
  padding: 13px;
  border: 1px dashed var(--line);
  border-radius: 9px;
  color: var(--muted);
  font-size: 0.73rem;
}

.expert-error { color: #fda4af; }

.expert-finding {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgb(6 16 21 / 70%);
}

.expert-rule-id {
  display: block;
  margin-bottom: 6px;
  color: var(--teal);
  font-size: 0.61rem;
  letter-spacing: 0.08em;
}

.expert-finding h4 {
  margin: 0;
  color: var(--text);
  font-size: 0.88rem;
}

.expert-confidence {
  padding: 5px 7px;
  color: var(--text-soft);
  font-size: 0.56rem;
}

.confidence-high { border-color: rgb(52 211 153 / 30%); color: var(--green); }
.confidence-medium { border-color: rgb(246 184 74 / 30%); color: var(--amber); }
.confidence-low { color: var(--muted); }

.expert-explanation {
  margin: 12px 0 0;
  color: var(--text-soft);
  font-size: 0.73rem;
  line-height: 1.65;
}

.expert-logic {
  display: grid;
  gap: 7px;
  margin-top: 13px;
  padding: 11px 12px;
  border-left: 2px solid var(--teal);
  background: rgb(45 212 191 / 5%);
}

.expert-logic span,
.expert-sources > span {
  color: var(--teal);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 0.57rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.expert-logic code {
  color: var(--text-soft);
  font-size: 0.65rem;
  line-height: 1.55;
  white-space: normal;
}

.expert-subsection { margin-top: 13px; }

.expert-subsection > strong {
  color: var(--text);
  font-size: 0.7rem;
}

.expert-list {
  margin: 7px 0 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 0.67rem;
  line-height: 1.55;
}

.expert-list li + li { margin-top: 4px; }
.expert-recommendations { color: var(--text-soft); }

.expert-sources {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px 11px;
  margin-top: 14px;
}

.expert-sources a {
  color: var(--cyan);
  font-size: 0.65rem;
  text-decoration: none;
}

.expert-sources a:hover { text-decoration: underline; }

.expert-disclaimer {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.61rem;
  line-height: 1.5;
}

.expert-summary,
.expert-explanation,
.expert-list { font-size: 0.875rem; }
.expert-finding h4 { font-size: 1rem; }
.expert-priority,
.expert-confidence,
.expert-rule-id,
.expert-metrics span,
.expert-logic span,
.expert-logic code,
.expert-sources > span,
.expert-sources a,
.expert-disclaimer { font-size: 0.75rem; }
.expert-subsection > strong,
.expert-loading,
.expert-error { font-size: 0.875rem; }
.expert-analysis { overflow-wrap: anywhere; }
.module-unread { color: var(--amber); font-size: 0.875rem; }
.dtc-raw { display: block; margin-top: 4px; color: var(--muted); font-size: 0.75rem; }

.section-divider {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.section-divider h3 {
  margin: 0;
  font-size: 1rem;
}

.section-divider p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.73rem;
}

.module-toggle-all {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--canvas);
  color: var(--text-soft);
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 800;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease;
}

.module-toggle-all:hover:not(:disabled) {
  border-color: var(--teal);
  background: rgb(45 212 191 / 7%);
  color: var(--teal-soft);
}

.module-toggle-all:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.module-list {
  display: grid;
  gap: 11px;
  margin-top: 16px;
}

.module-card {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--canvas);
}

.module-heading,
.module-title {
  display: flex;
  align-items: center;
}

.module-heading {
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.module-heading::-webkit-details-marker { display: none; }
.module-heading::marker { content: ""; }

.module-title {
  min-width: 0;
  gap: 11px;
}

.module-title strong,
.module-title small { display: block; }

.module-title strong {
  color: var(--text);
  font-size: 0.83rem;
}

.module-title small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.62rem;
}

.module-address {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 34px;
  border: 1px solid rgb(56 189 248 / 18%);
  border-radius: 8px;
  background: rgb(56 189 248 / 8%);
  color: var(--cyan);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 0.68rem;
  font-weight: 900;
}

.module-dtc-count {
  flex: 0 0 auto;
  color: var(--muted);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 0.65rem;
}

.module-heading-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.module-toggle {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--teal);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 1.1rem;
  line-height: 1;
  transform: rotate(0deg);
  transition: transform 160ms ease, border-color 160ms ease;
}

.module-card[open] .module-toggle {
  border-color: rgb(45 212 191 / 34%);
  transform: rotate(90deg);
}

.module-card:not([open]) .module-heading:hover .module-toggle {
  border-color: var(--teal);
}

.module-clear {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-left: 2px solid var(--green);
  background: rgb(52 211 153 / 5%);
  color: #7ee7bd;
  font-size: 0.7rem;
}

.dtc-list {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.dtc-row {
  display: grid;
  grid-template-columns: minmax(70px, 0.32fr) minmax(130px, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid rgb(246 184 74 / 21%);
  border-radius: 8px;
  background: rgb(246 184 74 / 5%);
}

.dtc-code {
  color: var(--amber);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 0.76rem;
  font-weight: 900;
}

.dtc-description {
  overflow-wrap: anywhere;
  color: var(--text-soft);
  font-size: 0.68rem;
}

.dtc-status {
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--muted);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 0.61rem;
  font-weight: 800;
}

.toast {
  position: fixed;
  z-index: 60;
  right: 24px;
  bottom: 24px;
  max-width: min(430px, calc(100vw - 48px));
  padding: 14px 17px;
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--teal);
  border-radius: 10px;
  background: #10232b;
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 0.78rem;
}

:where(button, a, input):focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
}

@media (max-width: 1120px) {
  :root { --rail-width: 220px; }

  .content-grid {
    grid-template-columns: minmax(230px, 0.72fr) minmax(0, 1.7fr);
  }

  .summary-card { padding: 19px; }
}

@media (max-width: 900px) {
  .login-shell {
    grid-template-columns: 1fr;
    gap: 40px;
    width: min(620px, calc(100% - 38px));
  }

  .login-intro { padding-top: 24px; }

  .login-intro h1 { font-size: clamp(3rem, 12vw, 5.5rem); }

  .app-header {
    position: sticky;
    top: 0;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: auto;
    padding: 13px 20px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 12px 34px rgb(0 0 0 / 18%);
  }

  .app-header::after,
  .app-system { display: none; }

  .account-area {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 0;
  }

  .account-copy {
    max-width: 220px;
    text-align: right;
  }

  .account-area .button {
    width: auto;
    min-height: 40px;
  }

  .dashboard-shell {
    width: 100%;
    margin-left: 0;
    padding: 30px 20px 50px;
  }

  .content-grid { grid-template-columns: 1fr; }

  .side-column {
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  }
}

@media (max-width: 700px) {
  .app-header {
    gap: 10px;
    padding-inline: 15px;
  }

  .brand-mark-small {
    width: 40px;
    height: 40px;
  }

  .app-brand strong { font-size: 0.82rem; }

  .app-brand small,
  .account-copy small { display: none; }

  .account-copy { display: none; }

  .account-area .button {
    min-height: 38px;
    padding: 0 13px;
    font-size: 0.78rem;
  }

  .dashboard-shell { padding: 24px 14px 40px; }

  .page-heading {
    align-items: stretch;
    flex-direction: column;
    gap: 20px;
  }

  .page-heading h1 { font-size: 2.2rem; }

  .page-actions { justify-content: space-between; }

  .connection-pill {
    padding-inline: 11px;
    font-size: 0.64rem;
  }

  .button-scan {
    flex: 1;
    max-width: 190px;
    padding-inline: 13px;
    font-size: 0.8rem;
  }

  .scan-command-card { grid-template-columns: auto minmax(0, 1fr); }

  .scan-command-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .summary-grid,
  .side-column { grid-template-columns: 1fr; }

  .summary-card { min-height: 126px; }

  .summary-card strong { margin-top: 17px; }

  .detail-panel,
  .side-column .panel { padding: 16px; }

  .scan-meta { grid-template-columns: 1fr; }

  .expert-header,
  .expert-finding-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-divider {
    align-items: flex-start;
    flex-direction: column;
  }

  .dtc-row {
    grid-template-columns: minmax(68px, 0.3fr) minmax(0, 1fr);
  }

  .dtc-status {
    grid-column: 2;
    justify-self: start;
  }

  .toast {
    right: 14px;
    bottom: 14px;
    max-width: calc(100vw - 28px);
  }
}

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