/* =========================================================
   VK2FR - Live Dashboard (style.css)
   Theme: gunmetal / white / lime accents
========================================================= */

/* -------------------------
   Base + Theme Tokens
------------------------- */
:root{
  --bg: #0f1418;
  --surface: #151c22;
  --surface-2: #1a232b;
  --border: rgba(255,255,255,.08);

  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.62);

  --lime: #a6ff3b;
  --lime-2: #73ff1a;
  --danger: #ff4d4d;
  --warn: #ffcc66;

  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --radius: 18px;

  --max: 1180px;
  --gap: 16px;

  --font: "Roboto", system-ui, -apple-system, Segoe UI, Arial, sans-serif;

  /* Vars used by modal/pills */
  --card: var(--surface);
  --accent: var(--lime);
  --pill-bg: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  --pill-text: rgba(255,255,255,.90);
}

/* Light mode if theme-dark removed */
:root:not(.theme-dark){
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #f1f4f8;
  --border: rgba(16,24,32,.10);

  --text: rgba(16,24,32,.92);
  --muted: rgba(16,24,32,.62);

  --shadow: 0 10px 24px rgba(16,24,32,.10);

  --pill-text: rgba(16,24,32,.92);
  --card: #ffffff;
}

/* -------------------------
   Global
------------------------- */
*{ box-sizing: border-box; }
html,body{ height:100%; }

body{
  margin:0;
  font-family: var(--font);
  background:
    radial-gradient(1200px 700px at 20% -10%, rgba(166,255,59,.10), transparent 55%),
    radial-gradient(900px 600px at 95% 0%, rgba(59,130,246,.10), transparent 60%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img{ max-width:100%; display:block; }
a{ color: inherit; text-decoration: none; }
a:hover{ text-decoration: none; }
button, input{ font-family: var(--font); }

.muted{ color: var(--muted); }
.small{ font-size: 12px; }

/* =========================================================
   HEADER (single clean system)
   - Logo left, pills right
   - No negative margins
========================================================= */
.dashboard-header{
  max-width: var(--max);
  margin: 18px auto 10px;
  padding: 0 14px;
}

.dashboard-header > .brand,
.dashboard-header > .header-actions{
  display: inline-flex;
  vertical-align: top;
}

.brand{
  display:flex;
  align-items:center;
  gap: 10px;
}

.brand-logo{
  height: 110px;       /* <-- MAIN CONTROL: 90 / 110 / 130 */
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,.25));
}

/* Put actions on the right */
.header-actions{
  float: right;
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:flex-end;
  flex-wrap:wrap;
  margin-top: 8px;
}

/* Clear float */
.dashboard-header::after{
  content:"";
  display:block;
  clear: both;
}

/* Pills */
.qrz-link-pill{
  display:inline-flex;
  align-items:center;
  gap:10px;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--pill-bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform .15s ease, border-color .15s ease;
  color: var(--pill-text);
}
.qrz-link-pill:hover{
  transform: translateY(-1px);
  border-color: rgba(166,255,59,.35);
}
.qrz-dot{
  width:10px; height:10px; border-radius:50%;
  background: var(--lime);
  box-shadow: 0 0 0 6px rgba(166,255,59,.12);
}
.qrz-text{ font-weight: 700; letter-spacing: .2px; }

