/* Demo mapa potencijalnog rizika od požara.
   Boje kategorija rizika (--r0..--r3) su iste u dnevnoj i noćnoj temi; menja se
   samo okruženje. Statusi izvora namerno ne koriste zelenu/žutu/narandžastu/
   crvenu, da se ne pomešaju sa rizikom. */

:root {
  --r0: #2e9e4f;
  --r1: #f2c200;
  --r2: #f07c00;
  --r3: #d7191c;
  --fire: #9b2fd6;
  --fire-ring: #ffffff;
  --na: #8a94a6;

  --bg: #eef2f7;
  --surface: #ffffff;
  --surface-2: #f5f7fb;
  --text: #142033;
  --muted: #5b6678;
  --line: #dde3ec;
  --accent: #1f5fd6;
  --accent-soft: #e6eefc;
  --ok: #0e6f86;
  --warn: #8a5a00;
  --err: #5c2a7a;
  --shadow: 0 8px 28px -10px rgba(20, 32, 51, 0.28);
  --radius: 12px;
  --topbar-h: 60px;
  --timeline-h: 78px;
  --panel-w: 380px;
  color-scheme: light;
}

body[data-ui="night"] {
  --bg: #0c111b;
  --surface: #151c2a;
  --surface-2: #1b2435;
  --text: #e7ecf4;
  --muted: #9aa6ba;
  --line: #2a3448;
  --accent: #7aa7ff;
  --accent-soft: #1d2b47;
  --ok: #5cc6dc;
  --warn: #e3b25a;
  --err: #c99ae8;
  --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

.topbar {
  height: var(--topbar-h);
  flex-shrink: 0;
}

.spacer {
  flex: 1;
}

/* ---------- gornja traka ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-shrink: 1;
}

.brand-logo img {
  height: 28px;
  display: block;
}

body[data-ui="night"] .brand-logo img {
  filter: brightness(0) invert(1);
}

.brand-text {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.brand-text h1 {
  margin: 0;
  min-width: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.demo-badge {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1.5px solid var(--accent);
  color: var(--accent);
}

.map-views {
  position: absolute;
  z-index: 500;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 24px - 2 * 230px);
}

.views {
  display: flex;
  gap: 2px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.views button {
  border: 0;
  background: transparent;
  padding: 6px 10px;
  border-radius: 7px;
  font-weight: 500;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}

.views button:hover {
  color: var(--text);
}

.views button[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

body[data-ui="night"] .views button[aria-pressed="true"] {
  color: #0c111b;
}

.views-select {
  display: none;
}

/* Kad dugmad ne staju u širinu mape (app.js meri), prikazuje se padajući meni. */
.map-views.compact .views {
  display: none;
}

.map-views.compact .views-select {
  display: block;
}

.views-select select {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-weight: 600;
}

.clock {
  text-align: right;
  flex-shrink: 0;
  line-height: 1.2;
}

.clock-time {
  font-weight: 700;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.clock-meta {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}

.sources-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.sources-pill .s {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.st-icon {
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  flex-shrink: 0;
}

.st-ok {
  background: var(--ok);
}

.st-stale {
  background: transparent;
  color: var(--warn);
  border: 1.5px dashed var(--warn);
}

.st-error {
  background: var(--err);
}

.st-loading {
  background: transparent;
  border: 1.5px solid var(--muted);
  color: var(--muted);
}

.panel-toggle {
  display: none;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 8px;
  width: 38px;
  height: 38px;
  padding: 8px;
  cursor: pointer;
  flex-shrink: 0;
}

/* ---------- napomena o demo karakteru ---------- */

.disclaimer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 16px;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}

.disclaimer svg {
  width: 18px;
  height: 18px;
  color: var(--accent);
  flex-shrink: 0;
}

.disclaimer p {
  margin: 0;
  flex: 1;
  min-width: 0;
}

.disclaimer[hidden] {
  display: none;
}

.disc-short {
  display: none;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 6px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
}

.icon-btn:hover {
  color: var(--text);
  background: var(--surface-2);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.link {
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}

.disclaimer,
.alert,
.timeline {
  flex-shrink: 0;
}

.alert {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  border-left: 4px solid var(--err);
}

.alert.warn {
  border-left-color: var(--warn);
}

/* ---------- mapa i panel ---------- */

.body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr var(--panel-w);
  min-height: 0;
}

.map-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
}

#map {
  position: absolute;
  inset: 0;
  background: #a9b8c8;
}

body[data-ui="night"] #map {
  background: #0b1220;
}

.leaflet-container {
  font-family: inherit;
}

