:root{
  --bg: #0b1020;
  --panel: rgba(255,255,255,0.04);
  --card: rgba(255,255,255,0.06);
  --card2: rgba(255,255,255,0.08);
  --border: rgba(255,255,255,0.10);
  --text: #e5e7eb;
  --muted: rgba(229,231,235,0.70);
  --muted2: rgba(229,231,235,0.55);
  --shadow: 0 12px 30px rgba(0,0,0,0.35);

  --accentA: #2563eb; /* blue */
  --accentB: #f59e0b; /* amber */

  --ok: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;

  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;

  /* native kontrole naj se renderirajo v dark načinu */
  color-scheme: dark;

  /* ===== Chart theme ===== */
  --chart-panel: rgba(0,0,0,0.22);
  --chart-panel2: rgba(255,255,255,0.03);
  --chart-border: rgba(255,255,255,0.12);
  --chart-grid: rgba(255,255,255,0.06);
  --chart-ticks: rgba(229,231,235,0.68);
  --chart-title: rgba(229,231,235,0.92);
}

*{ box-sizing: border-box; }
html,body{ height:100%; }
html{ -webkit-text-size-adjust: 100%; }

body{
  margin:0;
  font-family: var(--sans);
  color: var(--text);
  overflow-x: hidden; /* FIX: prepreči horizontalni scroll na mobilnih */
  background:
    radial-gradient(1200px 700px at 20% -10%, rgba(37,99,235,0.22), transparent 55%),
    radial-gradient(900px 600px at 90% 10%, rgba(245,158,11,0.18), transparent 55%),
    radial-gradient(1000px 700px at 30% 120%, rgba(34,197,94,0.14), transparent 60%),
    var(--bg);
}

a{ color: inherit; text-decoration: none; }
a:focus-visible{
  outline: 2px solid rgba(245,158,11,0.65);
  outline-offset: 3px;
  border-radius: 14px;
}
img{ max-width: 100%; display:block; }

/* ===== BIG LEFT LOGO (always left, like background) ===== */
.bg-logo{
  position: fixed;
  left: 18px;
  top: 18px;
  width: 240px;
  height: 240px;
  padding: 10px;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(0,0,0,0.22), rgba(0,0,0,0.10)) padding-box,
    linear-gradient(135deg, rgba(37,99,235,0.95), rgba(245,158,11,0.92)) border-box;
  border: 1px solid transparent;
  object-fit: contain;
  z-index: 0;
  pointer-events: none;
  opacity: 0.95;
  box-shadow:
    0 18px 40px rgba(0,0,0,0.45),
    inset 0 0 0 1px rgba(255,255,255,0.08);
}

/* content above bg logo */
.container{
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 16px 44px;

  /* FIX: safe-area (notch) */
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  padding-top: max(18px, env(safe-area-inset-top));
  padding-bottom: max(44px, env(safe-area-inset-bottom));
}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.brand{
  display:flex;
  align-items:center;
  gap: 12px;
  min-width: 0;
}

.h1{
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.2px;
  line-height: 1.1;
}
.h2{
  font-size: 14px;
  color: var(--muted);
  margin-top: 4px;
}

.actions{ display:flex; align-items:center; gap:10px; }

.badge{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid rgba(37,99,235,0.35);
  background: rgba(37,99,235,0.12);
  color: rgba(229,231,235,0.92);
  font-size: 13px;
  white-space: nowrap;
}
.badge:hover{
  border-color: rgba(245,158,11,0.45);
  background: rgba(245,158,11,0.12);
}
.badge:focus-visible{
  outline: 2px solid rgba(245,158,11,0.65);
  outline-offset: 2px;
}

.card{
  background: linear-gradient(180deg, var(--card), rgba(255,255,255,0.03));
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.card-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.card-title{
  display:flex;
  align-items:center;
  gap: 10px;
  font-weight: 900;
  letter-spacing: 0.2px;
  color: var(--chart-title);
}

.icon{
  width: 18px;
  height: 18px;
  opacity: 0.85;
}

.meta{
  margin-top: 10px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted2);
  font-size: 13px;
}

.footer-note{
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

/* Buttons */
.btn{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: transform 120ms ease, background 160ms ease, border-color 160ms ease, color 160ms ease;
}
.btn:hover{
  transform: translateY(-1px);
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.16);
}
.btn:active{ transform: translateY(0px); }
.btn:focus-visible{
  outline: 2px solid rgba(37,99,235,0.65);
  outline-offset: 2px;
}

/* Form controls */
select, input, textarea{ font-family: var(--mono); }

.select-wrap{
  position: relative;
  display: inline-block;
}

select{
  color-scheme: dark;

  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  color: rgba(229,231,235,0.95);
  background-color: rgba(0,0,0,0.28);
  border: 1px solid rgba(37,99,235,0.45);
  border-radius: 14px;
  padding: 10px 40px 10px 12px;
  outline: none;
  box-shadow: none;
}
.select-wrap::after{
  content: "▾";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: rgba(229,231,235,0.70);
  font-size: 14px;
}
select:hover{ border-color: rgba(245,158,11,0.45); }
select:focus{
  border-color: rgba(245,158,11,0.65);
  box-shadow: 0 0 0 3px rgba(245,158,11,0.18);
}
select:focus-visible{
  outline: 2px solid rgba(245,158,11,0.65);
  outline-offset: 2px;
}
select option, select optgroup{
  background-color: #0b1020 !important;
  color: #e5e7eb !important;
}

/* Chips */
.chips{
  display:flex;
  align-items:center;
  gap: 10px;
  flex-wrap: wrap;
}

.chip{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  font-size: 13px;
  color: rgba(229,231,235,0.92);
  white-space: nowrap;
}
.chip .dot{
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(229,231,235,0.35);
  box-shadow: 0 0 0 3px rgba(229,231,235,0.06);
}

