/* Белград 24.10–01.11 — дизайн: туман над Дунаем, чернила, красный ГСП; узкий гротеск табличек остановок; отметка = паспортный штамп «БИЛИ» */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

@font-face {
  font-family: 'Sofia XC';
  src: url('/fonts/SofiaSansExtraCondensed.ttf') format('truetype');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --fog: #edeff1;            /* магла — фон */
  --paper: #ffffff;
  --ink: #15202b;            /* Дунав ноћу */
  --ink-60: #5b6670;
  --ink-30: #b4bcc4;
  --hair: #dce0e4;
  --red: #c8202e;            /* трамвај ГСП / застава */
  --red-soft: #fbe7e9;
  --sava: #2b7a80;           /* нить маршрута, транспорт */
  --sava-soft: #e3f0f1;
  --kesten: #b9742a;         /* кестен — оценки, предупреждения */
  --kesten-soft: #f7ebdc;
  --kesten-text: #8a5a1e;    /* кестен для мелкого текста (контраст AA) */
  --stamp: #33408f;          /* мастило пограничного штампа */
  --tint-m: #eaf1ee;         /* утро — свет */
  --tint-d: #f4f0e7;         /* день — листва */
  --tint-e: #ebeaf3;         /* после заката */
  --disp: 'Sofia XC', 'Arial Narrow', 'Roboto Condensed', 'Helvetica Neue', sans-serif;
  --line-w: 2px;
  --dot-x: 32px;             /* ось маршрутной нити */
  --r: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fog: #101316; --paper: #191d22;
    --ink: #eceef1; --ink-60: #9aa3ac; --ink-30: #4f5862; --hair: #2a3038;
    --red: #e0404c; --red-soft: #3a1f22;
    --sava: #4aa3a9; --sava-soft: #1b2d2f;
    --kesten: #d59a4a; --kesten-soft: #332617; --kesten-text: #d59a4a;
    --stamp: #8b95e6;
    --tint-m: #171f1c; --tint-d: #221f19; --tint-e: #1c1b27;
  }
}

html { font-size: 16px; color-scheme: light dark; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", sans-serif;
  background: var(--fog);
  color: var(--ink);
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
  font-feature-settings: "tnum";
}
.hidden { display: none !important; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
a { color: inherit; }

/* ---------- вход: табличка остановки ---------- */
.login { position: fixed; inset: 0; background: var(--fog); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.login-box { width: min(360px, 92vw); background: var(--paper); border: 1px solid var(--hair); border-radius: 14px; padding: 26px 24px 24px; text-align: center; box-shadow: 0 10px 40px rgba(20,30,40,.08); position: relative; overflow: hidden; }
.login-box::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: var(--red); }
.login-city { font-family: var(--disp); font-weight: 800; font-size: 58px; line-height: .95; letter-spacing: 1px; text-transform: uppercase; color: var(--ink); margin-top: 6px; }
.login-dates { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 8px 0 6px; font-family: var(--disp); font-weight: 700; font-size: 20px; letter-spacing: 1px; color: var(--red); }
.login-dates i { flex: 0 0 44px; height: 2px; background: var(--red); position: relative; }
.login-dates i::after { content: ''; position: absolute; right: -1px; top: -4px; border: 5px solid transparent; border-left: 7px solid var(--red); }
.login-box h1 { font-size: 15px; font-weight: 600; color: var(--ink-60); letter-spacing: .2px; margin-bottom: 4px; }
.login-box p.who-hint { font-size: 13.5px; color: var(--ink-60); margin: 2px 0 14px; }
.login-box input { width: 100%; padding: 13px; border-radius: var(--r); border: 1.5px solid var(--hair); background: var(--fog); color: var(--ink); font-size: 18px; text-align: center; margin: 14px 0 10px; }
.login-box input:focus { outline: 2px solid var(--red); outline-offset: 1px; border-color: transparent; }
.login-box button { width: 100%; padding: 13px; border-radius: var(--r); font-size: 16px; font-weight: 700; background: var(--ink); color: var(--paper); }
.login-err { margin-top: 10px; color: var(--red); min-height: 20px; font-size: 14px; }
#who .login-box h1 { font-size: 20px; font-weight: 800; color: var(--ink); }

/* ---------- шапка ---------- */
header { position: sticky; top: 0; z-index: 20; background: var(--paper); border-bottom: 1px solid var(--hair); padding: 8px 12px 0; }
.hdr-top { display: flex; justify-content: space-between; align-items: baseline; padding: 2px 4px 6px; max-width: 600px; margin: 0 auto; }
.hdr-title { font-weight: 800; font-size: 16px; letter-spacing: .3px; }
.hdr-title::before { content: 'БЕОГРАД '; font-family: var(--disp); font-weight: 800; font-size: 20px; color: var(--red); letter-spacing: 1.2px; vertical-align: -1px; }
#syncDot { font-size: 10px; color: #3d9e63; vertical-align: 2px; margin-left: 2px; }
#syncDot.off { color: #d99a2b; }
.hdr-clock { font-size: 13px; color: var(--ink-60); }
.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 0 0 8px; scrollbar-width: none; max-width: 600px; margin: 0 auto; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 0 0 auto; min-width: 50px; padding: 5px 8px 6px; border-radius: 9px; color: var(--ink-60); text-align: center; border: 1px solid transparent; }
.tab .k { display: block; font-family: var(--disp); font-size: 24px; font-weight: 800; line-height: 1.05; color: var(--ink); letter-spacing: .3px; text-transform: uppercase; }
.tab .dw { display: block; font-size: 10.5px; margin-top: 1px; letter-spacing: .3px; }
.tab.active { background: var(--ink); border-color: var(--ink); }
.tab.active .k { color: var(--paper); }
.tab.active .dw { color: var(--paper); opacity: .75; }
.tab.today:not(.active) { border-color: var(--red); }
.tab.today .dw::after { content: ' ●'; color: var(--red); font-size: 8px; }
.tab:focus-visible { outline: 2px solid var(--red); outline-offset: 1px; }