.online-pill{
  display:inline-flex;
  align-items:center;
  gap:10px;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--pill-bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.online-heart{ color: var(--danger); }
.online-count{
  min-width: 26px;
  text-align:center;
  font-weight: 800;
  color: var(--lime);
}

.theme-toggle{
  border: 1px solid var(--border);
  background: var(--pill-bg);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 12px;
  cursor:pointer;
  box-shadow: var(--shadow);
  transition: transform .15s ease, border-color .15s ease;
}
.theme-toggle:hover{
  transform: translateY(-1px);
  border-color: rgba(166,255,59,.35);
}

/* Mobile: stack logo then pills */
@media (max-width: 980px){
  .header-actions{
    float: none;
    justify-content:flex-start;
    margin-top: 10px;
  }
  .brand-logo{ height: 56px; }
}

/* -------------------------
   Topbar
------------------------- */
.topbar{
  margin-top: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 14px;
  display:grid;
  grid-template-columns: 1.1fr 1fr 1fr;
  gap: 12px;
  align-items:center;
}

.topbar-left{
  display:flex;
  gap: 12px;
  align-items:center;
}
.avatar{
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  object-fit: cover;
  aspect-ratio: 1 / 1;
}

.callsign{
  font-weight: 900;
  letter-spacing: .8px;
  font-size: 20px;
}
.tagline{ color: var(--muted); font-size: 13px; margin-top: 2px; }

.topbar-mid{
  display:flex;
  align-items:center;
  justify-content:center;
  gap: 10px;
  flex-wrap: wrap;
}
.live-dot{
  width:10px; height:10px; border-radius:50%;
  background: var(--lime);
  box-shadow: 0 0 0 7px rgba(166,255,59,.12);
}
.live-text{ font-weight: 900; letter-spacing: 2px; font-size: 12px; color: var(--lime); }

.freq{
  display:flex;
  align-items:baseline;
  gap: 8px;
  flex-wrap: wrap;
  justify-content:center;
}
.freq-big{ font-size: 30px; font-weight: 900; letter-spacing: .3px; }
.freq-unit{ color: var(--muted); font-weight: 700; }

.topbar-right{
  display:flex;
  justify-content:flex-end;
  gap: 14px;
}
.mini{
  background: rgba(0,0,0,.10);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  min-width: 140px;
}
:root:not(.theme-dark) .mini{ background: rgba(16,24,32,.04); }
.mini-label{ color: var(--muted); font-size: 12px; }
.mini-value{ margin-top: 4px; font-weight: 900; }

/* Status bubble */
.topbar-status{
  margin-top: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}
.topbar-status-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.topbar-status-bubble{
  border-radius: 16px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  padding: 12px 12px;
}
.status-text{ font-size: 14px; line-height: 1.45; }
.status-meta{ margin-top: 8px; font-size: 12px; }

.pill{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,.12);
  font-weight: 900;
  font-size: 12px;
  letter-spacing: .3px;
}
:root:not(.theme-dark) .pill{ background: rgba(16,24,32,.06); }
.pill-mode{ color: var(--lime); }
.pill-band{ color: rgba(255,255,255,.88); }
.status-pill{
  color: var(--lime);
  background: rgba(166,255,59,.12);
  border-color: rgba(166,255,59,.25);
}

/* -------------------------
   Main Grid
------------------------- */
.dashboard-grid{
  max-width: var(--max);
  margin: 12px auto 0;
  padding: 0 14px 16px;
  display:grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--gap);
  align-items: start;
  grid-auto-rows: auto;
  align-self: start;
}

/* Cards */
.card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  overflow: hidden;
  height: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-self: start;
}
.card h2{
  margin: 0 0 8px;
  font-size: 16px;
  letter-spacing: .2px;
}
.card-large{ grid-column: span 6; }
@media (max-width: 980px){
  .topbar{ grid-template-columns: 1fr; }
  .card-large{ grid-column: span 12; }
}

/* Station configuration layout */
.station-grid{
  display:grid;
  gap:14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (max-width: 900px){
  .station-grid{ grid-template-columns: 1fr; }
}
.station-block{
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  border-radius: 14px;
  padding: 12px;
}
.station-block-title{
  font-weight: 900;
  margin-bottom: 10px;
}
.station-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding: 7px 0;
  border-bottom: 1px dashed rgba(255,255,255,0.08);
}
.station-row:last-child{ border-bottom: 0; }

/* Latest QSOs */
.qso-list{
  list-style:none;
  padding: 0;
  margin: 12px 0 0;
  display:flex;
  flex-direction:column;
  gap: 10px;
}
.qso-list li{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 14px;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  transition: transform .12s ease, border-color .15s ease;
}
.qso-list li:hover{
  transform: translateY(-1px);
  border-color: rgba(166,255,59,.25);
}
.qso-left{
  display:flex;
  align-items:center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}
