:root {
    --brand-navy: #0F2A4A;
    --brand-navy-dark: #0A1E36;
    --brand-teal: #1D63D8;   /* plate blue - main accent */
    --brand-teal-light: #8DB8FF;
    --brand-gold: #F5B300;   /* road-sign yellow */
    --page-bg: #F4F6FA;
    --line: #E4E8EF;
    --muted: #6B7685;
    --sidebar-w: 248px;

    --bs-body-font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --bs-body-font-size: .9375rem;
    --bs-body-color: #1F2937;
    --bs-body-bg: var(--page-bg);
    --bs-border-color: var(--line);
    --bs-primary: #0F2A4A;
    --bs-primary-rgb: 15, 42, 74;
    --bs-link-color: #1D63D8;
    --bs-link-color-rgb: 29, 99, 216;
    --bs-link-hover-color: #154BA6;
    --bs-link-hover-color-rgb: 21, 75, 166;
    --bs-border-radius: .5rem;
    --bs-border-radius-lg: .75rem;
    --bs-focus-ring-color: rgba(29, 99, 216, .25);
}

body { -webkit-font-smoothing: antialiased; word-spacing: .06em; }
.table, .num, .stat .value { font-variant-numeric: tabular-nums; }
h1, .h1, .h2, .h3, .h4 { font-weight: 700; letter-spacing: -.01em; color: #111827; }

/* ---------- layout ---------- */
.app-sidebar {
    width: var(--sidebar-w);
    background: var(--brand-navy) !important; /* offcanvas-md forces transparent on desktop */
    --bs-offcanvas-width: var(--sidebar-w);
    color: #C9D4E3;
}
@media (min-width: 768px) {
    .app-sidebar { position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; }
    .app-main { margin-left: var(--sidebar-w); }
}
.app-sidebar .offcanvas-body { display: flex; flex-direction: column; height: 100%; padding: 0; }
.app-brand { display: flex; align-items: center; gap: .6rem; padding: 1.35rem 1.1rem 1.25rem; text-decoration: none; font-size: 1.02rem; white-space: nowrap; }
.brand-a { font-weight: 800; color: #fff; letter-spacing: -.01em; }
.brand-b { font-weight: 400; color: var(--brand-gold); }
.nav-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #7F93AE; padding: 1rem 1.25rem .4rem; }
.app-nav a {
    display: flex; align-items: center; gap: .75rem;
    margin: 1px .75rem; padding: .55rem .75rem; border-radius: .5rem;
    color: #C9D4E3; text-decoration: none; font-weight: 500;
}
.app-nav a i { font-size: 1.05rem; opacity: .85; }
.app-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.app-nav a.active { background: rgba(29, 99, 216, .28); color: #fff; box-shadow: inset 3px 0 0 var(--brand-gold); }
.nav-badge { margin-left: auto; background: var(--brand-gold); color: #3D2A00; font-size: .72rem; font-weight: 700; border-radius: 999px; padding: .1rem .5rem; }
.app-nav a.active i { color: var(--brand-gold); opacity: 1; }
.app-user { margin-top: auto; padding: 1rem 1.25rem; border-top: 1px solid rgba(255, 255, 255, .08); font-size: .85rem; }
.app-user .avatar { flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--brand-gold); color: var(--brand-navy-dark); display: grid; place-items: center; font-weight: 700; }
.app-user button { color: #9FB0C6; }
.app-user button:hover { color: #fff; }

.app-topbar { background: var(--brand-navy); padding: .6rem 1rem; }
.app-content { padding: 2rem 2.25rem 4rem; }
@media (max-width: 767.98px) { .app-content { padding: 1.25rem 1rem 3rem; } }

/* ---------- page header ---------- */
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: 1.5rem; }
.page-head h1 { font-size: 1.6rem; margin: 0; }
main h1.h3 { font-size: 1.6rem; }
.text-muted { color: var(--muted) !important; }

/* ---------- cards ---------- */
.card { --bs-card-bg: #fff; background: #fff; border: 1px solid var(--line); border-radius: .75rem; box-shadow: 0 1px 2px rgba(16, 24, 40, .04) !important; }
.card-header { background: #fff; border-bottom: 1px solid var(--line); padding: .85rem 1.15rem; font-weight: 600; }
.card-header.bg-warning-subtle { background: #FFF8E6 !important; color: #8A5A00; }
.card.border-warning { border-color: #F3D48A !important; }
.card.border-danger { border-color: #F2B8B5 !important; }
.card.border-success { border-color: #A7DFBC !important; background: #F3FBF6; }
.card-body { padding: 1.15rem; }

.stat { display: flex; flex-direction: column; gap: .2rem; text-decoration: none; height: 100%; }
.stat .label { color: var(--muted); font-size: .8rem; font-weight: 500; }
.stat .value { font-size: 1.5rem; font-weight: 700; color: #111827; letter-spacing: -.01em; }
.stat .icon { width: 38px; height: 38px; border-radius: .6rem; display: grid; place-items: center; font-size: 1.15rem; margin-bottom: .6rem; background: #E6EEFC; color: #1D63D8; }
a.card:hover { border-color: #C5D0DE; }
/* stat tiles produced by older views: muted label + big value */
.card-body > .text-muted.small + .fs-3, .card-body > .text-muted.small + .fs-5 { letter-spacing: -.01em; }

/* ---------- tables ---------- */
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > :not(caption) > * > * { background-color: transparent; }
.table-hover > tbody > tr:has(.empty):hover > * { --bs-table-bg-state: transparent; }
.table > thead th {
    background: #F8FAFC; color: var(--muted); font-size: .72rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--line); padding: .7rem 1rem; white-space: nowrap;
}
.table > tbody td { padding: .75rem 1rem; border-color: #EEF1F5; }
.table-sm > tbody td, .table-sm > thead th { padding: .5rem .75rem; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #F6F9FC; }
.card > .table-responsive:first-child .table thead th:first-child,
.card > .table-responsive:first-child { border-top-left-radius: .75rem; border-top-right-radius: .75rem; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty { text-align: center; padding: 3rem 1rem !important; color: var(--muted); }
.empty i { display: block; font-size: 2rem; color: #B6C2D1; margin-bottom: .5rem; }

/* ---------- buttons & forms ---------- */
.btn { font-weight: 500; border-radius: .5rem; padding: .5rem .95rem; }
.btn-sm { padding: .3rem .65rem; font-size: .82rem; }
.btn-primary { --bs-btn-bg: var(--brand-navy); --bs-btn-border-color: var(--brand-navy); --bs-btn-hover-bg: var(--brand-navy-dark); --bs-btn-hover-border-color: var(--brand-navy-dark); --bs-btn-active-bg: var(--brand-navy-dark); --bs-btn-disabled-bg: var(--brand-navy); --bs-btn-disabled-border-color: var(--brand-navy); }
.btn-success { --bs-btn-bg: #12A150; --bs-btn-border-color: #12A150; --bs-btn-hover-bg: #0E8642; --bs-btn-hover-border-color: #0E8642; }
.btn-outline-secondary { --bs-btn-color: #374151; --bs-btn-border-color: #D5DCE5; --bs-btn-hover-bg: #F3F5F8; --bs-btn-hover-color: #111827; --bs-btn-hover-border-color: #C3CCD8; }
.btn-outline-primary { --bs-btn-color: var(--brand-navy); --bs-btn-border-color: #B9C6D6; --bs-btn-hover-bg: var(--brand-navy); --bs-btn-hover-border-color: var(--brand-navy); }
.btn-outline-danger { --bs-btn-border-color: #F0C2BF; }
.form-control, .form-select { border-color: #D5DCE5; border-radius: .5rem; }
.form-control:focus, .form-select:focus { border-color: var(--brand-teal); box-shadow: 0 0 0 .2rem rgba(29, 99, 216, .18); }
.form-check-input:checked { background-color: var(--brand-teal); border-color: var(--brand-teal); }
.form-label { font-weight: 500; font-size: .875rem; color: #374151; }
.form-text { color: var(--muted); }
code { color: #B4235A; background: #F6F2F5; padding: .05rem .3rem; border-radius: .25rem; }

/* ---------- badges & alerts ---------- */
.badge { font-weight: 600; padding: .4em .7em; border-radius: 999px; }
.badge.text-bg-success { background: #E3F6EA !important; color: #0E7A3E !important; }
.badge.text-bg-warning { background: #FFF1CC !important; color: #8A5A00 !important; }
.badge.text-bg-danger { background: #FDE2E0 !important; color: #A1221A !important; }
.badge.text-bg-info { background: #DDF0FB !important; color: #155B83 !important; }
.badge.text-bg-primary { background: #E1E9F4 !important; color: var(--brand-navy) !important; }
.badge.text-bg-secondary { background: #ECEFF3 !important; color: #4B5563 !important; }
.badge.text-bg-light { background: #F3F5F8 !important; color: #374151 !important; font-weight: 500; }
.alert { border-radius: .75rem; border-width: 1px; }
.alert-success { background: #EEF9F2; border-color: #A7DFBC; color: #0E6B37; }
.alert-danger { background: #FDF0EF; border-color: #F2C3BF; color: #8F1F18; }
.alert-warning { background: #FFF8E6; border-color: #F3D48A; color: #7A5000; }
.pagination { --bs-pagination-active-bg: var(--brand-navy); --bs-pagination-active-border-color: var(--brand-navy); --bs-pagination-color: var(--brand-navy); }

/* ---------- login ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side { background: var(--brand-navy); color: #C9D4E3; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-side h2 { color: #fff; font-size: 2rem; font-weight: 700; letter-spacing: -.015em; max-width: 22rem; }
.auth-side .auth-mark { position: absolute; right: -70px; bottom: -60px; width: 380px; opacity: .07; pointer-events: none; }
.auth-side > :not(.auth-mark) { position: relative; }
.auth-form { display: grid; place-items: center; padding: 2rem 1.25rem; background: #fff; }
.auth-form form { width: 100%; max-width: 360px; }
@media (max-width: 767.98px) { .auth-wrap { grid-template-columns: 1fr; } .auth-side { display: none; } }

/* ---------- home-screen app (iPad / iPhone): the page runs under the status bar and iOS draws a fade of the page background
   over its top edge, about 25 px below the clock (no iPad setting turns it off). In that mode the page is a navy frame (sidebar
   on the left, a strip on top tall enough to hold the fade) and the content is a light panel with a rounded corner inside it. */
@media (display-mode: standalone) {
    html, body { background: var(--brand-navy); }
    .app-main { padding-top: calc(env(safe-area-inset-top, 0px) + 26px); }
    .app-content { background: var(--page-bg); min-height: calc(100vh - env(safe-area-inset-top, 0px) - 26px); }
    .app-topbar { padding-top: calc(env(safe-area-inset-top, 0px) + 26px); }
    .app-sidebar .offcanvas-body { padding-top: env(safe-area-inset-top, 0px); }
}
@media (display-mode: standalone) and (min-width: 768px) {
    .app-content { border-top-left-radius: 18px; }
}
@media (display-mode: standalone) {
    /* sign-in page (white, no navy frame): white background, so the iOS fade under the clock is white too, not a grey shadow */
    html:has(body.guest), body.guest { background: #fff; }
}
@media (display-mode: standalone) and (max-width: 767.98px) {
    /* iPhone: the logo in the top bar and in the slide-out menu sits below the fade */
    .app-sidebar .offcanvas-body { padding-top: calc(env(safe-area-inset-top, 0px) + 26px); }
    .app-main { padding-top: 0; }
    .app-content { min-height: 100vh; }
}
.secret-box { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.05rem; letter-spacing: .04em; }
td .btn-sm { white-space: nowrap; }
.flex-none { flex: none; }
.min-w-0 { min-width: 0; }

/* ---------- pill tabs (vehicle type, price list type) ---------- */
.pill-tabs { display: inline-flex; flex-wrap: wrap; gap: .35rem; padding: .25rem; background: #fff; border: 1px solid var(--line); border-radius: 999px; }
.pill-tabs a, .pill-tabs label { padding: .4rem .95rem; border-radius: 999px; color: #374151; text-decoration: none; font-weight: 500; font-size: .875rem; cursor: pointer; margin: 0; }
.pill-tabs a:hover, .pill-tabs label:hover { background: #F3F5F8; }
.pill-tabs .active, .pill-tabs .active:hover { background: var(--brand-navy); color: #fff; }
.pill-tabs label:has(input:focus-visible) { box-shadow: 0 0 0 .2rem rgba(29, 99, 216, .25); }

/* ---------- fee calculation panel ---------- */
@media (min-width: 1200px) { .obracun-panel { position: sticky; top: 1.5rem; } }
.obracun-panel .table td, .obracun-panel .table th { padding: .45rem 1.15rem; }
.obracun-panel tfoot th { font-size: 1.05rem; border-top: 2px solid var(--line); border-bottom: 0; padding-top: .7rem; padding-bottom: .8rem; }

/* ---------- orders ---------- */
.plate { display: inline-block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 600; font-size: .85rem; letter-spacing: .04em;
    padding: .1rem .45rem .1rem .55rem; border: 1px solid #C9D2DE; border-left: 5px solid var(--brand-teal); border-radius: .3rem; background: #fff; color: #111827; white-space: nowrap; }
.plate-lg { font-size: 1.05rem; padding: .2rem .6rem .2rem .7rem; border-left-width: 7px; }
.row-link { cursor: pointer; }
.dl-grid { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.25rem; }
.dl-grid dt { font-weight: 500; color: var(--muted); }
.dl-grid dd { margin: 0; }
@media (min-width: 1200px) { .obracun-sticky { position: sticky; top: 1.5rem; } .obracun-sticky .obracun-panel { position: static; } }
.klijenti-menu { width: 100%; min-width: 320px; max-height: 360px; overflow-y: auto; padding: .3rem; }
.klijenti-menu .dropdown-item { border-radius: .4rem; padding: .45rem .65rem; white-space: normal; }
.klijenti-menu .dropdown-item.active, .klijenti-menu .dropdown-item:active { background: #E6EEFC; color: #111827; }
