/* == Finetech WiFi-koll ==================================================
   Mörkt tema som standard (fältarbete). Statusfärgerna är validerade mot
   den mörka ytan (#1a1a19) och bär aldrig betydelse ensamma — alltid
   ikon + text intill. Utskrift sker i ljust tema längst ner.            */

/* Färgerna följer finetech-site (style.css :root): djup marinblå bas och
   samma cyan som hemsidans knappar (--cyan #2ee0e0, mörk text på) så appen
   känns som en del av sajten. Uppladdning behåller violett som kontrast. */
:root {
  --page:        #051e2d;   /* hemsidans --bg */
  --surface:     #082c40;   /* hemsidans --bg-soft */
  --surface-2:   #0c3b54;   /* hemsidans --navy */
  --ink:         #eef5f9;
  --ink-2:       #a9c2cf;   /* hemsidans --text-soft */
  --ink-muted:   #7d99a8;
  --hairline:    rgba(255, 255, 255, 0.13);
  --accent:      #2ee0e0;   /* hemsidans --cyan */
  --accent-ink:  #051e2d;   /* mörk text på cyan, som hemsidans knappar */

  --status-good:     #0ca30c;
  --status-warning:  #fab219;
  --status-serious:  #ec835a;
  --status-critical: #d03b3b;

  --radius: 16px;
  --radius-sm: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--page);
  color: var(--ink);
  min-height: 100%;
}

body {
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-tap-highlight-color: transparent;
}

/* -- Topbar ------------------------------------------------------------ */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  padding-top: calc(14px + env(safe-area-inset-top));
  position: sticky;
  top: 0;
  background: rgba(5, 30, 45, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--hairline);
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 16px;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
}
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand strong { color: var(--ink); font-weight: 700; }
@media (max-width: 400px) { .brand span { font-size: 14px; } }
.brand-logo {
  width: 26px;
  height: auto;
  flex-shrink: 0;
  display: block;
}

.brand { flex: 1; min-width: 0; }

.help-btn {
  width: 32px; height: 32px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.help-btn:hover { color: var(--ink); border-color: var(--ink-muted); }

.logout-btn { display: flex; align-items: center; justify-content: center; }
.logout-btn svg { width: 17px; height: 17px; fill: currentColor; }

/* Tillbaka till huvudsajten (startvyn): knapp i samma ghost-stil som
   appens övriga knappar så den syns ordentligt. */
.back-link { margin-top: 22px; }
.back-link a {
  display: block;
  text-align: center;
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 600;
  padding: 13px 20px;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s;
}
.back-link a:hover { color: var(--ink); border-color: var(--ink-muted); }

.mode-toggle {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 3px;
}
.mode-toggle button {
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
}
.mode-toggle button.active {
  background: var(--accent);
  color: var(--accent-ink);
}

/* -- Layout ------------------------------------------------------------ */

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 18px 60px;
}

h1 {
  font-size: 24px;
  font-weight: 700;
  margin: 8px 0 4px;
}
.subtitle {
  color: var(--ink-2);
  font-size: 15px;
  margin: 0 0 24px;
  line-height: 1.45;
}

.section-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 28px 0 10px;
}

/* -- Kort & knappar ------------------------------------------------------ */

.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 12px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 13px 20px;
  cursor: pointer;
  background: var(--accent);
  color: var(--accent-ink);
  transition: filter 0.15s;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { filter: brightness(0.92); }
.btn.big { width: 100%; padding: 16px; font-size: 16px; }
.btn.ghost {
  background: transparent;
  border: 1px solid var(--hairline);
  color: var(--ink-2);
}
.btn.small { padding: 8px 14px; font-size: 13px; border-radius: 10px; }
.btn.danger-text { color: var(--status-critical); }

/* -- Startsida ----------------------------------------------------------- */