.qso-right{
  display:flex;
  flex-direction: column;
  align-items:flex-end;
  gap: 4px;
  flex: 0 0 auto;
  text-align: right;
}

.qso-line1{
  display:flex;
  align-items:center;
  gap: 10px;
  white-space: nowrap;
}
.qso-line2{
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0.85;
}

@media (max-width: 560px){
  .qso-list li{ align-items: flex-start; }
  .qso-right{ align-items: flex-start; text-align: left; }
  .qso-line1, .qso-line2{ white-space: normal; }
}

.qrz-link strong{
  font-weight: 900;
  letter-spacing: .2px;
}
.qrz-link:hover strong{
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  text-decoration-color: rgba(166,255,59,.7);
}

.flag{
  width: 18px;
  height: 13px;
  border-radius: 2px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(0,0,0,.18);
  display:inline-block;
}

.new-pill{
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .6px;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid rgba(166,255,59,.35);
  background: rgba(166,255,59,.12);
  color: var(--lime);
  transition: opacity 1s ease, transform 1s ease;
}
.new-pill.is-gone{
  opacity: 0;
  transform: translateY(-3px);
}

.age-pill{
  font-size: 11px;
  font-weight: 900;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,.18);
}
:root:not(.theme-dark) .age-pill{ background: rgba(16,24,32,.06); }

.age-recent{
  color: var(--lime);
  border-color: rgba(166,255,59,.35);
  background: rgba(166,255,59,.12);
}
.age-warm{
  color: #ffe08a;
  border-color: rgba(255,224,138,.35);
  background: rgba(255,224,138,.10);
}
.age-stale{ color: rgba(255,255,255,.78); }
.age-old{ color: rgba(255,255,255,.62); }
.age-unknown{ color: var(--muted); }

/* Time / Grayline */
.time-row{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 520px){
  .time-row{ grid-template-columns: 1fr; }
}
.time-block{
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  padding: 12px;
}
.time-label{ color: var(--muted); font-size: 12px; font-weight: 700; }
.time-big{ font-size: 26px; font-weight: 900; margin-top: 6px; }
.time-small{ color: var(--muted); font-size: 12px; margin-top: 4px; }

.grayline{
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(0,0,0,.10);
  padding: 12px;
}
:root:not(.theme-dark) .grayline{ background: rgba(16,24,32,.04); }
.grayline-label{ color: var(--muted); font-size: 12px; font-weight: 800; }
.grayline-status{ margin-top: 6px; font-weight: 900; }
.grayline-small{ margin-top: 6px; color: var(--muted); font-size: 12px; }

/* Flip card */
.flip-card{ perspective: 1200px; }
.flip-inner{
  position: relative;
  transform-style: preserve-3d;
  transition: transform .55s ease;
}
.flip-inner.is-flipped{ transform: rotateY(180deg); }
.flip-face{ backface-visibility: hidden; transform-style: preserve-3d; }
.flip-front{ position: relative; }
.flip-back{ position:absolute; inset:0; transform: rotateY(180deg); }

.card-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom: 10px;
}
.flip-btn{
  border: 1px solid var(--border);
  background: rgba(0,0,0,.14);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 10px;
  cursor:pointer;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
:root:not(.theme-dark) .flip-btn{ background: rgba(16,24,32,.05); }
.flip-btn:hover{
  border-color: rgba(166,255,59,.25);
  transform: translateY(-1px);
}

/* Solar metric */
.card-solar{ position: relative; overflow: hidden; }
.card-solar::before{
  content:"";
  position:absolute;
  inset:-2px;
  background:
    radial-gradient(900px 320px at 18% 10%, rgba(132,204,22,.18), transparent 55%),
    radial-gradient(700px 260px at 88% 20%, rgba(6,182,212,.14), transparent 55%);
  pointer-events:none;
}

.solar-metric{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.00));
  margin-top: 10px;
}
.solar-metric span{
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .2px;
  opacity: .85;
}
.solar-metric strong{
  font-size: 22px;
  font-weight: 900;
  letter-spacing: .3px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  min-width: 68px;
  text-align: right;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06), 0 4px 14px rgba(0,0,0,.35);
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}
.solar-metric:hover strong{
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.10), 0 8px 22px rgba(0,0,0,.45);
  filter: brightness(1.05);
}

