:root {
  --bg: #0a0a0c;
  --bg-elevated: #131316;
  --card: #17171b;
  --border: rgba(255,255,255,0.08);
  --text: #e4e4e7;
  --muted: #8b8b93;
  --accent: #ff4433;
  --accent-soft: rgba(255,68,51,0.12);
  --link: #4db8ff;
  --link-hover: #7fcaff;
  --header-h: 64px;
  --sidebar-w: 280px;
  --content-max-w: 1200px;
  --content-pad-x: clamp(16px, 4vw, 40px);
  --radius: 10px;
  --shadow: 0 8px 24px rgba(0,0,0,0.35);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); }

img { max-width: 100%; display: block; }

/* Header */
header.site-header {
  height: var(--header-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(10,10,12,0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  width: 100%;
  max-width: var(--content-max-w);
  margin: 0 auto;
  padding: 0 var(--content-pad-x);
  display: flex;
  align-items: center;
  gap: 14px;
}

.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  width: 40px;
  height: 40px;
  font-size: 1.2rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: 14px;
}
.menu-toggle:hover { background: var(--bg-elevated); }

.site-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.site-title h1 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0;
  color: #fff;
  white-space: nowrap;
}
.site-title .subtitle {
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-icons {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.header-icons img { height: 22px; width: auto; border-radius: 3px; opacity: 0.9; }
.header-icons img.flag-icon { width: 39px; height: 22px; object-fit: cover; }
.nav-flag { width: 18px; height: 12px; object-fit: cover; border-radius: 2px; flex-shrink: 0; }
.header-icons img.dmr-icon { width: 31px; height: 22px; }

/* Layout */
.main-layout {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

nav.sidebar {
  width: 100%;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  padding: 0 10px;
  position: sticky;
  top: var(--header-h);
  z-index: 80;
}

.nav-section { position: relative; }

.nav-section-title {
  display: block;
  background: none;
  border: none;
  font-family: inherit;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 16px 12px;
  cursor: pointer;
  white-space: nowrap;
}
.nav-section-title:hover,
.nav-section.open .nav-section-title {
  color: var(--accent);
}

.nav-section-links {
  display: none;
  flex-direction: column;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 250px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 90;
}
.nav-section.open .nav-section-links { display: flex; }

.nav-section-links a {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.88rem;
  line-height: 1.3;
  white-space: nowrap;
}
.nav-section-links a:hover {
  background: var(--bg-elevated);
  color: #fff;
}
.nav-section-links a.active {
  background: var(--accent-soft);
  color: var(--accent);
}

main.content {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

.scroll-container {
  flex: 1;
  overflow-y: auto;
  width: 100%;
  max-width: var(--content-max-w);
  margin: 0 auto;
  padding: 28px var(--content-pad-x) 60px;
}

.iframe-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
  width: 100%;
  max-width: calc(var(--content-max-w) - 2 * var(--content-pad-x));
  margin: 0 auto;
}
.iframe-full {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
  display: block;
}

/* Cards / content */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.card h2 {
  color: var(--accent);
  margin: 0 0 10px;
  font-size: 1.3rem;
}
.card p { margin: 6px 0; color: var(--text); }
.card.hero {
  text-align: center;
  border-top: 3px solid var(--accent);
  background: linear-gradient(180deg, var(--card), #0d0d10);
}
.card.hero h2 {
  font-size: 1.5rem;
  font-weight: 800;
}

.section-title {
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin: 32px 0 16px;
  font-size: 1.05rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.section-title:first-child { margin-top: 0; }

.widget-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  align-items: stretch;
  margin-bottom: 20px;
}
.widget-row .card { margin-bottom: 0; }

.c4fm-map-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
/* Botón genérico reusado en varias páginas (paginadores, filtros, toggles) -
   no solo en el mapa WiresX pese al nombre de la regla original. */
.filter-btn {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 0.82rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.filter-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.filter-btn:disabled { opacity: 0.4; cursor: default; }
.c4fm-map-stat { color: var(--muted); font-size: 0.8rem; margin-left: auto; }

.c4fm-map-layout {
  display: flex;
  gap: 12px;
  height: 420px;
}
.c4fm-map-list {
  width: 240px;
  flex-shrink: 0;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.c4fm-rep-item {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.c4fm-rep-item:last-child { border-bottom: none; }
.c4fm-rep-item:hover { background: var(--bg-elevated); }
.c4fm-rep-item.c4fm-rep-active { background: var(--accent-soft); }
.c4fm-rep-call { font-weight: 700; font-size: 0.88rem; display: flex; align-items: center; gap: 6px; }
.c4fm-rep-meta { color: var(--muted); font-size: 0.76rem; margin-top: 2px; }
.c4fm-map-empty { padding: 12px; color: var(--muted); font-size: 0.85rem; }

.c4fm-map-canvas { position: relative; flex: 1; min-width: 0; border-radius: var(--radius); overflow: hidden; }
#c4fm-map { width: 100%; height: 100%; }
.c4fm-map-legend {
  position: absolute;
  bottom: 14px;
  left: 10px;
  z-index: 1000;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.78rem;
  display: flex;
  gap: 12px;
  color: var(--text);
}
.c4fm-map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.c4fm-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.c4fm-antenna-pin {
  width: 24px;
  height: 24px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 1px solid #1c1f26;
  box-shadow: 0 1px 4px rgba(0,0,0,.35);
  display: flex;
  align-items: center;
  justify-content: center;
}
.c4fm-antenna-pin::before {
  content: '📡';
  display: inline-block;
  transform: rotate(45deg);
  font-size: 12px;
  line-height: 1;
}
@media (max-width: 720px) {
  .c4fm-map-layout { flex-direction: column; height: auto; }
  .c4fm-map-list { width: auto; height: 160px; }
  .c4fm-map-canvas { height: 320px; }
}

.img-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.img-grid img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  cursor: zoom-in;
}

.photo-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.85);
  align-items: center;
  justify-content: center;
  padding: 30px;
}
.photo-modal.open { display: flex; }
.photo-modal img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.6);
}
.photo-modal-close {
  position: absolute;
  top: 16px;
  right: 24px;
  color: #fff;
  font-size: 36px;
  line-height: 1;
  cursor: pointer;
  background: none;
  border: none;
}

.qrz-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
}
.qrz-form input[type="text"] {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.25);
  background: var(--bg-elevated);
  color: #fff;
  text-transform: uppercase;
  font-size: 0.95rem;
  min-width: 140px;
}
.qrz-form input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
}
.qrz-form input[type="submit"] {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  font-size: 0.9rem;
}
.qrz-form input[type="submit"]:hover { filter: brightness(1.1); }
.utc-date { color: var(--muted); font-size: 1.1em; margin: 8px 0 12px; text-transform: capitalize; }