.survey-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}
.survey-row .meta { min-width: 0; }
.survey-row .name {
  font-weight: 600;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.survey-row .sub { color: var(--ink-muted); font-size: 13px; margin-top: 3px; }
.survey-row .chev { color: var(--ink-muted); flex-shrink: 0; }

.dot-strip { display: inline-flex; gap: 4px; margin-left: 8px; vertical-align: middle; }
.dot-strip i {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block;
}

.empty-note {
  color: var(--ink-muted);
  text-align: center;
  padding: 32px 12px;
  font-size: 14px;
  line-height: 1.5;
}

/* -- Formulär ------------------------------------------------------------ */

input[type="text"], input[type="number"], input[type="password"], input[type="email"], input[type="tel"] {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  padding: 12px 14px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
input:focus { border-color: var(--accent); }

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}
.chip {
  border: 1px solid var(--hairline);
  background: var(--surface-2);
  color: var(--ink-2);
  font: inherit;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
}
.chip:hover, .chip.active { border-color: var(--accent); color: var(--ink); }

/* -- Baslinje ------------------------------------------------------------ */

.baseline-card { border-color: rgba(46, 224, 224, 0.35); }
.baseline-card .baseline-head {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.baseline-card .baseline-head svg { width: 18px; height: 18px; fill: var(--accent); }

/* -- Rumskort ------------------------------------------------------------ */

.room-card { padding: 0; overflow: hidden; }

.room-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}

.status-badge {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.status-badge svg { width: 22px; height: 22px; }

.level-good     .status-badge { background: rgba(12, 163, 12, 0.16); }
.level-good     .status-badge svg { fill: var(--status-good); }
.level-warning  .status-badge { background: rgba(250, 178, 25, 0.14); }
.level-warning  .status-badge svg { fill: var(--status-warning); }
.level-critical .status-badge { background: rgba(208, 59, 59, 0.16); }
.level-critical .status-badge svg { fill: var(--status-critical); }

.room-title { flex: 1; min-width: 0; }
.room-title .room-name {
  font-weight: 600;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.room-title .verdict { font-size: 13.5px; margin-top: 2px; color: var(--ink-2); }

.level-good     .verdict strong { color: var(--status-good); }
.level-warning  .verdict strong { color: var(--status-warning); }
.level-critical .verdict strong { color: var(--status-critical); }

.room-actions { display: flex; gap: 6px; flex-shrink: 0; }
.icon-btn {
  width: 34px; height: 34px;
  border-radius: 9px;
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-btn svg { width: 16px; height: 16px; fill: currentColor; }
.icon-btn:hover { color: var(--ink); border-color: var(--ink-muted); }

/* Statistikrad (pro-läge) */
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--hairline);
}
.stat-row.cols-3 { grid-template-columns: repeat(3, 1fr); }

/* Anslutningskort (pro): ISP ↔ enhet i WiFiman-stil */
.conn-row { display: flex; align-items: flex-start; gap: 10px; }
.conn-end { width: 86px; flex-shrink: 0; text-align: center; }
.conn-ico { width: 34px; height: 34px; margin: 0 auto 6px; color: var(--ink-2); }
.conn-ico svg { width: 100%; height: 100%; fill: currentColor; }
.conn-ico img { width: 30px; height: 30px; border-radius: 7px; margin-top: 2px; }
.conn-name { font-size: 13.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.conn-sub { font-size: 11px; color: var(--ink-muted); margin-top: 2px; }
.conn-link { flex: 1; min-width: 0; text-align: center; padding-top: 4px; }
.conn-speeds { font-size: 15.5px; font-weight: 700; }
.conn-speeds .dn { color: var(--accent); }
.conn-speeds .up { color: #9085e9; }
.conn-speeds small { color: var(--ink-muted); font-weight: 600; font-size: 11px; }
.conn-speeds.muted { color: var(--ink-muted); font-weight: 500; font-size: 13px; }
.conn-line { border-top: 2px dotted var(--ink-muted); opacity: 0.45; margin: 9px 2px; }
.conn-lat { font-size: 12px; color: var(--ink-2); }
.conn-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  align-items: center;
  border-top: 1px solid var(--hairline);
  margin-top: 14px;
  padding-top: 11px;
  font-size: 12.5px;
  color: var(--ink-muted);
}
.stat {
  padding: 10px 8px 12px;
  text-align: center;
  border-left: 1px solid var(--hairline);
}
.stat:first-child { border-left: 0; }
.stat .v { font-size: 17px; font-weight: 700; }
.stat .v small { font-size: 11px; font-weight: 600; color: var(--ink-muted); margin-left: 2px; }
.stat .k { font-size: 11px; color: var(--ink-muted); margin-top: 2px; }
.stat .delta { font-size: 11px; margin-top: 2px; color: var(--ink-muted); }
.stat .delta.bad { color: var(--status-serious); }
.stat .delta.good { color: var(--status-good); }

/* -- Fasväxlare (före/efter installation, pro-läge) ------------------------ */

.phase-toggle {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 3px;
  margin: 0 0 16px;
}
.phase-toggle button {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 8px;
  border-radius: 9px;
  cursor: pointer;
}
.phase-toggle button.active { background: var(--surface-2); color: var(--ink); border: 1px solid var(--hairline); }

/* Rum utan mätning i aktiv fas */
.level-none .status-badge { background: var(--surface-2); }
.level-none .status-badge svg { fill: var(--ink-muted); }
.level-none .verdict { color: var(--ink-muted); }

/* Före/efter-jämförelse på rumskort */
.compare-line {
  border-top: 1px solid var(--hairline);
  padding: 9px 16px;
  font-size: 12.5px;
  color: var(--ink-2);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}
.compare-line .imp { color: var(--status-good); font-weight: 600; }
.compare-line .wrs { color: var(--status-serious); font-weight: 600; }

/* Abonnemangsfält i baslinjekortet */
.sub-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--hairline);
  font-size: 13.5px;
  color: var(--ink-2);
  flex-wrap: wrap;
}
.sub-row input { width: 74px; padding: 7px 8px; text-align: center; font-size: 14px; }
.sub-note { font-size: 12.5px; color: var(--ink-muted); margin: 8px 0 0; width: 100%; }
.sub-note strong.ok { color: var(--status-good); }
.sub-note strong.low { color: var(--status-serious); }

/* -- Kundhjälp / offert ----------------------------------------------------- */

.help-card { border-color: rgba(46, 224, 224, 0.35); }
.help-card h3 { margin: 0 0 4px; font-size: 16px; }
.help-card .lead-sub { color: var(--ink-2); font-size: 14px; line-height: 1.5; margin: 0 0 14px; }
.lead-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
.lead-grid label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
  margin-bottom: 5px;
}
.lead-grid .wide { grid-column: 1 / -1; }
select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  padding: 12px 14px;
  outline: none;
  appearance: none;
}
select:focus { border-color: var(--accent); }

