/* ============================================================
   Dashboard - Dark Slate Theme
   Baggrund: #0b0f19 / #111827 · Kort: #1e293b · Kant: #334155
   Accent: Electric Blue #3b82f6 / Emerald #10b981
   Typografi: Inter, system-ui
   ============================================================ */
:root {
  --bg: #0b0f19;
  --bg2: #111827;
  --card: #1e293b;
  --card-hover: #243349;
  --border: #334155;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --emerald: #10b981;
  --red: #f87171;
  --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
/* KRITISK: hidden-attributten OG .hidden-klassen skal ALTID vinde
   over display-regler (fixer bl.a. chart-modal + søge-række-toggle) */
[hidden], .hidden { display: none !important; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100vh;
}
a { color: var(--accent-hover); }

/* ===== Passcode-gate ===== */
#gate {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 16px;
}
.gate-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 36px 32px; width: 100%; max-width: 360px; text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.gate-card h2 { margin: 0 0 8px; font-size: 20px; }
.gate-card p { font-size: 13px; color: var(--muted); margin: 0 0 18px; }
.gate-card input[type="password"] {
  width: 100%; padding: 12px 14px; font-size: 15px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text); outline: none;
}
.gate-card input[type="password"]:focus { border-color: var(--accent); }
.gate-card button {
  width: 100%; margin-top: 12px; padding: 12px; font-size: 15px; font-weight: 600;
  border: none; border-radius: 999px; background: var(--accent); color: #fff; cursor: pointer;
}
.gate-card button:hover { background: var(--accent-hover); }
.error { color: #fca5a5; font-size: 13px; font-weight: 600; margin-top: 10px; min-height: 18px; }

/* ===== Dashboard ===== */
.wrap { max-width: 1200px; margin: 0 auto; padding: 28px 16px 60px; }
header.dash {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px; margin-bottom: 22px;
}
header.dash h1 { font-size: 24px; font-weight: 700; letter-spacing: -.3px; }
header.dash .meta { color: var(--muted); font-size: 12.5px; }
.dash-clock-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.dash-clock {
  font-size: 24px; font-weight: 800; letter-spacing: 1px;
  color: var(--accent-hover); font-variant-numeric: tabular-nums;
  text-shadow: 0 0 18px rgba(59,130,246,.35);
}
.dash-tag { font-size: 10px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 430px));
  justify-content: center;
  align-items: start; /* kortene strækker sig ALDRIG vertikalt - kun indholdshøjde */
  gap: 16px;
}
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; overflow: hidden;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.card-head h2 { font-size: 14px; letter-spacing: .3px; font-weight: 600; }
.head-actions { display: flex; align-items: center; gap: 6px; }
.header-input {
  width: 120px; background: var(--bg); border: 1px solid var(--border); border-radius: 999px;
  color: var(--text); padding: 5px 12px; font-size: 12px; outline: none;
  transition: border-color .15s ease, width .2s ease;
}
.header-input:focus { border-color: var(--accent); width: 150px; }
.add-btn {
  background: none; border: 1px solid var(--accent); color: var(--accent); border-radius: 999px;
  padding: 3px 12px; font-size: 11px; font-weight: 600; cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.add-btn:hover { background: var(--accent); color: #fff; }
/* Markeder: sub-faner + søge-række */
.mtabs { display: flex; gap: 6px; margin-bottom: 12px; }
.search-row { display: flex; gap: 8px; margin-bottom: 12px; }
.search-row input {
  flex: 1; background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); padding: 8px 12px; font-size: 13px; outline: none; text-transform: uppercase;
}
.search-row input:focus { border-color: var(--accent); }
.search-row button {
  background: var(--bg2); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 8px 14px; font-size: 13px; cursor: pointer;
}
.search-row button:hover { border-color: var(--accent); color: var(--accent); }
.refresh {
  background: none; border: 1px solid var(--border); color: var(--muted); border-radius: 999px;
  padding: 3px 10px; font-size: 11px; cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}
.refresh:hover { color: var(--accent); border-color: var(--accent); }
.card-body { padding: 14px 16px; }
.card-msg { color: var(--muted); font-size: 13px; text-align: center; padding: 40px 10px; }
.card-msg.err { color: #fca5a5; }
/* Blød info-pladsholder (fx Superliga uden fri data) */
.info-box {
  border: 1px dashed var(--border); border-radius: 12px;
  background: var(--bg2); padding: 16px 18px; text-align: center;
  color: var(--muted); font-size: 12.5px; line-height: 1.6;
}
.info-box .ib-icon { font-size: 22px; display: block; margin-bottom: 6px; }
.info-box .ib-title { font-weight: 700; color: var(--text); display: block; margin-bottom: 2px; }

/* ===== Vejr (kompakt - højden er ALTID indholdsbundet) ===== */
.card-weather { max-width: 400px; height: fit-content; align-self: start; }
.card-weather .card-body { padding: 10px 14px 12px; }
.card-weather .loc-chips { margin-bottom: 10px; gap: 4px; }
.card-weather .loc-chip { padding: 3px 4px 3px 10px; font-size: 11px; }
.card-weather .weather-main { gap: 10px; margin-bottom: 8px; }
.card-weather .weather-icon { font-size: 34px; }
.card-weather .weather-temp { font-size: 32px; }
.card-weather .weather-desc { font-size: 12px; }
.card-weather .weather-grid { gap: 6px; }
.card-weather .w-item { padding: 5px; }
.card-weather .w-item .k { font-size: 9.5px; }
.card-weather .w-item .v { font-size: 13px; }

/* ===== Nyheder ===== */
.news-item {
  display: block; text-decoration: none; color: var(--text);
  padding: 9px 10px; border-bottom: 1px solid rgba(51,65,85,.4);
  background: var(--bg2); border-radius: 8px; margin-bottom: 6px;
  transition: border-color .15s ease, background .15s ease;
}
.news-item:hover { border-color: var(--accent); background: var(--card-hover); }
.news-item .nt { font-size: 12.5px; font-weight: 600; line-height: 1.35; }
.news-item .nm { color: var(--muted); font-size: 10.5px; margin-top: 3px; }
.news-item .nm .src { color: var(--accent-hover); font-weight: 600; }
.loc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.loc-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg2); border: 1px solid var(--border); color: var(--muted);
  border-radius: 999px; padding: 5px 6px 5px 12px; font-size: 12px; font-weight: 600; cursor: pointer;
  transition: all .15s ease;
}
.loc-chip:hover { color: var(--text); border-color: var(--accent); }
.loc-chip.active { background: var(--accent); color: #fff; border-color: transparent; }
.chip-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  font-size: 11px; line-height: 1; cursor: pointer;
  background: rgba(0,0,0,.25); color: inherit;
  transition: background .15s ease, color .15s ease;
}
.chip-x:hover { background: var(--red); color: #fff; }
.weather-main { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.weather-icon { font-size: 46px; }
.weather-temp { font-size: 40px; font-weight: 700; letter-spacing: -1px; }
.weather-desc { color: var(--muted); font-size: 13px; }
.weather-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.w-item { background: var(--bg2); border-radius: 10px; padding: 8px; text-align: center; }
.w-item .k { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.w-item .v { font-size: 15px; font-weight: 600; margin-top: 2px; }
.city-row { display: flex; gap: 8px; margin-top: 14px; }
.city-row input {
  flex: 1; background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); padding: 8px 12px; font-size: 13px; outline: none;
}
.city-row input:focus { border-color: var(--accent); }
.city-row button {
  background: var(--bg2); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 8px 14px; font-size: 13px; cursor: pointer;
}
.city-row button:hover { border-color: var(--accent); color: var(--accent); }

/* ===== Markeder ===== */
.watch-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-bottom: 1px solid rgba(51,65,85,.4); cursor: pointer;
  border-radius: 10px; transition: background .15s ease;
}
.watch-row:hover { background: var(--card-hover); }
.watch-row:last-child { border-bottom: none; }
.sym { font-weight: 700; font-size: 14px; width: 84px; }
.sym .sub { display: block; font-size: 10.5px; font-weight: 500; color: var(--muted); }
.price { font-size: 14px; text-align: right; min-width: 76px; font-variant-numeric: tabular-nums; }
.chg { font-size: 12.5px; font-weight: 600; min-width: 84px; text-align: right; }
.up { color: var(--emerald); } .down { color: var(--red); }
.spark { margin-left: auto; }
.watch-hint { color: var(--muted); font-size: 11px; margin-top: 8px; text-align: center; }
.watch-add { display: flex; gap: 8px; margin-top: 12px; }
.watch-add input {
  flex: 1; background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); padding: 8px 12px; font-size: 13px; outline: none; text-transform: uppercase;
}
.watch-add input:focus { border-color: var(--accent); }
.watch-add button {
  background: var(--bg2); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 8px 14px; font-size: 13px; cursor: pointer;
}
.watch-add button:hover { border-color: var(--accent); color: var(--accent); }
.rm { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 2px 6px; }
.rm:hover { color: var(--red); }

