/* IT Service Desk – osnovni stilovi. Mobile-first; bez eksternih biblioteka i fontova. */

:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-2: #f0f2f5;
    --border: #e1e5ea;
    --text: #1a1f26;
    --text-muted: #5a6472;

    --primary: #2353d1;
    --primary-hover: #1b43ad;
    --primary-soft: #e7edfc;
    --danger: #c0262d;
    --danger-soft: #fdecec;
    --warning: #a35f00;
    --warning-soft: #fff3de;
    --success: #1c7442;
    --success-soft: #e6f4eb;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 1px 3px rgb(16 24 40 / 8%);
    --focus: 0 0 0 3px rgb(35 83 209 / 30%);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --topbar-h: 56px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 0.75rem; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
h1:focus { outline: none; }
p { margin: 0 0 0.75rem; }

a { color: var(--primary); }
a:hover { color: var(--primary-hover); }

code { font-size: 0.9em; background: var(--surface-2); padding: 0.1em 0.35em; border-radius: 4px; }

.muted { color: var(--text-muted); }
.lead { font-size: 1.125rem; }
.stack { display: grid; gap: 0.75rem; }
.stack > * { margin: 0; }

.icon { width: 1.4em; height: 1.4em; flex: none; }

/* Dugmad: najmanje 44 px visine, da se lako pogode prstom. */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    background: var(--surface);
    color: var(--text);
}
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
/* Onemogućeno dugme (npr. dok nije odabran nijedan uređaj) mora se vidno razlikovati. */
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-secondary { border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { min-height: 36px; padding: 0 0.6rem; font-size: 0.9rem; }
.btn-lg { min-height: 56px; font-size: 1.125rem; border-radius: var(--radius); }
.btn-block { width: 100%; }

/* Polja forme: 16 px font sprečava automatsko zumiranje na iPhone-u. */
.field { display: grid; gap: 0.35rem; margin-bottom: 1rem; }
.field > span { font-weight: 600; font-size: 0.925rem; }
.input, select.input, textarea.input {
    width: 100%;
    min-height: 44px;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 1rem;
    color: var(--text);
    background: var(--surface);
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
.check { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1rem; min-height: 44px; cursor: pointer; }
.check input { width: 20px; height: 20px; }

.validation-message { color: var(--danger); font-size: 0.875rem; }
.input.invalid { border-color: var(--danger); }

.alert { padding: 0.75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; border: 1px solid transparent; }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: #f6c9cb; }
.alert-success { background: var(--success-soft); color: var(--success); border-color: #c4e5cf; }
.alert-info { background: var(--primary-soft); color: var(--primary-hover); border-color: #cbd8f8; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
}

/* Kartice sa ključnim pokazateljima. */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.75rem; }
.kpi {
    display: grid;
    gap: 0.25rem;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.kpi-label { color: var(--text-muted); font-size: 0.875rem; font-weight: 600; }
.kpi-value { font-size: 1.75rem; font-weight: 700; line-height: 1.1; }

/* ---- Stranice: zaglavlje, filteri, liste, tabele, forme ---- */

.page-head { display: flex; align-items: center; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1rem; }
.page-head h1 { margin: 0; flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.page-head .actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.back {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.925rem;
    text-decoration: none;
}
.back .icon { width: 1.1em; height: 1.1em; }

.section { margin-top: 1.5rem; }
.section-first { margin-bottom: 1rem; }
.narrow { max-width: 640px; }
.note { white-space: pre-line; }
.hint { color: var(--text-muted); font-size: 0.875rem; }
.text-danger { color: var(--danger); }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 1rem; }
.toolbar .spacer { flex: 1; }
.check-inline { display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.check-inline input, .selectable input { width: 20px; height: 20px; flex: none; }
.selectable { cursor: pointer; }
.toolbar > .input { width: auto; flex: 1 1 160px; }
.toolbar > .check { margin: 0; }
.search { position: relative; flex: 2 1 240px; }
.search .icon { position: absolute; left: 0.7rem; top: 50%; transform: translateY(-50%); width: 1.15em; height: 1.15em; color: var(--text-muted); }
.search .input { padding-left: 2.4rem; }

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.55rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-neutral { background: var(--surface-2); color: var(--text-muted); }

.group-title {
    margin: 1.25rem 0 0.5rem;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* minmax(0, 1fr): dug red (npr. prostorija i prijavilac) se skraćuje sa „…“ umjesto da proširi listu van ekrana. */
.list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.5rem; }
.list-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 56px;
    padding: 0.6rem 0.9rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
}
.list-item:hover { border-color: #c5cdd8; color: var(--text); }
.list-item .main { flex: 1; min-width: 0; }
.list-item .title { display: block; font-weight: 600; overflow-wrap: anywhere; }
.list-item .sub { display: block; color: var(--text-muted); font-size: 0.875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Red sa više radnji (izbor, link, dugme): link je samo glavni dio reda. */
.list-item a.main { color: inherit; text-decoration: none; }
.list-item a.main:hover .title { color: var(--primary); }
/* Red-dugme za dodavanje sa spiska (npr. uređaj na zapisnik o rashodu). */
.list-item.pick { width: 100%; font: inherit; text-align: left; cursor: pointer; }
.list-item.pick > .icon { color: var(--primary); }

/* Prijem opreme: po red za svaki komad (redni broj, inventurni i serijski broj). */
.units { display: grid; gap: 0.4rem; }
.unit-row { display: grid; grid-template-columns: 2rem minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 0.5rem; }
.unit-no { color: var(--text-muted); font-weight: 600; text-align: right; }
.receipt-line .page-head { margin-bottom: 0.5rem; }
.receipt-line .page-head h2 { margin: 0; }
.icon-box {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex: none;
    border-radius: 10px;
    background: var(--primary-soft);
    color: var(--primary);
}

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.table th, .table td { padding: 0.6rem 0.75rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.table th { background: var(--surface-2); color: var(--text-muted); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.table .row-actions { text-align: right; white-space: nowrap; }
.cell-link { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 600; text-decoration: none; }
.cell-link .icon { width: 1.2em; height: 1.2em; color: var(--text-muted); }


.form-grid { display: grid; gap: 0 1rem; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.5rem; }
.input:disabled { background: var(--surface-2); color: var(--text-muted); }

/* Uputstvo na QR nalepnici u formi prostorije: pregled podrazumijevanog i redovi vlastitog (pitanje, šta provjeriti). */
.label-check-preview { display: grid; gap: 0.35rem; margin: 0; padding-left: 1.1rem; }
.label-check-row { display: grid; gap: 0.4rem; padding: 0.75rem; border: 1px solid var(--border); border-radius: var(--radius); }
.label-check-row .input { font-size: 0.95rem; }
.label-check-row .btn { justify-self: end; }

.props { display: grid; grid-template-columns: max-content 1fr; gap: 0.5rem 1.25rem; margin: 0; }
.props dt { color: var(--text-muted); }
.props dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.timeline li { display: grid; gap: 0.1rem; padding-left: 0.9rem; border-left: 2px solid var(--border); }
.timeline .when { color: var(--text-muted); font-size: 0.85rem; }

/* ---- Dashboard i tiketi ---- */

.badge-info { background: var(--primary-soft); color: var(--primary-hover); }
.badges { display: flex; flex-wrap: wrap; gap: 0.35rem; }

/* Boja grupe tiketa (kartice na pregledu, tačka ispred naslova grupe). */
.tone-info { --tone: var(--primary); --tone-soft: var(--primary-soft); }
.tone-danger { --tone: var(--danger); --tone-soft: var(--danger-soft); }
.tone-warning { --tone: var(--warning); --tone-soft: var(--warning-soft); }
.tone-success { --tone: var(--success); --tone-soft: var(--success-soft); }
.tone-muted { --tone: #6b7686; --tone-soft: var(--surface-2); }
/* Dodatne boje za oblasti audit loga (oprema, magacin), da se oblasti razlikuju na prvi pogled. */
.tone-teal { --tone: #0f7584; --tone-soft: #e2f3f5; }
.tone-violet { --tone: #6a3fbf; --tone-soft: #f0eafb; }

/* ---- Audit log: zapisi po danima, ikona u boji oblasti, detalji kao „prije → poslije“ ---- */

.audit-tabs { margin: 0; }
.audit-tabs .icon { width: 1.1em; height: 1.1em; }
.audit-day { margin-bottom: 1.25rem; }
.audit-day .group-title { margin-top: 0.5rem; }
.audit-feed {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.audit-row {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: start;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    border-top: 1px solid var(--border);
    transition: background 0.1s;
}
.audit-row:first-child { border-top: 0; }
.audit-row:hover { background: #fafbfc; }
/* Upozorenja imaju traku u boji sa lijeve strane. */
.audit-row.tone-warning, .audit-row.tone-danger { box-shadow: inset 3px 0 0 var(--tone); }
.audit-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--tone-soft);
    color: var(--tone);
}
.audit-icon .icon { width: 1.2em; height: 1.2em; }
.audit-main { min-width: 0; }
.audit-title { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.audit-action { font-weight: 650; }
.audit-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.25rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}
.audit-meta .sep { color: #b4bcc7; }
.audit-meta time { font-variant-numeric: tabular-nums; }
.avatar {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.avatar-muted { background: var(--surface-2); color: var(--text-muted); }
.avatar .icon { width: 13px; height: 13px; }
.audit-entity {
    display: inline-flex;
    align-items: center;
    padding: 0.05rem 0.5rem;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text);
    font-weight: 600;
    font-size: 0.8rem;
    text-decoration: none;
}
a.audit-entity:hover { background: var(--primary-soft); color: var(--primary); }
.audit-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    min-height: 36px;
    padding: 0.25rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-muted);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}
.audit-toggle:hover, .audit-toggle.open { border-color: var(--primary); color: var(--primary); }
.audit-toggle:focus-visible { outline: none; box-shadow: var(--focus); }
.audit-toggle .icon { width: 1em; height: 1em; transform: rotate(-90deg); transition: transform 0.15s; }
.audit-toggle.open .icon { transform: rotate(90deg); }
.audit-fields {
    display: grid;
    grid-template-columns: minmax(7rem, max-content) minmax(0, 1fr);
    gap: 0.35rem 1rem;
    margin: 0.75rem 0 0;
    padding: 0.75rem 0.9rem;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}
.audit-fields dt { color: var(--text-muted); font-weight: 600; }
.audit-fields dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.audit-fields .change { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.audit-fields .before { padding: 0 0.35rem; border-radius: 4px; background: var(--danger-soft); color: var(--danger); text-decoration: line-through; }
.audit-fields .after { padding: 0 0.35rem; border-radius: 4px; background: var(--success-soft); color: var(--success); font-weight: 600; }
.audit-fields .arrow { color: var(--text-muted); }
.audit-note { display: flex; align-items: center; gap: 0.5rem; margin-top: 1.5rem; color: var(--text-muted); font-size: 0.85rem; }
.audit-note .icon { width: 1.1em; height: 1.1em; flex: none; }
@media (max-width: 599px) {
    .audit-row { grid-template-columns: auto minmax(0, 1fr); padding: 0.75rem; gap: 0.65rem; }
    .audit-toggle { grid-column: 2; justify-self: start; }
    .audit-fields { grid-template-columns: minmax(0, 1fr); gap: 0.1rem; }
    .audit-fields dd { margin-bottom: 0.4rem; }
}

/* ---- Lista tiketa ---- */

.page-head-text { flex: 1 1 auto; min-width: 0; }
.page-head-text h1 { margin: 0; }
.page-sub { margin: 0.2rem 0 0; color: var(--text-muted); font-size: 0.925rem; }

/* Status kao jezičci (pilule) sa brojem; na telefonu se prevlače vodoravno, inače prelaze u novi red. */
.status-tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.75rem; }
@media (max-width: 599px) {
    .status-tabs { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
    .status-tabs::-webkit-scrollbar { display: none; }
}
.status-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex: none;
    min-height: 40px;
    padding: 0 0.9rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-muted);
    font: inherit;
    font-size: 0.925rem;
    font-weight: 600;
    cursor: pointer;
}
.status-tab:hover { border-color: #c5cdd8; color: var(--text); }
.status-tab:focus-visible { outline: none; box-shadow: var(--focus); }
.status-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.tab-count {
    min-width: 1.5rem;
    padding: 0.05rem 0.4rem;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text);
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
    text-align: center;
}
.status-tab.active .tab-count { background: rgb(255 255 255 / 22%); color: #fff; }

/* Svi filteri u jednoj kartici: pretraga i period, zatim mjesto i vrsta, pa napredni na klik. */
.filter-card { display: grid; gap: 0.6rem; padding: 0.9rem; margin-bottom: 1rem; }
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.filter-row > .input { width: auto; flex: 1 1 170px; }
.filter-row > .search { flex: 3 1 260px; }
.filter-row > .check { margin: 0; }
.filter-advanced { display: grid; gap: 0.6rem; padding-top: 0.6rem; border-top: 1px dashed var(--border); }
.filter-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; padding-top: 0.5rem; border-top: 1px solid var(--border); }
.filter-foot .spacer { flex: 1; }
.filter-foot .tab-count { background: var(--primary-soft); color: var(--primary); }

.results-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.5rem; color: var(--text-muted); font-size: 0.925rem; }
.results-head strong { color: var(--text); }

/* Tabela tiketa: ikona i naslov kao link, prostorija u dva reda, hitni otvoreni tiketi označeni crvenom linijom lijevo. */
.ticket-table td { vertical-align: middle; }
.ticket-table tbody tr { transition: background 0.1s; }
.ticket-table tbody tr:hover td { background: var(--surface-2); }
.ticket-table .row-urgent td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.ticket-cell { display: flex; align-items: center; gap: 0.75rem; min-width: 16rem; color: var(--text); text-decoration: none; }
.ticket-cell .icon-box { width: 36px; height: 36px; }
.ticket-cell .icon-box .icon { width: 1.2em; height: 1.2em; }
.ticket-text { display: grid; min-width: 0; }
.ticket-title { font-weight: 600; }
.ticket-cell:hover .ticket-title { color: var(--primary); }
.room-code { font-weight: 600; }
.show-more { justify-content: center; margin-top: 1rem; }

/* ---- Prostorije ---- */

.page-head h2 { margin: 0; flex: 1 1 auto; }
.status-tab.tab-warning:not(.active) { border-color: #f0c98a; color: var(--warning); }

/* Dva dugmeta kao jedan prekidač (npr. grupisanje po zgradi ili službi). */
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.segmented button {
    min-height: 34px;
    padding: 0 0.75rem;
    border: 0;
    background: var(--surface);
    color: var(--text-muted);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
}
.segmented button + button { border-left: 1px solid var(--border); }
.segmented button.active { background: var(--primary-soft); color: var(--primary); }
.segmented button:focus-visible { outline: none; box-shadow: var(--focus); }

.room-section + .room-section { margin-top: 2rem; }
.room-section-title { display: flex; align-items: center; gap: 0.5rem; margin: 0 0 0.25rem; font-size: 1.15rem; }
.room-section-title .icon { color: var(--primary); }
.room-section > .group-title { display: flex; align-items: center; gap: 0.5rem; }
.room-section .group-title .count { padding: 0 0.45rem; border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: 0.75rem; letter-spacing: 0; }

/* Prostorija kao pločica: krupna oznaka, naziv, služba i oprema. */
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 0.6rem; }
.room-tile {
    display: grid;
    align-content: start;
    gap: 0.15rem;
    min-width: 0;
    padding: 0.75rem 0.9rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.room-tile:hover { border-color: var(--primary); box-shadow: var(--shadow); color: var(--text); }
.room-tile:focus-visible { outline: none; box-shadow: var(--focus); }
.room-tile.inactive { opacity: 0.65; border-style: dashed; }
.room-tile-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.room-tile-code { font-size: 1.15rem; font-weight: 800; letter-spacing: 0.01em; }
.room-tile-name { font-weight: 600; overflow-wrap: anywhere; }
.room-tile-meta { display: flex; align-items: center; gap: 0.3rem; color: var(--text-muted); font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-tile-meta .icon { width: 1em; height: 1em; flex: none; }

/* ---- Pregled ---- */

.dash-head > div:first-child { flex: 1 1 auto; min-width: 0; }
.dash-head h1 { font-size: 1.75rem; font-weight: 650; letter-spacing: -0.02em; }
.dash-date { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin: 0 0 0.2rem; color: var(--text-muted); font-size: 0.925rem; }
.live { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--success); font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); animation: live 2s ease-in-out infinite; }
@keyframes live { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }

/* Kartice-filteri: naziv i ikona u boji grupe, veliki broj, kratko objašnjenje. */
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
@media (min-width: 700px) { .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .stat-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.stat {
    display: grid;
    align-content: start;
    gap: 0.15rem;
    min-width: 0;
    padding: 0.85rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    font: inherit;
    color: var(--text);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.stat:hover { border-color: var(--tone); }
.stat:focus-visible { outline: none; box-shadow: var(--focus); }
.stat.active { border-color: var(--tone); box-shadow: 0 0 0 2px var(--tone-soft), var(--shadow); background: var(--tone-soft); }
.stat-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; min-width: 0; }
.stat-icon {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    flex: none;
    border-radius: 9px;
    background: var(--tone-soft);
    color: var(--tone);
}
.stat-icon .icon { width: 1.15em; height: 1.15em; }
.stat.active .stat-icon { background: var(--surface); }
.stat-label { padding-top: 0.3rem; font-weight: 700; font-size: 0.9rem; line-height: 1.25; }
.stat-value { font-size: 1.9rem; font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat.zero .stat-value { color: var(--text-muted); font-weight: 600; }
.stat-hint { color: var(--text-muted); font-size: 0.78rem; line-height: 1.3; }

/* Na računaru: tiketi lijevo, prostorije i riješeno danas desno. */
/* minmax(0, 1fr): kolona se ne širi prema dugom tekstu u karticama tiketa (inače bi na telefonu izašla van ekrana). */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.5rem; margin-top: 1.5rem; }
@media (min-width: 1100px) { .dash-grid { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; } }
.dash-group + .dash-group { margin-top: 1.5rem; }
.dash-main > .list-head .group-title, .dash-group .group-title { margin-top: 0; }
.group-title { display: flex; align-items: center; gap: 0.5rem; }
.group-title .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--tone, var(--text-muted)); }
.group-title .count {
    padding: 0 0.45rem;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text);
    font-size: 0.75rem;
    letter-spacing: 0;
}
.side-card { padding: 1rem 1.1rem; }
.side-card + .side-card { margin-top: 1rem; }
.side-card .group-title { margin: 0 0 0.75rem; }
.side-card .bar-row { grid-template-columns: minmax(0, 1fr) 34%; }
.resolved-list { list-style: none; margin: 0 0 0.25rem; padding: 0; display: grid; gap: 0.6rem; }
.resolved-list li { display: grid; gap: 0.05rem; padding-left: 0.75rem; border-left: 2px solid var(--success-soft); }
.resolved-list a { font-weight: 600; text-decoration: none; }
/* Mapa zgrade: spratovi odozgo nadolje, pločica po prostoriji; otvoren tiket istaknut, hitan crven i „diše“. */
/* Više zgrada nego što stane u usku kolonu: jezičci se pomjeraju vodoravno, ne prelamaju se. */
.map-tabs { display: flex; max-width: 100%; margin-bottom: 0.75rem; overflow-x: auto; scrollbar-width: none; }
.map-tabs button { flex: none; white-space: nowrap; }
.map-count { margin-left: 0.3rem; padding: 0 0.4rem; border-radius: 999px; background: var(--danger-soft); color: var(--danger); font-size: 0.75rem; }
.map { display: grid; gap: 0.4rem; }
.map-floor { display: grid; grid-template-columns: 1.4rem minmax(0, 1fr); align-items: start; gap: 0.4rem; }
.map-floor-label { padding-top: 0.45rem; color: var(--text-muted); font-size: 0.75rem; font-weight: 700; text-align: center; }
.map-rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 0.35rem; }
.map-tile {
    display: block;
    padding: 0.4rem 0.2rem;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    text-align: center;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: transform 0.15s ease, background 0.15s, color 0.15s;
}
.map-tile:hover { transform: scale(1.06); color: var(--text); }
.map-tile:focus-visible { outline: none; box-shadow: var(--focus); }
.map-tile.open { background: var(--primary-soft); border-color: var(--primary); color: var(--text); }
.map-tile.urgent { background: var(--danger); border-color: var(--danger); color: #fff; animation: breathe 1.8s ease-out infinite; }
@keyframes breathe { 0% { box-shadow: 0 0 0 0 rgb(239 68 68 / 55%); } 100% { box-shadow: 0 0 0 9px rgb(239 68 68 / 0%); } }
.map-legend { display: flex; flex-wrap: wrap; gap: 1rem; margin: 0.75rem 0 0; color: var(--text-muted); font-size: 0.8rem; }
.map-legend > span { display: inline-flex; align-items: center; gap: 0.35rem; }
.map-swatch { width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--primary); background: var(--primary-soft); }
.map-swatch.urgent { border-color: var(--danger); background: var(--danger); }

/* Mali grafikon trenda na dnu kartice-filtera, u boji grupe. */
.sparkline { display: block; width: 100%; height: 28px; margin-top: 0.5rem; color: var(--tone, var(--primary)); overflow: visible; }
.spark-area { fill: currentColor; fill-opacity: 0.14; }
.spark-line { fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* Bočni panel tiketa: klizi zdesna preko zamućenog pregleda; Escape ili klik pored njega ga zatvara. */
.drawer-layer { position: fixed; inset: 0; z-index: 60; }
.drawer-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    border: 0;
    background: rgb(2 6 23 / 55%);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    cursor: pointer;
    animation: fade-in 0.2s ease-out;
}
.drawer {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    bottom: 0.75rem;
    width: min(460px, calc(100% - 1.5rem));
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.25rem;
    overflow-y: auto;
    background: var(--drawer-bg, var(--surface));
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 6px);
    box-shadow: 0 30px 60px -20px rgb(0 0 0 / 60%);
    -webkit-backdrop-filter: var(--glass-blur, none);
    backdrop-filter: var(--glass-blur, none);
    animation: drawer-in 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.drawer:focus { outline: none; }
@keyframes drawer-in { from { transform: translateX(40px); opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } }
.drawer-head { display: flex; align-items: flex-start; gap: 0.75rem; }
.drawer-title { flex: 1; min-width: 0; }
.drawer-title .eyebrow { display: block; color: var(--primary); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.drawer-title h2 { margin: 0.15rem 0 0; font-size: 1.35rem; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.drawer-close { flex: none; }
.drawer .badges { align-items: center; }
.drawer .badges .ticket-no { margin-left: auto; }
.drawer .alert { margin: 0; }
.drawer-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
.drawer-facts > div { display: grid; gap: 0.1rem; padding: 0.6rem 0.75rem; border-radius: var(--radius-sm); background: var(--surface-2); min-width: 0; }
.drawer-facts > .wide { grid-column: 1 / -1; }
.drawer-facts span { color: var(--text-muted); font-size: 0.78rem; }
.drawer-facts strong { font-weight: 600; overflow-wrap: anywhere; }
.drawer-section h3 { margin-bottom: 0.5rem; color: var(--text-muted); font-size: 0.8rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.drawer-section p { margin: 0; }
.drawer-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: auto; padding-top: 0.5rem; }
.drawer-actions .btn-primary { flex: 1 1 160px; }
@media (prefers-reduced-motion: reduce) { .drawer, .drawer-backdrop { animation: none; } }

/* ---- Režim za TV: krupno, čitljivo sa nekoliko metara; veličine rastu sa širinom ekrana (vw). ---- */
.tv { min-height: 100dvh; display: flex; flex-direction: column; gap: clamp(1rem, 1.6vw, 2rem); padding: clamp(1rem, 2.5vw, 3rem); font-size: clamp(1rem, 1.05vw, 1.4rem); }
.tv h2 { margin: 0 0 0.75rem; color: var(--text-muted); font-size: 1em; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.tv-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.tv-brand { display: flex; align-items: center; gap: 0.9rem; }
.tv-brand > div { display: grid; line-height: 1.25; }
.tv-brand strong { font-size: 1.5em; }
.tv-brand span { color: var(--text-muted); }
.tv-brand .brand-logo { height: 2.6em; max-width: 9em; padding: 0.2em 0.4em; border-radius: 10px; background: rgb(255 255 255 / 92%); }
.tv-clock { display: flex; align-items: center; gap: 1.25rem; }
.tv-clock .live { font-size: 0.9em; }
.tv-clock time { font-size: 3.2em; font-weight: 300; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.tv-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: clamp(0.75rem, 1.2vw, 1.5rem); }
.tv-kpi {
    display: grid;
    gap: 0.3em;
    padding: 1em 1.2em;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 4px);
    background: linear-gradient(180deg, rgb(255 255 255 / 7%), rgb(255 255 255 / 3.5%));
}
.tv-kpi span { color: var(--text-muted); font-weight: 600; }
.tv-kpi strong { color: var(--tone); font-size: 4.2em; font-weight: 750; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.tv-kpi.hot { border-color: rgb(248 113 113 / 45%); background: rgb(239 68 68 / 12%); }
.tv-grid { flex: 1; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: clamp(0.75rem, 1.6vw, 2rem); min-height: 0; }
.tv-queue { display: flex; flex-direction: column; gap: 0.6em; }
.tv-row { display: flex; align-items: center; gap: 1.1em; padding: 0.8em 1em; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.tv-row.urgent { border-color: rgb(248 113 113 / 45%); background: rgb(239 68 68 / 10%); }
.tv-room { width: 5.5em; flex: none; font-size: 1.45em; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tv-what { flex: 1; min-width: 0; display: grid; }
.tv-what strong { font-size: 1.3em; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tv-what span { color: var(--text-muted); }
.tv-row .age { min-width: 4.5em; padding: 0.3em 0.6em; border-radius: 10px; font-size: 1.35em; text-align: center; }
.tv-calm { display: flex; align-items: center; gap: 0.6em; margin: 1em 0; font-size: 1.6em; font-weight: 600; color: var(--success); }
.tv-calm .icon { width: 1.3em; height: 1.3em; }
.tv-more { margin: 0.25em 0 0; color: var(--text-muted); text-align: center; }
.tv-side { display: flex; flex-direction: column; gap: clamp(0.75rem, 1.6vw, 2rem); min-width: 0; }
.tv-buildings { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16em), 1fr)); gap: clamp(0.75rem, 1.2vw, 1.5rem); }
.tv .map-tile { padding: 0.55em 0.2em; font-size: 0.85em; }
.tv .map-floor-label { font-size: 0.85em; }
.tv-feed-row { display: flex; gap: 1em; padding: 0.35em 0; }
.tv-feed-row time { width: 3.2em; flex: none; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.tv-feed-row span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 899px) {
    .tv-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tv-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Rečenica stanja na vrhu pregleda: šta je najvažnije upravo sada. */
.status-line { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; padding: 0.85rem 1.1rem; }
.status-line p { flex: 1; margin: 0; }
.status-line .muted { margin-left: 0.25rem; }
.status-dot { width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--success); }
.status-dot.urgent { background: var(--danger); animation: breathe 1.8s ease-out infinite; }
.status-dot.waiting { background: var(--primary); }
@media (prefers-reduced-motion: reduce) { .map-tile.urgent, .status-dot.urgent { animation: none; } }

.empty-state { display: grid; justify-items: center; gap: 0.5rem; padding: 2rem 1rem; text-align: center; }
.empty-state p { margin: 0; }

.list-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.list-head .group-title { margin-bottom: 0.5rem; }

.ticket-row { align-items: flex-start; }
.ticket-row .icon-box { margin-top: 2px; }
.ticket-row .badges { margin-top: 0.35rem; }
.ticket-row.suspicious { border-style: dashed; border-color: #e3a0a3; }
.ticket-no { color: var(--text-muted); font-size: 0.875rem; font-weight: 600; white-space: nowrap; }
.ticket-no.big { font-size: 1.1rem; }

/* Desno u redu tiketa: koliko čeka na preuzimanje (posle 15 min upozorenje, posle 30 min crveno) i broj tiketa. */
.ticket-side { display: grid; justify-items: end; gap: 0.3rem; flex: none; }
.age {
    padding: 0.1rem 0.5rem;
    border-radius: 7px;
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.age-warn { background: var(--warning-soft); color: var(--warning); }
.age-late { background: var(--danger-soft); color: var(--danger); }

/* Novi tiket je kratko istaknut. */
.flash { animation: flash 2.5s ease-out 2; }
@keyframes flash {
    0% { background: #fff6cc; border-color: #e0b400; }
    100% { background: var(--surface); }
}

.action-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }

/* Čipovi: izbor jednim dodirom (uzrok, rješenje, trajanje, razlog). */
.chips-group { margin: 0 0 1.25rem; padding: 0; border: 0; }
.chips-group legend { margin-bottom: 0.5rem; padding: 0; font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0.45rem 0.9rem;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 999px;
    color: var(--text);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip:has(input:checked), .chip.selected { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-hover); }
.chip:has(input:focus-visible), .chip:focus-visible { outline: none; box-shadow: var(--focus); }
.chip .icon { width: 1.15em; height: 1.15em; margin-right: 0.4rem; color: var(--primary); }
.chip-muted { border-style: dashed; color: var(--text-muted); }
.input-narrow { width: 6.5rem; }

/* Brza intervencija: numerisani koraci, odabrani korak se sažme u jedan red. */
.step { margin-bottom: 1.25rem; }
.step-title { display: flex; align-items: center; gap: 0.5rem; font-size: 1.05rem; margin-bottom: 0.6rem; }
.step-no {
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 0.85rem;
}
.step-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-height: 48px;
    padding: 0.4rem 0.4rem 0.4rem 1rem;
    background: var(--primary-soft);
    border-radius: var(--radius);
    font-weight: 600;
}
.step .chips + .chips { margin-top: 0.5rem; }
.input-inline { width: auto; min-height: 36px; padding: 0.3rem 0.5rem; }

.history-hint { margin-bottom: 1.25rem; padding: 0.75rem 1rem; border-radius: var(--radius-sm); background: var(--surface-2); }
.history-hint h3 { font-size: 0.95rem; margin-bottom: 0.5rem; }
.past-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.past-list li { display: grid; gap: 0.1rem; padding-left: 0.9rem; border-left: 2px solid var(--border); }
.past-title { font-weight: 600; text-decoration: none; }

.note-form { display: flex; gap: 0.5rem; margin-top: 1rem; }

/* Obavještenja o novim prijavama, dole desno (na telefonu iznad donje navigacije). */
.toasts {
    position: fixed;
    right: 1rem;
    bottom: calc(72px + env(safe-area-inset-bottom));
    z-index: 50;
    display: grid;
    gap: 0.5rem;
    width: min(380px, calc(100vw - 2rem));
}
.toast {
    display: grid;
    gap: 0.15rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    background: var(--text);
    color: #fff;
    text-decoration: none;
    box-shadow: 0 6px 20px rgb(16 24 40 / 25%);
    animation: toast-in 0.2s ease-out;
}
.toast:hover { color: #fff; }
.toast span { color: #d6dbe3; font-size: 0.9rem; }
.toast-muted { background: #5a6472; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
@media (min-width: 900px) { .toasts { bottom: 1.5rem; } }

/* ---- Lista tiketa, pretraga, statistika ---- */

.inline-field { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--text-muted); font-size: 0.9rem; }
.inline-field .input { width: auto; }
.nowrap { white-space: nowrap; }

.advanced { margin-bottom: 1rem; }
.advanced summary { cursor: pointer; font-weight: 600; color: var(--primary); padding: 0.4rem 0; min-height: 44px; display: flex; align-items: center; }
.advanced[open] summary { margin-bottom: 0.5rem; }

/* Pretraga u zaglavlju: polje na širem ekranu, ikona na telefonu. */
.topbar-search { position: relative; display: none; width: min(320px, 32vw); margin: 0; }
.topbar-search .icon { position: absolute; left: 0.65rem; top: 50%; transform: translateY(-50%); width: 1.1em; height: 1.1em; color: var(--text-muted); }
.topbar-search .input { min-height: 38px; padding: 0.4rem 0.6rem 0.4rem 2.2rem; background: var(--surface-2); border-color: transparent; }
.topbar-search .input:focus { background: var(--surface); }
@media (min-width: 700px) {
    .topbar-search { display: block; }
    .topbar-search-link { display: none; }
}

.kpi-value-sm { font-size: 1.35rem; }
.chart-grid { display: grid; gap: 1rem; margin-top: 1rem; }
@media (min-width: 900px) { .chart-grid { grid-template-columns: 1fr 1fr; } }

/* Horizontalne trake: jedna serija, tanka traka (12 px), zaobljena samo na kraju vrijednosti. */
.bar-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }
.bar-row { display: grid; grid-template-columns: minmax(7rem, 40%) 1fr; align-items: center; gap: 0.75rem; }
.bar-label { font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-label a { text-decoration: none; }
.bar-track { display: flex; align-items: center; gap: 0.45rem; min-width: 0; }
.bar { display: block; height: 12px; background: var(--primary); border-radius: 0 4px 4px 0; }
.bar-value { font-size: 0.85rem; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }

/* Stubovi po mjesecima: osnovna linija dole, tri blage pomoćne linije, broj samo na posljednjem stubu. */
.col-chart { position: relative; height: 200px; padding: 0.75rem 0 1.75rem 2rem; }
.col-grid { position: absolute; inset: 0.75rem 0 1.75rem 2rem; }
.col-grid span { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--border); }
.col-grid span::before {
    content: attr(data-value);
    position: absolute;
    right: calc(100% + 0.4rem);
    top: -0.6em;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.col-bars { position: relative; display: flex; align-items: stretch; height: 100%; gap: 2px; }
.col { flex: 1; display: flex; flex-direction: column; align-items: center; min-width: 0; }
.col-plot { position: relative; flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.col-bar { display: block; width: min(24px, 60%); min-height: 0; background: var(--primary); border-radius: 4px 4px 0 0; }
.col-value { position: absolute; left: 0; right: 0; margin-bottom: 0.2rem; text-align: center; font-size: 0.8rem; font-weight: 600; color: var(--text); }
.col-label { position: absolute; bottom: -1.5rem; font-size: 0.75rem; color: var(--text-muted); }
.col { position: relative; }

.qr-card { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 1.25rem; }
.qr-card > .stack { flex: 1 1 260px; }
.qr-card code { overflow-wrap: anywhere; }
.qr-preview { width: 160px; height: 160px; flex: none; }
.qr-preview svg { display: block; width: 100%; height: 100%; }

/* Privremena lozinka: lako se označi i prepiše, jasno izdvojena. */
.secret {
    display: inline-block;
    padding: 0.5rem 0.9rem;
    border-radius: var(--radius-sm);
    background: var(--warning-soft);
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: 1.25rem;
    letter-spacing: 0.05em;
    user-select: all;
}

.only-desktop { display: none; }

@media (min-width: 700px) {
    .form-grid { grid-template-columns: 1fr 1fr; }
    .form-grid .span-2 { grid-column: 1 / -1; }
    .form-grid .align-end { align-self: end; margin-bottom: 1rem; }
}

@media (min-width: 900px) {
    .only-desktop { display: block; }
    .only-mobile { display: none; }
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: #fff;
    font-weight: 800;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
}

/* Logo iz podešavanja: iste visine kao oznaka „IT“, širina prema slici (do 140 px). */
.brand-logo { display: block; height: 32px; width: auto; max-width: 140px; object-fit: contain; flex: none; }

.logo-preview {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 96px;
    padding: 1rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}
.logo-preview img { max-height: 80px; max-width: 100%; object-fit: contain; }

/* ---- Interni dio: zaglavlje, navigacija, sadržaj ---- */

/* minmax(0, 1fr): široki sadržaj (tabela, red jezičaka) se pomjera unutar sebe, a ne širi cijelu stranicu. */
.shell {
    min-height: 100dvh;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: var(--topbar-h) 1fr auto;
    grid-template-areas: "top" "main" "nav";
}

.topbar {
    grid-area: top;
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    height: var(--topbar-h);
    padding: 0 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.topbar .spacer { flex: 1; }
.brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand:hover { color: var(--text); }
.user-name { color: var(--text-muted); font-size: 0.925rem; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
.user-name:hover { color: var(--text); }
.logout { margin: 0; }

/* Prekidač jezika SR | EN: dva mala dugmeta, izabrani jezik istaknut. */
.lang-switch { display: inline-flex; flex: none; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.lang-switch a {
    display: inline-grid;
    place-items: center;
    min-width: 36px;
    min-height: 32px;
    padding: 0 0.45rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-decoration: none;
}
.lang-switch a + a { border-left: 1px solid var(--border); }
.lang-switch a:hover { background: var(--surface-2); color: var(--text); }
.lang-switch a.active { background: var(--primary-soft); color: var(--primary); }
.public-header .spacer { flex: 1; }

.content { grid-area: main; width: 100%; max-width: 1200px; margin: 0 auto; padding: 1rem 1rem 1.5rem; }

/* Na telefonu: navigacija je traka na dnu ekrana, na dohvat palca. */
.appnav {
    grid-area: nav;
    position: sticky;
    bottom: 0;
    z-index: 20;
    display: flex;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
}
.appnav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 56px;
    padding: 6px 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
}
.appnav a.active { color: var(--primary); }
.appnav a.secondary { display: none; }

@media (max-width: 599px) {
    .hide-sm { display: none; }
}

@media (min-width: 900px) {
    .shell {
        grid-template-columns: 232px minmax(0, 1fr);
        grid-template-rows: var(--topbar-h) 1fr;
        grid-template-areas: "top top" "nav main";
    }
    .appnav {
        position: sticky;
        top: var(--topbar-h);
        bottom: auto;
        align-self: start;
        flex-direction: column;
        gap: 2px;
        height: calc(100dvh - var(--topbar-h));
        padding: 0.75rem;
        border-top: 0;
        border-right: 1px solid var(--border);
    }
    .appnav a {
        flex: none;
        flex-direction: row;
        justify-content: flex-start;
        gap: 0.7rem;
        min-height: 42px;
        padding: 0 0.75rem;
        border-radius: var(--radius-sm);
        font-size: 0.95rem;
    }
    .appnav a:hover { background: var(--surface-2); color: var(--text); }
    .appnav a.active { background: var(--primary-soft); color: var(--primary); }
    .appnav a.secondary { display: flex; }
    .appnav a.more { display: none; }
    .content { padding: 1.5rem 2rem 2rem; }
}

/* ---- Javni dio ---- */

.public { min-height: 100dvh; display: flex; flex-direction: column; }
.public-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    font-weight: 700;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.public-main { flex: 1; width: 100%; max-width: 560px; margin: 0 auto; padding: 1.25rem 1rem 2rem; }

.public-footer { padding: 1rem; text-align: center; font-size: 0.85rem; }
.public-footer a { color: var(--text-muted); }

.auth-card { max-width: 420px; margin: 1rem auto 0; }

/* Javna forma: velike površine za dodir, minimum teksta. */
.room-head { margin-bottom: 1rem; }
.room-head .eyebrow { display: block; color: var(--text-muted); font-size: 0.9rem; font-weight: 700; letter-spacing: 0.03em; }
.room-head h1 { margin: 0; font-size: 1.4rem; }
.with-icon { display: flex; align-items: center; gap: 0.6rem; }
.with-icon .icon { color: var(--primary); }
.question { font-size: 1.15rem; margin-bottom: 0.75rem; }

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 112px;
    padding: 1rem 0.5rem;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    color: var(--text);
    font-size: 1.05rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
}
.tile .icon { width: 36px; height: 36px; color: var(--primary); }
.tile:hover, .tile:focus-visible { border-color: var(--primary); color: var(--text); outline: none; }

.options { display: grid; gap: 0.5rem; margin: 0 0 1.25rem; padding: 0; border: 0; }
.options legend { margin-bottom: 0.5rem; padding: 0; font-weight: 700; }
.option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 56px;
    padding: 0.7rem 1rem;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
}
.option input { width: 22px; height: 22px; flex: none; accent-color: var(--primary); }
.option:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.optional { color: var(--text-muted); font-weight: 400; }
.center { text-align: center; }

.done { text-align: center; padding-top: 1rem; }
.icon-circle {
    display: grid;
    place-items: center;
    width: 76px;
    height: 76px;
    margin: 0 auto;
    border-radius: 50%;
    background: var(--success-soft);
    color: var(--success);
}
.icon-circle .icon { width: 42px; height: 42px; }

.prose h2 { margin-top: 1.5rem; }
.prose ul { padding-left: 1.25rem; margin: 0 0 0.75rem; }
.prose li { margin-bottom: 0.35rem; }

/* Greška u interaktivnom dijelu (Blazor); prikazuje je blazor.web.js. */
.blazor-error-boundary { background: var(--danger); color: #fff; padding: 1rem; border-radius: var(--radius-sm); }
.blazor-error-boundary::after { content: "Došlo je do greške."; }

/* ---- Portovi mrežne opreme ---- */

/* Prednja strana switch-a: tamna ploča, zauzeti portovi „svijetle“. Na uskom ekranu se pomjera vodoravno. */
.faceplate {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 12px;
    background: #1f2630;
    border-radius: var(--radius);
}
.port-block { display: grid; grid-auto-flow: column; grid-template-rows: repeat(var(--rows), auto); gap: 4px; }
.port {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 2px;
    border: 1.5px solid transparent;
    border-radius: 6px;
    font: inherit;
    line-height: 1.1;
    cursor: pointer;
}
.port.used { background: var(--primary); color: #fff; }
.port.free { background: transparent; border: 1.5px dashed #6b7686; color: #c9d1db; }
.port:hover { border-color: #fff; }
.port.selected { outline: 3px solid #ffd34d; outline-offset: 1px; }
.port:focus-visible { outline: 3px solid #ffd34d; outline-offset: 1px; }
.port-no { font-size: 0.8rem; font-weight: 700; }
.port-short { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.6rem; opacity: 0.9; }

.legend { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.5rem; color: var(--text-muted); font-size: 0.85rem; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; }
.swatch.used { background: var(--primary); }
.swatch.free { border: 1.5px dashed #6b7686; margin-left: 0.6rem; }

.link-button { padding: 0; border: 0; background: none; color: var(--primary); font: inherit; font-weight: 700; cursor: pointer; }
.link-button:hover { text-decoration: underline; }
.ports-table .row-free td { color: var(--text-muted); }
.ports-table .row-selected td { background: var(--primary-soft); }

/* ---- Tamna „glass“ tema internog dijela ----
   Važi samo na ekranu i samo kad stranica ima .theme-glass (MainLayout, režim za TV, prijava osoblja);
   javna forma za profesore i štampa ostaju svijetle.
   Boje su iste promjenljive kao gore, pa ih sve stranice preuzimaju bez izmjena; ispod su samo mjesta sa fiksnim bojama. */

@media screen {
    body:has(.theme-glass) {
        color-scheme: dark;
        --bg: #070b16;
        --surface: rgb(255 255 255 / 5.5%);
        --surface-2: rgb(255 255 255 / 8%);
        --border: rgb(255 255 255 / 10%);
        --border-strong: rgb(255 255 255 / 20%);
        --text: #eef2f8;
        --text-muted: rgb(226 232 240 / 64%);

        --primary: #8b9cff;
        --primary-hover: #b4c0ff;
        --primary-soft: rgb(129 140 248 / 16%);
        --primary-solid: #6366f1;
        --danger: #f87171;
        --danger-soft: rgb(248 113 113 / 14%);
        --warning: #fbbf24;
        --warning-soft: rgb(251 191 36 / 14%);
        --success: #34d399;
        --success-soft: rgb(52 211 153 / 14%);

        --radius: 18px;
        --radius-sm: 11px;
        --shadow: inset 0 1px 0 rgb(255 255 255 / 6%), 0 20px 40px -24px rgb(0 0 0 / 60%);
        --focus: 0 0 0 3px rgb(129 140 248 / 45%);
        --glass-blur: blur(22px) saturate(150%);
        --cta: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
        --drawer-bg: rgb(17 22 40 / 86%);
        --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;

        /* Tri meka svjetla iza providnih panela; fiksirana, da se ne pomjeraju pri listanju. */
        background:
            radial-gradient(900px 640px at 0% 0%, rgb(79 70 229 / 30%), transparent 60%),
            radial-gradient(760px 600px at 100% 18%, rgb(14 165 233 / 16%), transparent 60%),
            radial-gradient(760px 520px at 55% 110%, rgb(147 51 234 / 20%), transparent 60%),
            var(--bg);
        background-attachment: fixed;
    }

    /* Providni paneli: zamućena pozadina, tanka svijetla ivica, blagi sjaj na gornjoj ivici. */
    body:has(.theme-glass) :is(.card, .stat, .table-wrap, .audit-feed, .topbar, .toast) {
        -webkit-backdrop-filter: var(--glass-blur);
        backdrop-filter: var(--glass-blur);
    }
    body:has(.theme-glass) :is(.card, .stat, .kpi, .table-wrap, .audit-feed, .list-item, .room-tile) {
        background: linear-gradient(180deg, rgb(255 255 255 / 7%), rgb(255 255 255 / 3.5%));
    }

    body:has(.theme-glass) .topbar { background: rgb(7 11 22 / 55%); border-bottom-color: var(--border); }
    body:has(.theme-glass) .appnav { background: rgb(7 11 22 / 55%); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
    @media (min-width: 900px) {
        body:has(.theme-glass) .appnav { background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
    }
    /* Logo fakulteta je često taman na providnoj pozadini; na svijetloj pločici se vidi na tamnoj temi. */
    body:has(.theme-glass) :is(.topbar, .public-header) .brand-logo { height: 30px; padding: 3px 6px; border-radius: 8px; background: rgb(255 255 255 / 92%); }
    body:has(.theme-glass) .public-header { background: rgb(7 11 22 / 55%); }
    body:has(.theme-glass) .auth-card { margin-top: 12vh; padding: 2rem; }
    body:has(.theme-glass) .brand-mark { background: var(--cta); }

    body:has(.theme-glass) .btn-primary,
    body:has(.theme-glass) .status-tab.active {
        background: var(--cta);
        border-color: transparent;
        color: #fff;
        box-shadow: 0 8px 22px -10px rgb(124 58 237 / 80%), inset 0 1px 0 rgb(255 255 255 / 22%);
    }
    body:has(.theme-glass) .btn-primary:hover { background: var(--cta); color: #fff; filter: brightness(1.12); }
    body:has(.theme-glass) .btn-danger { background: #dc2626; }
    body:has(.theme-glass) :is(.step-no, .port.used, .swatch.used) { background: var(--primary-solid); }

    /* Pomjeranje mišem: ivica posvijetli, kartica se blago podigne. */
    body:has(.theme-glass) :is(.list-item, .status-tab, .room-tile, .stat) { transition: transform 0.2s ease, border-color 0.2s, background 0.2s, box-shadow 0.2s; }
    body:has(.theme-glass) :is(.list-item, .status-tab):hover { border-color: var(--border-strong); }
    body:has(.theme-glass) :is(.room-tile, .stat):hover { transform: translateY(-2px); }
    body:has(.theme-glass) .audit-row:hover { background: rgb(255 255 255 / 4%); }
    body:has(.theme-glass) .audit-meta .sep { color: rgb(226 232 240 / 35%); }
    body:has(.theme-glass) .status-tab.tab-warning:not(.active) { border-color: rgb(251 191 36 / 45%); }
    body:has(.theme-glass) .ticket-row.suspicious { border-color: rgb(248 113 113 / 45%); }

    body:has(.theme-glass) .alert-error { border-color: rgb(248 113 113 / 30%); }
    body:has(.theme-glass) .alert-success { border-color: rgb(52 211 153 / 30%); }
    body:has(.theme-glass) .alert-info { border-color: rgb(129 140 248 / 30%); }

    body:has(.theme-glass) .tone-muted { --tone: #94a3b8; }
    body:has(.theme-glass) .tone-teal { --tone: #2dd4bf; --tone-soft: rgb(45 212 191 / 14%); }
    body:has(.theme-glass) .tone-violet { --tone: #c4b5fd; --tone-soft: rgb(196 181 253 / 14%); }

    body:has(.theme-glass) .faceplate { background: rgb(0 0 0 / 35%); border: 1px solid var(--border); }

    body:has(.theme-glass) .toast { background: rgb(17 22 40 / 85%); border: 1px solid var(--border); box-shadow: 0 20px 40px -16px rgb(0 0 0 / 70%); }
    body:has(.theme-glass) .toast-muted { background: rgb(51 59 77 / 85%); }

    body:has(.theme-glass) .flash { animation-name: flash-glass; }
    /* Novi tiket kratko zasvijetli (sjaj oko kartice; pozadina-prelaz se ne može animirati). */
    @keyframes flash-glass {
        0% { border-color: rgb(165 180 252 / 80%); box-shadow: 0 0 0 1px rgb(165 180 252 / 60%), 0 0 32px rgb(129 140 248 / 45%); }
        100% { box-shadow: none; }
    }
}

/* ---- Štampa (npr. filtrirani spisak tiketa) ---- */

.print-only { display: none; }

@media print {
    @page { margin: 12mm; }

    body { background: #fff; font-size: 10pt; }

    /* Na papiru samo sadržaj: bez navigacije, filtera, dugmadi i obavještenja. */
    .topbar, .appnav, .toasts, .toolbar, .advanced, .page-head .actions, .form-actions, .lang-switch,
    #blazor-error-ui, #components-reconnect-modal, .no-print { display: none !important; }
    .print-only { display: block; }

    .shell { display: block; min-height: 0; }
    .content { max-width: none; padding: 0; }
    .page-head { margin-bottom: 0.5rem; }
    .print-head { margin-bottom: 0.75rem; }
    .print-head p { margin: 0 0 0.2rem; }

    /* Uvijek tabela, i kad se štampa sa telefona. */
    .only-desktop { display: block !important; }
    .only-mobile { display: none !important; }

    .table-wrap { overflow: visible; border: 0; border-radius: 0; }
    .table { font-size: 9pt; }
    .table th, .table td { padding: 0.3rem 0.4rem; border-bottom: 1px solid #999; }
    .table th { background: none; color: #000; }
    .table tr { break-inside: avoid; }
    .table a, .cell-link, .link-button { color: #000; text-decoration: none; }
    .card { box-shadow: none; }
    .cell-link .icon, .ticket-cell .icon-box { display: none; }
    .ticket-cell { min-width: 0; }
    .hint { color: #333; }
    .badge { padding: 0; background: none !important; color: #000 !important; font-weight: 400; }
    .badge + .badge::before { content: "· "; }
}