/* ---------- полотно ---------- */
main { max-width: 600px; margin: 0 auto; padding: 16px 12px; }

/* табличка дня: красный кружок-номер как у линии ГСП */
.day-head { background: var(--paper); border: 1px solid var(--hair); border-radius: 12px; padding: 14px 16px 12px; margin-bottom: 14px; position: relative; overflow: hidden; display: flex; gap: 14px; align-items: flex-start; }
.day-head::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: var(--dc, var(--red)); }
.day-num { flex: 0 0 auto; width: 46px; height: 46px; border-radius: 50%; background: var(--dc, var(--red)); color: #fff; font-family: var(--disp); font-weight: 800; font-size: 26px; display: flex; align-items: center; justify-content: center; letter-spacing: .5px; }
.day-head h2 { font-family: var(--disp); font-size: 30px; font-weight: 800; letter-spacing: .4px; line-height: 1; text-transform: uppercase; }
.day-head .sub { color: var(--ink-60); font-size: 13.5px; margin-top: 4px; line-height: 1.4; }
.day-head .sun { color: var(--ink-60); font-size: 12.5px; margin-top: 3px; }

.draft-banner { background: var(--kesten-soft); color: var(--kesten); border-radius: var(--r); padding: 10px 14px; font-size: 14px; margin-bottom: 14px; line-height: 1.45; }

/* слоты дня — световой день как ограничение */
.slot { position: relative; border-radius: 12px; padding: 6px 6px 2px; margin-bottom: 14px; }
.slot.morning { background: var(--tint-m); }
.slot.day { background: var(--tint-d); }
.slot.evening { background: var(--tint-e); }
.slot-label { font-family: var(--disp); font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px; color: var(--ink-60); padding: 6px 12px 6px calc(var(--dot-x) + 18px); }

/* маршрутная нить — Сава */
.slot::before { content: ''; position: absolute; left: var(--dot-x); top: 14px; bottom: 12px; width: var(--line-w); background: var(--sava); opacity: .5; }
.slot > * { position: relative; }

/* карточка-остановка */
.card { background: var(--paper); border: 1px solid var(--hair); border-radius: var(--r); padding: 12px 14px 12px 10px; margin: 0 2px 8px; }
.card.done { opacity: .62; }
.card.now { border-color: var(--red); box-shadow: 0 0 0 1px var(--red); }
.card-row { display: flex; gap: 10px; align-items: flex-start; }

/* остановка-чекбокс: точка на нити / паспортный штамп «БИЛИ» */
.chk { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; border: 2.5px solid var(--sava); background: var(--paper); margin-top: 1px; position: relative; display: flex; align-items: center; justify-content: center; transition: border-color .15s; }
.chk::after { content: ''; position: absolute; inset: -9px; } /* тач-зона ~48px */
.chk:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.card.done > .card-row > .chk { border-color: transparent; width: 44px; margin-left: -7px; }
.stamp { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 44px; height: auto; min-height: 32px; padding: 2px 4px; border: 2px solid var(--stamp); border-radius: 4px; color: var(--stamp); font-family: var(--disp); font-weight: 800; font-size: 14px; line-height: 1; letter-spacing: .8px; transform: rotate(-9deg); background: var(--paper); box-shadow: inset 0 0 0 1px var(--paper), inset 0 0 0 2px color-mix(in srgb, var(--stamp) 35%, transparent); }
.stamp small { font-family: var(--disp); font-weight: 600; font-size: 9px; letter-spacing: .4px; margin-top: 1px; opacity: .9; }
@media (prefers-reduced-motion: no-preference) {
  .stamp { animation: stamp-in .22s cubic-bezier(.2, 1.6, .4, 1); }
  @keyframes stamp-in { from { transform: rotate(-9deg) scale(1.7); opacity: 0; } to { transform: rotate(-9deg) scale(1); opacity: 1; } }
}

.card-main { flex: 1; min-width: 0; }
.card-time { font-family: var(--disp); font-size: 15px; font-weight: 700; color: var(--ink-60); letter-spacing: .6px; }
.card.now .card-time { color: var(--red); }
.card-title { font-size: 16.5px; font-weight: 750; line-height: 1.25; margin-top: 1px; }
.card-sr { font-size: 12.5px; color: var(--ink-60); margin-top: 2px; letter-spacing: .2px; }
.card-desc { font-size: 14px; margin-top: 7px; line-height: 1.5; color: var(--ink); }
.card-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: 13px; color: var(--ink-60); }
.card-meta b { color: var(--ink); font-weight: 650; }
.warn { background: var(--red-soft); color: var(--red); border-radius: 8px; padding: 8px 11px; font-size: 13.5px; margin-top: 9px; line-height: 1.45; }
.unverified { color: var(--kesten-text); font-size: 12.5px; margin-top: 6px; }