.flip-clock { display: flex; align-items: center; justify-content: center; gap: 4px; }
.flip-colon { font-size: 34px; font-weight: 700; color: #d9cdb0; align-self: center; padding-bottom: 4px; }

.flip-digit {
  position: relative;
  width: 40px;
  height: 58px;
  font-family: 'Courier New', monospace;
  font-size: 40px;
  font-weight: 700;
  perspective: 220px;
  overflow: hidden;
  border-radius: 6px;
}
.flip-digit > div { position: absolute; left: 0; right: 0; height: 50%; overflow: hidden; }
.flip-digit > div span {
  position: absolute;
  left: 0; right: 0;
  height: 58px;
  line-height: 58px;
  text-align: center;
  color: #ecdfc0;
}
.fc-top, .fc-flap-top { top: 0; border-radius: 6px 6px 0 0; }
.fc-top span, .fc-flap-top span { top: 0; }
.fc-bottom, .fc-flap-bottom { bottom: 0; border-radius: 0 0 6px 6px; }
.fc-bottom span, .fc-flap-bottom span { bottom: 0; }

.fc-top, .fc-bottom { background: #262421; }
.fc-top { box-shadow: inset 0 -1px 0 rgba(0,0,0,.5); }
.fc-bottom { box-shadow: inset 0 1px 0 rgba(255,255,255,.05); }

.fc-flap-top, .fc-flap-bottom {
  background: #302d29;
  backface-visibility: hidden;
  z-index: 2;
  visibility: hidden;
}
.flip-digit.flipping .fc-flap-top,
.flip-digit.flipping .fc-flap-bottom {
  visibility: visible;
}
.fc-flap-top { transform-origin: bottom; transform: rotateX(0deg); }
.fc-flap-bottom { transform-origin: top; transform: rotateX(90deg); }

.flip-digit.flipping .fc-flap-top { animation: fcFlapTop .3s ease-in forwards; }
.flip-digit.flipping .fc-flap-bottom { animation: fcFlapBottom .3s .3s ease-out forwards; }

@keyframes fcFlapTop { from { transform: rotateX(0deg); } to { transform: rotateX(-90deg); } }
@keyframes fcFlapBottom { from { transform: rotateX(90deg); } to { transform: rotateX(0deg); } }
.mdp-weather-group { margin-top: 28px; }
.mdp-weather { margin: 4px 0 0; font-size: 0.85rem; color: var(--muted); }

.dmr-activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dmr-activity-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-elevated);
  border-radius: 8px;
  font-size: 0.88rem;
}
.dmr-activity-list .dmr-tg {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.dmr-activity-list .dmr-time {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.78rem;
}
.dmr-activity-list .dmr-extra {
  color: var(--muted);
  font-size: 0.78rem;
}
.dmr-activity-list .dmr-duration {
  color: var(--link);
  font-size: 0.78rem;
  font-weight: 600;
}
.dmr-activity-list .dmr-loss {
  color: var(--accent);
  font-size: 0.78rem;
}
.dmr-flag {
  height: 11px;
  width: auto;
  border-radius: 2px;
  vertical-align: middle;
  display: inline-block;
}

.reflector-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
  margin-right: 6px;
}
.reflector-dot.is-online { background: #2ecc71; }
.reflector-dot.is-offline { background: #e74c3c; }
.reflector-gateways {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.reflector-gw {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.78rem;
  color: var(--muted);
}

.log-embed {
  margin-top: 30px;
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.log-embed .log-header {
  padding: 14px 18px;
  color: #111;
  font-weight: 700;
  border-bottom: 1px solid #eee;
}
.log-embed iframe {
  width: 100%;
  height: 500px;
  border: none;
  display: block;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
table.data-table th {
  text-align: left;
  padding: 10px;
  background: var(--bg-elevated);
  color: var(--accent);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
table.data-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
}
table.data-table tr:hover td { background: var(--bg-elevated); }

footer.site-footer {
  text-align: center;
  padding: 16px;
  color: var(--muted);
  font-size: 0.78rem;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
}

/* Overlay for mobile drawer */
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 90;
}
.nav-overlay.open { display: block; }

@media (max-width: 900px) {
  .menu-toggle { display: inline-flex; }
  .header-icons img:nth-child(n+4) { display: none; }

  nav.sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    bottom: 0;
    z-index: 95;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: var(--shadow);
    width: min(var(--sidebar-w), 82vw);
    flex-direction: column;
    flex-wrap: nowrap;
    overflow-y: auto;
    padding: 10px 10px 40px;
    border-bottom: none;
    border-right: 1px solid var(--border);
  }
  nav.sidebar.open { transform: translateX(0); }

  .nav-section-title { width: 100%; text-align: left; padding: 10px 8px; }

  .nav-section-links {
    position: static;
    min-width: 0;
    background: none;
    border: none;
    box-shadow: none;
    padding: 0 0 4px 12px;
  }

  .site-title .subtitle { display: none; }
}