/* ===== Ticker-bar (statisk - manuel scroll/swipe, INGEN auto-loop) ===== */
.ticker {
  overflow: hidden; border: 1px solid var(--border); border-radius: 10px;
  background: var(--card); margin-bottom: 18px; height: 42px;
  display: flex; align-items: center;
}
.ticker-track {
  display: flex; align-items: center; gap: 24px;
  padding: 0 16px; white-space: nowrap;
  overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none;               /* Firefox: skjul scrollbar, bevar scroll */
  -webkit-overflow-scrolling: touch;
  cursor: grab;
  width: 100%;
}
.ticker-track::-webkit-scrollbar { display: none; } /* Chrome/Safari: skjul, bevar scroll */
.ticker-track:active { cursor: grabbing; }
.ticker-item {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 600; color: var(--text);
}
.ticker-item .tk-logo { width: 17px; height: 17px; border-radius: 50%; overflow: hidden; display: inline-flex; }
.ticker-item .tk-logo img { width: 100%; height: 100%; object-fit: contain; }
.ticker-item .tk-score { color: var(--accent-hover); font-weight: 700; }
.ticker-item .tk-live { color: var(--emerald); font-weight: 700; animation: pulse 1.6s ease-in-out infinite; }
.ticker-item .tk-time { color: var(--muted); }
.ticker-item .tk-sep { color: var(--border); }