/* CTA-knapp: skicka till Finetech */
.cta {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  background: linear-gradient(135deg, #2ee0e0 0%, #23c3cf 100%);
  border: 0;
  border-radius: 14px;
  padding: 14px 16px;
  text-decoration: none;
  color: var(--accent-ink);
  box-shadow: 0 10px 28px rgba(46, 224, 224, 0.35);
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}
.cta:hover { transform: translateY(-1px); box-shadow: 0 14px 32px rgba(46, 224, 224, 0.45); filter: brightness(1.05); }
.cta:active { transform: translateY(0); filter: brightness(0.95); }

/* Bekräftelse efter lyckad direktsändning av lead (grön → vit text) */
.cta-sent {
  background: linear-gradient(135deg, #1d9e57 0%, #16855f 100%);
  box-shadow: 0 10px 28px rgba(29, 158, 87, 0.35);
  color: #ffffff;
}
.cta-sent:hover { transform: none; box-shadow: 0 10px 28px rgba(29, 158, 87, 0.35); filter: none; }
.cta-sent .cta-icon { background: rgba(255, 255, 255, 0.18); }
.cta-sent .cta-icon svg { fill: #ffffff; }
.cta-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: rgba(5, 30, 45, 0.14);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.cta-icon svg { width: 21px; height: 21px; fill: #051e2d; }
.cta-text { flex: 1; text-align: left; min-width: 0; }
.cta-text strong { display: block; font-size: 16px; }
.cta-text small { display: block; font-size: 12px; opacity: 0.85; margin-top: 2px; }
.cta-arrow { width: 18px; height: 18px; fill: rgba(5, 30, 45, 0.65); flex-shrink: 0; }

/* Live-mätning */
.pulse-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--status-critical);
  display: inline-block;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.7); }
}
.live-btn { gap: 10px; }
.live-tag {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  margin: 0;
}
#liveTimer { color: var(--ink-muted); font-weight: 600; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.live-value {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 64px;
  font-weight: 200;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin-top: 20px;
}
.live-value small {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* Produktrekommendationer */
/* Nätverkspaket Bra/Bättre/Bäst — egna paket, ingen extern länk */
.tiers-intro { font-size: 13px; color: var(--ink-2); line-height: 1.5; margin: 6px 0 14px; }
.tier-list { display: grid; gap: 12px; }
.tier {
  position: relative;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 16px 16px 14px;
  background: var(--surface-2);
}
.tier-rec {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 8px 22px rgba(46, 224, 224, 0.14);
}
.tier-badge {
  position: absolute; top: -10px; left: 16px;
  background: var(--accent); color: var(--accent-ink);
  font-size: 11px; font-weight: 700; letter-spacing: 0.02em;
  padding: 3px 10px; border-radius: 999px;
}
.tier-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.tier-ico {
  width: 38px; height: 38px; flex-shrink: 0;
  border-radius: 10px;
  background: rgba(46, 224, 224, 0.14); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.tier-ico svg { width: 20px; height: 20px; fill: currentColor; }
.tier-namn { display: block; font-weight: 800; font-size: 17px; color: var(--ink); }
.tier-rubrik { display: block; font-size: 12.5px; color: var(--ink-2); margin-top: 1px; }
.tier-for { font-size: 12.5px; font-weight: 600; color: var(--accent); margin-bottom: 8px; }
.tier-punkter { margin: 0; padding-left: 18px; }
.tier-punkter li { font-size: 13px; color: var(--ink-2); line-height: 1.5; margin-bottom: 4px; }
.tier-punkter li::marker { color: var(--accent); }
/* Rekommenderad nivå först på breda skärmar? Håll i ordning (Bra→Bäst). */
@media (min-width: 560px) { .tier-list { grid-template-columns: repeat(3, 1fr); align-items: stretch; } .tier-punkter li { font-size: 12px; } }

/* -- Paneler: ordlista & inloggning ---------------------------------------- */

.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 30, 45, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 120;
}
.sheet-overlay.center { align-items: center; padding: 24px; }
.sheet {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 760px;
  max-height: 82vh;
  overflow-y: auto;
  padding: 18px 18px calc(24px + env(safe-area-inset-bottom));
}
.sheet-overlay.center .sheet { border-radius: 20px; max-width: 400px; }
@media (min-width: 700px) {
  .sheet-overlay { align-items: center; padding: 24px; }
  .sheet { border-radius: 20px; }
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.sheet-head h2 { font-size: 18px; margin: 0; }

#glossary { margin: 0; }
#glossary .term { padding: 13px 0; border-top: 1px solid var(--hairline); margin: 0; }
#glossary .term:first-child { border-top: 0; }
#glossary dt { font-weight: 600; font-size: 14.5px; }
#glossary dd { margin: 4px 0 0; color: var(--ink-2); font-size: 14px; line-height: 1.55; }

.login-card {
  position: relative;
  text-align: center;
  padding: 30px 22px 24px;
  animation: cardIn 0.22s ease-out;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}
.login-close { position: absolute; top: 12px; right: 12px; }
.login-logo {
  width: 46px;
  height: auto;
  display: block;
  margin: 2px auto 12px;
  filter: drop-shadow(0 0 14px rgba(47, 224, 237, 0.35));
}
.login-card h2 { font-size: 20px; margin: 0 0 6px; }
.login-sub { color: var(--ink-2); font-size: 14px; line-height: 1.5; margin: 0 0 18px; }
.login-card input {
  text-align: center;
  font-size: 17px;
  letter-spacing: 0.1em;
  padding: 13px 14px;
  border-radius: 12px; /* samma rundning som Lås upp-knappen */
}
.login-error { color: var(--status-critical); font-size: 13px; margin: 10px 0 0; }
.login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 16px;
  border: 0;
  border-radius: 12px;
  padding: 14px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent-ink);
  cursor: pointer;
  background: linear-gradient(135deg, #2ee0e0 0%, #23c3cf 100%);
  box-shadow: 0 8px 22px rgba(46, 224, 224, 0.3);
  transition: transform 0.15s, filter 0.15s;
}
.login-btn:hover { transform: translateY(-1px); filter: brightness(1.06); }
.login-btn:active { transform: translateY(0); filter: brightness(0.94); }
.login-btn svg { width: 17px; height: 17px; fill: #051e2d; }
.shake { animation: shake 0.4s; border-color: var(--status-critical) !important; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

/* -- Våningar --------------------------------------------------------------- */

.floor-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 16px 0 8px;
}
.room-floor {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-muted);
  margin-left: 7px;
}

/* -- Rekommendationer ----------------------------------------------------- */

.reco-card { border-left: 3px solid var(--accent); }
.reco-card h3 { margin: 0 0 8px; font-size: 15px; }
.reco-card ul { margin: 0; padding-left: 20px; color: var(--ink-2); font-size: 14px; line-height: 1.55; }
.reco-card li { margin-bottom: 6px; }
.reco-card li::marker { color: var(--accent); }

/* -- Mätöverlägg ----------------------------------------------------------- */

.measure-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 30, 45, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}
.measure-card {
  width: 100%;
  max-width: 380px;
  text-align: center;
}
.measure-room { font-size: 19px; font-weight: 600; margin: 0; }
.measure-phase {
  color: var(--ink-muted);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 8px 0 10px;
  min-height: 16px;
}

