:root {
  --lab-accent: #173b63;
  --lab-accent-strong: #102d4d;
  --lab-focus: rgba(23, 59, 99, .22);
  --canvas: #f2f4f3;
  --panel: #ffffff;
  --ink: #17201d;
  --muted: #66706c;
  --line: #dfe3df;
  --accent: var(--lab-accent);
  --radius: var(--lab-radius-panel, 16px);
  --shadow: var(--lab-shadow-panel, 0 14px 38px rgba(17, 37, 61, .08));
  --space-2: var(--lab-space-2, 12px);
  --space-3: var(--lab-space-3, 16px);
  --space-4: var(--lab-space-4, 24px);
  --space-5: var(--lab-space-5, 32px);
  --card-shadow-rest: 0 1px 2px rgba(15, 26, 41, .04), 0 10px 24px rgba(15, 26, 41, .05);
  --card-shadow-hover: 0 4px 10px rgba(15, 26, 41, .06), 0 22px 44px rgba(15, 26, 41, .12);
  font-family: var(--lab-font-sans, Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif);
}

* { box-sizing: border-box; }

html { background: var(--canvas); }

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  position: relative;
  isolation: isolate;
}

/* Textured backdrop: soft brand-tinted glow + faint blueprint grid + fine
   grain. Pure CSS, no images/fonts/CDN — safe for an offline production box. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 14% -6%, rgba(23, 59, 99, .10), transparent 42%),
    radial-gradient(circle at 90% 4%, rgba(15, 118, 110, .07), transparent 40%),
    radial-gradient(circle at 50% 115%, rgba(23, 59, 99, .06), transparent 55%),
    repeating-linear-gradient(0deg, rgba(23, 59, 99, .05) 0 1px, transparent 1px 88px),
    repeating-linear-gradient(90deg, rgba(23, 59, 99, .05) 0 1px, transparent 1px 88px),
    radial-gradient(rgba(23, 59, 99, .12) 1px, transparent 1px);
  background-size: auto, auto, auto, 88px 88px, 88px 88px, 22px 22px;
  background-position: 0 0, 0 0, 0 0, 0 0, 0 0, 0 0;
  opacity: .8;
}

/* The shared auth template inlines its own background on .login-shell; let
   the body texture above show through on the login page too. */
.login-shell { background: transparent !important; }

a { color: inherit; }
button, input { font: inherit; }
input { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
input:focus { outline: 2px solid var(--lab-focus); border-color: var(--accent); }
button.primary { border: 0; border-radius: 9px; padding: 12px; color: #fff; background: var(--accent); cursor: pointer; }

.portal-shell {
  width: min(1180px, calc(100% - 48px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 48px 0 32px;
  display: flex;
  flex-direction: column;
}
.portal-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
}
.portal-header { max-width: 660px; margin-bottom: 52px; }

.brand-row { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.brand-mark {
  position: relative;
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: linear-gradient(155deg, var(--accent), var(--lab-accent-strong));
  box-shadow: 0 8px 18px rgba(17, 45, 77, .28), inset 0 1px 0 rgba(255, 255, 255, .16);
}
.brand-mark em {
  position: absolute;
  display: block;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .92);
  font-style: normal;
}
.brand-mark em:first-child { width: 20px; height: 20px; left: 9px; top: 9px; }
.brand-mark em:last-child { width: 20px; height: 20px; right: 6px; bottom: 6px; border-color: rgba(255, 255, 255, .55); background: rgba(255, 255, 255, .12); }

.eyebrow { margin: 0 0 6px; color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: .16em; }
h1 { margin: 0; font-size: clamp(34px, 5vw, 56px); line-height: 1.05; letter-spacing: -.04em; font-weight: 680; }
.intro { margin: 22px 0 0; color: var(--muted); font-size: 16px; line-height: 1.7; max-width: 52ch; }

.system-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }

.system-card {
  --card-accent: var(--accent);
  --card-accent-soft: rgba(23, 59, 99, .10);
  position: relative;
  overflow: hidden;
  min-height: 250px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 26px 24px 22px;
  text-decoration: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow-rest);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.system-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--card-accent), color-mix(in srgb, var(--card-accent) 45%, transparent));
}
.system-card::after {
  content: "";
  position: absolute;
  right: -34px;
  top: -34px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--card-accent-soft), transparent 70%);
  pointer-events: none;
}