/* Tooltip */
.qso-tip{
  position: fixed;
  z-index: 9999;
  max-width: 320px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .12s ease, transform .12s ease;
  background: rgba(0,0,0,.85);
  color: #fff;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: 0 18px 40px rgba(0,0,0,.45);
}
.qso-tip.is-on{ opacity: 1; transform: translateY(0); }

/* Guestbook */
.guestbook-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 12px;
}
.guestbook-sub{ color: var(--muted); font-size: 12px; margin-top: 2px; }
.guestbook-pill{
  min-width: 44px;
  text-align:center;
  font-weight: 900;
  border-radius: 999px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,.12);
  color: var(--lime);
}
:root:not(.theme-dark) .guestbook-pill{ background: rgba(16,24,32,.05); }

.guestbook-fade{
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  padding: 12px;
}
.guestbook-meta{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.guestbook-name{ font-weight: 900; }
.guestbook-date{ color: var(--muted); font-size: 12px; }
.guestbook-message{ line-height: 1.5; }

#guestbookFade{
  transition: opacity 240ms ease, transform 240ms ease;
  opacity: 1;
  transform: translateY(0);
}
#guestbookFade.gb-fading{
  opacity: 0;
  transform: translateY(4px);
}

/* DX MAP */
.dx-map-wrap{
  position: relative;
  height: 320px;
  border-radius: 14px;
  overflow: hidden;
}
#dxMap{
  height: 100%;
  width: 100%;
  z-index: 1;
  border: 1px solid var(--border);
  background: var(--surface-2);
  position: relative;
}

/* Leaflet UI */
.leaflet-container{ font-family: var(--font); border-radius: 14px; }
:root.theme-dark .leaflet-control-attribution,
:root.theme-dark .leaflet-control-zoom a{
  background: rgba(0,0,0,.55) !important;
  color: rgba(255,255,255,.85) !important;
  border-color: rgba(255,255,255,.12) !important;
}
:root.theme-dark .leaflet-control-zoom a:hover{
  background: rgba(0,0,0,.70) !important;
}

/* =========================
   DX MAP LEGEND
========================= */
.dx-map-wrap{
  position: relative;
  height: 320px;
  border-radius: 14px;
  overflow: hidden;
}

#dxMap{
  height: 100%;
  width: 100%;
  z-index: 1;
  border: 1px solid var(--border);
  background: var(--surface-2);
  position: relative;
}

/* =========================
   DX MAP LEGEND (external)
========================= */
.dx-map-legend{
  margin-top: 12px;
  display: flex;
  justify-content: flex-start;
}

.dx-map-legend .legend-card{
  width: 100%;
  max-width: 520px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.12);
}

.theme-dark .dx-map-legend .legend-card{
  background: rgba(17,24,39,0.75);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 14px 40px rgba(0,0,0,0.45);
}

