/* ============================================================
   MÁSWIFI — Sistema de diseño premium para paneles
   (cliente / administrador / técnico)
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,300;9..144,400;9..144,500&family=Inter:wght@300;400;500;600;700&family=Montserrat:wght@400;500;600&display=swap');

:root {
  --white: #ffffff;
  --ink: #0a0a0a;
  --ink-soft: #414141;
  --ink-mute: #8f8f8f;
  --line: rgba(10, 10, 10, 0.045);
  --line-strong: rgba(10, 10, 10, 0.1);

  --bg: #fbfbfa;
  --bg-grad: radial-gradient(1200px 700px at 100% -10%, rgba(10, 10, 10, 0.016), transparent 55%),
             radial-gradient(900px 600px at -10% 110%, rgba(10, 10, 10, 0.01), transparent 55%);
  --card: #ffffff;

  --ok: #167b3d;
  --ok-bg: #e8f4ec;
  --warn: #96630a;
  --warn-bg: #fbf1d9;
  --danger: #b32017;
  --danger-bg: #fceae8;
  --info: #0a5bab;
  --info-bg: #e8f0fb;
  --neutral: #5c5c5c;
  --neutral-bg: #efefec;

  --radius: 20px;
  --radius-sm: 13px;
  --radius-xs: 9px;

  --shadow-xs: none;
  --shadow-sm: none;
  --shadow: none;
  --shadow-lg: none;
  --sidebar-w: 268px;

  --serif: 'Fraunces', serif;
  --sans: 'Inter', sans-serif;
  --brand: 'Montserrat', sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--sans);
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-size: 14.5px;
}

a { color: inherit; }
button { font-family: inherit; }
.serif { font-family: var(--serif); font-weight: 300; }
::selection { background: var(--ink); color: #fff; }

/* ─────────────── LAYOUT ─────────────── */
.app { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: linear-gradient(185deg, #141414 0%, #0a0a0a 55%, #050505 100%);
  color: var(--white);
  display: flex;
  flex-direction: column;
  z-index: 60;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  transition: transform 0.42s var(--ease);
}
.sidebar::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(420px 260px at 90% 0%, rgba(255, 255, 255, 0.06), transparent 65%);
  pointer-events: none;
}

.sidebar-brand {
  font-family: var(--brand);
  font-size: 17px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--white);
  text-decoration: none;
  padding: 28px 22px 18px;
  display: flex;
  align-items: baseline;
  gap: 2px;
  position: relative; z-index: 1;
}
.sidebar-brand sup { font-size: 8.5px; letter-spacing: 0.14em; opacity: 0.55; }
.sidebar-brand span.role {
  margin-left: auto;
  font-family: var(--sans);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  opacity: 0.5;
  text-transform: uppercase;
}

.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 14px 20px; position: relative; z-index: 1; }
.sidebar-nav::-webkit-scrollbar { width: 0; }

.nav-group-label {
  font-size: 9.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.33);
  padding: 20px 12px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.64);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background 0.22s var(--ease), color 0.22s var(--ease), transform 0.22s var(--ease);
  margin-bottom: 3px;
  position: relative;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; stroke-width: 1.7; }
