/* Fidalsa Holidays — light corporate theme
   Brand blues from fidalsaholidays.com logo: #005090 / lime accent #C0D000
*/
@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&family=Open+Sans:wght@400;500;600&display=swap");

:root {
  --bg-0: #ffffff;
  --bg-1: #f5f8fb;
  --bg-2: #eaf0f6;
  --bg-3: #dce6f0;
  --line: #d0dbe8;
  --text: #0a2744;
  --muted: #5a7190;
  --accent: #005090;
  --accent-dim: #003d6b;
  --accent-bright: #1a6bb8;
  --lime: #c0d000;
  --warn: #c47d16;
  --danger: #c0392b;
  --ok: #1a8f5c;
  --radius: 10px;
  --font: "Open Sans", "Segoe UI", "Helvetica Neue", sans-serif;
  --display: "Montserrat", "Open Sans", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --shadow: 0 8px 28px rgba(10, 39, 68, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg-1);
  color: var(--text);
  font-family: var(--font);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--accent-bright); }

.shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
  background: var(--bg-1);
}

.rail {
  background: var(--bg-0);
  border-right: 1px solid var(--line);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.brand { display: flex; align-items: center; gap: 0.75rem; }
.brand-logo {
  display: block;
  height: 42px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
}
.brand-logo.lg { height: 56px; max-width: 220px; }
.brand-mark {
  display: none; /* replaced by logo image */
}
.brand-text {
  font-family: var(--display);
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.01em;
}
.brand-sub { color: var(--muted); font-size: 0.75rem; }

.nav { display: flex; flex-direction: column; gap: 0.35rem; }
.nav-link {
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}
.nav-link:hover { background: var(--bg-2); text-decoration: none; }
.nav-link.active {
  background: rgba(0, 80, 144, 0.08);
  border: 1px solid rgba(0, 80, 144, 0.2);
  color: var(--accent);
}
.nav-link.muted { color: var(--muted); font-size: 0.92rem; }

.rail-foot {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
}

.meta { color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.7rem; }
.mono { font-family: var(--mono); word-break: break-all; }
.small { font-size: 0.82rem; }

.main { display: flex; flex-direction: column; min-width: 0; background: var(--bg-1); }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
}
.eyebrow {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.68rem;
  margin-bottom: 0.2rem;
  font-weight: 600;
}
.topbar h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent-dim);
}
.topbar-actions { display: flex; align-items: center; gap: 0.75rem; }
.user { color: var(--muted); font-size: 0.92rem; }

.content { padding: 1.35rem 1.5rem 2rem; }

.grid.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.15rem;
}

.stat, .panel {
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}
.stat.ok { border-color: rgba(26, 143, 92, 0.35); }
.stat.warn { border-color: rgba(196, 125, 22, 0.4); }
.stat.bad { border-color: rgba(192, 57, 43, 0.4); }
.stat-label { color: var(--muted); font-size: 0.8rem; margin-bottom: 0.3rem; }
.stat-value {
  font-family: var(--display);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent-dim);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.panel h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--accent-dim);
}
.muted { color: var(--muted); }

.layout-2 {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 1rem;
  align-items: stretch;
}
.stack-panels { display: flex; flex-direction: column; gap: 1rem; }

.map-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-bottom: 0.75rem;
}
.map-panel .panel-head { flex-shrink: 0; }
.map {
  flex: 1 1 auto;
  width: 100%;
  min-height: 420px;
  height: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  position: relative;
  z-index: 0;
}

.health-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}
.health-card {
  text-align: center;
  padding: 0.85rem 0.5rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-1);
}
.health-card.ok { box-shadow: inset 0 0 0 1px rgba(26, 143, 92, 0.25); }
.health-card.warn { box-shadow: inset 0 0 0 1px rgba(196, 125, 22, 0.3); }
.health-card.bad { box-shadow: inset 0 0 0 1px rgba(192, 57, 43, 0.3); }
.health-n { font-size: 1.5rem; font-weight: 700; font-family: var(--display); color: var(--accent); }
.health-l { color: var(--muted); font-size: 0.78rem; margin-top: 0.15rem; }

