/* ---------- Base Layout ---------- */
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial;
  background: #0b1020;
  color: #e7eefc;
}

.wrap {
  max-width: 900px;
  margin: 40px auto;
  padding: 0 16px;
}

/* Reduce spacing for the first metrics card to make UI more compact */
.wrap > .card:first-of-type {
  margin-top: 8px;
  padding: 12px;
}

/* ---------- Control Panel (right column in metrics card) ---------- */
.ctrl-panel {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-self: stretch;
  min-height: 160px;
  overflow: hidden;
}

.ctrl-panel-title {
  grid-column: 1 / -1;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: #6b80a8;
  margin-bottom: 2px;
  white-space: nowrap;
}
.ctrl-panel-hint {
  grid-column: 1 / -1;
  font-size: 11px;
  color: #ffffff;
  margin: -1px 0 1px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  line-height: 1.4;
}

/* Page subtitle under the h1 */
.page-subtitle {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: #5a6f91;
  margin-top: -10px;
  margin-bottom: 4px;
}

/* ---------- Metrics sub-sections ---------- */
.metrics-section {
  margin-top: 10px;
}
.metrics-section + .metrics-section {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.07);
}
.metrics-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: #6b80a8;
  margin-bottom: 6px;
}

/* ---------- Compact metrics tables ---------- */
.metrics-card { }
.metrics-tables {
  display: flex;
  gap: 0;
  align-items: flex-start;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.metrics-divider {
  width: 1px;
  background: rgba(255,255,255,.09);
  align-self: stretch;
  margin: 0 20px;
}
.metrics-tbl {
  border-collapse: collapse;
  flex-shrink: 0;
  overflow: visible;
}
.metrics-tbl thead th {
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: #6b80a8;
  padding: 0 20px 6px 0;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
/* ---------- MTTR tooltip ---------- */
.mttr-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: rgba(107,128,168,.25);
  color: #6b80a8;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  cursor: pointer;
  position: relative;
  top: -1px;
  text-transform: none;
  margin-left: 4px;
  user-select: none;
}
#mttr-floating-tooltip {
  position: fixed;
  background: #1a2540;
  color: #9db0d1;
  font-size: 11px;
  font-weight: 400;
  white-space: nowrap;
  padding: 5px 9px;
  border-radius: 5px;
  border: 1px solid rgba(255,255,255,.1);
  pointer-events: none;
  z-index: 9999;
  display: none;
  letter-spacing: 0;
  text-transform: none;
}
#mttr-floating-tooltip.tip-wide {
  white-space: normal;
  max-width: 320px;
}
#mttr-floating-tooltip.tip-centered {
  white-space: normal;
  max-width: 240px;
  text-align: center;
  left: 50% !important;
  top: 50% !important;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  box-shadow: 0 4px 24px rgba(0,0,0,.5);
}
.metrics-tbl thead th:first-child {
  min-width: 80px;
  padding-left: 0;
}
.metrics-tbl tbody td {
  padding: 5px 20px 5px 0;
  white-space: nowrap;
  vertical-align: middle;
  font-size: 13px;
}
.metrics-tbl tbody td:first-child {
  padding-left: 0;
}
.mrow-label {
  color: #9db0d1;
  font-size: 13px;
}
.metrics-tbl tbody .mono {
  color: #e7eefc;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* ---------- Severity badges ---------- */
.sev {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .4px;
  vertical-align: middle;
}
.sev.p1 {
  background: rgba(255,80,80,.18);
  color: #ff7070;
  border: 1px solid rgba(255,80,80,.3);
}
.sev.p2 {
  background: rgba(255,190,50,.15);
  color: #ffcc55;
  border: 1px solid rgba(255,190,50,.3);
}
.sev.p3 {
  background: rgba(255,210,0,.10);
  color: #ffe080;
  border: 1px solid rgba(255,210,0,.22);
}

.card h2 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 16px;
}

.card {
  margin-top: 13px;
  padding: 13px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
}