/* действия */
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.act { display: inline-flex; align-items: center; gap: 5px; padding: 8px 14px; border-radius: 999px; font-size: 13.5px; font-weight: 650; text-decoration: none; border: 1.5px solid var(--hair); color: var(--ink); min-height: 38px; position: relative; }
.act::after { content: ''; position: absolute; inset: -3px; border-radius: 999px; } /* тач-зона ≥44px */
.act.primary { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.act.photo { border-color: var(--red); color: var(--red); padding: 8px 12px; margin-left: auto; }

.tasks { margin-top: 9px; border-top: 1px dashed var(--hair); padding-top: 7px; }
.task { display: flex; gap: 9px; align-items: center; padding: 5px 0; font-size: 14px; }
.task .chk { width: 20px; height: 20px; border-radius: 6px; border-width: 2px; margin: 0; border-color: var(--ink-60); }
.task .chk::after { inset: -12px; } /* тач-зона 44px */
.task .chk .stamp { display: none; }
.task.done .chk { background: var(--stamp); border-color: var(--stamp); }
.task.done .chk::before { content: '✓'; color: #fff; font-size: 12px; font-weight: 800; }
.task.done span { text-decoration: line-through; color: var(--ink-60); }

.thumbs { display: flex; gap: 6px; overflow-x: auto; margin-top: 10px; }
.thumbs img { width: 62px; height: 62px; object-fit: cover; border-radius: 8px; flex: 0 0 auto; border: 1px solid var(--hair); }

/* перегон между остановками */
.transit { display: flex; align-items: baseline; gap: 8px; margin: 0 8px 8px calc(var(--dot-x) + 14px); font-size: 12.5px; color: var(--ink-60); line-height: 1.45; }
.transit .tdot { color: var(--sava); }
.line-pill { flex: 0 0 auto; padding: 1.5px 9px; border-radius: 4px; color: #fff; font-family: var(--disp); font-size: 13.5px; font-weight: 700; white-space: nowrap; letter-spacing: .6px; }
.transit .walk { font-weight: 650; color: var(--ink); }

.planb { background: var(--paper); border: 1.5px dashed var(--ink-30); border-radius: 12px; padding: 12px 14px; font-size: 14px; margin-top: 4px; line-height: 1.5; }
.planb b { display: block; margin-bottom: 4px; font-family: var(--disp); font-size: 14px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--ink-60); }

.budget { background: var(--paper); border: 1px solid var(--hair); border-radius: 12px; padding: 12px 14px; margin: 4px 0 10px; font-size: 14px; }
.b-head { font-family: var(--disp); font-size: 14px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--ink-60); margin-bottom: 7px; }
.b-row { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; line-height: 1.4; }
.b-row .b-val { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }
.b-total { border-top: 1px solid var(--hair); margin-top: 6px; padding-top: 7px; font-weight: 750; }
.b-total .b-val { color: var(--red); }
.b-note { font-size: 12px; color: var(--ink-60); margin-top: 7px; line-height: 1.45; }

/* справка и галерея */
.info-block { background: var(--paper); border: 1px solid var(--hair); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; font-size: 14.5px; line-height: 1.55; }
.info-block h3 { font-size: 15px; margin-bottom: 7px; font-weight: 750; }
.info-block .sr-copy { background: var(--fog); padding: 9px 11px; border-radius: 8px; margin-top: 8px; font-size: 15px; line-height: 1.5; }
.info-block.pending { border-style: dashed; color: var(--ink-60); }
.gallery-group { margin-bottom: 18px; }
.gallery-group h3 { font-size: 14.5px; margin-bottom: 8px; font-weight: 700; }
.gallery-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.gallery-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; border: 1px solid var(--hair); }

