:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --line: #334155;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --brand: #fbbf24;
  --brand-dark: #b45309;
}
/* Svetla tema — prevpiše temne barve. Aktivira se z <body class="light">. */
body.light {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --line: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --brand-dark: #92400e;
}
body.light pre.transcript { background: rgba(15, 23, 42, 0.04); }
body.light .field-row .mono { background: rgba(15, 23, 42, 0.05); }
body.light .clickable:hover { background: rgba(15, 23, 42, 0.05); }
body.light .list li { border-color: var(--line); }
.timer-display {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 6px 0 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 96px;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 5;
}
.topbar h1 { margin: 0; font-size: 20px; }
.sub { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px 18px 0; position: sticky; top: 61px; background: var(--bg); z-index: 4; }
.tabs button {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}
.tabs button.active { color: var(--text); border-color: var(--brand); }
#admin-tab { color: var(--brand); border-bottom-color: var(--brand); }
#admin-tab.active { color: var(--brand-dark); background: var(--brand); border-color: var(--brand); }
.seg { display: flex; gap: 4px; margin-bottom: 12px; }
.seg button {
  flex: 1;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.seg button.active { background: var(--brand); color: var(--brand-dark); border-color: var(--brand); }
.dim { opacity: 0.55; }
ul.plain { list-style: none; padding: 0; margin: 4px 0 8px; }
ul.plain li { padding: 2px 0; }
pre.transcript { white-space: pre-wrap; word-break: break-word; font-size: 12px; color: var(--muted); background: rgba(255,255,255,0.03); padding: 8px; border-radius: 8px; max-height: 240px; overflow: auto; }
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--line);
  color: var(--muted);
  margin-left: 8px;
}
.badge.warn { background: rgba(245, 158, 11, 0.18); color: #f59e0b; }
.badge.danger { background: rgba(239, 68, 68, 0.18); color: #f87171; }
.badge.ok { background: rgba(34, 197, 94, 0.18); color: #4ade80; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 500;
  padding: 2px 9px; border-radius: 999px;
  background: var(--line); color: var(--muted);
}
main { padding: 16px 18px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.bold { font-weight: 700; }
.list { list-style: none; padding: 0; margin: 0; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
}
.card-title { font-weight: 600; margin-bottom: 4px; }
.card.archived { opacity: 0.55; }
.notice {
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid var(--brand);
  color: var(--brand);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  margin-bottom: 10px;
}
.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
}
.ghost.small { padding: 4px 10px; font-size: 13px; }
.langseg { display: flex; gap: 2px; }
.langseg button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}
.langseg button.active { background: var(--brand); color: var(--brand-dark); border-color: var(--brand); }
.primary {
  background: var(--brand);
  color: var(--brand-dark);
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.form input {
  width: 100%;
  margin: 6px 0;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 16px;
}
.form textarea {
  width: 100%;
  margin: 6px 0;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 16px;
  min-height: 70px;
  resize: vertical;
  font-family: inherit;
}
.form select {
  width: 100%;
  margin: 6px 0;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 16px;
}
.clickable { cursor: pointer; }
.clickable:hover { background: rgba(255,255,255,0.04); }
.ghost.danger { color: #f87171; border-color: #7f1d1d; }
.form .primary { width: 100%; margin-top: 8px; }
.field { margin-bottom: 10px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.field .row { display: flex; gap: 6px; align-items: center; }
.field .row input, .field .row textarea { margin: 0; flex: 1; }
.field .row .ghost.small { flex: 0 0 auto; }
.items { border-top: 1px dashed var(--line); margin-top: 8px; padding-top: 8px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; white-space: nowrap; }
.field-row { display: flex; gap: 6px; align-items: center; margin-bottom: 4px; }
.field-row input { flex: 1; min-width: 0; margin: 0; }
.field-row select { flex: 0 0 96px; margin: 0; }
.field-row .mono { flex: 0 0 auto; padding: 2px 6px; border-radius: 4px; background: rgba(255,255,255,0.06); }
.items-row { margin-bottom: 4px; }
.items-row input { margin: 0; flex: 1; min-width: 0; }
.items-row .w60 { flex: 0 0 60px; }
.items-row .w70 { flex: 0 0 70px; }
.row { display: flex; gap: 8px; }
.row input { flex: 1; }
.row-space { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sig-pad {
  width: 100%;
  height: 130px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  touch-action: none;
  margin: 6px 0;
  display: block;
}
.sig-img { max-width: 130px; max-height: 60px; background: #fff; border-radius: 4px; padding: 2px; }
.sig-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.sig-name { flex: 1; font-size: 14px; }
.body-editor { margin-top: 6px; }
.body-editor textarea { width: 100%; min-height: 220px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 16px; line-height: 1.5; margin-top: 6px; }
.body-editor .row { margin-top: 6px; }
.primary.small { padding: 8px 12px; font-size: 13px; width: auto; margin-top: 0; }
input[type="date"], input[type="time"], input[type="month"] { color-scheme: dark; }
.mic {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: var(--brand);
  color: var(--brand-dark);
  font-size: 26px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  z-index: 10;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.mic.rec { background: #ef4444; color: #fff; animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.5); } 50% { box-shadow: 0 0 0 14px rgba(239,68,68,0); } }
.sso { max-width: 360px; margin: 15vh auto; text-align: center; padding: 0 20px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.thumb { position: relative; width: 72px; height: 72px; }
.thumb img, .thumb-img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.thumb-del {
  position: absolute;
  top: -6px; right: -6px;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: none;
  background: #ef4444;
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  background: var(--brand);
  color: var(--brand-dark);
  padding: 10px 16px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  z-index: 20;
  white-space: nowrap;
}

/* ---------- RETENTION DOWNLOAD-GATE ---------- */
.retention-gate {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.82);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(4px);
}
.retention-gate-card {
  max-width: 440px;
  width: 100%;
  background: var(--card, #fff);
  border-radius: 16px;
  padding: 28px 24px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.retention-gate-icon { font-size: 44px; margin-bottom: 8px; }
.retention-gate-card h2 { margin: 0 0 12px; font-size: 20px; }
.retention-gate-card p { margin: 0 0 12px; font-size: 14px; line-height: 1.5; }
.retention-gate-count { font-size: 15px; }
.retention-gate-count b { color: #dc2626; }
.retention-gate-card .primary { width: 100%; margin-top: 16px; padding: 14px; font-size: 16px; }

/* ---------- MOBILNO / PWA (Sprint 2) ---------- */
/* 3.1 iOS Safari auto-zoom: form controls min 16px */
input, select, textarea { font-size: 16px; }
/* 3.2 safe-area (zarezi na iPhone/iPad) */
body {
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}
.topbar { padding-top: calc(16px + env(safe-area-inset-top, 0px)); }
.mic { bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
/* 3.9 Install dugme (beforeinstallprompt) */
#install-btn { display: none; }
#install-btn.show { display: inline-flex; }
/* 4.0 Pretraga dnevnika (Faza 2.5) */
.search-input { width: 100%; padding: 12px 14px; margin: 4px 0 12px; box-sizing: border-box; border: 1px solid var(--line, #ddd); border-radius: 10px; background: var(--card, #fff); color: var(--text, #111); font-size: 16px; }
