:root {
  --bg: #05080c;
  --panel: #11161d;
  --panel2: #171d25;
  --line: #2c3440;
  --text: #f4f7fb;
  --muted: #a8b1bd;
  --blue: #087cff;
  --green: #36d34a;
  --red: #ff3030;
  --amber: #ffb000;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #202936, var(--bg));
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  display: flex;
  justify-content: center;
}
.phone-frame {
  width: 390px;
  min-height: 844px;
  background: #070b10;
  border-left: 1px solid #26303b;
  border-right: 1px solid #26303b;
  padding: 14px 12px 74px;
}
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
h1 { font-size: 21px; margin: 0; letter-spacing: .3px; }
p { margin: 0; }
#active-template {
  display: none;
}
.status-pill { padding: 7px 10px; border-radius: 9px; font-weight: 700; font-size: 12px; }
.online { background: #0d7d22; }
.offline { background: #8f1d1d; }
.template-card {
  background: none;
  border: none;
  padding: 0;
  margin: 0 0 12px 0;
  box-shadow: none;
}
.template-card label { display:block; color: var(--muted); font-size: 12px; text-transform: uppercase; margin-bottom: 6px; }
select {
  width: 100%;
  background: #0b1017;
  color: var(--text);
  border: 1px solid #323b48;
  border-radius: 8px;
  padding: 10px;
  font-size: 18px;
}
.main-tabs, .subtabs { display: grid; gap: 6px; margin-bottom: 10px; }
.main-tabs { grid-template-columns: repeat(4, 1fr); }
.subtabs { grid-template-columns: repeat(4, 1fr); }
.hidden {
  display: none !important;
}
button {
  color: var(--text);
  background: #10151c;
  border: 1px solid #303945;
  border-radius: 9px;
  padding: 10px 8px;
  font-weight: 650;
}
button.active, .tab.active, .subtab.active { background: var(--blue); border-color: #3a9aff; }
.view { display: none; }
.view.active { display: block; }
.grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.big-value span { color: var(--muted); font-size: 13px; }
.big-value strong { display:block; font-size: 24px; margin-top: 8px; }
h2 { margin: 0 0 10px; font-size: 16px; }
.status-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 16px;
  font-size: 14px;
}
.status-grid div {
  color: #a8b1bd;
}
.status-grid strong {
  color: #fff;
  text-align: right;
}
.icon { display:inline-flex; align-items:center; justify-content:center; width:38px; height:38px; border-radius: 50%; font-size:20px; font-weight:800; margin-bottom:6px; }
.ok { background: var(--green); color:#06260c; }
.warn { background: var(--red); }
.blue { background: #123b64; color:#4dc2ff; }
.overview-row, .signal-row {
  display: grid;
  align-items: center;
  border-top: 1px solid #252d37;
  padding: 9px 0;
  gap: 7px;
}
.overview-row { grid-template-columns: 1fr 32px 32px; }
.signal-row { grid-template-columns: 1.55fr 30px 92px 30px 56px; }
.name { font-size: 14px; font-weight: 650; }
.pin { color: var(--muted); font-size: 12px; margin-top: 2px; }
.wire { display: inline-flex; align-items: center; gap: 5px; }
.wire-dot {
  width: 12px; height: 12px; border-radius: 50%;
  display: inline-block; border: 1px solid rgba(255,255,255,.55);
  background: var(--wire1, #777);
}
.wire-dot.split { background: linear-gradient(90deg, var(--wire1) 0 50%, var(--wire2) 50% 100%); }
.led {
  width: 18px; height: 18px; border-radius: 50%;
  background: #d8dde3; box-shadow: inset 0 0 4px rgba(0,0,0,.35);
}
.led.on { background: var(--green); box-shadow: 0 0 12px rgba(54,211,74,.7); }
.led.out { background: var(--green); }
.led.warn { background: var(--red); box-shadow: 0 0 12px rgba(255,48,48,.7); }
.led.blink { animation: blink .55s infinite; }
@keyframes blink { 50% { opacity: .25; transform: scale(.88); } }
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; }
.mode-switch button { border-radius: 0; padding: 9px 0; font-size: 18px; }
.mode-switch button:first-child { border-radius: 8px 0 0 8px; }
.mode-switch button:last-child { border-radius: 0 8px 8px 0; }
.mode-pass { background: #0f62c9; }
.mode-force { background: #9f1515; }
.mode-disabled { opacity: .35; }
.current { text-align:right; font-weight: 800; color: #62f34d; }
.current.high { color: var(--red); }
.full-button { width: 100%; background: var(--blue); margin-top: 10px; }
.full-button.danger { background: #8f1d1d; }
.bottom-nav {
  position: fixed;
  bottom: 0;
  width: 390px;
  background: rgba(6,10,15,.95);
  border-top: 1px solid #26303b;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 8px 8px 10px;
  gap: 6px;
}
.bottom { border: 0; background: transparent; color: var(--muted); }
.bottom.active { color: #3b95ff; background: transparent; }
.error-box { color: #fff; background: #7a1717; border-radius: 10px; padding: 12px; margin-top: 10px; }
@media (max-width: 389px) {
  .phone-frame, .bottom-nav { width: 100vw; }
}
.signal-click {
  cursor: pointer;
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.back-button {
  background: #18202a;
  color: white;
  border: 1px solid #344252;
  border-radius: 8px;
  padding: 8px 10px;
}

.detail-card {
  padding: 16px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid #263241;
  padding: 10px 0;
}

.detail-row span {
  color: #a8b1bd;
}

.detail-status,
.detail-values {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}

.detail-status > div,
.detail-values > div {
  background: #101720;
  border: 1px solid #263241;
  border-radius: 12px;
  padding: 10px 12px;
}

.detail-status > div {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
}

.detail-status span {
  color: #d8dee9;
  font-size: 16px;
}

.detail-values > div {
  text-align: center;
}

.detail-values span {
  display: block;
  color: #a8b1bd;
  margin-bottom: 6px;
}

.detail-values strong {
  display: block;
  font-size: 24px;
  margin-top: 6px;
}

.detail-buttons {
  margin-top: 18px;
  display: flex;
  justify-content: center;
}

.detail-buttons .mode-switch {
  transform: scale(1.4);
}
.detail-wrapper {
  margin-top: 12px;
  border: 1px solid #263241;
  border-radius: 18px;
  background: linear-gradient(180deg,#111827 0%,#0a1018 100%);
  padding: 16px;
  box-shadow: 0 8px 30px rgba(0,0,0,.35);
}
.detail-title {
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 22px;
  letter-spacing: 0.3px;
}
.wire-rect {
  display: inline-block;
  width: 100px;      /* ungefär 10 mm på skärm */
  height: 25px;     /* ungefär 5 mm */
  border: 1px solid #666;
  border-radius: 3px;
  background-color: var(--wire1, #777);
  vertical-align: middle;
}

.wire-rect.split {
  position: relative;
  background-color: var(--wire1, #777);
}

.wire-rect.split::after {
  content: "";
  position: absolute;

  left: 0;
  top: 50%;

  width: 100%;
  height: 1mm;

  transform: translateY(-50%);

  background-color: var(--wire2, #fff);
}
.cable-row {
  justify-content: flex-start;
}

.cable-display {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cable-text {
  font-size: 18px;
  font-weight: 500;
  color: #ffffff;
}
.detail-pin {
  font-size: 28px;
  font-weight: 600;
  color: #ffffff;

  margin-bottom: 18px;
}

.detail-pin strong {
  font-weight: 800;
}