.muted { color: #9db0d1; }
.tiny { font-size: 12px; margin-top: 10px; }

.label {
  font-size: 12px;
  color: #9db0d1;
  margin-bottom: 6px;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.row {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
}

/* ---------- Status line layout ---------- */
.statusline {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---------- Status Badge ---------- */
.pill {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.15);
  font-weight: 900;
  font-size: 12px;
  letter-spacing: .6px;
}

.pill.ok {
  background: rgba(37,211,102,.18);
  border-color: rgba(37,211,102,.35);
}

.pill.down {
  background: rgba(255,77,77,.18);
  border-color: rgba(255,77,77,.35);
}

/* ---------- Toggle button ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color: #e7eefc;
  font-weight: 900;
  font-size: 12px;
  letter-spacing: .4px;
  cursor: pointer;
  user-select: none;
  justify-content: center;
  transition: transform .06s ease, background .12s ease, border-color .12s ease;
}

.btn:hover {
  background: rgba(255,255,255,.10);
  border-color: rgba(255,255,255,.20);
}

.btn:active {
  transform: translateY(1px) scale(0.99);
}

.btn:disabled {
  opacity: .65;
  cursor: not-allowed;
}

.btn .dots {
  display: none;
  align-items: center;
  gap: 4px;
}

.btn.loading .dots {
  display: inline-flex;
}

/* Three bouncing dots */
.btn .dots i {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: rgba(231,238,252,.85);
  display: inline-block;
  animation: dotBounce 0.7s infinite ease-in-out;
}

.btn .dots i:nth-child(2) { animation-delay: 0.12s; }
.btn .dots i:nth-child(3) { animation-delay: 0.24s; }

@keyframes dotBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: .5; }
  40% { transform: translateY(-4px); opacity: 1; }
}

/* ---------- Service Window ---------- */
.window {
  position: relative;
  margin-top: 16px;
  height: 220px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.10);
  overflow: hidden;
  background:
    radial-gradient(900px 220px at 50% 0%, rgba(60,110,255,.22), transparent 65%),
    linear-gradient(180deg, rgba(0,0,0,.35), rgba(0,0,0,.6));
}

/* subtle scanlines */
.scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    180deg,
    rgba(255,255,255,.03) 0px,
    rgba(255,255,255,.03) 1px,
    transparent 2px,
    transparent 6px
  );
  mix-blend-mode: overlay;
  pointer-events: none;
}

/* subtle grid (optional) */
.grid {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.10;
  pointer-events: none;
}

/* Overlay shown when alert is firing */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  background: rgba(0,0,0,.62);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
  z-index: 5;
}

.overlay-title {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: .8px;
  color: #ff4d4d;
}

.overlay-sub {
  margin-top: 6px;
  font-size: 13px;
  color: #9db0d1;
  max-width: 200px;
  text-align: center;
  line-height: 1.45;
}

/* Visual hint when DOWN */
.window.down {
  border-color: rgba(255,77,77,.35);
}

/* ---------- ECG Monitor ---------- */
.ecg {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.baseline {
  position: absolute;
  left: 18px;
  right: 18px;
  top: 50%;
  height: 2px;
  transform: translateY(-50%);
  background: rgba(37,211,102,.18);
  border-radius: 999px;
}

.ecg-strip {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 140px;
  transform: translateY(-50%);
  background-repeat: repeat-x;
  background-size: 220px 140px;

  /* repeating “spike” pattern */
  background-image:
    linear-gradient(
      90deg,
      transparent 0%,
      transparent 14%,

      rgba(37,211,102,.0) 14%,
      rgba(37,211,102,.0) 18%,

      rgba(37,211,102,.85) 18%,
      rgba(37,211,102,.85) 19%,

      rgba(37,211,102,.0) 19%,
      rgba(37,211,102,.0) 22%,

      rgba(37,211,102,.55) 22%,
      rgba(37,211,102,.55) 23%,

      rgba(37,211,102,.0) 23%,
      rgba(37,211,102,.0) 26%,

      rgba(37,211,102,.75) 26%,
      rgba(37,211,102,.75) 27%,

      rgba(37,211,102,.0) 27%,
      rgba(37,211,102,.0) 100%
    );

  /* soften into a waveform band */
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 0 55%, transparent 56% 100%);
  -webkit-mask-repeat: repeat-x;
  -webkit-mask-size: 220px 140px;
  -webkit-mask-position: 0 0;

  filter: drop-shadow(0 0 10px rgba(37,211,102,.25))
          drop-shadow(0 0 22px rgba(37,211,102,.18));

  animation: ecgScroll 1.25s linear infinite;
}

.glow {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 90px;
  transform: translateY(-50%);
  background: radial-gradient(closest-side, rgba(37,211,102,.12), transparent 70%);
  pointer-events: none;
}