.table-wrap { overflow: auto; max-height: 420px; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.table th, .table td {
  text-align: left;
  padding: 0.55rem 0.45rem;
  border-bottom: 1px solid var(--line);
}
.table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: sticky;
  top: 0;
  background: var(--bg-1);
}
.table.compact td, .table.compact th { padding: 0.4rem 0.35rem; }

.pill {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  border: 1px solid var(--line);
  text-transform: lowercase;
  font-weight: 600;
}
.pill.ok { color: var(--ok); border-color: rgba(26, 143, 92, 0.4); background: rgba(26, 143, 92, 0.08); }
.pill.warn, .pill.warning { color: var(--warn); border-color: rgba(196, 125, 22, 0.4); background: rgba(196, 125, 22, 0.08); }
.pill.bad, .pill.offline, .pill.critical { color: var(--danger); border-color: rgba(192, 57, 43, 0.4); background: rgba(192, 57, 43, 0.08); }
.pill.muted, .pill.pending, .pill.info, .pill.unknown {
  color: var(--muted);
  background: rgba(90, 113, 144, 0.08);
}
.pill.iot { color: var(--accent-bright); border-color: rgba(26, 107, 184, 0.35); background: rgba(26, 107, 184, 0.08); }
.pill.guest { color: var(--ok); border-color: rgba(26, 143, 92, 0.3); background: rgba(26, 143, 92, 0.08); }

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg-0);
  color: var(--text);
  border-radius: 4px;
  padding: 0.55rem 0.95rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-dim);
  border-color: var(--accent-dim);
  color: #fff;
}
.btn-ghost { background: transparent; }
.inline { display: inline; margin: 0; }

.auth-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 1.5rem;
  background:
    linear-gradient(180deg, rgba(0, 80, 144, 0.06), transparent 40%),
    var(--bg-1);
}
.auth-panel {
  width: min(440px, 100%);
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.85rem;
  box-shadow: var(--shadow);
}
.auth-panel-wide { width: min(480px, 100%); }
.auth-brand { margin-bottom: 1.25rem; text-align: center; }
.auth-brand .brand-logo { margin: 0 auto 0.75rem; }
.auth-brand h1 {
  margin: 0.5rem 0 0.4rem;
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent-dim);
}
.auth-foot { margin: 1.1rem 0 0; font-size: 0.8rem; text-align: center; }
.auth-foot a { color: var(--accent); font-weight: 600; }

.stack { display: flex; flex-direction: column; gap: 0.9rem; }
label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.9rem; color: var(--muted); font-weight: 500; }

input[type="email"],
input[type="password"],
input[type="text"] {
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text);
  padding: 0.7rem 0.8rem;
  font: inherit;
}
input:focus {
  outline: 2px solid rgba(0, 80, 144, 0.25);
  border-color: var(--accent);
}

.alert {
  padding: 0.7rem 0.85rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.92rem;
}
.alert-error {
  background: rgba(192, 57, 43, 0.08);
  border: 1px solid rgba(192, 57, 43, 0.35);
  color: var(--danger);
}

.crumb { margin: 0 0 1rem; font-size: 0.92rem; }

.topo { text-align: center; padding: 0.5rem 0 0.25rem; }
.topo-node {
  display: inline-block;
  min-width: 180px;
  padding: 0.65rem 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-1);
  margin: 0.15rem 0;
}
.topo-node.accent {
  border-color: rgba(0, 80, 144, 0.4);
  background: rgba(0, 80, 144, 0.06);
  color: var(--accent-dim);
  font-weight: 600;
}
.topo-arrow { color: var(--muted); margin: 0.15rem 0; }
.topo-branches {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.topo-branches .topo-node { min-width: 0; width: 100%; font-size: 0.85rem; }
.topo-node.guest { border-color: rgba(26, 143, 92, 0.35); }
.topo-node.iot { border-color: rgba(26, 107, 184, 0.35); }
.topo-node.mgmt { border-color: rgba(196, 125, 22, 0.35); }

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
}
.metric {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.75rem;
}
.metric-v { font-size: 1.15rem; font-weight: 700; font-family: var(--display); color: var(--accent); }

.kv {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 0.35rem 0.75rem;
  margin: 0;
}
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

code {
  font-family: var(--mono);
  background: var(--bg-2);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.9em;
}