.system-card.sound { --card-accent: #4338ca; --card-accent-soft: rgba(67, 56, 202, .12); }
.system-card.gas   { --card-accent: #0d7d72; --card-accent-soft: rgba(13, 125, 114, .12); }
.system-card.intel { --card-accent: #b3670c; --card-accent-soft: rgba(179, 103, 12, .12); }

.system-card:hover, .system-card:focus-visible {
  transform: translateY(-4px);
  border-color: var(--card-accent);
  box-shadow: var(--card-shadow-hover);
  outline: none;
}
.system-card:focus-visible { outline: 3px solid var(--lab-focus); outline-offset: 3px; }

.card-index {
  position: absolute;
  top: 8px;
  right: 18px;
  font-size: 64px;
  font-weight: 700;
  letter-spacing: -.03em;
  color: var(--card-accent);
  opacity: .08;
  line-height: 1;
  user-select: none;
}

.card-icon {
  position: relative;
  z-index: 1;
  display: block;
  width: 40px;
  height: 40px;
  margin-bottom: 18px;
}
.card-icon i { position: absolute; display: block; font-style: normal; }

/* Sound: concentric sonar rings */
.system-card.sound .card-icon i:nth-child(1) { inset: 0; border-radius: 50%; border: 2px solid var(--card-accent); opacity: .25; }
.system-card.sound .card-icon i:nth-child(2) { inset: 8px; border-radius: 50%; border: 2px solid var(--card-accent); opacity: .55; }
.system-card.sound .card-icon i:nth-child(3) { inset: 16px; border-radius: 50%; background: var(--card-accent); }

/* Gas: layered airflow streamlines */
.system-card.gas .card-icon i { left: 0; width: 40px; height: 6px; border-radius: 999px; background: var(--card-accent); }
.system-card.gas .card-icon i:nth-child(1) { top: 4px; width: 40px; opacity: .9; }
.system-card.gas .card-icon i:nth-child(2) { top: 17px; width: 30px; opacity: .55; }
.system-card.gas .card-icon i:nth-child(3) { top: 30px; width: 20px; opacity: .3; }

/* Intel: stacked report bars */
.system-card.intel .card-icon i { left: 0; border-radius: 3px; background: var(--card-accent); }
.system-card.intel .card-icon i:nth-child(1) { top: 0; width: 40px; height: 9px; opacity: .9; }
.system-card.intel .card-icon i:nth-child(2) { top: 15px; width: 40px; height: 9px; opacity: .55; }
.system-card.intel .card-icon i:nth-child(3) { top: 30px; width: 24px; height: 9px; opacity: .3; }

.card-copy { position: relative; z-index: 1; }
.system-card h2 { margin: 0 0 9px; font-size: 22px; letter-spacing: -.02em; }
.system-card p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.6; }

.card-cta {
  position: relative;
  z-index: 1;
  margin-top: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: .02em;
  color: var(--card-accent);
}
.card-cta .arrow { transition: transform .18s ease; }
.system-card:hover .card-cta .arrow, .system-card:focus-visible .card-cta .arrow { transform: translateX(4px); }

footer { margin-top: 40px; color: #89918e; font-size: 11px; letter-spacing: .08em; }

@media (max-width: 760px) {
  .portal-shell { padding-top: 56px; }
  .portal-header { margin-bottom: 34px; }
  .system-grid { grid-template-columns: 1fr; }
  .system-card { min-height: 180px; }
  .card-index { font-size: 52px; }
}

@media (prefers-reduced-motion: reduce) {
  .system-card, .card-cta .arrow { transition: none; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #0f1720;
    --panel: #17212c;
    --ink: #e8edf2;
    --muted: #93a1ae;
    --line: #29343f;
    --lab-accent: #6c8fc7;
    --lab-accent-strong: #8fabd9;
    --card-shadow-rest: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 24px rgba(0, 0, 0, .35);
    --card-shadow-hover: 0 4px 10px rgba(0, 0, 0, .35), 0 26px 50px rgba(0, 0, 0, .5);
  }
  body::before {
    background:
      radial-gradient(circle at 14% -6%, rgba(108, 143, 199, .16), transparent 42%),
      radial-gradient(circle at 90% 4%, rgba(45, 165, 150, .12), transparent 40%),
      radial-gradient(circle at 50% 115%, rgba(108, 143, 199, .10), transparent 55%),
      repeating-linear-gradient(0deg, rgba(255, 255, 255, .035) 0 1px, transparent 1px 88px),
      repeating-linear-gradient(90deg, rgba(255, 255, 255, .035) 0 1px, transparent 1px 88px),
      radial-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px);
    background-size: auto, auto, auto, 88px 88px, 88px 88px, 22px 22px;
    opacity: 1;
  }
  .system-card.sound { --card-accent: #8b83f0; --card-accent-soft: rgba(139, 131, 240, .16); }
  .system-card.gas   { --card-accent: #34c7b8; --card-accent-soft: rgba(52, 199, 184, .16); }
  .system-card.intel { --card-accent: #e0a039; --card-accent-soft: rgba(224, 160, 57, .16); }
  input { background: var(--panel); color: var(--ink); }
  .login-lab-note { background: rgba(255, 255, 255, .04) !important; }
}