.now-btn { position: fixed; right: 14px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 15; padding: 12px 18px; border-radius: 999px; background: var(--red); color: #fff; font-size: 14px; font-weight: 750; box-shadow: 0 4px 16px rgba(120,20,10,.35); }

.overlay { position: fixed; inset: 0; background: rgba(12,14,18,.96); z-index: 60; display: flex; flex-direction: column; }
.overlay-bar { display: flex; justify-content: space-between; padding: 12px 16px; }
.overlay-bar button { background: #2a2f38; color: #fff; border-radius: 10px; padding: 9px 16px; font-size: 14px; }
#ovImg { flex: 1; object-fit: contain; min-height: 0; width: 100%; }
.ov-cap { padding: 10px 14px calc(12px + env(safe-area-inset-bottom)); }
#ovCapText { display: none; color: #ddd; font-size: 14px; line-height: 1.45; }
#ovCapText:empty { padding: 0; }
body.ro #ovCapText { display: block; }
body.ro .ov-cap-edit { display: none; }
.ov-cap-edit { display: flex; gap: 8px; align-items: stretch; }
.ov-cap-edit textarea { flex: 1; background: #2a2f38; color: #fff; border: none; border-radius: 10px; padding: 9px 12px; font-size: 14px; font-family: inherit; resize: none; }
.ov-cap-edit button { background: #2a2f38; color: #fff; border-radius: 10px; padding: 9px 14px; font-size: 14px; white-space: nowrap; }

/* галерея: подписи */
.gph { position: relative; margin: 0; }
.gph img { display: block; }
.gph figcaption { font-size: 11.5px; line-height: 1.35; color: var(--ink-60); padding: 3px 2px 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* лист фраз */
.sheet { position: fixed; inset: 0; background: rgba(12,14,18,.5); z-index: 55; display: flex; align-items: flex-end; }
.sheet-box { background: var(--paper); width: 100%; max-height: 78vh; overflow-y: auto; border-radius: 18px 18px 0 0; padding: 14px 16px calc(16px + env(safe-area-inset-bottom)); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sheet-head div { font-weight: 750; font-size: 16px; }
.sheet-head button { background: var(--fog); color: var(--ink); border-radius: 10px; padding: 7px 13px; font-size: 14px; }
.sheet-hint { font-size: 12.5px; color: var(--ink-60); margin: 6px 0 10px; }
.ph-row { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-top: 1px solid var(--hair); }
.ph-row.ctx { background: var(--red-soft); margin: 0 -8px; padding: 9px 8px; border-radius: 10px; border-top: none; }
.ph-play { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%; background: var(--red); color: #fff; font-size: 14px; }
.ph-sr { font-size: 17px; line-height: 1.4; font-weight: 600; }
.ph-lat { font-size: 12.5px; color: var(--ink-60); margin-top: 1px; }
.ph-ru { font-size: 13px; color: var(--ink-60); margin-top: 2px; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 80px; background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 999px; font-size: 14px; z-index: 40; opacity: 0; transition: opacity .25s; pointer-events: none; }
.toast.show { opacity: 1; }

/* ---------- заметки ---------- */
.pnote { margin-top: 9px; padding: 9px 12px; background: var(--fog); border-left: 3px solid var(--red); border-radius: 0 8px 8px 0; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; }
.pnote-by { color: var(--ink-60); font-size: 12px; font-style: italic; }
.act.note { padding: 8px 12px; }

/* ---------- дневник ---------- */
.feed-day { background: var(--paper); border: 1px solid var(--hair); border-radius: 12px; padding: 13px 14px 10px; margin-bottom: 14px; position: relative; overflow: hidden; }
.feed-day::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--dc, var(--red)); }
.fd-head { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.fd-head h3 { font-size: 15.5px; font-weight: 800; line-height: 1.3; }
.fb-edit { flex: 0 0 auto; font-size: 15px; padding: 6px 9px; border-radius: 8px; border: 1.5px solid var(--hair); }
.fd-note { margin: 9px 0 4px; font-size: 14.5px; line-height: 1.55; white-space: pre-wrap; }
.fd-note.fresh { background: var(--red-soft); margin-left: -6px; margin-right: -6px; padding: 8px 6px; border-radius: 8px; }
.fd-empty { margin: 9px 0 4px; padding: 9px 12px; border: 1.5px dashed var(--ink-30); border-radius: 8px; color: var(--ink-60); font-size: 13.5px; cursor: pointer; }
.fb { border-top: 1px solid var(--hair); margin-top: 10px; padding-top: 10px; }
.fb-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fb-title { font-weight: 750; font-size: 14.5px; }
.fb-st { color: var(--stamp); font-family: var(--disp); font-size: 13px; font-weight: 700; letter-spacing: .5px; }
.fb-head .fb-edit { margin-left: auto; font-size: 13px; padding: 4px 8px; }
.chip-new { background: var(--red); color: #fff; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; padding: 2px 7px; border-radius: 999px; }
.fb-note { margin-top: 7px; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; color: var(--ink); }
.fb-ph { margin: 9px 0 0; }
.fb-ph img { display: block; width: 100%; border-radius: 10px; border: 1px solid var(--hair); }
.fb-ph figcaption { font-size: 13px; line-height: 1.45; color: var(--ink); padding: 5px 2px 0; }

/* бейдж «новое» на вкладке дневника */
.tab .k { position: relative; }
.badge { position: absolute; top: -4px; right: -14px; background: var(--red); color: #fff; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-size: 9.5px; font-weight: 800; min-width: 15px; padding: 1.5px 4px; border-radius: 999px; line-height: 1.2; letter-spacing: 0; }

/* ---------- композер подписей ---------- */
.comp-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--hair); }
.comp-row img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; flex: 0 0 auto; border: 1px solid var(--hair); }
.comp-row textarea, #compNote, #noteInput { flex: 1; width: 100%; background: var(--fog); color: var(--ink); border: 1.5px solid var(--hair); border-radius: 10px; padding: 9px 12px; font-size: 14px; font-family: inherit; resize: none; }
.comp-row textarea:focus, #compNote:focus, #noteInput:focus { outline: 2px solid var(--red); outline-offset: 1px; }
.comp-note-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--ink-60); margin: 12px 0 6px; }
.comp-save { display: block; width: 100%; margin-top: 12px; padding: 13px; border-radius: var(--r); font-size: 15px; font-weight: 750; background: var(--ink); color: var(--paper); }
#noteInput { margin-top: 4px; }

/* режим наблюдателя */
body.ro .chk { pointer-events: none; border-style: dashed; }
body.ro .act.photo { display: none; }
body.ro .act.note { display: none; }
body.ro #ovDel { display: none; }