.night-tiles {
  filter: brightness(0.6) saturate(0.75) contrast(1.05);
}

.map-tools {
  position: absolute;
  z-index: 510;
  top: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.map-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  cursor: pointer;
}

.map-btn svg {
  width: 20px;
  height: 20px;
}

.map-btn .i-exit,
body.map-full .map-btn .i-enter {
  display: none;
}

body.map-full .map-btn .i-exit {
  display: block;
}

.full-when {
  display: none;
  position: absolute;
  z-index: 510;
  left: 12px;
  bottom: 12px;
  max-width: calc(100% - 24px - 60px);
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.full-when:empty {
  visibility: hidden;
}

.map-card {
  position: absolute;
  z-index: 500;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px 12px;
}

.card-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.light-title {
  margin-top: 10px;
}

.layers {
  top: 12px;
  left: 12px;
  width: 218px;
  /* ostaje mesta za skupljenu legendu ispod */
  max-height: calc(100% - 70px);
  overflow: auto;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  cursor: pointer;
  font-size: 13px;
}

.check input {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  margin: 0;
}

.effis-opacity {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  padding: 2px 0 2px 23px;
}

.effis-opacity[hidden] {
  display: none;
}

.effis-opacity input {
  flex: 1;
  min-width: 0;
  accent-color: var(--accent);
}

.seg {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2px;
}

.seg button {
  flex: 1;
  border: 0;
  background: transparent;
  border-radius: 6px;
  padding: 4px 0;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
}

.seg button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.light-note {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 5px;
}

.legend {
  left: 12px;
  bottom: 12px;
  width: 262px;
  /* --layers-bottom postavlja fitCards u app.js */
  max-height: calc(100% - var(--layers-bottom, 290px) - 24px);
  overflow: auto;
  padding: 8px 12px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
}

.card-head .card-title {
  margin: 0;
}

.card-head svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
  transition: transform 0.15s;
}

.map-card.collapsed .card-head svg {
  transform: rotate(-90deg);
}

.map-card.collapsed .card-body {
  display: none;
}

/* zaglavlje skupljene kartice se nikad ne seče */
.map-card.collapsed {
  max-height: none;
  overflow: visible;
}

.card-body {
  margin-top: 8px;
}