.dx-map-legend .legend-title{
  display:flex;
  align-items:center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.dx-map-legend .legend-title strong{
  font-weight: 900;
}
.dx-map-legend .legend-note{
  font-size: 12px;
  opacity: .75;
}

.dx-map-legend .legend-grid{
  display:flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dx-map-legend .legend-pill{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid rgba(0,0,0,0.10);
  background: rgba(255,255,255,0.7);
}

.theme-dark .dx-map-legend .legend-pill{
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.14);
}

.dx-map-legend .legend-dot{
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* Legend outside map */
.dx-legend-out{
  margin-top: 10px;
  display:flex;
  flex-wrap:wrap;
  gap: 8px;
  align-items:center;
}

.dx-legend-out .legend-pill{
  display:inline-flex;
  align-items:center;
  gap: 7px;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 12px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
}

.dx-legend-out .legend-dot{
  width: 10px;
  height: 10px;
  border-radius: 99px;
  display:inline-block;
}



/* =========================================================
   MODALS (Say Hi + QSL) — THIS IS THE IMPORTANT BIT
   If this works, the form will NOT sit at bottom.
========================================================= */
.modal{
  position: fixed !important;
  inset: 0 !important;
  z-index: 9999 !important;
  display: none !important;
}
.modal.is-on{ display:block !important; }

.modal-backdrop{
  position:absolute !important;
  inset:0 !important;
  background: rgba(0,0,0,0.55) !important;
  backdrop-filter: blur(6px) !important;
}

.modal-card{
  position: relative !important;
  width: min(560px, calc(100vw - 24px)) !important;
  margin: 10vh auto 0 !important;
  background: var(--card) !important;
  border: 1px solid var(--border) !important;
  border-radius: 18px !important;
  box-shadow: 0 30px 90px rgba(0,0,0,0.35) !important;
  overflow: hidden !important;
}

.modal-head{
  display:flex;
  align-items:flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
}
.modal-title{
  font-weight: 900;
  font-size: 18px;
  letter-spacing: 0.2px;
}
.modal-sub{ margin-top: 3px; font-size: 13px; }
.modal-x{
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 8px 10px;
  border-radius: 10px;
}
.modal-x:hover{ background: rgba(17,24,39,0.06); }

.modal-body{
  padding: 14px 16px 16px;
  display: grid;
  gap: 12px;
}

.field{
  display:flex;
  flex-direction:column;
  gap: 6px;
}
.field-label{
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}
.field input{
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,.16);
  color: var(--text);
  padding: 12px 12px;
  outline: none;
}
:root:not(.theme-dark) .field input{ background: rgba(16,24,32,.05); }
.field input:focus{
  border-color: rgba(166,255,59,.35);
  box-shadow: 0 0 0 4px rgba(166,255,59,.12);
}

.check-row{
  display:flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 14px;
}
.check-row input{
  margin-top: 3px;
  accent-color: var(--accent);
}

.modal-actions{
  display:flex;
  justify-content:flex-end;
  gap: 10px;
  margin-top: 6px;
}

.btn-primary{
  border: 1px solid rgba(166,255,59,.35);
  background: linear-gradient(180deg, rgba(166,255,59,.22), rgba(166,255,59,.12));
  color: var(--text);
  font-weight: 900;
  letter-spacing: .2px;
  border-radius: 14px;
  padding: 12px 14px;
  cursor:pointer;
  box-shadow: 0 12px 28px rgba(0,0,0,.28);
  transition: transform .12s ease, filter .12s ease;
}
.btn-primary:hover{ transform: translateY(-1px); filter: brightness(1.05); }

.btn-secondary{
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--pill-bg);
  color: var(--pill-text);
  font-weight: 900;
  cursor: pointer;
}

.modal-msg{
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(17,24,39,0.03);
}
.theme-dark .modal-msg{ background: rgba(255,255,255,0.04); }

/* Say Hi animation */
@keyframes hi-throb {
  0%   { transform: scale(1);    box-shadow: 0 0 0 rgba(34, 197, 94, 0); }
  50%  { transform: scale(1.06); box-shadow: 0 0 18px rgba(34, 197, 94, 0.55); }
  100% { transform: scale(1);    box-shadow: 0 0 0 rgba(34, 197, 94, 0); }
}
.hi-pill{ animation: hi-throb 2.4s ease-in-out infinite; }
@keyframes hi-dot { 0%,100%{opacity:.6} 50%{opacity:1} }
.hi-pill .qrz-dot{ animation: hi-dot 2.4s ease-in-out infinite; }