@keyframes ecgScroll {
  from { background-position: 0 0; -webkit-mask-position: 0 0; }
  to   { background-position: 220px 0; -webkit-mask-position: 220px 0; }
}

/* Optional: when DOWN, shift styling toward red */
/* Hide ECG visuals when DOWN */
.window.down .ecg,
.window.down .baseline,
.window.down .ecg-strip,
.window.down .glow {
  display: none;
}
.window.down .overlay {
  display: flex !important;
  opacity: 1 !important;
}

/* ---------- Danger button variant (Break Bulb) ---------- */
.btn-danger {
  background: rgba(180,30,30,.18);
  border-color: rgba(255,77,77,.55);
  color: rgba(255,160,160,.90);
  box-shadow: 0 0 0 1px rgba(255,60,60,.15), 0 0 10px rgba(255,50,50,.14);
  animation: dangerPulse 3s ease-in-out infinite;
}

.btn-danger:hover {
  background: rgba(255,60,60,.14);
  border-color: rgba(255,77,77,.80);
  color: #ff9999;
  box-shadow: 0 0 0 1px rgba(255,60,60,.30), 0 0 16px rgba(255,50,50,.26);
  animation: none;
}

/* Primary (Overload Grid) — same style, kept for semantic clarity */
.btn-danger-primary {}

@keyframes dangerPulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(255,60,60,.12), 0 0  8px rgba(255,50,50,.10); }
  50%       { box-shadow: 0 0 0 1px rgba(255,60,60,.28), 0 0 16px rgba(255,50,50,.22); }
}

/* ---------- Warning button variant (Low Voltage) ---------- */
.btn-warning {
  border-color: rgba(255,180,0,.30);
  color: rgba(255,210,100,.90);
}

.btn-warning:hover {
  background: rgba(255,180,0,.10);
  border-color: rgba(255,180,0,.50);
  color: #ffd060;
}