.lg-group + .lg-group {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

.lg-head {
  font-weight: 600;
  font-size: 12.5px;
  margin-bottom: 5px;
}

.lg-row {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  min-height: 26px;
}

.lg-row .sym {
  display: grid;
  place-items: center;
}

.lg-row .rng {
  color: var(--muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.lg-note {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 4px;
}

.lg-swatch {
  width: 22px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

/* ---------- desni panel ---------- */

.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
  border-left: 1px solid var(--line);
}

.tabs {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 0 8px;
  flex-shrink: 0;
}

.panel-close {
  display: none;
}

/* Bez ovoga dugme nasleđuje flex: 1 i padding od .tabs button. */
.tabs .panel-close {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  margin-left: 4px;
  padding: 7px;
  border-bottom: 0;
}

.tabs button {
  flex: 1;
  border: 0;
  background: none;
  padding: 11px 4px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
}

.tabs button[aria-selected="true"] {
  color: var(--text);
  font-weight: 600;
  border-bottom-color: var(--accent);
}

.tab-body {
  flex: 1;
  overflow: auto;
  padding: 14px 16px 24px;
}

.sec + .sec {
  margin-top: 18px;
}

.sec h2 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px;
}

.sec h3 {
  font-size: 15px;
  margin: 0 0 4px;
}

.sub {
  color: var(--muted);
  font-size: 12.5px;
}

.hint {
  color: var(--muted);
  font-size: 12.5px;
  margin: 6px 0 0;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 30px 10px;
}

.empty svg {
  width: 34px;
  height: 34px;
  margin-bottom: 6px;
  opacity: 0.6;
}

/* raspodela ćelija po kategoriji */
.dist {
  display: flex;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.dist span {
  display: block;
  height: 100%;
}

.dist-legend {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px 12px;
  margin-top: 8px;
  font-size: 12.5px;
}

.dist-legend div {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dist-legend b {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.list li + li {
  border-top: 1px solid var(--line);
}

.list button {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  background: none;
  padding: 7px 4px;
  text-align: left;
  cursor: pointer;
  border-radius: 6px;
}

.list button:hover {
  background: var(--surface-2);
}

.list .val {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.list .meta {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
}

/* kartica rizika u detaljima */
.risk-card {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.risk-card .lvl {
  font-size: 17px;
  font-weight: 700;
}

.risk-card.na {
  border-style: dashed;
}

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  vertical-align: 1px;
}

.badge.warn {
  color: var(--warn);
  border-color: var(--warn);
  border-style: dashed;
}

.kv {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 12px;
  margin: 0;
  font-size: 13px;
}

.kv dt {
  color: var(--muted);
}

.kv dd {
  margin: 0;
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.kv dd.na {
  color: var(--muted);
  font-weight: 400;
  font-style: italic;
}

.idx-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.idx-table th,
.idx-table td {
  padding: 7px 4px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.idx-table th {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.idx-table td.num {
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.idx-table .src {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 400;
}

.compare {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 12.5px;
}

details.more {
  margin-top: 8px;
  font-size: 12.5px;
}

details.more summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
}

.spark {
  display: block;
  width: 100%;
  height: 46px;
  margin-top: 4px;
}

.spark-row {
  margin-top: 10px;
}

.spark-row .sub {
  display: flex;
  justify-content: space-between;
}

.wind-arrow {
  display: inline-block;
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  margin-right: 3px;
}

/* izvori */
.src-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}

.src-card + .src-card {
  margin-top: 10px;
}

.src-card header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.src-card header b {
  flex: 1;
}

.src-status {
  font-size: 12px;
  font-weight: 600;
}

.src-card .kv {
  font-size: 12.5px;
}

.src-err {
  margin-top: 6px;
  font-size: 12px;
  color: var(--err);
}

.btn {
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 8px;
  padding: 7px 12px;
  font-weight: 600;
  cursor: pointer;
}

.btn:hover {
  border-color: var(--accent);
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* metodologija */
.prose p,
.prose li {
  font-size: 13px;
}

.prose ul {
  padding-left: 18px;
  margin: 6px 0;
}

.formula {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  margin: 8px 0;
}

/* ---------- vremenska linija ---------- */

.timeline {
  height: var(--timeline-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.tl-controls {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.btn.icon {
  width: 40px;
  height: 40px;
  padding: 9px;
  display: grid;
  place-items: center;
}

.btn.icon svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  stroke: none;
}

.btn .i-pause,
.btn.playing .i-play {
  display: none;
}

.btn.playing .i-pause {
  display: block;
}

.btn.now {
  height: 40px;
}

.btn.now.live {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

body[data-ui="night"] .btn.now.live {
  color: #0c111b;
}

.tl-main {
  flex: 1;
  min-width: 0;
}

.tl-label {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 2px;
  min-width: 0;
}

.tl-when {
  flex-shrink: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tl-mode {
  min-width: 0;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tl-track {
  position: relative;
}

#tlRange {
  width: 100%;
  margin: 0;
  accent-color: var(--accent);
  height: 22px;
  cursor: pointer;
}

.tl-ticks {
  position: relative;
  height: 16px;
  font-size: 11px;
  color: var(--muted);
  margin: 0 8px;
}

.tl-ticks span {
  position: absolute;
  transform: translateX(-50%);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.tl-ticks span.day {
  font-weight: 700;
  color: var(--text);
}

/* ---------- simboli na mapi ---------- */

.sym-icon {
  background: none;
  border: 0;
}

.sym-icon svg,
.lg-row .sym svg {
  display: block;
  overflow: visible;
}

body[data-ui="night"] .sym-icon svg {
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.45));
}

body[data-ui="night"] .fire-icon svg {
  filter: drop-shadow(0 0 5px rgba(214, 140, 255, 0.85));
}

.city-label {
  background: rgba(255, 255, 255, 0.92);
  border: 0;
  border-radius: 5px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  padding: 1px 6px;
  font-size: 12px;
  font-weight: 600;
  color: #142033;
}

.city-label::before {
  display: none;
}

body[data-ui="night"] .city-label {
  background: rgba(21, 28, 42, 0.92);
  color: #e7ecf4;
}

.leaflet-tooltip.hover-tip {
  font-size: 12.5px;
  border-radius: 7px;
  padding: 5px 8px;
}

.leaflet-control-attribution {
  font-size: 10.5px;
}

/* ---------- ugrađeni prikaz (?embed=1) ---------- */

body.embed .brand-logo,
body.embed .demo-badge,
body.embed .embed-howto {
  display: none;
}

.embed-origin {
  display: none;
  flex-shrink: 0;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.embed-origin:hover {
  border-color: var(--accent);
  color: var(--accent);
}

body.embed .embed-origin {
  display: inline-block;
}

@media (max-width: 760px) {
  .embed-howto {
    display: none;
  }
}

/* ---------- mapa preko celog ekrana ---------- */

body.map-full .topbar,
body.map-full .disclaimer,
body.map-full .alert,
body.map-full .timeline,
body.map-full .panel,
body.map-full .map-views,
body.map-full .map-card {
  display: none;
}

body.map-full .body {
  grid-template-columns: 1fr;
}

body.map-full .full-when {
  display: block;
}

/* ---------- tablet i uži ekrani ---------- */


@media (max-width: 1100px) {
  :root {
    --panel-w: 360px;
  }

  .body {
    grid-template-columns: 1fr;
  }

  .panel {
    position: fixed;
    z-index: 1000;
    top: var(--topbar-h);
    right: 0;
    bottom: var(--timeline-h);
    width: min(var(--panel-w), 92vw);
    box-shadow: var(--shadow);
    transform: translateX(105%);
    transition: transform 0.2s ease;
  }

  body.panel-open .panel {
    transform: none;
  }

  .panel-toggle,
  .panel-close {
    display: grid;
  }

  .topbar {
    gap: 12px;
  }

  .sources-pill .lbl {
    display: none;
  }
}

@media (max-width: 900px) {
  .clock-meta {
    display: none;
  }
}

@media (max-width: 480px) {
  .clock {
    display: none;
  }

  .sources-pill {
    margin-left: auto;
  }
}

/* ---------- telefon: panel kao donji list, kartice se skupljaju ---------- */

@media (max-width: 760px) {
  :root {
    --topbar-h: 52px;
    --timeline-h: 60px;
  }

  .topbar {
    gap: 10px;
    padding: 0 10px 0 12px;
  }

  .brand,
  .brand-text {
    flex-shrink: 1;
    min-width: 0;
  }

  .demo-badge {
    flex-shrink: 0;
  }

  .brand-text h1 {
    min-width: 0;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .brand-logo {
    display: none;
  }

  .spacer {
    display: none;
  }

  .clock {
    margin-left: auto;
  }

  .clock-time {
    font-size: 15px;
  }

  .clock-meta {
    display: none;
  }

  .sources-pill .lbl {
    display: none;
  }

  .disclaimer {
    gap: 8px;
    padding: 4px 6px 4px 12px;
    font-size: 12px;
  }

  .disc-more {
    display: none;
  }

  .disc-short {
    display: inline;
  }

  .alert {
    padding: 6px 12px;
    font-size: 12px;
  }

  .map-views {
    top: 10px;
    left: 10px;
    transform: none;
    max-width: calc(100% - 20px - 50px);
  }

  .views-select select {
    padding: 7px 10px;
    max-width: 100%;
  }

  .map-tools {
    top: 10px;
    right: 10px;
  }

  .layers {
    top: 56px;
    left: 10px;
    width: auto;
    min-width: 0;
    max-width: calc(100% - 20px);
    max-height: calc(100% - 66px - 60px);
    overflow: auto;
  }

  .layers:not(.collapsed) {
    width: 230px;
  }

  .legend {
    left: 10px;
    bottom: 10px;
    width: auto;
    max-height: calc(100% - var(--layers-bottom, 66px) - 20px);
  }

  .legend:not(.collapsed) {
    width: min(262px, calc(100% - 20px - 50px));
  }

  .map-card.collapsed {
    padding: 8px 10px;
  }

  .map-card.collapsed .card-head {
    gap: 6px;
  }

  .full-when {
    left: 10px;
    bottom: 10px;
  }

  .panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    height: min(60dvh, 560px);
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: 16px 16px 0 0;
    transform: translateY(105%);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .tabs {
    padding: 0 4px 0 6px;
  }

  .tabs button[role="tab"] {
    padding: 13px 2px 11px;
    font-size: 12.5px;
  }

  .timeline {
    gap: 10px;
    padding: 0 12px;
    padding-bottom: env(safe-area-inset-bottom);
    height: calc(var(--timeline-h) + env(safe-area-inset-bottom));
  }

  .tl-controls {
    gap: 6px;
  }

  .btn.icon,
  .btn.now {
    height: 36px;
  }

  .btn.icon {
    width: 36px;
    padding: 8px;
  }

  .btn.now {
    padding-left: 10px;
    padding-right: 10px;
  }

  .tl-label {
    margin-bottom: 0;
  }

  .tl-when {
    flex-shrink: 1;
    min-width: 0;
    font-size: 12.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .tl-mode {
    display: none;
  }

  .tl-ticks {
    height: 14px;
    font-size: 10px;
  }

  .tl-ticks span:not(.day) {
    display: none;
  }

  .leaflet-control-zoom {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .panel,
  .card-head svg {
    transition: none;
  }
}
