:root {
  --bg: #071210;
  --bg-2: #0a1916;
  --panel: #0d1b18;
  --panel-2: #11231f;
  --border: #25423b;
  --border-soft: #1a332d;
  --text: #eef8f3;
  --muted: #9bb5aa;
  --accent: #38d99b;
  --accent-2: #70ebba;
  --ok: #43d89c;
  --warn: #f0b35d;
  --bad: #f07878;
  --info: #64bde9;
  --radius: 20px;
  --radius-sm: 14px;
  --nav-h: 68px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; }
body {
  font-family: "Segoe UI", Tahoma, "Noto Kufi Arabic", Arial, sans-serif;
  min-height: 100vh; min-height: 100dvh;
  background:
    radial-gradient(1100px 620px at 82% -12%, rgba(56, 217, 155, 0.13), transparent 62%),
    radial-gradient(760px 540px at 0% 40%, rgba(58, 158, 177, 0.08), transparent 60%),
    var(--bg);
}
#app { width: 100%; max-width: 1280px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; position: relative; }
#app-main { flex: 1; padding: 22px 16px calc(var(--nav-h) + 28px); overflow-y: auto; }
.screen { display: flex; flex-direction: column; gap: 16px; animation: screen-in 0.22s ease; }
@keyframes screen-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.screen h1, .screen h2 { margin: 0; font-size: clamp(22px, 3vw, 30px); letter-spacing: -0.02em; line-height: 1.25; }
.flow-note { color: var(--muted); font-size: 14px; line-height: 1.7; max-width: 68ch; margin: 0; }
.eyebrow { color: var(--accent-2); font-size: 12px; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; margin: 0; }

#app-header { position: sticky; top: 10px; z-index: 40; background: rgba(10, 25, 22, 0.9); backdrop-filter: blur(16px); border: 1px solid var(--border-soft); border-radius: 18px; padding: 12px 16px; display: flex; align-items: center; gap: 12px; margin: 10px 10px 0; box-shadow: 0 10px 32px rgba(0, 0, 0, 0.18); }
.brand { font-size: 19px; font-weight: 850; letter-spacing: -0.03em; white-space: nowrap; }
.brand span { color: var(--accent); }
.header-badges { margin-inline-start: auto; display: flex; gap: 8px; align-items: center; }
.badge { font-size: 11px; padding: 6px 11px; border-radius: 999px; border: 1px solid; font-weight: 750; white-space: nowrap; }
.badge.demo { background: rgba(240, 120, 120, 0.1); color: #ffaaaa; border-color: rgba(240, 120, 120, 0.34); }
.badge.dev { background: rgba(100, 189, 233, 0.1); color: var(--info); border-color: rgba(100, 189, 233, 0.34); }

.language-picker { position: relative; }
#languageToggle { width: 40px; height: 40px; border-radius: 13px; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.045); color: var(--text); display: grid; place-items: center; cursor: pointer; }
.language-menu { position: absolute; top: 46px; inset-inline-end: 0; z-index: 60; background: var(--panel-2); border: 1px solid var(--border); border-radius: 14px; padding: 6px; min-width: 168px; box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55); }
.language-option { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 8px; background: none; border: none; color: var(--text); font-size: 13.5px; padding: 10px 12px; border-radius: 10px; cursor: pointer; text-align: start; }
.language-option[aria-checked="true"] { background: rgba(46, 224, 113, 0.12); color: var(--accent); }

#app-nav { position: fixed; bottom: 0; inset-inline: 0; max-width: 1280px; margin: 0 auto; background: rgba(9, 23, 20, 0.97); backdrop-filter: blur(16px); border-top: 1px solid var(--border-soft); display: flex; z-index: 40; padding: 4px 6px 0; }
.nav-item { flex: 1; min-width: 0; background: none; border: none; color: var(--muted); padding: 11px 2px calc(11px + env(safe-area-inset-bottom)); font-size: 11px; font-weight: 700; cursor: pointer; border-top: 2px solid transparent; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.nav-item.active { color: var(--accent-2); border-top-color: var(--accent); }

.card { background: linear-gradient(155deg, rgba(17, 35, 31, 0.98), rgba(11, 26, 22, 0.98)); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 18px; box-shadow: 0 14px 36px rgba(0, 0, 0, 0.22); }
.card.protection { border-color: rgba(56, 217, 155, 0.32); }
.protection-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 6px; }
.protection-id { display: flex; gap: 12px; align-items: center; }
.shield-wrap { width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; background: rgba(56, 217, 155, 0.12); color: var(--accent-2); flex: 0 0 auto; }
.protection-value { font-size: 17px; }

.banner { border-radius: 14px; padding: 12px 14px; font-size: 13px; border: 1px solid; line-height: 1.5; }
.banner.ok { background: rgba(34, 197, 94, 0.12); border-color: rgba(34, 197, 94, 0.4); color: var(--ok); }
.banner.warn { background: rgba(232, 161, 58, 0.12); border-color: rgba(232, 161, 58, 0.4); color: var(--warn); }
.banner.bad { background: rgba(239, 90, 90, 0.12); border-color: rgba(239, 90, 90, 0.4); color: var(--bad); }
.banner.info { background: rgba(74, 163, 255, 0.12); border-color: rgba(74, 163, 255, 0.4); color: var(--info); }
.banner.muted { background: rgba(148, 163, 196, 0.08); border-color: var(--border); color: var(--muted); }

.status-pill { display: inline-block; padding: 6px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 700; }
.status-pill.ok { background: rgba(34, 197, 94, 0.15); color: var(--ok); }
.status-pill.warn { background: rgba(232, 161, 58, 0.15); color: var(--warn); }
.status-pill.bad { background: rgba(239, 90, 90, 0.15); color: var(--bad); }
.status-pill.info { background: rgba(74, 163, 255, 0.15); color: var(--info); }