/* Footer */
.site-footer{
  margin-top: 40px;
  padding: 22px 28px;
  border-top: 1px solid rgba(255,255,255,0.06);
  background: linear-gradient(180deg, rgba(10,15,20,0.6), rgba(5,10,15,0.85));
}
.footer-inner{
  display: grid;
  grid-template-columns: 1.2fr auto 1fr;
  align-items: center;
  gap: 28px;
}
@media (max-width: 980px){
  .footer-inner{ grid-template-columns: 1fr; }
}
.footer-brand{ font-weight: 800; letter-spacing: 0.4px; }
.footer-callsign{ font-size: 15px; }
.footer-title{ font-size: 14px; opacity: 0.85; }
.footer-sep{ margin: 0 6px; opacity: 0.4; }
.footer-small{ margin-top: 6px; }
.footer-version{ opacity: 0.65; font-weight: 500; letter-spacing: 0.3px; }
.footer-stats{
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 10px 18px;
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
}
.footer-stat{ text-align: center; }
.footer-stat-label{ font-size: 11px; opacity: 0.6; margin-bottom: 2px; }
.footer-stat-value{ font-size: 16px; font-weight: 800; }
.footer-divider{ width: 1px; height: 28px; background: rgba(255,255,255,0.08); }
.footer-right{
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.footer-btn{
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s ease;
}
.footer-btn:hover{ background: rgba(255,255,255,0.14); }
.footer-btn.ghost{
  background: transparent;
  border: 1px solid rgba(255,255,255,0.12);
}

/* Utility */
hr{
  border:0;
  border-top:1px solid var(--border);
  margin: 12px 0;
}

/* =========================================================
   TOASTS (Say Hi popup notifications)
   Add this at END of style.css
========================================================= */

.toast-host{
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 10000; /* higher than modal backdrop */
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none; /* clicks pass through */
}

.toast{
  width: min(360px, calc(100vw - 32px));
  background: rgba(17, 24, 39, 0.88);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(0,0,0,.45);
  padding: 12px 12px 10px;
  color: rgba(255,255,255,.92);

  opacity: 0;
  transform: translateY(10px);
  transition: opacity .22s ease, transform .22s ease;
  pointer-events: none;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

:root:not(.theme-dark) .toast{
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(16,24,32,0.12);
  color: rgba(16,24,32,.92);
  box-shadow: 0 18px 40px rgba(16,24,32,.12);
}

.toast.is-on{
  opacity: 1;
  transform: translateY(0);
}

.toast-top{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.toast-title{
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  letter-spacing: .2px;
  line-height: 1.25;
}

.toast-flag{
  width: 18px;
  height: 13px;
  border-radius: 2px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.20);
  flex: 0 0 auto;
}

:root:not(.theme-dark) .toast-flag{
  border: 1px solid rgba(16,24,32,0.16);
}

.toast-flag img{
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.toast-sub{
  margin-top: 6px;
  font-size: 13px;
  color: rgba(255,255,255,.72);
  line-height: 1.35;
}

:root:not(.theme-dark) .toast-sub{
  color: rgba(16,24,32,.70);
}

/* Weather pill */
.weather-pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--pill-bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-weight: 900;
}

.weather-icon{
  font-size: 16px;
  line-height: 1;
}

.weather-temp{
  font-size: 14px;
  letter-spacing: .3px;
}

/* ===== Weather pill temp colours ===== */
.weather-pill{
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: rgba(229,231,235,0.95);
  transition: background .25s ease, border-color .25s ease, transform .15s ease;
}

/* temp bands */
.weather-pill.wx-cold{
  background: rgba(59,130,246,0.16);
  border-color: rgba(59,130,246,0.30);
}

.weather-pill.wx-mild{
  background: rgba(34,197,94,0.14);
  border-color: rgba(34,197,94,0.28);
}

.weather-pill.wx-warm{
  background: rgba(245,158,11,0.16);
  border-color: rgba(245,158,11,0.30);
}

.weather-pill.wx-hot{
  background: rgba(239,68,68,0.16);
  border-color: rgba(239,68,68,0.32);
}

/* optional: tiny lift on hover */
.weather-pill:hover{
  transform: translateY(-1px);
}


/* =========================================================
   FIX: Latest 5 layout + NEW pill + flag slot + tooltip
   (add at very bottom of style.css)
========================================================= */

/* latest list rows: make the new two-line layout work */
#latestQsos li{
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
}

/* left side */
#latestQsos .qso-left{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

/* right side: two-line */
#latestQsos .qso-right{
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  min-width: 220px;
}