.leaflet-container {
  width: 100%;
  height: 100%;
  background: #e8eef5;
  font: inherit;
  color: var(--text);
}
.leaflet-container:focus { outline: none; }

/* ——— Guest portal (mobile-first) ——— */
.guest-body {
  min-height: 100vh;
  padding: 0;
  background: var(--bg-1);
}
.guest-shell {
  width: min(440px, 100%);
  margin: 0 auto;
  padding: 1.15rem 1rem 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.guest-hero {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.15rem 1.2rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-0);
  box-shadow: var(--shadow);
}
.guest-kicker {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}
.guest-welcome {
  margin: 0;
  font-family: var(--display);
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--accent-dim);
}
.guest-welcome span { color: var(--accent); }
.guest-landing { padding-top: 2.5rem; }
.guest-wifi-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: center;
}
.guest-wifi-qr img {
  display: block;
  border-radius: 12px;
  background: #fff;
  padding: 0.4rem;
  border: 1px solid var(--line);
}
.guest-wifi-creds { display: flex; flex-direction: column; gap: 0.65rem; }
.guest-wifi-row { display: flex; flex-direction: column; gap: 0.15rem; }
.guest-psk { user-select: all; color: var(--accent-dim); }
.badge-blocked {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--danger);
  border: 1px solid rgba(192, 57, 43, 0.4);
  background: rgba(192, 57, 43, 0.08);
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
  flex-shrink: 0;
}
.guest-brand-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0 0.25rem;
}
.guest-brand-bar .brand-logo { height: 40px; }
@media (max-width: 420px) {
  .guest-wifi-grid { grid-template-columns: 1fr; justify-items: center; text-align: center; }
}
.guest-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.75rem;
  align-items: center;
}
.guest-sync {
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  width: fit-content;
  font-weight: 600;
}
.guest-sync.ok {
  color: var(--ok);
  border-color: rgba(26, 143, 92, 0.4);
  background: rgba(26, 143, 92, 0.08);
}
.guest-sync.pending {
  color: var(--warn);
  border-color: rgba(196, 125, 22, 0.45);
  background: rgba(196, 125, 22, 0.08);
}
.guest-status-card {
  display: grid;
  grid-template-columns: 1.6fr 0.8fr;
  gap: 0.75rem;
  padding: 1rem 1.1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-0);
  box-shadow: var(--shadow);
}
.guest-status-label { color: var(--muted); font-size: 0.78rem; margin-bottom: 0.25rem; font-weight: 600; }
.guest-status-value { font-size: 1.45rem; font-weight: 700; font-family: var(--display); }
.guest-status-value.on { color: var(--ok); }
.guest-status-value.off { color: var(--danger); }
.guest-panel {
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.05rem;
  box-shadow: var(--shadow);
}
.guest-toggles { display: flex; flex-direction: column; gap: 0.55rem; }
.guest-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0;
  padding: 0.75rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-1);
}
.guest-toggle.locked { opacity: 0.85; }
.guest-toggle-label { font-weight: 700; font-size: 0.95rem; color: var(--accent-dim); }
.switch {
  position: relative;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-3);
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
}
.switch.on {
  background: var(--accent);
  border-color: var(--accent);
}
.switch:disabled { cursor: not-allowed; opacity: 0.85; }
.switch-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.18s ease;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.switch.on .switch-knob { transform: translateX(20px); }
.guest-device-list { display: flex; flex-direction: column; gap: 0.75rem; }
.guest-device {
  padding: 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-1);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.guest-rename {
  display: flex;
  gap: 0.5rem;
  margin: 0;
}
.guest-rename input {
  flex: 1;
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text);
  padding: 0.55rem 0.7rem;
  font: inherit;
}
.guest-device-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.guest-device-toggles form { margin: 0; }
.chip {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg-0);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.chip.on {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}
.guest-foot { text-align: center; padding: 0.25rem 0.5rem; }
.btn.small { padding: 0.4rem 0.7rem; font-size: 0.85rem; }

@media (max-width: 1100px) {
  .grid.stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .layout-2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .rail { border-right: 0; border-bottom: 1px solid var(--line); }
  .topo-branches { grid-template-columns: 1fr; }
}
