/* =========================================================
   Telefon (< 768px) – planer i prozori prilagođeni dodiru.
   Računar i tablet ostaju nepromenjeni.
   ========================================================= */
.m-plan, .fab, .m-hint, .v-list, .m-agenda { display: none; }
.v-dates { display: contents; }

/* panel odozdo (filteri) */
.sheet-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(6, 24, 22, .42); opacity: 0; transition: opacity .25s; }
.sheet-backdrop.open { opacity: 1; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; background: var(--surface); border-radius: 24px 24px 0 0;
  padding: 10px 18px calc(22px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px;
  transform: translateY(100%); transition: transform .34s var(--ease, ease); box-shadow: 0 -20px 60px -20px rgba(0, 0, 0, .35);
}
.sheet-backdrop.open .sheet { transform: none; }
.sheet-handle { width: 44px; height: 5px; border-radius: 3px; background: var(--border-strong); margin: 0 auto 4px; }
.sheet h3 { font-size: 18px; font-weight: 800; margin-bottom: 2px; }
.sheet .seg { display: flex; }
.sheet .seg button { flex: 1; padding: 11px 8px; font-size: 14px; }
.sheet .input { height: 48px; font-size: 16px; }

@media (max-width: 767px) {
  /* ---------- planer ---------- */
  .planner-bar, .pl-legend { display: none !important; }
  .m-plan { display: block; margin: 0 0 10px; }
  .m-week { display: flex; align-items: center; gap: 2px; margin: 0 -8px; }
  .m-week .icon-btn { width: 32px; height: 44px; flex: none; }
  .m-days { flex: 1; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
  .m-day {
    border: 0; background: transparent; border-radius: 14px; padding: 6px 0 7px; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; gap: 1px; color: var(--text-2);
    transition: background .2s, color .2s, transform .2s var(--spring, ease);
  }
  .m-day small { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
  .m-day b { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
  .m-day.today b { color: var(--primary); }
  .m-day.today::after { content: ""; width: 4px; height: 4px; border-radius: 50%; background: var(--primary); }
  .m-day.on { background: var(--primary); color: #fff; box-shadow: 0 8px 18px -8px rgba(0, 137, 127, .7); }
  .m-day.on small, .m-day.on b { color: #fff; }
  .m-day.on::after { background: #fff; }
  .m-day:active { transform: scale(.93); }
  .m-head { display: flex; align-items: center; gap: 8px; margin: 10px 0 10px; }
  .m-title { flex: 1; min-width: 0; font-weight: 800; font-size: 16px; letter-spacing: -.01em; text-transform: capitalize; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .m-filter { position: relative; background: var(--surface); border: 1px solid var(--border-strong); width: 42px; height: 42px; border-radius: 12px; }
  .m-filter-dot { position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }
  .m-rooms {
    display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none;
    margin: 0 -16px; padding: 2px 16px 6px;
  }
  .m-rooms::-webkit-scrollbar { display: none; }
  .m-room {
    flex: none; scroll-snap-align: center; display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 12px;
    border-radius: 14px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
    font-weight: 700; font-size: 13.5px; cursor: pointer; transition: all .2s var(--ease, ease);
  }
  .m-room .dot { width: 9px; height: 9px; background: var(--rc); }
  .m-room .live { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: rt-blink 1.4s infinite; }
  .m-room .cnt { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 8px; background: var(--surface-3); display: grid; place-items: center; font-size: 11.5px; font-weight: 800; color: var(--text-2); }
  .m-room.on { border-color: var(--rc); background: color-mix(in srgb, var(--rc) 12%, var(--surface)); box-shadow: 0 0 0 2px color-mix(in srgb, var(--rc) 30%, transparent); }
  .m-room.on .cnt { background: var(--rc); color: #fff; }

  /* jedna prostorija preko celog ekrana */
  .pg.m1 { grid-template-columns: 48px minmax(0, 1fr); min-width: 0; }
  .pg.m1 .pg-corner, .pg.m1 .pg-room { display: none; }
  .pg.m1 .pg-time { font-size: 12px; }
  .pg.m1 .appt { left: 6px; right: 6px; padding: 6px 10px; font-size: 13px; border-radius: 12px; }
  .pg.m1 .appt .a-t { font-size: 12.5px; }
  .pg.m1 .appt .a-n { font-size: 14px; }
  .planner-card { border-radius: 18px; }
  .pg-scroll { max-height: calc(100dvh - 268px); overscroll-behavior: contain; }
  .pg-scroll.sw-l { animation: sw-l .3s var(--ease, ease); }
  .pg-scroll.sw-r { animation: sw-r .3s var(--ease, ease); }
  @keyframes sw-l { from { opacity: .3; transform: translateX(28px); } to { opacity: 1; transform: none; } }
  @keyframes sw-r { from { opacity: .3; transform: translateX(-28px); } to { opacity: 1; transform: none; } }
  .appt { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
  .appt.lp-arm { animation: lp-arm .42s linear forwards; }
  @keyframes lp-arm { to { transform: scale(.96); box-shadow: 0 0 0 3px var(--c); } }
  .appt-resize { display: none; } /* na telefonu se trajanje menja preko "Izmeni" */
  .m-hint { display: block; text-align: center; font-size: 11.5px; color: var(--muted); margin: 10px 0 70px; }

  /* plutajuće dugme za novi termin – na dohvat palca */
  .fab {
    display: grid; place-items: center; position: fixed; right: 18px; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 35;
    width: 60px; height: 60px; border-radius: 20px; border: 0; cursor: pointer; color: #fff;
    background: linear-gradient(135deg, var(--primary-2), var(--primary));
    box-shadow: 0 16px 32px -10px rgba(0, 137, 127, .75); transition: transform .2s var(--spring, ease);
  }
  .fab svg.i { width: 28px; height: 28px; stroke-width: 2.4; }
  .fab:active { transform: scale(.92); }
  .app:has(#mFab) #quickBook { display: none; } /* u planeru na telefonu je dovoljno plutajuće dugme */

  /* ---------- prozori preko celog ekrana ---------- */
  /* prozor raste sa sadržajem (stretch ga je ograničavao na visinu ekrana, pa je sadržaj ispadao preko pozadine) */
  .modal-backdrop { padding: 0; align-items: flex-start; background: var(--surface); }
  .modal-backdrop:has(.modal.sm) { background: rgba(6, 24, 22, .42); }
  .modal { max-width: none !important; min-height: 100dvh; height: auto; border-radius: 0; box-shadow: none; }
  .modal.sm { min-height: auto; margin-top: auto; align-self: flex-end; border-radius: 22px 22px 0 0; box-shadow: var(--shadow-lg); }
  .modal-backdrop:has(.modal.sm) { align-items: flex-end; }
  .modal-head { position: sticky; top: 0; z-index: 6; background: var(--surface); padding: 14px 16px 12px; border-bottom: 1px solid var(--border); }
  .modal-head h3 { font-size: 17px; }
  .modal-body { padding: 16px 16px 24px; flex: 1; }
  .modal-foot { position: sticky; bottom: 0; z-index: 6; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-radius: 0; box-shadow: 0 -10px 24px -18px rgba(0, 0, 0, .3); }
  .modal-foot .btn { flex: 1; height: 48px; }
  .modal-foot .spacer { display: none; }
  .modal.sm .modal-foot { border-radius: 0; }
  /* veća polja i bez automatskog zumiranja na iPhone-u (font >= 16px) */
  .field input:not([type=checkbox]):not([type=color]), .field select, .field textarea, .input, .search input { font-size: 16px; }
  .field input:not([type=checkbox]):not([type=color]), .field select, .input { height: 48px; }
  .time24 { height: 48px; }
  .field .search, .search { height: 48px; }
  .field .search input, .search input { height: 44px !important; border: 0 !important; box-shadow: none !important; padding: 0 !important; background: transparent !important; }
  .time24 select { font-size: 17px !important; }
  .chips { gap: 8px; }
  .chip { padding: 9px 14px; font-size: 14px; }
  .timeline-actions { grid-template-columns: 1fr 1fr; }
  .timeline-actions .btn { height: 46px; }
  .detail-head { padding: 12px; }
}

/* ---------- Lista dolazaka na telefonu: filteri u mreži, termini kao kartice ---------- */
@media (max-width: 767px) {
  .v-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; margin-bottom: 14px; }
  .v-toolbar .spacer { display: none; }
  .v-toolbar #vRange { grid-column: 1 / -1; display: flex; }
  .v-toolbar #vRange button { flex: 1; padding: 9px 4px; }
  .v-toolbar .search { grid-column: 1 / -1; order: -1; min-width: 0; }
  .v-toolbar .v-dates { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 6px; }
  .v-toolbar .input { width: 100% !important; min-width: 0; }
  .v-toolbar select.input:only-of-type { grid-column: 1 / -1; }
  .v-desk { display: none; }
  .v-list { display: flex; flex-direction: column; gap: 8px; padding-bottom: 80px; }
  .v-day { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 8px 2px 0; }
  .v-item {
    display: flex; gap: 14px; width: 100%; padding: 14px 14px 14px 12px; text-align: left; cursor: pointer; font: inherit; color: var(--text);
    background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--dc); border-radius: 16px;
    transition: transform .15s;
  }
  .v-item:active { transform: scale(.985); }
  .v-item.off { opacity: .55; }
  .v-time { flex: none; width: 50px; font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums; }
  .v-time small { display: block; font-size: 12px; font-weight: 600; color: var(--muted); }
  .v-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
  .v-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
  .v-name { font-weight: 800; font-size: 15px; line-height: 1.3; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .v-top .badge { flex: none; }
  .v-svc { font-size: 13.5px; color: var(--text-2); }
  .v-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
  .v-meta > span { display: inline-flex; align-items: center; gap: 6px; }
  .v-meta .dot { background: var(--dc); }
}

/* iOS Safari daje polju za datum sopstvenu minimalnu širinu, pa ono izlazi iz ekrana – ovde se uklapa u kolonu */
@media (max-width: 767px) {
  input[type=date] { -webkit-appearance: none; appearance: none; min-width: 0; max-width: 100%; display: block; }
  input[type=date].input, .field input[type=date] { padding-top: 0 !important; padding-bottom: 0 !important; line-height: 46px; }
  input[type=date]::-webkit-date-and-time-value { text-align: left; margin: 0; line-height: 46px; }
  .v-toolbar .v-dates input[type=date] { width: 100% !important; padding-left: 12px; padding-right: 10px; }
}

/* =========================================================
   Telefon – zajednička pravila za sve stranice i prozore
   ========================================================= */
@media (max-width: 767px) {
  /* ---------- filteri iznad lista: uredna mreža preko cele širine ---------- */
  .toolbar { gap: 8px; margin-bottom: 14px; }
  .toolbar > .spacer, .toolbar > span.muted { display: none; }
  .toolbar > .search { flex: 1 1 100%; order: -1; min-width: 0; }
  .toolbar > .seg { flex: 1 1 100%; display: flex; overflow-x: auto; scrollbar-width: none; }
  .toolbar > .seg::-webkit-scrollbar { display: none; }
  .toolbar > .seg button { flex: 1 0 auto; padding: 9px 10px; white-space: nowrap; }
  .toolbar > .input, .toolbar > select { flex: 1 1 calc(50% - 4px); width: auto !important; min-width: 0; }
  .toolbar > .btn { flex: 1 1 calc(50% - 4px); justify-content: center; height: 44px; }

  /* ---------- kartice sa brojevima: dve u redu, sažetije ---------- */
  .grid:has(> .kpi) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px !important; }
  .grid:has(> .kpi) > .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .kpi { padding: 14px; gap: 4px; }
  .kpi .label { font-size: 12px; gap: 6px; }
  .kpi .label .ico { width: 24px; height: 24px; border-radius: 7px; }
  .kpi .label .ico svg { width: 13px; height: 13px; }
  .kpi .value, .grid-5 .kpi .value { font-size: 18px; }
  .kpi .hint { font-size: 11.5px; }
  .kpi:hover { transform: none; }

  /* ---------- tabele kao kartice: naziv kolone levo, vrednost desno ---------- */
  .table-wrap:has(> .table:not(.no-stack)) { overflow: visible; }
  .table:not(.no-stack), .table:not(.no-stack) tbody, .table:not(.no-stack) tfoot,
  .table:not(.no-stack) tr, .table:not(.no-stack) td { display: block; width: 100% !important; }
  .table:not(.no-stack) thead { display: none; }
  .table:not(.no-stack) tr { padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .table:not(.no-stack) tbody tr:last-child { border-bottom: 0; }
  .table:not(.no-stack) td {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 3px 0 !important; border: 0 !important; text-align: right !important; white-space: normal; min-height: 0;
  }
  .table:not(.no-stack) td::before {
    content: attr(data-label); flex: none; max-width: 45%; text-align: left;
    font-size: 12px; font-weight: 600; color: var(--muted);
  }
  .table:not(.no-stack) td[data-label=""]::before, .table:not(.no-stack) td:first-child::before { display: none; }
  .table:not(.no-stack) td:empty { display: none; }
  .table:not(.no-stack) td > * { min-width: 0; }
  .table:not(.no-stack) td[data-label=""] { justify-content: flex-end; }
  /* prva kolona je naslov kartice */
  .table:not(.no-stack) td:first-child { display: block; text-align: left !important; padding-bottom: 6px !important; font-size: 15px; }
  .table:not(.no-stack) td:first-child .cell-person { justify-content: flex-start; }
  .table:not(.no-stack) tbody tr.clickable:hover td { background: none; }
  .table:not(.no-stack) tbody tr.clickable:active { background: var(--surface-2); }
  /* stavke sa poljima (naplata, ulazne fakture) */
  .items-table:not(.no-stack) td input, .items-table:not(.no-stack) td select { flex: 0 1 60%; min-width: 0; height: 44px; }
  .items-table:not(.no-stack) td:first-child input, .items-table:not(.no-stack) td:first-child select { width: 100%; }
}

@media (max-width: 767px) {
  /* Bilans – doprinos doktora: redni broj i doktor u istom redu kao naslov kartice */
  .table:not(.no-stack) tr.doc-row { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; align-items: center; }
  .table:not(.no-stack) tr.doc-row td { grid-column: 1 / -1; }
  .table:not(.no-stack) tr.doc-row td:nth-child(1) { grid-column: 1; width: auto !important; padding-bottom: 6px !important; }
  .table:not(.no-stack) tr.doc-row td:nth-child(2) { grid-column: 2; padding-bottom: 6px !important; justify-content: flex-start; text-align: left !important; }
  .table:not(.no-stack) tr.doc-row td:nth-child(2)::before { display: none; }
  .table:not(.no-stack) tr.doc-row td:nth-child(5) > div { flex: 0 1 60%; }
  .table:not(.no-stack) tr.doc-row .doc-services { justify-content: flex-end; }
}

@media (max-width: 767px) {
  /* zaglavlje detalja (klijent, termin): dugmad prelaze u svoj red */
  .detail-head { flex-wrap: wrap; }
  .detail-head > div[style*="flex:1"] { flex: 1 1 calc(100% - 80px) !important; }
  .detail-head > .btn { flex: 1 1 40%; height: 42px; justify-content: center; }

  /* istorija termina klijenta: kompaktne kartice (datum + status, usluga, doktor) */
  .table.hist-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; align-items: center; }
  .table.hist-table td { display: block !important; text-align: left !important; padding: 0 !important; }
  .table.hist-table td:nth-child(1) { grid-column: 1; grid-row: 1; font-weight: 700; font-size: 14px; }
  .table.hist-table td:nth-child(2) { grid-column: 1; grid-row: 2; font-size: 13.5px; color: var(--text-2); }
  .table.hist-table td:nth-child(3) { grid-column: 1; grid-row: 3; font-size: 12.5px; color: var(--muted); }
  .table.hist-table td:nth-child(4) { grid-column: 2; grid-row: 1; }
  .table.hist-table td:nth-child(5) { grid-column: 2; grid-row: 2 / 4; text-align: right !important; }
}

@media (max-width: 767px) {
  /* stavke naplate i ulazne fakture: svaka stavka je kartica, dugme za brisanje u gornjem desnom uglu */
  .items-table:not(.no-stack) tr { position: relative; background: var(--surface-2); border: 0 !important; border-radius: 14px; margin-bottom: 8px; padding: 10px 12px; }
  .items-table:not(.no-stack) td:first-child { padding-right: 44px !important; }
  .items-table:not(.no-stack) td:last-child[data-label=""] { position: absolute; top: 10px; right: 6px; width: auto !important; padding: 0 !important; }
  .items-table:not(.no-stack) td:last-child[data-label=""]:empty { display: none; }
}

@media (max-width: 767px) {
  /* ćelija sa više delova (opis + napomena…): delovi idu jedan ispod drugog, desno od naziva kolone */
  .table:not(.no-stack) td:not(:first-child):not([data-label=""]):has(> * + *) {
    display: grid; grid-template-columns: minmax(0, max-content) minmax(0, 1fr); column-gap: 12px; align-items: center;
  }
  .table:not(.no-stack) td:not(:first-child):not([data-label=""]):has(> * + *)::before { grid-column: 1; grid-row: 1 / span 3; }
  .table:not(.no-stack) td:not(:first-child):not([data-label=""]):has(> * + *) > * { grid-column: 2; justify-self: end; }
  .table:not(.no-stack) tr td:empty { display: none !important; }
  .table.hist-table td { display: block !important; }
  /* dugmad u redu se prelamaju umesto da izlaze iz ekrana */
  .btn-row { flex-wrap: wrap; }
  .btn-row > .btn { flex: 1 1 auto; justify-content: center; white-space: normal; text-align: center; }
  .modal .kpi .value { font-size: 18px !important; }
}

@media (max-width: 767px) {
  /* u prozoru preko celog ekrana nema potrebe za unutrašnjim skrolovanjem tabela */
  .modal .table-wrap { max-height: none !important; overflow: visible !important; }
}

@media (max-width: 767px) {
  /* kontrolna tabla – današnji dolasci: vreme levo, ime i usluga preko cele širine, status desno, dugme ispod */
  .agenda-time small { white-space: nowrap; font-size: 11.5px; }
  .agenda-item { display: grid !important; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 12px 14px !important; border-left: 3px solid var(--dc, transparent); }
  .agenda-item > .dot { display: none; }
  .agenda-time { width: auto; grid-column: 1; grid-row: 1 / span 2; align-self: start; font-size: 14px; }
  .agenda-main { grid-column: 2; grid-row: 1; }
  .agenda-item > .badge { grid-column: 3; grid-row: 1; }
  .agenda-item > div:last-child { grid-column: 2 / -1; grid-row: 2; width: auto !important; text-align: left !important; }
  .agenda-item > div:last-child:empty { display: none; }
  .agenda-item > div:last-child .btn { height: 38px; }
  .card-head { padding: 14px 16px; flex-wrap: wrap; row-gap: 6px; }
  .card-head h3 { min-width: 0; }
  .card-head .btn { flex: none; }
}

/* =========================================================
   Planer na telefonu – "Moj dan": termini po redu i slobodna vremena
   ========================================================= */
@media (max-width: 767px) {
  .m-hide { display: none !important; }
  .m-agenda { display: block; padding-bottom: 96px; }
  .m-agenda.sw-l { animation: sw-l .3s var(--ease, ease); }
  .m-agenda.sw-r { animation: sw-r .3s var(--ease, ease); }
  .m-view { display: flex; margin: 0 0 10px; }
  .m-view button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 8px; font-size: 14px; }
  .m-view button svg.i { width: 15px; height: 15px; }
  .m-docs { margin-bottom: 4px; }
  .m-day .m-cnt { font-style: normal; font-size: 10px; font-weight: 800; line-height: 14px; min-height: 14px; color: var(--primary); }
  .m-day.on .m-cnt { color: #fff; }
  .m-day.today::after { display: none; }

  /* sažetak dana */
  .ag-sum { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 2px 0 12px; }
  .ag-sum:has(> :nth-child(2):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ag-stat, .ag-free {
    display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 14px; text-align: left; min-width: 0;
    background: var(--surface); border: 1px solid var(--border); font: inherit; color: var(--text);
  }
  .ag-stat b, .ag-free b { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
  .ag-stat span, .ag-free span { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ag-free { cursor: pointer; background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 30%, transparent); }
  .ag-free b, .ag-free span { color: var(--primary); }
  .ag-free.none { background: var(--surface-3); border-color: var(--border); cursor: default; }
  .ag-free.none b, .ag-free.none span { color: var(--muted); }
  .ag-free:active:not(.none) { transform: scale(.97); }
  .ag-hint { font-size: 12.5px; color: var(--muted); margin: -4px 2px 10px; }

  /* lista */
  .ag-list { display: flex; flex-direction: column; gap: 8px; }
  .ag-time { flex: none; width: 50px; font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums; line-height: 1.25; }
  .ag-time small { display: block; font-size: 12px; font-weight: 600; color: var(--muted); }
  .ag-item {
    display: flex; gap: 12px; padding: 13px 14px 13px 12px; cursor: pointer;
    background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--dc); border-radius: 16px;
  }
  .ag-item:active { transform: scale(.99); }
  .ag-item.done { opacity: .6; }
  .ag-item.in_progress { box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 45%, transparent); }
  .ag-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
  .ag-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
  .ag-top b { font-size: 15px; font-weight: 800; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ag-top .badge { flex: none; }
  .ag-sub { font-size: 13.5px; color: var(--text-2); }
  .ag-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--muted); }
  .ag-meta > span { display: inline-flex; align-items: center; gap: 5px; }
  .ag-meta svg.i { width: 13px; height: 13px; }
  .ag-meta .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dc); display: inline-block; }
  .ag-act { margin-top: 6px; }
  .ag-act .btn { height: 40px; padding: 0 16px; }

  /* slobodno vreme */
  .ag-gap {
    display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 14px 11px 12px; cursor: pointer; font: inherit; text-align: left;
    background: transparent; color: var(--text); border: 1.5px dashed color-mix(in srgb, var(--primary) 40%, var(--border)); border-radius: 16px;
  }
  .ag-gap .ag-time { color: var(--primary); }
  .ag-gap-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .ag-gap-main b { font-size: 14.5px; color: var(--primary); }
  .ag-gap-main small { font-size: 12px; color: var(--muted); }
  .ag-gap-cta { display: inline-flex; align-items: center; gap: 4px; padding: 8px 12px; border-radius: 10px; background: var(--primary); color: #fff; font-weight: 700; font-size: 13px; }
  .ag-gap-cta svg.i { width: 15px; height: 15px; stroke-width: 2.4; }
  .ag-gap:active { background: var(--primary-soft); }

  /* linija "sada" */
  .ag-now { display: flex; align-items: center; gap: 8px; margin: 2px 0; color: var(--accent); font-size: 11.5px; font-weight: 800; }
  .ag-now::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
  .ag-now::after { content: ""; flex: 1; height: 2px; background: var(--accent); opacity: .5; border-radius: 2px; }

  .ag-empty { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 40px 16px; text-align: center; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; }
  .ag-empty svg.i { width: 30px; height: 30px; }
}

/* otvoren meni na telefonu: stranica ispod se ne pomera dok se meni ne zatvori */
@media (max-width: 767px) {
  html:has(.app.nav-open), html:has(.app.nav-open) body { overflow: hidden; overscroll-behavior: none; }
  .app.nav-open .sb-backdrop { touch-action: none; }
  .app.nav-open .sidebar { overscroll-behavior: contain; }
  .app.nav-open .nav { overscroll-behavior: contain; }
}

/* meni na telefonu: visina vidljivog dela ekrana (100vh u Safariju zalazi ispod donje trake, pa se nalog i odjava nisu videli) */
@media (max-width: 767px) {
  .sidebar { height: 100vh; height: 100dvh; padding-bottom: env(safe-area-inset-bottom); }
  .sidebar .nav { min-height: 0; }
  .sidebar-foot { flex: none; }
}

/* telefon: stranica se nikad ne pomera u stranu, čak i ako neki element zađe preko ivice */
@media (max-width: 767px) {
  html, body { overflow-x: clip; }
}