#latestQsos .qso-line1{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

#latestQsos .qso-line2{
  font-size: 12px;
  opacity: 0.72;
}

/* NEW pill (your JS inserts <span class="new-pill">NEW</span>) */
.new-pill{
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 4px 10px;
  border-radius: 999px;

  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;

  border: 1px solid rgba(34,197,94,0.35);
  background: rgba(34,197,94,0.16);
  color: rgba(229,231,235,0.95);
}

/* when you fade it out via JS */
.new-pill.is-gone{
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 800ms ease, transform 800ms ease;
}

/* tooltip typography (you already have tooltip container styles) */
#qsoTip .tip-title{
  font-weight: 900;
  font-size: 1rem;
  margin-bottom: 4px;
}
#qsoTip .tip-dxcc{
  opacity: 0.8;
  font-weight: 700;
}
#qsoTip .tip-sub{
  font-size: 0.88rem;
  opacity: 0.85;
  margin-top: 2px;
}

/* make sure flags have a consistent slot size even before load */
#latestQsos [id^="flag_"]{
  display: inline-flex;
  width: 22px;
  height: 16px;
  align-items: center;
  justify-content: center;
}
#latestQsos img.flag{
  width: 22px;
  height: 16px;
  border-radius: 3px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,0.16);
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
}

.weather-wind{
  margin-left: 8px;
  font-weight: 800;
  opacity: .9;
  font-size: 12px;
}

.pill.source {
  background: #e5e7eb;
  color: #374151;
}

.pill.tx {
  background: #dc2626;
  color: #fff;
  font-weight: 700;
}

.pill.tx.tx {
  animation: pulse 1.2s infinite;
}

@keyframes pulse {
  0%   { opacity: 1; }
  50%  { opacity: 0.6; }
  100% { opacity: 1; }
}

.dx-legend-row{
  margin-top: 10px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  flex-wrap:wrap;
}

.dx-limit{
  display:flex;
  gap: 8px;
  align-items:center;
}

.dx-limit-btn{
  appearance: none;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  color: var(--text);
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 900;
  font-size: 12px;
  cursor: pointer;
  transition: transform .12s ease, border-color .12s ease, filter .12s ease;
}
.dx-limit-btn:hover{
  transform: translateY(-1px);
  border-color: rgba(166,255,59,.25);
  filter: brightness(1.05);
}
.dx-limit-btn.is-on{
  border-color: rgba(166,255,59,.35);
  background: rgba(166,255,59,.12);
  color: var(--lime);
}

/* ===============================
   Latest 5 Contacts — Mobile fix
================================ */
@media (max-width: 520px) {

  /* Each QSO row becomes a clean 2-line layout */
  .qso-list li {
    padding: 14px 14px;
  }

  .qso-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex-wrap: wrap;              /* allow call + country to wrap nicely */
  }

  /* Keep callsign + NEW together */
  .qso-left .qrz-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
  }

  /* Country/name text: allow wrapping, never overlap */
  .qso-left .muted {
    display: block;
    width: 100%;
    margin-left: 0;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Right side becomes second line, aligned and spaced */
  .qso-right {
    width: 100%;
    margin-top: 10px;
  }

  .qso-line1 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: nowrap;
  }

  /* The freq/mode line should never sit centered over the whole card */
  .qso-line1 > span:first-child {
    min-width: 0;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;      /* trims long strings instead of wrapping into overlap */
    font-weight: 700;
  }

  /* Age pill stays on the right */
  .age-pill {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  /* Line2 wraps normally */
  .qso-line2 {
    margin-top: 6px;
    white-space: normal;
    line-height: 1.25;
  }

  /* Flag size a touch smaller on phones */
  .qso-list .flag {
    width: 22px;
    height: 16px;
    border-radius: 3px;
  }

  /* NEW badge smaller on phones */
  .new-pill {
    transform: scale(0.92);
    transform-origin: left center;
  }
}

