/* Advent snimanja — stil. Sistemski font, svijetla/tamna tema, mobitel prvi. */

:root {
  color-scheme: light dark;
  --bg: #fff; --panel: #f2f2f7; --text: #111; --muted: #6b6b70; --line: #e3e3e8;
  --accent: #d32f2f; --on-accent: #fff;
  --koncert: #f08a24; --posebno: #1e9bd7; --tema: #d6409f;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #000; --panel: #1c1c1e; --text: #f5f5f7; --muted: #98989f; --line: #2c2c2e; --accent: #ff5a4f; }
}

* { box-sizing: border-box; margin: 0; }
html { overscroll-behavior: none; }
body {
  height: 100dvh; display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg); color: var(--text);
  font: 16px/1.35 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
header, main, nav { width: 100%; max-width: 720px; margin-inline: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; border-radius: var(--radius); -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- zaglavlje ---------- */
header { padding: env(safe-area-inset-top) 12px 0; }
.bar { display: flex; align-items: center; gap: 4px; min-height: 52px; }
.bar h1 { font-size: 20px; font-weight: 700; white-space: nowrap; }
.bar h1::first-letter, main h2::first-letter { text-transform: uppercase; }
.bar button { min-width: 40px; min-height: 44px; padding: 0 6px; color: var(--accent); font-weight: 600; }
#prev, #next { font-size: 28px; line-height: 1; }
.grow { flex: 1; }
body:not([data-tab='cal']) .nav { display: none; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 36px; padding: 0 14px; border-radius: 18px; background: var(--panel); font-size: 14px; }
.chip[aria-pressed='true'] { background: var(--text); color: var(--bg); }
#offline { padding: 6px 10px; margin-bottom: 8px; border-radius: 8px; background: var(--panel); color: var(--muted); font-size: 13px; }

/* ---------- sadržaj ---------- */
main { flex: 1; overflow-y: auto; padding: 0 12px 88px; -webkit-overflow-scrolling: touch; }
main h2 { font-size: 14px; font-weight: 600; color: var(--muted); padding: 16px 4px 6px; }
main h2.past { opacity: .55; }
.hint { color: var(--muted); font-size: 14px; padding: 8px 4px; }
.empty { color: var(--muted); text-align: center; padding: 32px 0; }

/* kalendar: mjeseci su vodoravna traka sa scroll-snapom, pa listanje prati prst */
.weekdays, .month { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; }
.weekdays { font-size: 12px; color: var(--muted); padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.months { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
.months::-webkit-scrollbar { display: none; }
.month { flex: 0 0 100%; scroll-snap-align: start; scroll-snap-stop: always; align-content: start; }
.day { display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 54px; padding: 6px 0; border-radius: 0; border-bottom: 1px solid var(--line); }
.day span { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; font-size: 17px; }
.day.today span { color: var(--accent); font-weight: 700; }
.day.sel span { background: var(--text); color: var(--bg); font-weight: 600; }
.day.sel.today span { background: var(--accent); color: var(--on-accent); }
.day em { display: flex; gap: 3px; height: 6px; }
.day em b { width: 6px; height: 6px; border-radius: 50%; }

.c-koncert { background: var(--koncert); }
.c-posebno { background: var(--posebno); }
.c-tema { background: var(--tema); }

/* red događaja */
.row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 56px; padding: 8px 10px 8px 0; margin-bottom: 6px; background: var(--panel); text-align: left; overflow: hidden; }
.row > i { align-self: stretch; width: 5px; margin: -8px 0; flex: none; }
.row .when { width: 44px; flex: none; font-variant-numeric: tabular-nums; font-size: 14px; color: var(--muted); }
.row .what { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row .what b { font-weight: 600; overflow-wrap: anywhere; }
.row .what small { color: var(--muted); font-size: 13px; }
.row.off b { text-decoration: line-through; color: var(--muted); }
.pill { flex: none; padding: 3px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; background: var(--line); color: var(--muted); }
.s-zatrazeno { background: #f5a524; color: #111; }
.s-potvrdeno { background: #1f9d55; color: #fff; }
.s-snimljeno { background: #1e6fd9; color: #fff; }
.s-isporuceno { background: #6b4fd8; color: #fff; }
.s-odobreno { background: var(--text); color: var(--bg); }
.request { margin-bottom: 14px; }
.request > .primary { width: 100%; }

/* ---------- gumbi i forme ---------- */
.primary { background: var(--accent); color: var(--on-accent); font-weight: 600; min-height: 44px; padding: 0 16px; }
.danger { color: var(--accent); min-height: 44px; width: 100%; margin-top: 8px; }
.fab { position: fixed; right: max(16px, calc(50vw - 344px)); bottom: calc(76px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: 32px; line-height: 1; box-shadow: 0 4px 14px rgb(0 0 0 / .25); }

nav { display: flex; border-top: 1px solid var(--line); background: var(--bg); padding-bottom: env(safe-area-inset-bottom); }
nav button { flex: 1; min-height: 56px; font-size: 13px; color: var(--muted); border-radius: 0; }
nav button[aria-current='true'] { color: var(--accent); font-weight: 700; }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--on-accent); font-size: 12px; }

dialog { width: 100%; max-width: 560px; max-height: 92dvh; margin: auto auto 0; padding: 0 16px calc(20px + env(safe-area-inset-bottom)); border: 0; border-radius: 16px 16px 0 0; background: var(--bg); color: var(--text); overflow-y: auto; }
@media (min-width: 600px) { dialog { margin: auto; border-radius: 16px; } }
dialog::backdrop { background: rgb(0 0 0 / .45); }
.sheet-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 0; margin-bottom: 4px; background: var(--bg); }
.sheet-head button:not(.primary) { min-height: 44px; color: var(--accent); }
.sheet-head span { width: 60px; }
label { display: block; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
input, select, textarea { display: block; width: 100%; min-height: 44px; margin-top: 4px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); font-size: 16px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.inline { display: flex; gap: 8px; margin: 8px 0 12px; }
.inline input, .inline select { margin: 0; min-width: 0; }
.inline button { flex: none; min-height: 44px; padding: 0 14px; color: var(--accent); font-weight: 600; }
.inline .primary { color: var(--on-accent); }
dialog h3 { font-size: 15px; margin: 16px 0 6px; }
.comment { padding: 8px 12px; margin-bottom: 6px; border-radius: 10px; background: var(--panel); font-size: 15px; overflow-wrap: anywhere; }
.comment small { color: var(--muted); }
code { font: 600 16px ui-monospace, monospace; letter-spacing: .08em; user-select: all; }

.person { display: flex; align-items: center; gap: 6px; min-height: 52px; border-bottom: 1px solid var(--line); }
.person span { flex: 1; display: flex; flex-direction: column; }
.person small { color: var(--muted); }
.person.off b { text-decoration: line-through; color: var(--muted); }
.person button, [data-logout] { min-height: 44px; padding: 0 12px; color: var(--accent); }
[data-logout] { width: 100%; margin-top: 12px; }

#login { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 24px; background: var(--bg); }
#login form { display: grid; gap: 12px; width: 100%; max-width: 320px; text-align: center; justify-items: center; }
#login img { border-radius: 16px; }
#login input { text-align: center; text-transform: uppercase; letter-spacing: .2em; font-weight: 600; }
#login .primary { width: 100%; }
#login p { color: var(--muted); }

#toast { position: fixed; left: 50%; bottom: calc(140px + env(safe-area-inset-bottom)); translate: -50%; z-index: 20; max-width: 90vw; padding: 10px 16px; border-radius: 20px; background: var(--text); color: var(--bg); font-size: 14px; }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