/* ---------- Lightbulb Visual ---------- */
.bulb-visual {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.bulb-icon {
  width: 96px;
  height: 124px;
}

/* ── OFF (default) ── */
.bulb-body {
  fill: #1b1d2e;
  transition: fill 0.4s ease;
}

.bulb-shine {
  fill: rgba(255,255,255,0);
  transition: fill 0.4s ease;
}

.bulb-base {
  fill: #23253a;
  transition: fill 0.4s ease;
}

.bulb-filament {
  fill: none;
  stroke: #2a2c40;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.4s ease;
}

/* ── ON ── */
.bulb-visual.on .bulb-body {
  fill: #ffc400;
}

.bulb-visual.on .bulb-shine {
  fill: rgba(255,255,255,0.25);
}

.bulb-visual.on .bulb-base {
  fill: #b8780a;
}

.bulb-visual.on .bulb-filament {
  stroke: rgba(255,230,120,0.8);
}

.bulb-visual.on {
  animation: bulbPulse 2.4s ease-in-out infinite;
}

@keyframes bulbPulse {
  0%, 100% {
    filter:
      drop-shadow(0 0 14px rgba(255,196,0,0.80))
      drop-shadow(0 0 36px rgba(255,140,0,0.40));
  }
  50% {
    filter:
      drop-shadow(0 0 24px rgba(255,220,0,1.00))
      drop-shadow(0 0 60px rgba(255,170,0,0.65));
  }
}

/* ── BROKEN ── */
.bulb-visual.broken .bulb-body {
  fill: #111320;
}

.bulb-visual.broken .bulb-shine {
  fill: transparent;
}

.bulb-visual.broken .bulb-base {
  fill: #1a1c2c;
}

.bulb-visual.broken .bulb-filament {
  stroke: #252738;
  stroke-dasharray: 3 4;
}

.bulb-visual.broken {
  filter: drop-shadow(0 0 10px rgba(180,40,40,0.30));
}

/* Crack lines — hidden by default, shown only in broken state */
.bulb-crack {
  display: none;
  fill: none;
  stroke: rgba(200,200,220,0.55);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bulb-visual.broken .bulb-crack {
  display: block;
}

/* Window border tint when bulb is broken */
.window.broken {
  border-color: rgba(180,50,50,.40);
  background:
    radial-gradient(900px 220px at 50% 0%, rgba(120,30,30,.18), transparent 65%),
    linear-gradient(180deg, rgba(0,0,0,.40), rgba(0,0,0,.65));
}

/* Low-voltage window: identical to normal state — no tint */
.window.low-voltage { }

/* ── DIM (low-voltage: same dark fills as OFF, only filament hint visible) ── */
.bulb-visual.on.dim .bulb-body {
  fill: #7a4e00;
}

.bulb-visual.on.dim .bulb-shine {
  fill: rgba(255,200,80,0.12);
}

.bulb-visual.on.dim .bulb-base {
  fill: #5a3a00;
}

.bulb-visual.on.dim .bulb-filament {
  stroke: rgba(255,200,80,0.75);
}

.bulb-visual.on.dim {
  animation: bulbDim 4s ease-in-out infinite;
}

@keyframes bulbDim {
  0%, 100% {
    filter:
      drop-shadow(0 0 6px rgba(255,150,30,0.30))
      drop-shadow(0 0 14px rgba(200,100,0,0.15));
  }
  50% {
    filter:
      drop-shadow(0 0 10px rgba(255,170,40,0.45))
      drop-shadow(0 0 22px rgba(210,110,0,0.22));
  }
}

/* ---------- Electricity Canvas ---------- */
.ecg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
}

#electricCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ---------- Fan Visual ---------- */
.fan-visual {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.fan-icon {
  width: 110px;
  height: 110px;
}

/* Frame ring */
.fan-frame {
  fill: none;
  stroke: #2a2d42;
  stroke-width: 3;
  transition: stroke 0.4s ease;
}

.fan-visual.on .fan-frame {
  stroke: #3a4060;
}

.fan-visual.clogged .fan-frame {
  stroke: rgba(200,60,60,0.55);
}

/* Blades */
.fan-blade {
  fill: #1e2035;
  transition: fill 0.4s ease;
}

.fan-visual.on .fan-blade {
  fill: #4a9eff;
}

.fan-visual.clogged .fan-blade {
  fill: rgba(200,60,60,0.70);
}

/* Hub */
.fan-hub {
  fill: #1e2035;
  transition: fill 0.4s ease;
}

.fan-hub-inner {
  fill: #111220;
  transition: fill 0.4s ease;
}

.fan-visual.on .fan-hub {
  fill: #2060c0;
}

.fan-visual.on .fan-hub-inner {
  fill: #0a0f1e;
}

.fan-visual.clogged .fan-hub {
  fill: rgba(180,40,40,0.80);
}

/* Spinning animation */
@keyframes fanSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.fan-blades {
  transform-origin: 50px 50px;
  animation: fanSpin 0.65s linear infinite;
  animation-play-state: paused;
}

/* ON: spinning at full speed */
.fan-visual.on .fan-blades {
  animation-play-state: running;
}

/* DIM (low voltage): spinning slowly */
.fan-visual.on.dim .fan-blades {
  animation-duration: 4s;
}

/* No power (electricity out): paused blades, keep ON class active */
.fan-visual.on.no-power .fan-blades {
  animation-play-state: paused;
}

/* No power: kill the blue glow and revert all colors to dark/off */
.fan-visual.on.no-power {
  animation: none;
  filter: none;
}
.fan-visual.on.no-power .fan-blade      { fill: #1e2035; }
.fan-visual.on.no-power .fan-frame      { stroke: #2a2d42; }
.fan-visual.on.no-power .fan-hub        { fill: #1e2035; }
.fan-visual.on.no-power .fan-hub-inner  { fill: #111220; }

/* OFF: paused */
.fan-visual.off .fan-blades {
  animation-play-state: paused;
}

/* CLOGGED: paused, red tint (already on blades) */
.fan-visual.clogged .fan-blades {
  animation-play-state: paused;
}

/* ON glow pulse */
.fan-visual.on {
  animation: fanGlow 2.2s ease-in-out infinite;
}

@keyframes fanGlow {
  0%, 100% { filter: drop-shadow(0 0 10px rgba(74,158,255,0.50)) drop-shadow(0 0 26px rgba(40,100,220,0.25)); }
  50%       { filter: drop-shadow(0 0 18px rgba(74,158,255,0.75)) drop-shadow(0 0 44px rgba(40,120,255,0.40)); }
}

/* DIM glow */
.fan-visual.on.dim {
  animation: fanGlowDim 4s ease-in-out infinite;
}

@keyframes fanGlowDim {
  0%, 100% { filter: drop-shadow(0 0 5px rgba(74,120,200,0.25)); }
  50%       { filter: drop-shadow(0 0 9px rgba(74,130,210,0.38)); }
}

/* CLOGGED glow */
.fan-visual.clogged {
  filter: drop-shadow(0 0 10px rgba(180,40,40,0.40));
}

/* Window border when clogged — mirrors .window.broken */
.window.clogged {
  border-color: rgba(180,50,50,.40);
  background:
    radial-gradient(900px 220px at 50% 0%, rgba(120,30,30,.18), transparent 65%),
    linear-gradient(180deg, rgba(0,0,0,.40), rgba(0,0,0,.65));
}

/* Window border when no power — neutral dark tint */
.window.no-power {
  border-color: rgba(150,160,190,.22);
}

/* Bulb visual when electricity is out — kill glow, revert to dark */
.bulb-visual.on.no-power {
  animation: none;
  filter: none;
}
.bulb-visual.on.no-power .bulb-body     { fill: #1b1d2e; }
.bulb-visual.on.no-power .bulb-shine    { fill: rgba(255,255,255,0); }
.bulb-visual.on.no-power .bulb-base     { fill: #23253a; }
.bulb-visual.on.no-power .bulb-filament { stroke: #2a2c40; }

/* Muted overlay title (used for NO POWER state — not a hard failure) */
.overlay-title--muted {
  color: #8a9dbf;
}

/* ---------- Side-by-side device cards ---------- */
.devices-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px;
  margin-top: 13px;
}

.devices-row > .card {
  margin-top: 0;
}

@media (max-width: 768px) {
  .devices-row {
    grid-template-columns: 1fr;
  }

  /* Stack the metrics tables + ctrl-panel vertically on mobile */
  .metrics-tables {
    flex-direction: column;
    align-items: stretch;
    overflow-x: visible;
    overflow-y: visible;
  }

  /* Allow tables to shrink/stretch in column flow */
  .metrics-tbl {
    flex-shrink: 1;
    width: 100%;
  }

  /* Turn vertical dividers into horizontal rules */
  .metrics-divider {
    width: auto;
    height: 1px;
    margin: 14px 0;
    align-self: auto;
  }

  /* ctrl-panel takes full width and has a fixed height so the overlay fills it */
  .ctrl-panel {
    width: 100%;
    min-height: 180px;
    align-self: auto;
  }
}

/* ═══════════════════════════════════════════════════
   Control Panel Lock Overlay
   ═══════════════════════════════════════════════════ */

/* ctrl-panel is the positioning anchor for the lock overlay */
.ctrl-lock {
  position: absolute;
  inset: 0;
  z-index: 10;
  border-radius: 10px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  background: rgba(11, 16, 32, 0.92);
  border: 1px solid rgba(74, 158, 255, 0.18);
  box-shadow: inset 0 0 30px rgba(74, 158, 255, 0.04);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px 12px;
  overflow: hidden;
  transition: opacity .15s ease;
}

.ctrl-lock.hidden {
  display: none;
}

/* Padlock SVG inside the lock overlay */
.lock-icon {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  animation: lockPulse 3s ease-in-out infinite;
}

.lock-icon .lock-body {
  fill: rgba(74, 158, 255, 0.12);
  stroke: #4a9eff;
  stroke-width: 1.8;
  stroke-linejoin: round;
}

.lock-icon .lock-shackle {
  stroke: #4a9eff;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lock-icon .lock-dot {
  fill: #4a9eff;
}

@keyframes lockPulse {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(74, 158, 255, 0.45)); }
  50%       { filter: drop-shadow(0 0 14px rgba(74, 158, 255, 0.80)); }
}

.ctrl-lock-title {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .7px;
  text-transform: uppercase;
  color: #6b80a8;
  margin-top: 2px;
}

.ctrl-lock-sub {
  font-size: 11px;
  color: #445570;
  text-align: center;
  max-width: 160px;
  line-height: 1.5;
}

/* Blue button variant */
.btn-unlock {
  background: rgba(74, 158, 255, 0.12);
  border-color: rgba(74, 158, 255, 0.45);
  color: #7ab8ff;
  box-shadow: 0 0 0 1px rgba(74, 158, 255, 0.10), 0 0 10px rgba(74, 158, 255, 0.12);
  animation: unlockPulse 3s ease-in-out infinite;
  margin-top: 2px;
  flex-shrink: 0;
  font-size: 11px;
  padding: 6px 14px;
}

.btn-unlock:hover {
  background: rgba(74, 158, 255, 0.22);
  border-color: rgba(74, 158, 255, 0.75);
  color: #aad4ff;
  box-shadow: 0 0 0 1px rgba(74, 158, 255, 0.25), 0 0 16px rgba(74, 158, 255, 0.28);
  animation: none;
}

@keyframes unlockPulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(74, 158, 255, 0.10), 0 0  8px rgba(74, 158, 255, 0.10); }
  50%       { box-shadow: 0 0 0 1px rgba(74, 158, 255, 0.25), 0 0 16px rgba(74, 158, 255, 0.22); }
}

/* ═══════════════════════════════════════════════════
   Survey Modal
   ═══════════════════════════════════════════════════ */

.survey-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(5, 8, 18, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .20s ease;
}

.survey-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

.survey-dialog {
  width: min(460px, calc(100vw - 32px));
  border-radius: 16px;
  background: rgba(13, 18, 38, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow:
    0 0 0 1px rgba(74, 158, 255, 0.10),
    0 24px 80px rgba(0, 0, 0, 0.70),
    0 0 60px rgba(74, 158, 255, 0.04);
  overflow: hidden;
  transform: translateY(8px) scale(0.98);
  opacity: 0;
  transition: transform .22s ease, opacity .22s ease;
}

.survey-backdrop.visible .survey-dialog {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* Progress strip */
.survey-progress {
  height: 3px;
  background: rgba(255, 255, 255, 0.06);
  width: 100%;
}

.survey-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #3c6eff, #4a9eff);
  transition: width .35s ease;
  border-radius: 0 2px 2px 0;
}

/* Dialog inner padding */
#surveyMain,
.survey-success {
  padding: 22px 24px 20px;
}

/* Header row */
.survey-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}

.survey-lock-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.survey-lock-icon .lock-body {
  fill: rgba(74, 158, 255, 0.10);
  stroke: #4a9eff;
  stroke-width: 1.8;
  stroke-linejoin: round;
}

.survey-lock-icon .lock-shackle {
  stroke: #4a9eff;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.survey-lock-icon .lock-dot {
  fill: #4a9eff;
}

.survey-header-text {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .7px;
  text-transform: uppercase;
  color: #6b80a8;
}

/* Step dots */
.survey-steps {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  transition: background .2s ease, box-shadow .2s ease;
  display: inline-block;
}

.step-dot.active {
  background: #4a9eff;
  box-shadow: 0 0 8px rgba(74, 158, 255, 0.75);
}

.step-dot.complete {
  background: rgba(74, 158, 255, 0.40);
}

/* Question label + text */
.survey-q-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: #445570;
  margin-bottom: 8px;
}

.survey-q-text {
  font-size: 15px;
  font-weight: 600;
  color: #c8d8f0;
  line-height: 1.45;
  margin-bottom: 14px;
  min-height: 44px;
}

/* Textarea */
.survey-textarea {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 10px;
  color: #e7eefc;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  padding: 10px 12px;
  resize: vertical;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.survey-textarea:focus {
  border-color: rgba(74, 158, 255, 0.52);
  box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.12);
}

.survey-textarea::placeholder {
  color: #354560;
}

/* Error message */
.survey-error {
  font-size: 12px;
  color: #ff7070;
  margin-top: 8px;
  min-height: 18px;
  letter-spacing: .2px;
}

/* Footer */
.survey-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  gap: 10px;
}

.survey-btn-back {
  font-size: 12px;
  padding: 7px 14px;
  color: #6b80a8;
  border-color: rgba(255, 255, 255, 0.08);
  background: transparent;
}

.survey-btn-back:hover {
  color: #9db0d1;
  background: rgba(255, 255, 255, 0.05);
}

/* Success screen */
.survey-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 36px 24px;
  animation: successFadeIn .35s ease forwards;
}

.survey-success.hidden {
  display: none;
}

.success-icon {
  width: 52px;
  height: 52px;
  filter: drop-shadow(0 0 12px rgba(37, 211, 102, 0.60));
}

.success-icon circle {
  fill: rgba(37, 211, 102, 0.10);
  stroke: #25d366;
  stroke-width: 1.8;
}

.success-icon polyline {
  fill: none;
  stroke: #25d366;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.survey-success-title {
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .7px;
  text-transform: uppercase;
  color: #25d366;
}

.survey-success-sub {
  font-size: 12px;
  color: #5a7a5a;
  letter-spacing: .3px;
}

@keyframes successFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* hidden utility */
.hidden {
  display: none !important;
}