/* status variants */
.chip.ok{
  border-color: rgba(34,197,94,0.35);
  background: rgba(34,197,94,0.10);
}
.chip.ok .dot{ background: var(--ok); box-shadow: 0 0 0 3px rgba(34,197,94,0.14); }

.chip.warn{
  border-color: rgba(245,158,11,0.35);
  background: rgba(245,158,11,0.10);
}
.chip.warn .dot{ background: var(--warn); box-shadow: 0 0 0 3px rgba(245,158,11,0.16); }

.chip.bad{
  border-color: rgba(239,68,68,0.35);
  background: rgba(239,68,68,0.10);
}
.chip.bad .dot{ background: var(--bad); box-shadow: 0 0 0 3px rgba(239,68,68,0.16); }

/* Grid */
.grid{
  display:grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
}
.col12{ grid-column: span 12; }
.col6{ grid-column: span 6; }

@media (max-width: 860px){
  .col6{ grid-column: span 12; }
}

/* ===== NAV GRID + NAV CARDS ===== */
.nav-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.nav-card{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;

  min-height: 64px; /* tap-friendly */
  padding: 14px 14px;
  border-radius: 18px;

  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--card2), rgba(255,255,255,0.03));
  box-shadow: 0 10px 22px rgba(0,0,0,0.22);

  transition: transform 120ms ease, border-color 160ms ease, background 160ms ease;
}

.nav-card:hover{
  transform: translateY(-1px);
  border-color: rgba(245,158,11,0.35);
  background: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.03));
}

.nav-card:active{ transform: translateY(0px); }

.nav-card .left{
  min-width: 0;
}

.nav-card .title{
  font-weight: 900;
  letter-spacing: 0.2px;
}

.nav-card .desc{
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
}

.nav-card .arrow{
  opacity: 0.70;
  flex: 0 0 auto;
}

/* ===== Chart stability + nicer panel ===== */
.chart-wrap{
  height: 270px;
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--chart-border);
  background:
    radial-gradient(900px 260px at 15% 10%, rgba(37,99,235,0.10), transparent 55%),
    radial-gradient(700px 240px at 85% 0%, rgba(245,158,11,0.08), transparent 55%),
    linear-gradient(180deg, var(--chart-panel2), var(--chart-panel));
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.04),
    0 12px 26px rgba(0,0,0,0.25);
  padding: 8px 10px 8px 10px;
}

.chart-wrap canvas{
  display:block;
  width:100% !important;
  height:100% !important;
}

/* =========================
   LORA/APRS UI (KV / DETAILS / FEED)
   ========================= */

/* KV (key-value) – poravnane vrstice */
.kv{
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.kv-row{
  display:flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 7px 0;
  border-bottom: 1px dashed rgba(255,255,255,0.10);
}
.kv-row:last-child{ border-bottom: 0; }

.kv-row .k{
  color: var(--muted);
  font-size: 13px;
}
.kv-row .v{
  font-family: var(--mono);
  color: rgba(229,231,235,0.95);
  font-size: 13px;
  text-align: right;
  white-space: nowrap;
}

/* DETAILS (RAW/DEBUG) */
.details{
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 14px;
  background: rgba(0,0,0,0.18);
  padding: 10px 12px;
}
.details > summary{
  cursor: pointer;
  list-style: none;
  font-weight: 800;
  color: rgba(229,231,235,0.92);
}
.details > summary::-webkit-details-marker{ display:none; }
.details-body{ margin-top: 10px; }

.mini{
  color: var(--muted2);
  font-size: 12px;
  margin-bottom: 8px;
}
.raw-json{
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.22);
  color: rgba(229,231,235,0.92);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.35;
  overflow: auto;
  max-height: 320px;
}

/* FEED – brez bulletov, bolj “log” izgled */
.feed{
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
}
.feed li{
  padding: 10px 0;
  border-top: 1px solid rgba(255,255,255,0.10);
}
.feed li:first-child{ border-top: 0; padding-top: 2px; }

.feed .t{
  font-family: var(--mono);
  color: var(--muted2);
  font-size: 12px;
}
.feed .m{
  margin-top: 4px;
  color: rgba(229,231,235,0.92);
  font-size: 13px;
  word-break: break-word;
}

/* =========================
   RESPONSIVE
   ========================= */

/* Responsive logo + NAV collapse */
@media (max-width: 860px){
  .bg-logo{
    width: 190px;
    height: 190px;
    left: 12px;
    top: 12px;
    padding: 9px;
    border-radius: 24px;
    opacity: 0.88;
  }

  .nav-grid{ grid-template-columns: 1fr; }
}

/* KV: na ozkih zaslonih vrednosti pod ključ */
@media (max-width: 520px){
  .kv-row{
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .kv-row .v{
    text-align: left;
    white-space: normal;
    word-break: break-word;
  }
}

/* Phone */
@media (max-width: 560px){
  .bg-logo{
    width: 155px;
    height: 155px;
    left: 10px;
    top: 10px;
    padding: 8px;
    border-radius: 22px;
    opacity: 0.72;
  }

  .topbar{
    flex-direction: column;
    align-items: flex-start;
  }
  .actions{ width: 100%; }

  .h1{ font-size: 20px; }
  .h2{ font-size: 13px; }
  .chip{ font-size: 12px; }
  .btn{ font-size: 13px; }
  .chart-wrap{ height: 250px; }
}

@media (max-width: 420px){
  .bg-logo{ opacity: 0.45; }
  .nav-card .arrow{ display:none; }
}

/* ŠIRŠI LAYOUT na velikih zaslonih (manj praznine desno) */
@media (min-width: 1400px){
  .container{ max-width: 1400px; }
}