.nav-item:hover { background: rgba(255, 255, 255, 0.07); color: var(--white); }
.nav-item.active {
  background: var(--white);
  color: var(--ink);
}
.nav-item .nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 100px;
  min-width: 18px;
  text-align: center;
}
.nav-item.active .nav-badge { background: var(--ink); color: #fff; }

.sidebar-foot {
  padding: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  position: relative; z-index: 1;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
}
.sidebar-user .avatar { width: 34px; height: 34px; font-size: 12px; background: #fff; color: var(--ink); }
.sidebar-user-info { overflow: hidden; }
.sidebar-user-name { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-mail { font-size: 11px; color: rgba(255, 255, 255, 0.45); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.appbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(251, 251, 250, 0.82);
  backdrop-filter: blur(18px) saturate(170%);
  -webkit-backdrop-filter: blur(18px) saturate(170%);
  border-bottom: 1px solid var(--line);
  padding: 15px 32px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.appbar h1 { font-size: 18px; font-weight: 600; letter-spacing: -0.015em; }
.appbar .sub { font-size: 12.5px; color: var(--ink-mute); font-weight: 400; }
.appbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.menu-toggle {
  display: none;
  width: 40px; height: 40px;
  border: 1px solid var(--line-strong);
  background: var(--card);
  border-radius: var(--radius-sm);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}
.menu-toggle:active { transform: scale(0.96); }
.menu-toggle svg { width: 18px; height: 18px; }

.content { padding: 30px 32px 70px; flex: 1; animation: fadeUp 0.4s var(--ease); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ─────────────── COMPONENTES ─────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}

.card-pad { padding: 24px 26px; }

.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}
.card-head h3 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.card-head .sub { font-size: 12px; color: var(--ink-mute); }
.card-head .head-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

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

.section-title-sm {
  font-size: 10.5px;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 12px;
  font-weight: 600;
}

/* Stat cards */
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow-xs);
  position: relative;
  overflow: hidden;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s var(--ease);
}
.stat::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(10, 10, 10, 0.06), transparent);
}
.stat:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); border-color: var(--line-strong); }
.stat .stat-label { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-mute); font-weight: 600; }
.stat .stat-value { font-family: var(--serif); font-size: 34px; font-weight: 400; letter-spacing: -0.025em; margin-top: 10px; line-height: 1; display: flex; align-items: center; gap: 8px; }
.stat .stat-foot { font-size: 12px; color: var(--ink-mute); margin-top: 12px; display: flex; align-items: center; gap: 6px; }
.stat .stat-icon {
  position: absolute; top: 20px; right: 20px;
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--neutral-bg); color: var(--ink-soft);
}
.stat .stat-icon svg { width: 19px; height: 19px; stroke-width: 1.7; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.005em;
  border-radius: 100px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s var(--ease), background 0.2s, border-color 0.2s, box-shadow 0.2s, color 0.2s;
  white-space: nowrap;
  background: none;
  color: var(--ink);
}
.btn svg { width: 15px; height: 15px; stroke-width: 1.9; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--ink); color: var(--white); }
.btn-primary:hover { background: #232323; }
.btn-ghost { background: var(--card); border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #961a12; }
.btn-ok { background: var(--ok); color: #fff; }
.btn-ok:hover { background: #136a34; }
.btn-sm { padding: 7px 13px; font-size: 12px; }
.btn-sm svg { width: 13px; height: 13px; }
.btn-icon { padding: 9px; border-radius: 11px; }
.btn-block { width: 100%; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 11px;
  border-radius: 100px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.no-dot::before { display: none; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-neutral { background: var(--neutral-bg); color: var(--neutral); }

/* Tables */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th {
  text-align: left;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 600;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.tbl td {
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl tbody tr { transition: background 0.18s; }
table.tbl tbody tr:hover { background: rgba(10, 10, 10, 0.016); }
table.tbl .cell-main { font-weight: 600; }
table.tbl .cell-sub { font-size: 12px; color: var(--ink-mute); }
table.tbl .cell-actions { display: flex; gap: 6px; justify-content: flex-end; }
.tbl-num { font-variant-numeric: tabular-nums; text-align: right; }

.empty {
  text-align: center;
  padding: 52px 20px;
  color: var(--ink-mute);
}
.empty svg { width: 34px; height: 34px; opacity: 0.35; margin-bottom: 12px; }
.empty p { font-size: 13.5px; }

/* Forms */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 7px;
}
.input, .select, .textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--white);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input::placeholder, .textarea::placeholder { color: #b4b4b4; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--ink);
  outline: 3px solid rgba(10, 10, 10, 0.07);
  outline-offset: 1px;
}
.textarea { resize: vertical; min-height: 100px; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238f8f8f' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; padding-right: 36px; cursor: pointer; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-hint { font-size: 11.5px; color: var(--ink-mute); margin-top: 6px; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(10, 10, 10, 0.38);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s var(--ease);
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--white);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  transform: translateY(16px) scale(0.985);
  transition: transform 0.3s var(--ease);
  margin: auto;
  overflow: hidden;
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal.modal-lg { max-width: 780px; }
.modal-head {
  display: flex; align-items: center; gap: 12px;
  padding: 22px 26px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.modal-head .sub { font-size: 12px; color: var(--ink-mute); }
.modal-head .close {
  margin-left: auto;
  width: 34px; height: 34px;
  border: none; background: var(--neutral-bg);
  border-radius: 10px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-soft);
  transition: background 0.2s;
}
.modal-head .close:hover { background: var(--line-strong); }
.modal-head .close svg { width: 15px; height: 15px; }
.modal-body { padding: 26px; max-height: calc(100vh - 220px); overflow-y: auto; }
.modal-foot {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 18px 26px;
  border-top: 1px solid var(--line);
  background: #fbfbfa;
}

/* Toast */
.toast-wrap {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 200; display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: var(--ink);
  color: #fff;
  padding: 13px 19px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px;
  animation: toastIn 0.32s var(--ease);
  max-width: 360px;
}
.toast svg { width: 16px; height: 16px; flex-shrink: 0; }
.toast.ok svg { color: #6ee7a0; }
.toast.err svg { color: #ff8a80; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }

/* Avatar */
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--ink); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px; flex-shrink: 0;
  letter-spacing: 0.02em;
}

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 24px; flex-wrap: wrap; }
.tab {
  padding: 11px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-mute);
  background: none; border: none; cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.2s, border-color 0.2s;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--ink); }

/* Chips */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 7px 14px; border-radius: 100px;
  border: 1px solid var(--line-strong);
  background: var(--white);
  font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: all 0.2s var(--ease); color: var(--ink-soft);
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* List rows */
.list-row {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.list-row:last-child { border-bottom: none; }
.list-row .lr-main { flex: 1; min-width: 0; }
.list-row .lr-title { font-weight: 600; font-size: 14px; }
.list-row .lr-sub { font-size: 12.5px; color: var(--ink-mute); }

/* ─────────────── CUADRÍCULAS (TILES) ─────────────── */
.tiles { display: grid; gap: 12px; }
.tiles-2 { grid-template-columns: repeat(2, 1fr); }
.tiles-3 { grid-template-columns: repeat(3, 1fr); }
.tiles-4 { grid-template-columns: repeat(4, 1fr); }
.tiles-auto { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.tiles-auto-sm { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }

.tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 17px 18px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.tile-label {
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 600;
}
.tile-value { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; }
.tile-value.lg { font-family: var(--serif); font-size: 27px; font-weight: 400; letter-spacing: -0.025em; }
.tile-value.xl { font-family: var(--serif); font-size: 34px; font-weight: 400; letter-spacing: -0.03em; line-height: 1; }
.tile-foot { font-size: 11.5px; color: var(--ink-mute); margin-top: auto; }
.tile-mono { font-variant-numeric: tabular-nums; }

.tile-action {
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: var(--ink);
  align-items: flex-start;
}
.tile-action:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.tile-action .tile-ico {
  width: 34px; height: 34px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--neutral-bg); color: var(--ink);
}
.tile-action .tile-ico svg { width: 17px; height: 17px; }
.tile-action.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.tile-action.primary .tile-ico { background: rgba(255,255,255,0.14); color: #fff; }
.tile-action.primary .tile-foot { color: rgba(255,255,255,0.6); }

.tile-clickable { cursor: pointer; }
.tile-clickable:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.tile-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tile-head .tile-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-head .badge { flex-shrink: 0; }
.tile-label.mono { letter-spacing: 0.03em; }
.tile-actions { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }

/* ─────────────── TEST DE VELOCIDAD ─────────────── */
.speedtest { display: grid; grid-template-columns: 210px 1fr; gap: 30px; align-items: center; }
.speed-ring { position: relative; width: 200px; height: 200px; margin: 0 auto; }
.speed-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.speed-track { fill: none; stroke: var(--neutral-bg); stroke-width: 12; }
.speed-progress {
  fill: none; stroke: var(--ink); stroke-width: 12; stroke-linecap: round;
  transition: stroke-dashoffset 0.35s linear, stroke 0.35s ease;
}
.speed-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
}
.speed-value { font-family: var(--serif); font-size: 46px; font-weight: 400; letter-spacing: -0.03em; line-height: 1; }
.speed-unit { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-mute); margin-top: 4px; }
.speed-phase { font-size: 11.5px; color: var(--ink-mute); margin-top: 9px; max-width: 150px; line-height: 1.3; }
.speed-side { display: flex; flex-direction: column; gap: 14px; }
.speed-side .tile-value { font-size: 20px; }

/* Progress */
.progress { height: 7px; background: var(--neutral-bg); border-radius: 100px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--ink); border-radius: 100px; transition: width 0.6s var(--ease); }

/* Misc */
.muted { color: var(--ink-mute); }
.small { font-size: 12px; }
.mono { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.flex { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-1 { gap: 8px; } .gap-2 { gap: 14px; } .gap-3 { gap: 20px; }
.wrap { flex-wrap: wrap; }
.hidden { display: none !important; }

.divider { height: 1px; background: var(--line); margin: 22px 0; }

.kv { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--ink-mute); }
.kv .v { font-weight: 600; text-align: right; }

.alert {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 15px 17px; border-radius: var(--radius-sm);
  font-size: 13px;
  border: 1px solid transparent;
}
.alert svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px; }
.alert-info { background: var(--info-bg); color: #0a4c8f; }
.alert-warn { background: var(--warn-bg); color: #7a5200; }
.alert-danger { background: var(--danger-bg); color: #8f1c13; }
.alert-ok { background: var(--ok-bg); color: #146c2e; }

/* ─────────────── MENÚ INFERIOR (MÓVIL) ─────────────── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 70;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border-top: 1px solid var(--line);
}

.bnav-inner { display: flex; align-items: stretch; justify-content: space-around; gap: 2px; }

.bnav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 2px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink-mute);
  text-decoration: none;
  border: none;
  background: none;
  cursor: pointer;
  transition: color 0.2s var(--ease);
  min-width: 0;
}
.bnav-ico {
  display: flex; align-items: center; justify-content: center;
  width: 48px; height: 30px;
  border-radius: 100px;
  transition: background 0.28s var(--ease), color 0.28s var(--ease);
}
.bnav-ico svg { width: 21px; height: 21px; stroke-width: 1.8; }
.bnav-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.bnav-item.active { color: var(--ink); }
.bnav-item.active .bnav-ico { background: var(--ink); color: #fff; }
.bnav-item:active .bnav-ico { transform: scale(0.94); }
.bnav-item .bnav-badge {
  position: absolute; top: 2px; right: 50%;
  transform: translateX(22px);
  background: var(--danger); color: #fff;
  font-size: 9px; font-weight: 700;
  min-width: 16px; height: 16px;
  border-radius: 100px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
  border: 2px solid rgba(255, 255, 255, 0.9);
}
.bnav-item { position: relative; }

/* ─────────────── MENÚ EXPANDIBLE HACIA ARRIBA (MÓVIL) ─────────────── */
.menu-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(10, 10, 10, 0.34);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 68;
}
.menu-backdrop.open { display: block; }

.bottom-menu {
  display: none;
  position: fixed;
  left: 12px; right: 12px;
  bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  z-index: 69;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 10px;
  max-height: calc(100vh - 190px);
  overflow-y: auto;
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  transform-origin: bottom center;
  pointer-events: none;
  transition: opacity 0.26s var(--ease), transform 0.26s var(--ease);
}
.bottom-menu.open { opacity: 1; transform: none; pointer-events: auto; }

.bm-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 13px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  cursor: pointer;
  text-align: left;
  transition: background 0.18s var(--ease);
}
.bm-item svg { width: 18px; height: 18px; flex-shrink: 0; stroke-width: 1.8; }
.bm-item:hover { background: var(--neutral-bg); }
.bm-item.active { background: var(--ink); color: #fff; }
.bm-item .nav-badge { margin-left: auto; background: var(--danger); color: #fff; font-size: 10px; font-weight: 600; padding: 1px 7px; border-radius: 100px; }
.bm-item.active .nav-badge { background: #fff; color: var(--ink); }

/* ─────────────── LOGIN ─────────────── */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
}
.auth-side {
  background: linear-gradient(185deg, #141414, #050505);
  color: #fff;
  padding: 48px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.auth-side::before {
  content: '';
  position: absolute;
  width: 560px; height: 560px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.07), transparent 65%);
  top: -140px; right: -180px;
}
.auth-side .auth-brand {
  font-family: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 20px;
  position: relative;
}
.auth-side .auth-brand sup { font-size: 9px; opacity: 0.6; }
.auth-side-inner { margin: auto 0; max-width: 420px; position: relative; }
.auth-side h1 { font-family: var(--serif); font-weight: 300; font-size: clamp(32px, 3.6vw, 48px); letter-spacing: -0.03em; line-height: 1.04; }
.auth-side p { color: rgba(255,255,255,0.6); margin-top: 18px; font-size: 15px; line-height: 1.6; }
.auth-side .auth-points { margin-top: 32px; display: flex; flex-direction: column; gap: 15px; }
.auth-point { display: flex; gap: 12px; align-items: center; font-size: 14px; color: rgba(255,255,255,0.8); }
.auth-point svg { width: 18px; height: 18px; flex-shrink: 0; color: #6ee7a0; }
.auth-foot { font-size: 12px; color: rgba(255,255,255,0.38); margin-top: auto; position: relative; }

.auth-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background: var(--white);
}
.auth-card { width: 100%; max-width: 400px; animation: fadeUp 0.5s var(--ease); }
.auth-card h2 { font-size: 27px; font-weight: 600; letter-spacing: -0.025em; }
.auth-card .auth-sub { color: var(--ink-mute); margin-top: 6px; margin-bottom: 30px; font-size: 14px; }
.auth-demo {
  margin-top: 24px;
  padding: 15px 17px;
  background: var(--bg);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--ink-soft);
}
.auth-demo strong { font-weight: 600; }
.auth-demo button {
  border: none; background: none; color: var(--info);
  font-weight: 600; cursor: pointer; font-size: 12.5px; padding: 0;
  text-decoration: underline;
}

.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(2px);
  z-index: 55;
}

/* ─────────────── RESPONSIVE ─────────────── */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .tiles-4 { grid-template-columns: repeat(2, 1fr); }
  .tiles-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .sidebar { transform: translateX(-102%); width: min(84vw, 320px); border-radius: 0 24px 24px 0; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.open { display: block; }
  .main { margin-left: 0; }
  .menu-toggle { display: none; }
  .content { padding: 20px 18px 104px; }
  .appbar { padding: 12px 16px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .tiles-3, .tiles-4 { grid-template-columns: repeat(2, 1fr); }
  .tiles-auto { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .speedtest { grid-template-columns: 1fr; gap: 22px; }
  .span-2 { grid-column: auto; }
  .field-row { grid-template-columns: 1fr; }
  .stat { padding: 18px 20px; }
  .stat .stat-value { font-size: 28px; }
  .card-pad { padding: 18px 20px; }
  .card-head { padding: 16px 18px; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .appbar h1 { font-size: 16px; }
  .appbar .sub { display: none; }
  .bottom-nav { display: block; }
  .bottom-menu { display: block; }
  .modal { border-radius: 22px 22px 0 0; margin-top: auto; margin-bottom: 0; }
  .modal-overlay { padding: 24px 10px 0; align-items: flex-end; }
  .modal-head { padding: 18px 20px; }
  .modal-body { padding: 20px; }
  .modal-foot { padding: 15px 20px calc(15px + env(safe-area-inset-bottom, 0px)); flex-wrap: wrap; }
  .modal-foot .btn { flex: 1; }
  .toast-wrap { bottom: 92px; left: 16px; right: 16px; }
  .toast { max-width: none; }
}

@media (max-width: 420px) {
  .bnav-item span { font-size: 9px; }
  .bnav-ico { width: 44px; height: 28px; }
}

@media print {
  .sidebar, .appbar, .no-print, .dock, .bottom-nav { display: none !important; }
  .main { margin-left: 0; }
  body { background: #fff; }
}