@media (max-width: 520px) {
  .qso-line1 > span:first-child {
    font-size: 15px;
    letter-spacing: 0.2px;
  }
}

@media (max-width: 520px) {
  .qso-list li {
    padding-top: 12px;
    padding-bottom: 12px;
  }
}

.dashboard-grid { align-items: start; }
.dashboard-grid > * { align-self: start; }

/* =========================================================
   DESKTOP MASONRY (removes the “grid gaps”)
   - Keeps mobile the same
========================================================= */
@media (min-width: 981px){
  body:not(.admin-page) .dashboard-grid{
    display: block;
    column-count: 2;
    column-gap: var(--gap);
  }

  body:not(.admin-page) .dashboard-grid > .card{
    break-inside: avoid;
    margin: 0 0 var(--gap);
    width: 100%;
    display: inline-block;
  }

  body:not(.admin-page) .card-large{ grid-column: auto; }
}

  .dashboard-grid > .card{
    break-inside: avoid;            /* don't split cards */
    margin: 0 0 var(--gap);
    width: 100%;
    display: inline-block;          /* required for columns */
  }

  /* grid-column is irrelevant in masonry mode */
  .card-large{ grid-column: auto; }
}

/* Search */
.search-row{
  display:flex;
  gap:10px;
  align-items:center;
  margin-top: 10px;
}
.search-input{
  flex: 1 1 auto;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,.16);
  color: var(--text);
  padding: 12px 12px;
  outline: none;
}
:root:not(.theme-dark) .search-input{ background: rgba(16,24,32,.05); }
.search-input:focus{
  border-color: rgba(166,255,59,.35);
  box-shadow: 0 0 0 4px rgba(166,255,59,.12);
}

.search-btn{
  border: 1px solid var(--border);
  background: var(--pill-bg);
  color: var(--pill-text);
  font-weight: 900;
  border-radius: 14px;
  padding: 12px 14px;
  cursor:pointer;
}
.search-btn:hover{
  border-color: rgba(166,255,59,.35);
  transform: translateY(-1px);
}

/* Search card */
.search-row{
  display:flex;
  gap:10px;
  align-items:center;
  margin-top: 10px;
}
.search-input{
  flex: 1 1 auto;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,.16);
  color: var(--text);
  padding: 12px 12px;
  outline: none;
}
:root:not(.theme-dark) .search-input{ background: rgba(16,24,32,.05); }
.search-input:focus{
  border-color: rgba(166,255,59,.35);
  box-shadow: 0 0 0 4px rgba(166,255,59,.12);
}

.search-btn{
  flex: 0 0 auto;
  border: 1px solid rgba(166,255,59,.35);
  background: linear-gradient(180deg, rgba(166,255,59,.22), rgba(166,255,59,.12));
  color: var(--text);
  font-weight: 900;
  letter-spacing: .2px;
  border-radius: 14px;
  padding: 12px 14px;
  cursor:pointer;
  box-shadow: 0 12px 28px rgba(0,0,0,.18);
  transition: transform .12s ease, filter .12s ease;
}
.search-btn:hover{ transform: translateY(-1px); filter: brightness(1.05); }

@media (max-width:560px){
  .search-row{ flex-direction: column; align-items: stretch; }
}

/* Search modal rows */
.search-rows{
  display: grid;
  gap: 10px;
}

.search-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
}

.search-k{
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .2px;
}
.search-v{
  font-weight: 900;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