.btn { background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: #052117; border: none; border-radius: 14px; padding: 13px 16px; font-size: 14.5px; font-weight: 800; cursor: pointer; width: 100%; min-height: 48px; box-shadow: 0 8px 20px rgba(56, 217, 155, 0.18); transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease; font-family: inherit; }
.btn:not(:disabled):hover { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(56, 217, 155, 0.25); filter: brightness(1.04); }
.btn:disabled { background: var(--panel-2); color: var(--muted); border: 1px solid var(--border); box-shadow: none; cursor: not-allowed; }
.btn.ghost { background: rgba(255, 255, 255, 0.045); color: var(--text); border: 1px solid var(--border); box-shadow: none; }
.btn.danger { background: rgba(240, 120, 120, 0.12); color: #ffb3b3; border: 1px solid rgba(240, 120, 120, 0.35); box-shadow: none; }
.btn.small { width: auto; padding: 10px 16px; min-height: 42px; font-size: 13px; }

.actions-row { display: flex; gap: 10px; flex-wrap: wrap; }
.actions-row .btn { width: auto; flex: 1; min-width: 140px; }

.action { display: flex; align-items: center; gap: 12px; background: var(--panel-2); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: 14px; }
.action .grow { flex: 1; display: flex; gap: 12px; align-items: center; min-width: 0; }
.action .cap { color: var(--muted); font-size: 12px; display: block; margin-top: 3px; }
.action.on { border-color: rgba(34, 197, 94, 0.5); }
.action.off { opacity: 0.62; }

.skeleton { background: linear-gradient(90deg, var(--panel-2) 25%, var(--border) 50%, var(--panel-2) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 10px; height: 14px; margin-bottom: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.timeline { position: relative; padding-inline-start: 22px; }
.timeline::before { content: ""; position: absolute; top: 6px; bottom: 6px; inset-inline-start: 6px; width: 2px; background: var(--border); }
.incident { position: relative; background: var(--panel-2); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 10px; }
.incident::before { content: ""; position: absolute; inset-inline-start: -20px; top: 18px; width: 10px; height: 10px; border-radius: 50%; background: var(--warn); }
.incident.resolved::before { background: var(--ok); }

.mapbox { background: var(--panel-2); border: 1px solid var(--border-soft); border-radius: var(--radius); height: 240px; position: relative; overflow: hidden; }
.mapbox svg { width: 100%; height: 100%; display: block; }
.map-label { position: absolute; top: 10px; inset-inline-start: 10px; padding: 6px 9px; border-radius: 999px; background: rgba(7, 11, 9, 0.78); border: 1px solid var(--border); color: var(--muted); font-size: 11px; }
.map-pin { position: absolute; inset-inline-start: 50%; top: 44%; transform: translate(-50%, -100%); color: var(--accent); filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.6)); }

.kv { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 7px 0; border-bottom: 1px dashed var(--border-soft); align-items: center; }
.kv:last-child { border-bottom: none; }
.stat { background: var(--panel-2); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: 14px; flex: 1; min-width: 120px; }
.stat .num { font-size: 24px; font-weight: 800; }
.stat .cap { color: var(--muted); font-size: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px dashed var(--border-soft); font-size: 14px; }
.toggle-row:last-child { border-bottom: none; }

input, select, textarea {
  width: 100%; min-height: 48px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 14px;
  background: rgba(5, 17, 14, 0.8); color: var(--text); font: inherit;
}
textarea { min-height: 100px; resize: vertical; }
label { font-size: 13px; font-weight: 700; color: var(--text); }
.connect-screen { width: 100%; max-width: 620px; margin: clamp(18px, 6vh, 68px) auto; align-items: stretch; }
.connect-mark { width: 58px; height: 58px; display: grid; place-items: center; border: 1px solid rgba(112, 235, 186, 0.32); border-radius: 19px; background: linear-gradient(145deg, rgba(56, 217, 155, 0.2), rgba(100, 189, 233, 0.08)); color: var(--accent-2); }
.connect-mark svg, .unavailable-icon svg { width: 28px; height: 28px; }
.connect-form, .report-form { display: grid; gap: 12px; }
.form-help, .form-status, .status-disclaimer { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.form-status.error { color: #ffaaaa; }
.connect-safety { margin: 0; padding: 13px 15px; border-inline-start: 3px solid var(--info); border-radius: 10px; background: rgba(100, 189, 233, 0.08); color: #c5e7f5; font-size: 12px; line-height: 1.65; }
.connected-status.is-stolen { border-color: rgba(240, 120, 120, 0.52); background: linear-gradient(155deg, rgba(56, 27, 28, 0.95), rgba(24, 21, 21, 0.98)); }
.status-disclaimer { margin: 8px 0 0; padding-top: 12px; border-top: 1px solid var(--border-soft); }
.checkbox-row { display: flex; align-items: flex-start; gap: 10px; color: var(--muted); line-height: 1.55; cursor: pointer; font-weight: 500; }
.checkbox-row input { width: 18px; min-height: 18px; height: 18px; flex: 0 0 auto; margin: 2px 0 0; accent-color: var(--accent); }
.unavailable-panel { display: grid; justify-items: start; gap: 10px; padding: 24px; }
.unavailable-icon { display: grid; width: 48px; height: 48px; place-items: center; border-radius: 15px; background: rgba(100, 189, 233, 0.1); color: var(--info); }

.owner-hero { display: grid; gap: 8px; }
.profile-chip { display: inline-flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 16px; background: rgba(56,217,155,0.08); border: 1px solid rgba(56,217,155,0.22); width: fit-content; max-width: 100%; }
.owner-avatar { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, rgba(56,217,155,0.35), rgba(100,189,233,0.18)); color: #052117; font-weight: 900; flex: 0 0 auto; }
.vehicle-grid { display: grid; gap: 12px; }
.vehicle-card { border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 16px; background: linear-gradient(155deg, rgba(17,35,31,0.98), rgba(11,26,22,0.98)); display: grid; gap: 10px; }
.vehicle-card.is-stolen { border-color: rgba(240,120,120,0.45); }
.vehicle-card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.vehicle-plate { font-size: 18px; font-weight: 800; letter-spacing: 0.02em; }
.auth-steps { display: flex; gap: 8px; flex-wrap: wrap; }
.auth-step { font-size: 11px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.auth-step.active { color: var(--accent-2); border-color: rgba(56,217,155,0.4); background: rgba(56,217,155,0.08); }
.divider { height: 1px; background: var(--border-soft); margin: 4px 0; }

.steps { display: grid; gap: 14px; }
.step-dot { display: flex; gap: 10px; align-items: center; }
.step-dot .dot { width: 28px; height: 28px; border-radius: 50%; background: var(--panel-2); border: 1px solid var(--border); display: grid; place-items: center; font-size: 12px; color: var(--muted); }
.step-dot .dot.done { background: var(--ok); border-color: var(--ok); color: #06281a; font-weight: 800; }
.step-dot .dot.current { background: var(--accent); border-color: var(--accent); color: #04140b; font-weight: 800; }

@media (min-width: 768px) {
  #app-header { width: min(calc(100% - 48px), 1200px); margin: 16px auto 0; padding: 14px 20px; }
  #app-main { padding: 34px 32px 54px; overflow: visible; }
  .screen { max-width: 900px; margin: 0 auto; width: 100%; }
  .vehicle-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  #app-nav {
    top: 104px; bottom: 24px; inset-inline: auto;
    inset-inline-start: max(24px, calc((100vw - 1280px) / 2 + 24px));
    width: 198px; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 5px;
    padding: 10px; border: 1px solid var(--border-soft); border-radius: 20px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
  }
  .nav-item { flex: 0 0 auto; min-height: 48px; justify-content: flex-start; align-items: center; padding: 12px 14px; border: 0; border-inline-start: 3px solid transparent; border-radius: 12px; font-size: 13px; }
  .nav-item.active { background: rgba(56, 217, 155, 0.1); border-inline-start-color: var(--accent); }
  #app-main { padding: 42px 32px 64px; margin-inline-start: 220px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}

/* ==========================================================================
   Owner app — premium automotive UI layer
   ========================================================================== */

.ltr-text { unicode-bidi: isolate; font-variant-numeric: tabular-nums; }

.screen-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.screen-head > div { display: grid; gap: 6px; min-width: 0; }
.screen-head h1, .screen-head h2 { margin: 0; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}
.section-head h2 { font-size: 15px; font-weight: 800; letter-spacing: 0.01em; color: var(--text); }
.section-head .muted { font-variant-numeric: tabular-nums; }

/* ---------------------------- live status badge --------------------------- */
.badge.live,
.badge.offline {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(67, 216, 156, 0.1);
  color: #7ff0c0;
  border-color: rgba(67, 216, 156, 0.4);
}
.badge.offline {
  background: rgba(240, 120, 120, 0.09);
  color: #ffabab;
  border-color: rgba(240, 120, 120, 0.34);
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
  box-shadow: 0 0 0 0 currentColor;
  animation: live-pulse 2s ease-out infinite;
}
.badge.offline .live-dot,
.hero-badge.offline .live-dot { animation: none; box-shadow: none; opacity: 0.75; }

@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(67, 216, 156, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(67, 216, 156, 0); }
  100% { box-shadow: 0 0 0 0 rgba(67, 216, 156, 0); }
}

/* ------------------------------- hero card -------------------------------- */
.hero-card {
  position: relative;
  border-radius: 26px;
  border: 1px solid var(--border-soft);
  background:
    radial-gradient(120% 90% at 70% -10%, rgba(56, 217, 155, 0.16), transparent 60%),
    linear-gradient(160deg, rgba(18, 39, 34, 0.98), rgba(8, 21, 18, 0.99));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  overflow: hidden;
}
.hero-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(112, 235, 186, 0.06);
}
.hero-card.is-stolen {
  background:
    radial-gradient(120% 90% at 70% -10%, rgba(240, 120, 120, 0.22), transparent 60%),
    linear-gradient(160deg, rgba(43, 24, 25, 0.98), rgba(18, 15, 15, 0.99));
  border-color: rgba(240, 120, 120, 0.42);
}

.hero-stage {
  --glow: #38d99b;
  position: relative;
  padding: 6px 14px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  isolation: isolate;
}
.hero-stage.is-armed { --glow: #38d99b; }
.hero-stage.is-idle { --glow: #4d7f70; }
.hero-stage.is-alert { --glow: #f07878; }

.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(112, 235, 186, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(112, 235, 186, 0.09) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: radial-gradient(closest-side at 50% 62%, #000 35%, transparent 82%);
  -webkit-mask-image: radial-gradient(closest-side at 50% 62%, #000 35%, transparent 82%);
  opacity: 0.85;
  pointer-events: none;
}
.hero-stage.is-alert .hero-grid {
  background-image:
    linear-gradient(rgba(240, 120, 120, 0.11) 1px, transparent 1px),
    linear-gradient(90deg, rgba(240, 120, 120, 0.11) 1px, transparent 1px);
}

.hero-car {
  width: 100%;
  max-width: 540px;
  min-width: 0;
  height: auto;
  display: block;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 18px 26px rgba(0, 0, 0, 0.45));
}

.hero-mirror { stroke-linejoin: round; }
.hero-rail { stroke-linejoin: round; }
.hero-headlight, .hero-taillight { transition: fill 0.45s ease, opacity 0.45s ease; }
.hero-stage.is-idle .hero-headlight,
.hero-stage.is-idle .hero-taillight { opacity: 0.45; }
.hero-stage.is-alert .hero-headlight,
.hero-stage.is-alert .hero-taillight { opacity: 1; }
.hero-underglow { transition: fill 0.45s ease, opacity 0.45s ease; }

.hero-badge {
  position: absolute;
  z-index: 2;
  top: 12px;
  inset-inline-end: 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  background: rgba(7, 18, 16, 0.72);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(67, 216, 156, 0.42);
  color: #7ff0c0;
}
.hero-badge.offline {
  border-color: rgba(240, 120, 120, 0.36);
  color: #ffabab;
}

.hero-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 4px 18px 18px;
}
.hero-identity { display: grid; gap: 3px; min-width: 0; }
.hero-label {
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 800;
}
.hero-plate {
  font-size: clamp(20px, 5vw, 26px);
  font-weight: 850;
  letter-spacing: 0.06em;
  line-height: 1.15;
  color: #f2fffa;
}

/* ---------------------------- telemetry cards ----------------------------- */
.telemetry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
}
.telemetry-card {
  position: relative;
  display: grid;
  gap: 3px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--border-soft);
  background: linear-gradient(155deg, rgba(19, 41, 35, 0.95), rgba(10, 25, 21, 0.98));
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  min-height: 104px;
  align-content: start;
  transition: border-color 0.25s ease, transform 0.25s ease;
}
.telemetry-card::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(112, 235, 186, 0.5), transparent);
  opacity: 0.55;
}
.telemetry-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  margin-bottom: 4px;
  background: rgba(56, 217, 155, 0.1);
  color: var(--accent-2);
}
.telemetry-icon svg { width: 17px; height: 17px; }
.telemetry-label { font-size: 11px; font-weight: 750; color: var(--muted); letter-spacing: 0.02em; }
.telemetry-value {
  font-size: clamp(20px, 5vw, 25px);
  font-weight: 850;
  letter-spacing: -0.02em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  color: #f2fffa;
}
.telemetry-value small {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  margin-inline-start: 4px;
  letter-spacing: 0;
}
.telemetry-hint {
  font-size: 10.5px;
  color: var(--muted);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.telemetry-card.ok::before { background: linear-gradient(90deg, transparent, rgba(67, 216, 156, 0.75), transparent); }
.telemetry-card.ok .telemetry-icon { background: rgba(67, 216, 156, 0.13); color: var(--ok); }
.telemetry-card.warn::before { background: linear-gradient(90deg, transparent, rgba(240, 179, 93, 0.75), transparent); }
.telemetry-card.warn .telemetry-icon { background: rgba(240, 179, 93, 0.14); color: var(--warn); }
.telemetry-card.danger::before { background: linear-gradient(90deg, transparent, rgba(240, 120, 120, 0.8), transparent); }
.telemetry-card.danger .telemetry-icon { background: rgba(240, 120, 120, 0.14); color: var(--bad); }
.telemetry-card.danger .telemetry-value { color: #ffb3b3; }
.telemetry-card.muted .telemetry-icon { background: rgba(155, 181, 170, 0.1); color: var(--muted); }
.telemetry-card.is-empty .telemetry-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0;
  line-height: 1.5;
}
.telemetry-card.is-empty::before { opacity: 0.25; }

/* ----------------------------- control grid ------------------------------- */
.control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}
.control-card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "icon go"
    "copy copy";
  align-items: start;
  gap: 10px;
  padding: 16px;
  min-height: 122px;
  text-align: start;
  font-family: inherit;
  color: var(--text);
  border-radius: 20px;
  border: 1px solid var(--border-soft);
  background: linear-gradient(155deg, rgba(20, 44, 37, 0.96), rgba(10, 26, 22, 0.99));
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.control-card .control-icon {
  grid-area: icon;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: rgba(56, 217, 155, 0.1);
  border: 1px solid rgba(56, 217, 155, 0.18);
  color: var(--accent-2);
}
.control-card .control-icon svg { width: 21px; height: 21px; }
.control-card .control-copy { grid-area: copy; display: grid; gap: 3px; min-width: 0; }
.control-card .control-copy b { font-size: 14.5px; font-weight: 800; letter-spacing: -0.01em; }
.control-card .control-copy small {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.control-go {
  grid-area: go;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-soft);
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
}
html[dir="rtl"] .control-go { transform: scaleX(-1); }
.control-card:not(:disabled):hover {
  transform: translateY(-2px);
  border-color: rgba(56, 217, 155, 0.42);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(56, 217, 155, 0.12);
}
.control-card:not(:disabled):active { transform: translateY(0) scale(0.988); }
.control-card:disabled { cursor: not-allowed; opacity: 0.6; box-shadow: none; }
.control-card.is-locked { opacity: 0.72; }
.control-card.is-locked .control-icon { color: var(--muted); background: rgba(155, 181, 170, 0.08); border-color: var(--border-soft); }
.control-card.is-status {
  cursor: default;
  background: linear-gradient(155deg, rgba(13, 31, 27, 0.98), rgba(9, 22, 19, 0.99));
  border-style: dashed;
  grid-template-areas:
    "icon status"
    "copy copy";
  align-items: center;
}
.control-card.is-status .control-icon { color: var(--info); background: rgba(100, 189, 233, 0.1); border-color: rgba(100, 189, 233, 0.2); }
.control-status {
  grid-area: status;
  justify-self: end;
  align-self: start;
  font-size: 11px;
  font-weight: 800;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(155, 181, 170, 0.1);
  border: 1px solid var(--border-soft);
  color: var(--muted);
  white-space: nowrap;
}
.control-status.ok {
  background: rgba(67, 216, 156, 0.12);
  border-color: rgba(67, 216, 156, 0.34);
  color: var(--ok);
}

.btn-spinner {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid rgba(155, 181, 170, 0.35);
  border-top-color: var(--accent-2);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------- map ----------------------------------- */
.mapbox .map-canvas { width: 100%; height: 100%; display: block; }
.map-zone {
  position: absolute;
  width: 0;
  height: 0;
  transition: left 0.9s cubic-bezier(0.22, 1, 0.36, 1), top 0.9s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}
.map-ripple {
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  width: 78px;
  height: 78px;
  margin: -39px 0 0 -39px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(56, 217, 155, 0.24), rgba(56, 217, 155, 0) 70%);
  animation: map-ripple 2.6s ease-out infinite;
}
@keyframes map-ripple {
  0% { transform: scale(0.35); opacity: 0.9; }
  70% { transform: scale(1); opacity: 0; }
  100% { transform: scale(1); opacity: 0; }
}
.map-pin {
  inset-inline-start: auto;
  left: 50%;
  top: 44%;
  display: grid;
  place-items: center;
  color: var(--accent);
  transition: left 0.9s cubic-bezier(0.22, 1, 0.36, 1), top 0.9s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: left, top;
}
.map-coords {
  position: absolute;
  bottom: 10px;
  inset-inline-end: 10px;
  padding: 5px 9px;
  border-radius: 9px;
  background: rgba(7, 11, 9, 0.8);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------- responsive -------------------------------- */
@media (min-width: 560px) {
  .telemetry-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 768px) {
  .hero-card { border-radius: 30px; }
  .hero-stage { padding: 10px 22px 0; }
  .hero-meta { padding: 6px 26px 24px; }
  .control-card { min-height: 132px; padding: 18px; }
}
@media (max-width: 400px) {
  .control-card { min-height: 112px; padding: 13px; }
  .control-card .control-copy b { font-size: 13px; }
  .telemetry-card { min-height: 96px; padding: 12px; }
}

/* ==========================================================================
   Arabic / RTL typography and alignment pass
   ========================================================================== */

/* Arabic is a connected script: letter-spacing visibly breaks the joins.
   Reset it on every element that carries Arabic copy. */
html[dir="rtl"] body,
html[dir="rtl"] .screen h1,
html[dir="rtl"] .screen h2,
html[dir="rtl"] .section-head h2,
html[dir="rtl"] .brand,
html[dir="rtl"] .eyebrow,
html[dir="rtl"] .hero-label,
html[dir="rtl"] .hero-plate,
html[dir="rtl"] .telemetry-label,
html[dir="rtl"] .telemetry-value,
html[dir="rtl"] .telemetry-value small,
html[dir="rtl"] .control-card .control-copy b,
html[dir="rtl"] .control-card .control-copy small,
html[dir="rtl"] .nav-item,
html[dir="rtl"] .btn,
html[dir="rtl"] .badge,
html[dir="rtl"] .status-pill,
html[dir="rtl"] .kv,
html[dir="rtl"] .banner {
  letter-spacing: 0;
}

/* Arabic needs a taller line box so diacritics and descenders never clip. */
html[dir="rtl"] .screen h1,
html[dir="rtl"] .screen h2,
html[dir="rtl"] .screen-head h1,
html[dir="rtl"] .screen-head h2,
html[dir="rtl"] .section-head h2 {
  line-height: 1.45;
}
html[dir="rtl"] .telemetry-value { line-height: 1.35; }
html[dir="rtl"] .hero-plate { line-height: 1.4; }
html[dir="rtl"] .banner,
html[dir="rtl"] .flow-note,
html[dir="rtl"] .form-help,
html[dir="rtl"] .kv { line-height: 1.75; }

/* Arabic-first font stack (no webfont request, uses the best local face). */
html[dir="rtl"] body {
  font-family: "Segoe UI", "Dubai", "Noto Kufi Arabic", "Tajawal", "Cairo", Tahoma, Arial, sans-serif;
}

/* Latin/digit runs inside RTL copy stay isolated and tabular. */
html[dir="rtl"] .ltr-text,
html[dir="rtl"] .map-coords,
html[dir="rtl"] bdi {
  unicode-bidi: isolate;
  font-variant-numeric: tabular-nums;
}

/* Field alignment: labels and values line up on the right, except numeric
   inputs which are explicitly left-aligned. */
html[dir="rtl"] .kv > span { text-align: right; }
html[dir="rtl"] .kv > b { text-align: end; }
html[dir="rtl"] input:not(.ltr-field),
html[dir="rtl"] textarea {
  text-align: right;
}
html[dir="rtl"] input.ltr-field,
html[dir="rtl"] .ltr-field {
  text-align: left;
  direction: ltr;
}

/* Control cards: icon and status pill sit on the leading edge in RTL. */
html[dir="rtl"] .control-card.is-status .control-status {
  justify-self: start;
}
html[dir="rtl"] .control-card .control-copy { text-align: right; }
html[dir="rtl"] .control-card { text-align: right; }

/* Hero identity block follows reading direction. */
html[dir="rtl"] .hero-identity { text-align: right; }
html[dir="rtl"] .hero-label { letter-spacing: 0; }

/* Select / option lists inherit RTL text alignment. */
html[dir="rtl"] select { text-align: right; }

/* Slightly roomier Arabic labels inside tight chips. */
html[dir="rtl"] .badge,
html[dir="rtl"] .status-pill {
  padding-block: 7px;
  line-height: 1.4;
}

/* ==========================================================================
   Vehicle appearance picker (Settings)
   ========================================================================== */

.color-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.color-swatch {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  min-height: 46px;
  border-radius: 14px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  text-align: start;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.15s ease;
}
.color-swatch:hover { border-color: rgba(112, 235, 186, 0.4); }
.color-swatch:active { transform: scale(0.985); }
.color-swatch.is-selected {
  border-color: var(--accent);
  background: rgba(56, 217, 155, 0.1);
  box-shadow: 0 0 0 1px rgba(56, 217, 155, 0.35), 0 8px 20px rgba(0, 0, 0, 0.25);
}

.swatch-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--swatch, #3a4046);
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.35),
    inset 0 -3px 5px rgba(0, 0, 0, 0.45),
    0 2px 6px rgba(0, 0, 0, 0.35);
}
.color-swatch.is-selected .swatch-dot {
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.4),
    inset 0 -3px 5px rgba(0, 0, 0, 0.45),
    0 0 0 3px rgba(56, 217, 155, 0.22);
}

.swatch-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.color-custom { display: grid; gap: 8px; }
.color-custom-row { display: flex; align-items: center; gap: 10px; }

input[type="color"] {
  width: 58px;
  min-height: 44px;
  height: 44px;
  padding: 4px;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: rgba(5, 17, 14, 0.8);
  cursor: pointer;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch {
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 9px;
}
input[type="color"]::-moz-color-swatch {
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 9px;
}

.color-code {
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px dashed var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.settings-preview {
  margin: 6px 0 0;
  padding: 4px 10px 0;
  border-radius: 18px;
  border: 1px solid var(--border-soft);
  background:
    radial-gradient(90% 80% at 50% 0%, rgba(56, 217, 155, 0.12), transparent 65%),
    linear-gradient(160deg, rgba(16, 35, 30, 0.95), rgba(8, 20, 17, 0.98));
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  overflow: hidden;
}
.settings-preview .hero-car { max-width: 440px; }

@media (min-width: 768px) {
  .color-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ----------------------------- safe exit mode ----------------------------- */
.safe-exit-card { display: grid; gap: 14px; }
.safe-exit-status-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.safe-exit-shield { width: 52px; height: 52px; border-radius: 17px; display: grid; place-items: center; background: rgba(56, 217, 155, 0.12); border: 1px solid rgba(56, 217, 155, 0.22); color: var(--accent-2); flex: 0 0 auto; }
.safe-exit-shield svg { width: 24px; height: 24px; }
.safe-exit-status-copy { display: grid; gap: 4px; min-width: 0; flex: 1; }
.safe-exit-status-value { font-size: 18px; font-weight: 850; letter-spacing: -0.01em; }
.safe-exit-ring-wrap { position: relative; width: 132px; height: 132px; flex: 0 0 auto; }
.safe-exit-ring { width: 100%; height: 100%; display: block; transform: rotate(-90deg); }
.safe-exit-ring circle { fill: none; stroke-width: 9; stroke-linecap: round; }
.safe-exit-ring-bg { stroke: rgba(148, 163, 196, 0.16); }
.safe-exit-ring-fg { stroke: var(--accent); stroke-dasharray: 326.73; stroke-dashoffset: 326.73; transition: stroke-dashoffset 1s linear, stroke 0.45s ease; }
.safe-exit-ring-wrap.is-armed .safe-exit-ring-fg { stroke: var(--accent-2); }
.safe-exit-ring-wrap.is-alert .safe-exit-ring-fg { stroke: var(--bad); }
.safe-exit-ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-align: center; }
.safe-exit-ring-center b { font-size: 21px; font-weight: 850; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: #f2fffa; }
.safe-exit-ring-center small { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: 0.05em; line-height: 1.3; }
.safe-exit-ring-idle-icon { display: grid; place-items: center; width: 100%; height: 100%; color: var(--muted); }
.safe-exit-ring-idle-icon svg { width: 30px; height: 30px; }

.safe-exit-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--border-soft); font-size: 14px; font-weight: 700; }
.safe-exit-toggle { position: relative; width: 56px; height: 32px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel-2); cursor: pointer; padding: 0; transition: background 0.25s ease, border-color 0.25s ease; flex: 0 0 auto; }
.safe-exit-toggle[aria-checked="true"] { background: rgba(56, 217, 155, 0.3); border-color: rgba(56, 217, 155, 0.55); }
.safe-exit-toggle-knob { position: absolute; top: 3px; bottom: 3px; width: 26px; height: 26px; border-radius: 50%; background: #9bb5aa; transition: inset-inline-start 0.25s ease, background 0.25s ease; }
.safe-exit-toggle[aria-checked="true"] .safe-exit-toggle-knob { inset-inline-start: auto; inset-inline-end: 3px; background: var(--accent-2); }

.safe-exit-presets-label { font-size: 12px; font-weight: 800; color: var(--muted); letter-spacing: 0.05em; margin: 14px 0 8px; }
.safe-exit-presets { display: flex; gap: 8px; flex-wrap: wrap; }
.safe-exit-preset { flex: 1 1 0; min-width: 76px; }

@media (min-width: 768px) {
  .safe-exit-ring-wrap { width: 148px; height: 148px; }
}

/* ----------------------------- neural diagnostics ----------------------------- */
.ai-diagnostic { display: grid; gap: 14px; border-color: rgba(100, 189, 233, 0.24); background: linear-gradient(155deg, rgba(12, 30, 40, 0.98), rgba(9, 21, 27, 0.98)); }
.ai-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.ai-title { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.ai-title h2 { font-size: 16px; margin: 0 0 4px; }
.ai-title p { margin: 0; }
.ai-pulse { position: relative; width: 12px; height: 12px; border-radius: 50%; margin-top: 5px; background: var(--info); box-shadow: 0 0 0 0 rgba(100, 189, 233, 0.5); animation: ai-pulse 2.2s infinite; flex: 0 0 auto; }
@keyframes ai-pulse { 0% { box-shadow: 0 0 0 0 rgba(100, 189, 233, 0.45); } 70% { box-shadow: 0 0 0 10px rgba(100, 189, 233, 0); } 100% { box-shadow: 0 0 0 0 rgba(100, 189, 233, 0); } }
.ai-badge { font-size: 10px; letter-spacing: 0.12em; font-weight: 850; color: var(--info); border: 1px solid rgba(100, 189, 233, 0.4); background: rgba(100, 189, 233, 0.1); padding: 5px 9px; border-radius: 8px; flex: 0 0 auto; }
.ai-readout { border: 1px solid var(--border-soft); border-radius: 14px; padding: 14px; background: rgba(255, 255, 255, 0.02); font-size: 13.5px; }
.ai-empty { color: var(--muted); }
.ai-loading { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.ai-loading .btn-spinner { width: 18px; height: 18px; border-width: 2px; }
.ai-error { color: #ffb3b3; border-color: rgba(240, 120, 120, 0.3); background: rgba(240, 120, 120, 0.08); }
.ai-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.ai-chip { font-size: 11px; padding: 5px 9px; border-radius: 999px; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.035); color: var(--muted); }
.ai-chip b { color: var(--text); font-weight: 800; }
.ai-chip-warn { color: var(--warn); border-color: rgba(232, 161, 58, 0.4); background: rgba(232, 161, 58, 0.1); }
.ai-text { white-space: pre-wrap; line-height: 1.65; color: #dcefe7; margin: 0; }
.ai-stamp { margin-top: 10px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ai-status-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ai-severity { font-size: 11px; font-weight: 850; padding: 5px 11px; border-radius: 999px; letter-spacing: 0.04em; border: 1px solid var(--border); }
.ai-sev-safe { color: #7ef0c0; border-color: rgba(46, 204, 113, 0.45); background: rgba(46, 204, 113, 0.12); }
.ai-sev-attention { color: #ffd28a; border-color: rgba(232, 161, 58, 0.45); background: rgba(232, 161, 58, 0.12); }
.ai-sev-urgent { color: #ff9d9d; border-color: rgba(240, 120, 120, 0.45); background: rgba(240, 120, 120, 0.12); }
.ai-overview { margin: 0; font-size: 12.5px; line-height: 1.65; color: #dcefe7; flex: 1 1 100%; }
.ai-section { display: grid; gap: 8px; border-top: 1px solid var(--border-soft); padding-top: 12px; }
.ai-section-title { font-size: 11px; font-weight: 850; letter-spacing: 0.06em; color: var(--muted); }
.ai-fault-list { display: grid; gap: 8px; }
.ai-fault-card { border: 1px solid var(--border-soft); border-inline-start: 3px solid var(--info); border-radius: 12px; padding: 10px 12px; background: rgba(255, 255, 255, 0.02); }
.ai-fault-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.ai-fault-code { font-size: 12px; font-weight: 800; color: var(--accent-2); font-variant-numeric: tabular-nums; }
.ai-fault-title { font-size: 12.5px; font-weight: 800; color: var(--text); }
.ai-fault-meaning { margin: 0; font-size: 12px; line-height: 1.6; color: var(--muted); }
.ai-causes { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.ai-causes li { position: relative; padding-inline-start: 18px; font-size: 12.5px; line-height: 1.6; color: #dcefe7; }
.ai-causes li::before { content: "•"; position: absolute; inset-inline-start: 0; color: var(--accent-2); font-weight: 900; }
.ai-steps { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; counter-reset: ai-step; }
.ai-steps li { position: relative; padding-inline-start: 28px; font-size: 12.5px; line-height: 1.6; color: #dcefe7; }
.ai-steps li::before { content: counter(ai-step); position: absolute; inset-inline-start: 0; top: 0; width: 18px; height: 18px; border-radius: 50%; background: rgba(100, 189, 233, 0.15); color: var(--info); font-size: 10px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.ai-safety { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.ai-safety li { position: relative; padding-inline-start: 18px; font-size: 12.5px; line-height: 1.6; color: #ffd9a8; }
.ai-safety li::before { content: "⚠"; position: absolute; inset-inline-start: 0; color: var(--warn); }
.ai-telemetry { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.ai-tel-item { border: 1px solid var(--border-soft); border-radius: 12px; padding: 10px 12px; background: rgba(255, 255, 255, 0.02); display: grid; gap: 4px; }
.ai-tel-label { font-size: 10.5px; color: var(--muted); font-weight: 700; }
.ai-tel-value { font-size: 15px; font-weight: 800; color: var(--text); }
.ai-tel-hint { font-size: 10.5px; color: var(--muted); }
@media (max-width: 640px) {
  .ai-telemetry { grid-template-columns: 1fr; }
}



/* ----------------------------- smart diagnostics page ----------------------------- */
.diagnostics-screen { display: grid; gap: 16px; }
.diag-hero {
  display: grid;
  grid-template-columns: 1.4fr auto;
  gap: 18px;
  align-items: stretch;
  padding: 20px;
  border-radius: 22px;
  border: 1px solid var(--border);
  background:
    radial-gradient(120% 120% at 100% 0%, rgba(100, 189, 233, 0.14), transparent 45%),
    linear-gradient(160deg, rgba(12, 30, 40, 0.98), rgba(8, 20, 17, 0.98));
  box-shadow: var(--shadow);
}
.diag-hero-main { display: grid; gap: 10px; align-content: start; }
.diag-hero-main h2 { margin: 0; font-size: 20px; line-height: 1.45; color: #f3fff9; }
.diag-hero-main p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.diag-chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.diag-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
  border: 1px solid rgba(100, 189, 233, 0.28); color: #d9efff; background: rgba(100, 189, 233, 0.1);
}
.diag-chip.is-muted { color: var(--muted); border-color: var(--border); background: rgba(255,255,255,0.03); }
.diag-sev-pill {
  display: inline-flex; align-items: center; width: fit-content;
  padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 850; letter-spacing: 0.03em;
  border: 1px solid var(--border);
}
.diag-sev-safe, .diag-sev-pill.diag-sev-safe { color: #7ef0c0; border-color: rgba(46, 204, 113, 0.45); background: rgba(46, 204, 113, 0.12); }
.diag-sev-attention, .diag-sev-pill.diag-sev-attention { color: #ffd28a; border-color: rgba(232, 161, 58, 0.45); background: rgba(232, 161, 58, 0.12); }
.diag-sev-urgent, .diag-sev-pill.diag-sev-urgent { color: #ff9d9d; border-color: rgba(240, 120, 120, 0.45); background: rgba(240, 120, 120, 0.12); }

.diag-health { display: grid; gap: 10px; align-content: center; justify-items: center; min-width: 170px; }
.diag-health-ring {
  --size: 132px;
  width: var(--size); height: var(--size); border-radius: 50%;
  display: grid; place-items: center; text-align: center; position: relative;
  background:
    radial-gradient(circle at center, rgba(8, 20, 17, 0.98) 58%, transparent 59%),
    conic-gradient(var(--accent-2) calc(var(--score, 0) * 1%), rgba(148,163,196,0.18) 0);
  border: 1px solid var(--border-soft);
  box-shadow: inset 0 0 0 10px rgba(255,255,255,0.02);
}
.diag-hero.diag-sev-attention .diag-health-ring { background: radial-gradient(circle at center, rgba(8,20,17,0.98) 58%, transparent 59%), conic-gradient(var(--warn) calc(var(--score,0) * 1%), rgba(148,163,196,0.18) 0); }
.diag-hero.diag-sev-urgent .diag-health-ring { background: radial-gradient(circle at center, rgba(8,20,17,0.98) 58%, transparent 59%), conic-gradient(var(--bad) calc(var(--score,0) * 1%), rgba(148,163,196,0.18) 0); }
.diag-health-ring b { display: block; font-size: 28px; line-height: 1; color: #f4fffb; font-variant-numeric: tabular-nums; }
.diag-health-ring small { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); font-weight: 700; }
.diag-health-hint { font-size: 11.5px; color: var(--muted); text-align: center; max-width: 180px; line-height: 1.5; }

.diag-panel { display: grid; gap: 14px; }
.diag-fault-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.diag-fault-card {
  display: grid; gap: 10px; padding: 14px; border-radius: 16px;
  border: 1px solid var(--border-soft); border-inline-start: 4px solid var(--info);
  background: rgba(255,255,255,0.02);
}
.diag-fault-card.diag-sev-safe { border-inline-start-color: var(--ok); }
.diag-fault-card.diag-sev-attention { border-inline-start-color: var(--warn); }
.diag-fault-card.diag-sev-urgent { border-inline-start-color: var(--bad); }
.diag-fault-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.diag-code { font-size: 13px; font-weight: 900; letter-spacing: 0.08em; color: var(--accent-2); font-variant-numeric: tabular-nums; }
.diag-fault-title { margin: 0; font-size: 15px; color: var(--text); line-height: 1.45; }
.diag-fault-meaning { margin: 0; font-size: 13px; color: #dcefe7; line-height: 1.7; }
.diag-fault-system { font-size: 12px; color: var(--muted); }
.diag-fault-system b { color: var(--text); }
.diag-fault-block { display: grid; gap: 6px; }
.diag-fault-block > span { font-size: 11.5px; font-weight: 800; color: var(--muted); letter-spacing: 0.04em; }
.diag-empty-card { border-inline-start-color: var(--ok); }

.diag-list, .diag-steps { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.diag-list li { position: relative; padding-inline-start: 18px; font-size: 13.5px; line-height: 1.7; color: #dcefe7; }
.diag-list li::before { content: "•"; position: absolute; inset-inline-start: 0; color: var(--accent-2); font-weight: 900; }
.diag-steps { counter-reset: diag-step; }
.diag-steps li { position: relative; padding-inline-start: 30px; font-size: 13.5px; line-height: 1.7; color: #dcefe7; }
.diag-steps li::before {
  counter-increment: diag-step; content: counter(diag-step);
  position: absolute; inset-inline-start: 0; top: 2px; width: 20px; height: 20px; border-radius: 50%;
  background: rgba(100,189,233,0.16); color: var(--info); font-size: 11px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
}
.diag-safety-panel { border-color: rgba(232,161,58,0.28); background: linear-gradient(160deg, rgba(34,24,10,0.35), rgba(17,26,22,0.98)); }
.diag-safety-list li { color: #ffe2b3; }
.diag-safety-list li::before { content: "!"; color: var(--warn); font-weight: 900; }

.diag-columns { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.diag-ai { border-color: rgba(100,189,233,0.24); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.section-head h2 { margin: 0; font-size: 16px; }

@media (max-width: 860px) {
  .diag-hero { grid-template-columns: 1fr; }
  .diag-health { justify-items: start; min-width: 0; }
  .diag-health-hint { text-align: start; }
  .diag-columns { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .diag-fault-grid { grid-template-columns: 1fr; }
}