/* ===== Match-detalje (SofaScore-stil) ===== */
.md-head { text-align: center; padding: 6px 0 12px; }
.md-teams { display: flex; align-items: center; justify-content: center; gap: 18px; }
.md-team { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.md-team .md-logo { width: 44px; height: 44px; border-radius: 50%; overflow: hidden; display: flex; align-items: center; justify-content: center; background: var(--card); border: 1px solid var(--border); }
.md-team .md-logo img { width: 100%; height: 100%; object-fit: contain; }
.md-team .md-name { font-size: 12px; font-weight: 700; text-align: center; line-height: 1.25; word-break: break-word; max-width: 130px; }
.md-center { text-align: center; padding: 0 10px; }
.md-score { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .5px; }
.md-status { font-size: 12px; font-weight: 700; margin-top: 4px; }
.md-status.live { color: var(--emerald); }
.md-status.final { color: var(--muted); }
.md-status.upcoming { color: var(--accent-hover); }
.md-meta { text-align: center; color: var(--muted); font-size: 11.5px; margin-top: 8px; }
.md-broadcast {
  display: inline-block; margin-top: 10px; font-size: 13px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, #1d4ed8, #3b82f6);
  border-radius: 999px; padding: 4px 14px; letter-spacing: .3px;
  box-shadow: 0 2px 12px rgba(59,130,246,.35);
}
.md-form { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.md-form h4 {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; font-weight: 800; color: var(--muted);
  text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px;
}
.md-form-title { color: var(--accent-hover); }
.md-legend { font-size: 10px; font-weight: 600; color: var(--muted); text-transform: none; letter-spacing: 0; display: flex; gap: 6px; align-items: center; }
.md-legend .lg { width: 15px; height: 15px; border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 800; color: #fff; margin-right: 2px; }
.md-legend .lg.w { background: var(--emerald); }
.md-legend .lg.d { background: #64748b; }
.md-legend .lg.l { background: var(--red); }
.form-team { margin-bottom: 12px; }
.form-team .ft-name { font-size: 12.5px; font-weight: 700; margin-bottom: 5px; }
.form-badges { display: flex; gap: 4px; margin-bottom: 5px; }
.form-badge { width: 20px; height: 20px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 10.5px; font-weight: 800; color: #fff; }
.form-badge.w { background: var(--emerald); }
.form-badge.d { background: #64748b; }
.form-badge.l { background: var(--red); }
.form-bar { display: flex; height: 6px; border-radius: 999px; overflow: hidden; margin-bottom: 4px; }
.form-bar .fb-w { background: var(--emerald); }
.form-bar .fb-d { background: #64748b; }
.form-bar .fb-l { background: var(--red); }
.form-pct { font-size: 10.5px; color: var(--muted); display: flex; justify-content: space-between; }
.md-note { color: var(--muted); font-size: 10.5px; margin-top: 10px; line-height: 1.5; text-align: center; }

/* ===== Sport ===== */
/* Dato-navigation (SofaScore-stil: Yesterday/Today/Tomorrow + pile) */
.day-nav {
  display: flex; align-items: center; gap: 6px;
  flex: 1; justify-content: center; min-width: 230px; /* bred nok - aldrig klippet */
}
.day-label {
  font-size: 13px; font-weight: 800; color: var(--text);
  min-width: 110px; text-align: center; letter-spacing: .2px;
  font-variant-numeric: tabular-nums;
}
.week-btn {
  background: none; border: 1px solid var(--border); color: var(--muted);
  border-radius: 999px; width: 28px; height: 28px; cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.week-btn:hover { border-color: var(--accent); color: var(--accent); background: rgba(59,130,246,.08); }
/* Team-kalender-modal */
.modal-sm { max-width: 460px; height: auto; max-height: 70vh; }
.sched-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px; border-bottom: 1px solid rgba(51,65,85,.4);
  background: var(--bg2); border-radius: 8px; margin-bottom: 6px; font-size: 13px;
}
.sched-row .sd { color: var(--muted); font-size: 11.5px; min-width: 62px; }
.sched-row .sc { font-weight: 600; text-align: right; }
.sched-row .cc { color: var(--muted); font-size: 11px; }

.league-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.league-tab {
  background: var(--bg2); border: 1px solid var(--border); color: var(--muted);
  border-radius: 999px; padding: 6px 12px; font-size: 12px; font-weight: 600; cursor: pointer;
  transition: all .15s ease;
}
.league-tab:hover { color: var(--text); border-color: var(--accent); }
.league-tab.active { background: var(--accent); color: #fff; border-color: transparent; }
.match {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-bottom: 1px solid rgba(51,65,85,.4);
  background: var(--bg2); border-radius: 10px; margin-bottom: 8px;
  min-height: 58px;
}
.match:last-child { margin-bottom: 0; }
.team {
  flex: 1; display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600;
  min-width: 0;
}
.team.away { justify-content: flex-end; text-align: right; }
.team .tname {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 100%;
}
.logo {
  width: 26px; height: 26px; border-radius: 50%; flex: 0 0 26px;
  display: flex; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--border);
  font-size: 10px; font-weight: 700; color: var(--muted); overflow: hidden;
}
.logo img { width: 100%; height: 100%; object-fit: contain; }
.center { text-align: center; min-width: 74px; }
.score { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.status {
  display: inline-block; font-size: 10.5px; font-weight: 700; margin-top: 2px;
  padding: 1px 7px; border-radius: 999px; background: var(--card);
}
.match .status.live { color: #fff; background: var(--emerald); animation: pulse 1.6s ease-in-out infinite; }
.status.final { color: var(--muted); }
.status.upcoming { color: var(--accent-hover); }
/* Broadcast-chip (📺 kanal) */
.broadcast {
  display: inline-block; margin-top: 3px;
  font-size: 10px; font-weight: 600; color: var(--muted);
  background: var(--card); border: 1px solid var(--border);
  border-radius: 999px; padding: 1px 7px;
  white-space: nowrap;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .55; } }
.dk-chip {
  display: inline-block; background: var(--bg2); border: 1px solid var(--border);
  color: var(--text); border-radius: 999px; padding: 4px 10px; font-size: 11.5px;
  cursor: pointer; margin: 2px; transition: border-color .15s ease;
}
.dk-chip:hover { border-color: var(--accent); }
.player-card {
  background: var(--bg2); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px;
  display: flex; justify-content: space-between; align-items: center;
}
.player-card .nm { font-weight: 600; font-size: 13px; }
.player-card .ct { color: var(--muted); font-size: 11.5px; }
.sport-note { color: var(--muted); font-size: 11px; margin-top: 10px; line-height: 1.5; }

/* ===== Chart-modal (TradingView) ===== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(7,10,17,.85); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 16px;
  width: 100%; max-width: 860px; height: min(70vh, 620px);
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
  position: relative; z-index: 1;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  position: relative; z-index: 2;
}
.modal-head h3 { font-size: 15px; font-weight: 700; }
.modal-close {
  background: none; border: 1px solid var(--border); color: var(--muted);
  border-radius: 999px; width: 34px; height: 34px; cursor: pointer; font-size: 15px;
  /* Luk-knappen ligger ALTID øverst og er altid klikbar */
  position: relative; z-index: 1000; pointer-events: auto;
}
.modal-close:hover { color: var(--text); border-color: var(--accent); }
.modal-body {
  flex: 1; min-height: 0;
  position: relative; z-index: 0; overflow: hidden;
}
.modal-body iframe { max-width: 100%; }

@media (max-width: 700px) { .grid { grid-template-columns: 1fr; } }