/* Mätvy med live-graf: ned/upp som överlagrade areakurvor.
   Färgerna följer serien, aldrig tvärtom: ned = blå, upp = violett. */
.m-head {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 18px 0 4px;
}
.m-col { text-align: center; opacity: 0.45; transition: opacity 0.3s; }
.m-col.running, .m-col.done { opacity: 1; }
.m-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}
.m-label svg { width: 16px; height: 16px; }
.m-col[data-col="down"] .m-label svg { fill: var(--accent); }
.m-col[data-col="up"] .m-label svg { fill: #9085e9; }
.m-value {
  display: block;
  margin-top: 4px;
  font-size: 30px;
  font-weight: 250;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.m-value small {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
}
.m-lat {
  font-size: 12.5px;
  color: var(--ink-muted);
  margin: 10px 0 14px;
  font-variant-numeric: tabular-nums;
}

.m-chart {
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
  margin-bottom: 24px;
}
.m-chart svg { display: block; width: 100%; height: 130px; }

/* Gauge i mätvyn: 300°-båge med tickring och logaritmisk skala 0–1000+.
   Färgen följer fasen: blå nedladdning, violett uppladdning. */
.gauge-wrap {
  position: relative;
  max-width: 320px;
  margin: 6px auto 14px;
}
.gauge-wrap svg { display: block; width: 100%; }
#gaugeTicks .tick { stroke: rgba(255, 255, 255, 0.14); stroke-width: 1.5; }
#gaugeTicks .tick-major { stroke: rgba(255, 255, 255, 0.32); stroke-width: 2; }
#gaugeLabels text {
  fill: var(--ink-muted);
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
}
.gauge-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.09);
  stroke-width: 4;
  stroke-linecap: round;
}
.gauge-trail {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 460.8;   /* 300°-bågens längd, r = 88 */
  stroke-dashoffset: 460.8;
}
.gauge-dot {
  fill: #ffffff;
  filter: drop-shadow(0 0 6px rgba(120, 190, 255, 0.9));
}
.gauge-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: 6px;
  pointer-events: none;
}
.gauge-phase {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
  margin-bottom: 2px;
}
.gauge-num {
  font-size: 46px;
  font-weight: 200;
  letter-spacing: -0.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.gauge-unit {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-top: 2px;
}

/* -- Sammanfattning ---------------------------------------------------------- */

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.summary-tile {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 14px 10px;
  text-align: center;
}
.summary-tile .n { font-size: 26px; font-weight: 700; }
.summary-tile .t {
  font-size: 12px;
  color: var(--ink-2);
  margin-top: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.summary-tile .t i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* Diskret felruta */
.error-note {
  border: 1px solid rgba(208, 59, 59, 0.4);
  background: rgba(208, 59, 59, 0.08);
  color: var(--ink-2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.45;
  margin: 14px 0;
}

.footer-note {
  color: var(--ink-muted);
  font-size: 12.5px;
  text-align: center;
  margin-top: 32px;
  line-height: 1.5;
}

[hidden] { display: none !important; }
.print-only { display: none; }
.print-inline { display: none; }

/* -- Utskrift / PDF-rapport --------------------------------------------------
   Ljust tema med eget rapporthuvud och rapportfot. Interaktiva element och
   formulär döljs; statusfärger och märken skrivs ut med exakta färger.
   "Spara som PDF" i utskriftsdialogen ger kundrapporten.                    */

@media print {
  @page { margin: 13mm; }

  :root {
    --page: #ffffff;
    --surface: #ffffff;
    --surface-2: #f4f4f2;
    --ink: #0b0b0b;
    --ink-2: #52514e;
    --ink-muted: #898781;
    --hairline: #dddcd5;
    --accent: #1c5cab;
    --status-good: #006300; /* mörkare steg för ljus yta */
  }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body { background: #fff; }

  /* Dölj allt interaktivt och formulärartat */
  .topbar, .phase-toggle, .mode-toggle, .btn, .icon-btn, .room-actions,
  .chip-row, .measure-overlay, .sheet-overlay, .footer-note, .cta,
  #addRoomCard, .help-card h3, .help-card .lead-sub, .lead-grid { display: none !important; }

  /* Rapporthuvud och rapportfot */
  .print-only { display: block; }
  .print-head {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border-bottom: 2.5px solid #0d3b52;
    padding-bottom: 14px;
    margin-bottom: 18px;
  }
  /* Loggan är ljus (för mörk bakgrund) → mörk navy-bricka ger kontrast på papper,
     precis som webbsidans mörka header. */
  .ph-mark {
    width: 58px;
    height: 58px;
    border-radius: 15px;
    background: #0d3b52;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .ph-mark img { width: 42px; height: 42px; display: block; }
  .ph-name {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: #0d3b52;
    margin-top: 9px;
  }
  .ph-tagline {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #0f7d86;
    margin-top: 2px;
  }
  .ph-tag {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #898781;
    margin-top: 10px;
  }
  .print-foot {
    margin-top: 22px;
    padding-top: 10px;
    border-top: 1px solid #dddcd5;
    font-size: 10.5px;
    color: #898781;
    text-align: center;
  }

  /* Layout och typografi i rapporten */
  main { max-width: 100%; padding: 0; }
  h1 { font-size: 21px; margin-top: 0; }
  .subtitle { margin-bottom: 16px; }
  .card, .summary-tile { break-inside: avoid; border-color: #dddcd5; box-shadow: none; }
  .summary-tile .n { font-size: 22px; }
  .baseline-card { border-left: 3px solid #1c5cab; }
  .status-badge { border: 1px solid #dddcd5; }

  /* Abonnemangsraden: visa värdena som text, inte inmatningsfält */
  .sub-row input {
    border: 0;
    background: none;
    width: auto;
    max-width: 52px;
    padding: 0;
    font-weight: 700;
    text-align: center;
  }
  .stat .v input { border: 0; background: none; }

  /* Fas i rapportrubriken (pro) */
  .print-inline { display: inline; }

  /* Anslutningskortet i rapporten */
  .conn-line { border-color: #898781; }
  .conn-speeds .dn { color: #1c5cab; }
  .conn-speeds .up { color: #5b4bc4; }

  /* Före → efter-sammanfattningen */
  .print-summary { border-left: 3px solid #006300; }
  .print-summary h3 { margin: 0 0 8px; font-size: 15px; }
  .print-summary ul { margin: 0; padding-left: 20px; font-size: 13px; line-height: 1.6; }
  .print-summary li { margin-bottom: 4px; }
}
