/* ePoslovanje — Swiss Financial Precision Theme */

:root {
    --font-body: 'DM Sans', sans-serif;
    --font-heading: 'Instrument Serif', serif;
    --font-mono: 'DM Mono', monospace;
    --kai: #3B82F6;
    --kv: #8B5CF6;
    --ks: #059669;
    --kd: #DC2626;
    --kw: #D97706;
    --bg: #F5F5F0;
    --r: 10px;
    --rs: 6px;
    --sb-bg: #0F172A;
}

body {
    font-family: var(--font-body);
    background: var(--bg);
}

/* ============================================================
   KAI DESIGN SYSTEM — Badges, utilities
   ============================================================ */
.kai-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}
.kai-badge-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.kai-badge-ok { background: #ECFDF5; color: #059669; }
.kai-badge-warn { background: #FFFBEB; color: #D97706; }
.kai-badge-err { background: #FEF2F2; color: #DC2626; }
.kai-badge-info { background: #EFF6FF; color: #2563EB; }
/* Aliasi (success/warning/danger/default) — koriste ih Korisnici.razor i F1 postavke.
   .kai-badge-dot inheritom (currentColor) automatski dobiva boju badgea. */
.kai-badge-success { background: #ECFDF5; color: #059669; }
.kai-badge-warning { background: #FFFBEB; color: #D97706; }
.kai-badge-danger { background: #FEF2F2; color: #DC2626; }
.kai-badge-default { background: #F1F5F9; color: #64748B; }

/* KPI Grid — 4 column responsive */
.kai-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}
@media (max-width: 1200px) { .kai-kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .kai-kpi-grid { grid-template-columns: 1fr; } }

/* eVisitor KPI — kompaktne kartice na mobitelu (kao eracun-novi era-kpi tiles):
   2 u redu, manji padding/font, bez podnaslova i ikone. Scopano na .pg-kpi-compact. */
@media (max-width: 600px) {
    .pg-kpi-compact { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 6px !important; }
    .pg-kpi-compact > .mud-paper { padding: 8px 10px !important; }
    .pg-kpi-compact .mud-typography-overline { font-size: 0.55rem !important; letter-spacing: 0.02em !important; line-height: 1.15 !important; }
    .pg-kpi-compact .mud-typography-body1 { font-size: 1.05rem !important; }
    .pg-kpi-compact .mud-typography-caption { display: none !important; }
    .pg-kpi-compact .mud-icon-root { display: none !important; }
}
@media (max-width: 380px) {
    .pg-kpi-compact > .mud-paper { padding: 6px 8px !important; }
    .pg-kpi-compact .mud-typography-body1 { font-size: 0.95rem !important; }
}

/* Klikabilne KPI kartice (KpiCard s OnClick) — hover lift */
.kai-kpi-clickable:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(15,23,42,0.08); }

/* Mono text */
.kai-mono { font-family: var(--font-mono); }

/* Positive/Negative values */
.kai-pos { color: #059669; }
.kai-neg { color: #DC2626; }
.kai-warn-val { color: #D97706; }

/* Table th uppercase */
.mud-table .mud-table-head th {
    font-size: 0.65rem !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748B !important;
}

/* Section card */
.kai-section {
    background: #fff;
    border: 1px solid #E8EBF0;
    border-radius: var(--r);
    padding: 16px;
    margin-bottom: 12px;
}

/* Filter bar */
.kai-filter {
    background: #fff;
    border: 1px solid #E8EBF0;
    border-radius: var(--r);
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

/* Info/warning/success banners */
.kai-banner {
    padding: 10px 14px;
    border-radius: var(--rs);
    font-size: 0.72rem;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.kai-banner-info { background: #EFF6FF; border: 1px solid #BFDBFE; color: #1E40AF; }
.kai-banner-warn { background: #FFFBEB; border: 1px solid #FDE68A; color: #92400E; }
.kai-banner-success { background: #ECFDF5; border: 1px solid #A7F3D0; color: #065F46; }
.kai-banner-error { background: #FEF2F2; border: 1px solid #FECACA; color: #991B1B; }

/* Money / number display */
.money, .number {
    font-family: var(--font-heading);
    font-variant-numeric: tabular-nums;
}

/* ============================================================
   MudBlazor Overrides — AppBar + Main Content offset
   ============================================================ */
.mud-main-content {
    padding-top: 76px !important;
}

/* ============================================================
   MudBlazor Overrides — Sidebar styling
   ============================================================ */
.mud-drawer {
    transition: width 200ms ease !important;
    overflow-x: hidden;
}

/* Hide logo text and footer when mini drawer is collapsed */
.mud-drawer--closed .sidebar-logo-text,
.mud-drawer--closed .sidebar-footer {
    opacity: 0;
    transition: opacity 150ms ease;
}
.mud-drawer--open .sidebar-logo-text,
.mud-drawer--open .sidebar-footer {
    opacity: 1;
    transition: opacity 150ms ease 100ms;
}

.mud-nav-link {
    color: #CBD5E1 !important;
    font-size: 0.82rem;
}

.mud-nav-link:hover,
.mud-nav-link.active {
    background: rgba(255, 255, 255, 0.1) !important;
    color: white !important;
}

.mud-nav-group .mud-nav-group-text {
    color: #94A3B8 !important;
    font-size: 0.82rem;
}

/* Table hover */
.mud-table .mud-table-row:hover {
    background: #F1F5F9 !important;
}

/* KPI card hover */
.kpi-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.2s ease;
}

/* ============================================================
   NOTIFICATION BELL — pulsing badge + gentle ring shake
   ============================================================
   The red unread-count badge pulses (scale + outward halo) so it
   draws the eye without being annoying. The bell itself does a
   short ring-shake every few seconds while unread > 0. Both
   animations honour prefers-reduced-motion. */

@keyframes kai-badge-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.55);
    }
    50% {
        transform: scale(1.18);
        box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
    }
}

@keyframes kai-bell-ring {
    /* Idle 0-60%, shake from 60-95%, settle by 100%. Longer shake +
       shorter cycle below = visibly "ringing" instead of a single flick
       buried inside a 3 s lull. */
    0%, 60%, 100% { transform: rotate(0deg); }
    63% { transform: rotate(-18deg); }
    67% { transform: rotate(15deg); }
    71% { transform: rotate(-12deg); }
    75% { transform: rotate(10deg); }
    79% { transform: rotate(-7deg); }
    83% { transform: rotate(5deg); }
    87% { transform: rotate(-3deg); }
    91% { transform: rotate(2deg); }
    95% { transform: rotate(-1deg); }
}

/* MudBlazor's badge dot is rendered as <span class="mud-badge ..."> in v9
   but the exact class chain varies (mud-badge, mud-badge-content,
   mud-badge-icon). Match any of them so the pulse fires regardless of
   internal variant. */
.kai-pulse-badge .mud-badge,
.kai-pulse-badge .mud-badge-content,
.kai-pulse-badge .mud-badge-icon,
.kai-pulse-badge > span[class*="badge"]:not(.kai-pulse-badge) {
    animation: kai-badge-pulse 1.8s ease-in-out infinite !important;
    transform-origin: center;
}

.kai-bell-ring {
    /* 2 s cycle (was 3.2 s) + 35 % shake duration (was 17 %) = the bell
       visibly shakes every couple of seconds instead of looking static. */
    animation: kai-bell-ring 2s ease-in-out infinite !important;
    transform-origin: 50% 10%;
}

@media (prefers-reduced-motion: reduce) {
    .kai-pulse-badge .mud-badge,
    .kai-bell-ring {
        animation: none !important;
    }
}

/* ============================================================
   NOTIFICATION CARD — smooth body expand/collapse
   ============================================================
   "Pročitaj više / Sažmi" toggles body visibility. We can't animate
   `height: auto`, and Chrome 148 still doesn't reliably interpolate
   `grid-template-rows: 0fr ↔ 1fr` (it jumps to the final value with
   no in-between frames). So we use the classic max-height trick:
   set a generous ceiling that comfortably exceeds any notification
   body. CSS animates max-height + opacity smoothly; the slight
   imperfection (max-height is larger than real height, so the
   easing curve isn't perfectly linear with content) is invisible
   to the eye for short text. Honour prefers-reduced-motion. */
.kai-notif-body-wrap {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.32s cubic-bezier(0.4, 0, 0.2, 1),
                opacity   0.22s ease-in;
}

.kai-notif-body-wrap[data-expanded="true"] {
    max-height: 800px;
    opacity: 1;
}

.kai-notif-body-inner {
    /* No layout-affecting rules — kept as a hook for future styling. */
}

@media (prefers-reduced-motion: reduce) {
    .kai-notif-body-wrap {
        transition: none;
    }
}

/* ============================================================
   NOTIFICATION DROPDOWN PANEL
   ============================================================
   Desktop: right-anchored 380 px panel next to the bell.
   Mobile (<768): pin to 8 px from both edges so the panel never
   clips off-screen on a 390 px viewport. The previous fixed
   `right: 80px; width: 380px` put the left edge at −70 px on a
   390 px phone, hiding the title + Označi-sve button. */
.kai-notif-panel {
    position: fixed;
    top: 52px;
    right: 80px;
    width: 380px;
    max-height: 70vh;
    z-index: 9999;
    display: flex;
    flex-direction: column;
}
@media (max-width: 767px) {
    .kai-notif-panel {
        right: 8px;
        left: 8px;
        width: auto;
        max-height: 80vh;
    }
}

/* ============================================================
   SIDEBAR OVERLAY
   ============================================================ */
.sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1099;
}

/* Mobile-only close X inside the drawer brand row. Hidden by default
   on desktop (where the Mini drawer stays docked), shown as a comfortable
   tap target on phones where backdrop tap requires hitting a narrow
   strip of dimmed page. */
.sidebar-close-btn {
    display: none;
    margin-left: auto;
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .12);
    color: #CBD5E1;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}
@media (max-width: 767px) {
    .sidebar-close-btn { display: flex; }
}

/* ============================================================
   SEARCH OVERLAY — Ctrl+K fullscreen search
   ============================================================ */
.search-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 15vh;
}

/* ============================================================
   VISIBILITY TOGGLES
   ============================================================ */
.hide-mobile { }
.show-mobile { display: none; }

/* ============================================================
   BOTTOM NAV — mobile navigation bar
   ============================================================ */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: #fff;
    border-top: 1px solid #E2E8F0;
    z-index: 1100;
    align-items: center;
    justify-content: space-around;
    padding: 0 8px;
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
    .mud-drawer, .mud-appbar, .no-print {
        display: none !important;
    }
    .mud-main-content {
        padding: 0 !important;
        margin: 0 !important;
    }
}

/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */

/* Mobile drawer — Variant=Temporary below Sm. MudBlazor 9 toggles the
   .mud-drawer--open class but does NOT slide-out the closed state with
   its own CSS (the drawer aside stays at left:0 with full width even
   when --closed, intercepting taps on the hamburger). We provide the
   off-canvas transform ourselves AND lift z-index above MudBlazor's
   own scrim (1301) so taps on nav links don't fall through to the
   backdrop and dismiss the drawer instead of navigating. */

/* Mobile S (< 360px) */
@media (max-width: 359px) {
    .bottom-nav { display: flex; }
    .mud-main-content { padding-bottom: 72px !important; }
    .hide-mobile { display: none !important; }
    .show-mobile { display: block; }
    .mud-drawer-temporary.mud-drawer-pos-left {
        width: 280px !important; max-width: 88vw !important;
        position: fixed !important; top: 0; height: 100vh !important;
        z-index: 1302 !important;
        transform: translateX(-100%);
        transition: transform .25s ease;
    }
    .mud-drawer-temporary.mud-drawer-pos-left.mud-drawer--open {
        transform: translateX(0);
    }
    /* Closed → fully out of the hit-test plane too (belt + suspenders;
       a half-rendered transition shouldn't intercept clicks). */
    .mud-drawer-temporary.mud-drawer-pos-left.mud-drawer--closed {
        pointer-events: none;
    }
    /* Compact appbar on phones — single-line at 360-ish px width.
       Tightens icon button padding and clips the user-badge identifier so it
       can't drift over the right edge. OIB switcher label (ime firme + OIB)
       OSTAJE vidljiva i na telefonu (zahtjev korisnika) — samo se naziv
       ellipsira na užu širinu. */
    .mud-appbar .mud-icon-button { padding: 6px !important; }
    .mud-appbar .kai-oib-menu .mud-button {
        padding: 2px 6px !important; min-width: 0 !important;
    }
    .mud-appbar .kai-oib-menu .mud-button-icon-start { margin: 0 2px 0 0; }
    .mud-appbar .kai-oib-menu .mud-button-icon-end { margin: 0; }
    .mud-appbar .kai-oib-menu .kai-oib-label-name { max-width: 72px !important; }
}

/* Mobile (360px - 767px) */
@media (min-width: 360px) and (max-width: 767px) {
    .bottom-nav { display: flex; }
    .mud-main-content { padding-bottom: 72px !important; }
    .hide-mobile { display: none !important; }
    .show-mobile { display: block; }
    .mud-drawer-temporary.mud-drawer-pos-left {
        width: 280px !important; max-width: 88vw !important;
        position: fixed !important; top: 0; height: 100vh !important;
        z-index: 1302 !important;
        transform: translateX(-100%);
        transition: transform .25s ease;
    }
    .mud-drawer-temporary.mud-drawer-pos-left.mud-drawer--open {
        transform: translateX(0);
    }
    .mud-drawer-temporary.mud-drawer-pos-left.mud-drawer--closed {
        pointer-events: none;
    }
    /* Single-line appbar on phones — see notes in the < 360px block. */
    .mud-appbar .mud-icon-button { padding: 6px !important; }
    .mud-appbar .kai-oib-menu .mud-button {
        padding: 2px 6px !important; min-width: 0 !important;
    }
    .mud-appbar .kai-oib-menu .mud-button-icon-start { margin: 0 2px 0 0; }
    .mud-appbar .kai-oib-menu .mud-button-icon-end { margin: 0; }
    .mud-appbar .kai-oib-menu .kai-oib-label-name { max-width: 96px !important; }
}

/* Tablet (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .bottom-nav { display: none; }
    .hide-mobile { display: block; }
    .show-mobile { display: none; }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
    .bottom-nav { display: none; }
    .hide-mobile { display: block; }
    .show-mobile { display: none; }
}

/* ============================================================
   HORECA POS — Dark Theme
   ============================================================ */
.pos-root {
    --pos-bg: #0A0E1A; --pos-bg2: #111827; --pos-bg3: #1A2035;
    --pos-border: #1E293B; --pos-border2: #2A3550;
    --pos-text: #E2E8F0; --pos-text2: #94A3B8; --pos-text3: #475569;
    --pos-kai: #3B82F6; --pos-ks: #059669; --pos-kd: #DC2626;
    --pos-kw: #D97706; --pos-kv: #7C3AED;
    --pos-r: 10px; --pos-rs: 6px;
    --pos-mono: 'DM Mono', monospace;
    font-family: 'DM Sans', sans-serif;
    background: var(--pos-bg); color: var(--pos-text); font-size: 14px;
    overflow: hidden; height: 100vh;
}
.pos-top-nav {
    height: 48px; background: var(--pos-bg2); border-bottom: 1px solid var(--pos-border);
    display: flex; align-items: center; padding: 0 16px; gap: 12px; z-index: 100;
}
.pos-main { display: flex; height: calc(100vh - 48px); overflow: hidden; }
.pos-view { display: none; flex: 1; overflow: hidden; }
.pos-view.active { display: flex; }

/* Appbar icon buttons — consistent rounded square with subtle hover, matches the user-badge chip. */
.kai-appbar-action.mud-icon-button {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, .25);
    background: rgba(255, 255, 255, .55);
    transition: background .15s ease, border-color .15s ease, transform .12s ease;
    margin: 0 2px;
}
.kai-appbar-action.mud-icon-button:hover {
    background: rgba(59, 130, 246, .08);
    border-color: rgba(59, 130, 246, .35);
}
.kai-appbar-action.mud-icon-button:active { transform: scale(.96); }
.kai-appbar-action .mud-icon-root { font-size: 1.05rem; color: #475569; }
.kai-appbar-action:hover .mud-icon-root { color: #3B82F6; }

/* Dark theme variant */
.mud-theme-dark .kai-appbar-action.mud-icon-button {
    background: rgba(15, 23, 42, .35);
    border-color: rgba(148, 163, 184, .18);
}
.mud-theme-dark .kai-appbar-action.mud-icon-button:hover {
    background: rgba(59, 130, 246, .15);
    border-color: rgba(59, 130, 246, .45);
}
.mud-theme-dark .kai-appbar-action .mud-icon-root { color: #CBD5E1; }
.mud-theme-dark .kai-appbar-action:hover .mud-icon-root { color: #60A5FA; }

/* Notification badge sits on top of the new rounded chrome */
.kai-appbar-action .mud-badge { display: inline-flex; }

/* ── Dashboard GridStack: make resize handles + drag affordance obvious ── */
.grid-stack > .grid-stack-item {
    cursor: grab;
}
.grid-stack > .grid-stack-item:active,
.grid-stack > .grid-stack-item.ui-draggable-dragging {
    cursor: grabbing !important;
}
/* Children that the user is supposed to click (buttons, links, inputs) keep their own cursor. */
.grid-stack > .grid-stack-item button,
.grid-stack > .grid-stack-item a,
.grid-stack > .grid-stack-item input,
.grid-stack > .grid-stack-item select,
.grid-stack > .grid-stack-item textarea,
.grid-stack > .grid-stack-item .mud-icon-button,
.grid-stack > .grid-stack-item .mud-button-root { cursor: pointer; }

/* Resize handle in the south-east corner — paint it red and bigger so it's findable. */
.grid-stack > .grid-stack-item > .ui-resizable-se {
    width: 22px !important;
    height: 22px !important;
    right: 4px !important;
    bottom: 4px !important;
    background: transparent !important;
    /* Diagonal red arrow icon (Material Icons "open_in_full"-ish) inlined as SVG. */
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23DC2626'><path d='M21 15v6h-6l2.29-2.29-4.88-4.88 1.41-1.41 4.88 4.88L21 15zm-12 4.71-4.88-4.88L3 17.12V21h6l-2.29-2.29zM3 9V3h6L6.71 5.29l4.88 4.88-1.41 1.41L5.29 6.71 3 9zm12-6h6v6l-2.29-2.29-4.88 4.88-1.41-1.41 4.88-4.88L15 3z'/></svg>") !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: 18px 18px !important;
    cursor: nwse-resize !important;
    opacity: 0.8;
    transition: opacity .15s, transform .15s;
}
.grid-stack > .grid-stack-item:hover > .ui-resizable-se {
    opacity: 1;
    transform: scale(1.15);
}
/* Edge handles — thin red bar so user sees them on hover. */
.grid-stack > .grid-stack-item > .ui-resizable-e,
.grid-stack > .grid-stack-item > .ui-resizable-s {
    background: rgba(220, 38, 38, 0); /* invisible until hover */
    transition: background .15s;
}
.grid-stack > .grid-stack-item:hover > .ui-resizable-e {
    background: rgba(220, 38, 38, 0.45);
    width: 4px !important;
    cursor: ew-resize !important;
}
.grid-stack > .grid-stack-item:hover > .ui-resizable-s {
    background: rgba(220, 38, 38, 0.45);
    height: 4px !important;
    cursor: ns-resize !important;
}


/* Slow down + ease MudCollapse for the eRačun detail dialog (smoother expand/collapse). */
.mud-collapse-container,
.mud-collapse-container .mud-collapse-wrapper,
.mud-collapse-wrapper {
    transition-duration: 600ms !important;
    transition-timing-function: cubic-bezier(0.22, 1, 0.36, 1) !important;
}

/* Help system — applied to <body> for the duration of an html2canvas screenshot
   when the user opts into "Sakri osjetljive" (HtmlScreenshotService.CaptureViewportAsDataUrlAsync
   with blurSensitive=true). Targets table cells, anything tagged data-pii, and
   any input — the agent still sees the screen layout but can't read IBANs,
   amounts, emails, or partner names off the screenshot. Best-effort; user is
   still responsible for reviewing the screenshot before sending. */
.kai-blur-sensitive .mud-table-cell,
.kai-blur-sensitive [data-pii],
.kai-blur-sensitive input,
.kai-blur-sensitive .mud-input {
    filter: blur(4px);
}

/* eRačun status-note attention pulse. Defined here (global CSS) rather than in a Razor
   <style> block, because @keyframes inside a .razor file needs @@ escaping and silently
   breaks the animation (the static rule applies, but the animation name stays undefined →
   no pulse). The note pulled from ePoslovanje keeps a soft amber marker and breathes
   (background + glow) continuously so it always visibly draws the eye. */
@keyframes kaiNotePulse {
    0%, 100% { background: rgba(217, 119, 6, 0.14); box-shadow: 0 0 0 1px rgba(217, 119, 6, 0.20); }
    50%      { background: rgba(217, 119, 6, 0.62); box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.48); }
}
.kai-note-pulse {
    display: inline-block;
    border-radius: 4px;
    padding: 1px 6px;
    background: rgba(217, 119, 6, 0.14);
    box-shadow: 0 0 0 1px rgba(217, 119, 6, 0.20);
    /* Pulse ~6× (~5s) then stop and settle to the static amber marker (keyframe 100% ==
       the base background, so it rests cleanly). !important so a stale inline rule from a
       cached old WASM build (broken @@keyframes, no !important) can't override the pulse. */
    animation: kaiNotePulse 0.85s ease-in-out 6 !important;
}

/* eRačun detail dialog — mobile layout. On phones the action rows (XML/PDF split-button
   groups and the footer buttons) overflowed and crowded each other. Stack them full-width
   for big tap targets, and hide the redundant "Zatvori" footer button (the dialog's
   top-right ✕ already closes it). */
@media (max-width: 700px) {
    .era-doc-actions { gap: 6px; }
    .era-doc-actions > .era-xml-split,
    .era-doc-actions > .era-pdf-split { width: 100%; }
    .era-doc-actions .era-xml-split > button,
    .era-doc-actions .era-pdf-split > button { flex: 1 1 auto; }

    .era-detail-dialog .mud-dialog-actions { flex-wrap: wrap; gap: 6px; }
    .era-detail-dialog .mud-dialog-actions > .mud-button-root,
    .era-detail-dialog .mud-dialog-actions > .mud-menu { flex: 1 1 100%; }
    .era-detail-dialog .mud-dialog-actions .mud-menu > .mud-button-root { width: 100%; }

    .era-close-btn { display: none !important; }
}

/* ============================================================
   Prijava gostiju — AirBnB-stil kalendar rezervacija.
   Plain CSS (ne Razor <style>) zbog @@ zamke. Mjesečna mreža + timeline,
   rezervacije kao trake (avatar + ime + broj gostiju), lane-stacking za preklapanja.
   ============================================================ */
.pgcal-month { margin-bottom: 18px; }
.pgcal-month-title { font-family: 'DM Sans', sans-serif; font-weight: 600; font-size: 1rem; color: #0F172A; margin: 14px 2px 6px; }
.pgcal-dow { display: grid; grid-template-columns: repeat(7, 1fr); }
.pgcal-dow > span { text-align: left; font-size: 0.6rem; font-weight: 600; color: #64748B; text-transform: uppercase; letter-spacing: 0.5px; padding: 4px 6px; }
.pgcal-week { position: relative; }
.pgcal-week-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.pgcal-daycell { min-height: 96px; border-right: 1px solid #EAECEF; border-bottom: 1px solid #EAECEF; padding: 3px 5px; cursor: pointer; user-select: none; }
.pgcal-daycell:first-child { border-left: 1px solid #EAECEF; }
.pgcal-week:first-child .pgcal-daycell { border-top: 1px solid #EAECEF; }
.pgcal-day-num { font-size: 0.72rem; color: #334155; font-family: 'DM Mono', monospace; }
.pgcal-out { background: #FAFBFC; }
.pgcal-out .pgcal-day-num { color: #CBD5E1; }
.pgcal-today .pgcal-day-num { background: var(--kai, #3B82F6); color: #fff; border-radius: 999px; padding: 1px 6px; }
.pgcal-daycell:hover { background: rgba(59,130,246,0.05); }
.pgcal-daycell.pgcal-sel { background: rgba(59,130,246,0.16); }
.pgcal-bars { position: absolute; top: 0; left: 0; right: 0; bottom: 0; pointer-events: none; }
.pgcal-bar { position: absolute; height: 20px; border-radius: 10px; display: flex; align-items: center; gap: 4px; padding: 0 7px 0 2px;
    font-size: 0.66rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; cursor: pointer; pointer-events: auto;
    box-shadow: 0 1px 2px rgba(0,0,0,0.13); }
.pgcal-bar:hover { filter: brightness(1.06); }
.pgcal-bar.pgcal-cont-l { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.pgcal-bar.pgcal-cont-r { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.pgcal-avatar { width: 16px; height: 16px; border-radius: 50%; background: rgba(255,255,255,0.35); display: inline-flex; align-items: center; justify-content: center; font-size: 0.58rem; font-weight: 700; flex: 0 0 auto; }
.pgcal-st-najavljen { background: #3B82F6; }
.pgcal-st-utijeku { background: #059669; }
.pgcal-st-zatvoren { background: #94A3B8; }

/* Timeline (svi objekti kao retci) */
.pgtl-scroll { overflow-x: auto; border: 1px solid #EAECEF; border-radius: 8px; }
/* Strelice za prethodni/sljedeći mjesec u lijevoj sticky ćeliji mjesečne trake. */
.pgtl-monthnav { gap: 2px; justify-content: center; padding: 1px 4px; }
.pgtl-navbtn { width: 26px; height: 26px; }
.pgtl-navbtn .mud-icon-root { font-size: 1.1rem; }
.pgtl-row { display: flex; align-items: stretch; }
.pgtl-label { position: sticky; left: 0; z-index: 3; background: #fff; border-right: 1px solid #EAECEF; min-width: 150px; max-width: 150px;
    padding: 4px 8px; font-size: 0.72rem; font-weight: 600; color: #334155; display: flex; align-items: center; }
.pgtl-headrow .pgtl-label { background: #F8FAFC; }
.pgtl-headrow { border-bottom: 1px solid #EAECEF; }
.pgtl-monthrow { border-bottom: 1px solid #EAECEF; background: #F8FAFC; }
.pgtl-monthrow .pgtl-label { background: #F8FAFC; }
.pgtl-month { font-size: 0.62rem; font-weight: 700; color: #0F172A; padding: 3px 8px; border-right: 1px solid #E2E8F0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-sizing: border-box; display: flex; align-items: center; }
.pgtl-dhead { min-width: 38px; max-width: 38px; text-align: center; font-size: 0.56rem; line-height: 1.1; color: #64748B; font-family: 'DM Mono', monospace; padding: 3px 0; border-right: 1px solid #F1F3F5; }
.pgtl-dhead.pgtl-weekend { background: #FAFBFC; }
.pgtl-dhead.pgtl-today { background: var(--kai,#3B82F6); color: #fff; font-weight: 700; border-radius: 4px 4px 0 0; }
.pgtl-dhead.pgtl-selecting { background: rgba(59,130,246,0.22); color: #1E3A8A; font-weight: 700; }
.pgtl-track { position: relative; border-bottom: 1px solid #EAECEF; }
.pgtl-col { position: absolute; top: 0; bottom: 0; width: 38px; border-right: 1px solid #F4F6F8; }
.pgtl-col.pgtl-weekend { background: #FAFBFC; }
.pgtl-col.pgtl-todaycol { background: rgba(59,130,246,0.08); border-left: 2px solid var(--kai,#3B82F6); border-right: 2px solid var(--kai,#3B82F6); }
.pgtl-col.pgtl-selecting-col { background: rgba(59,130,246,0.22); }
.pgcal-guest-row:hover { background: #F1F5F9; }
.pgtl-bar { position: absolute; height: 22px; border-radius: 11px; display: flex; align-items: center; gap: 4px; padding: 0 8px 0 2px;
    font-size: 0.66rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,0.13); z-index: 1; }
.pgtl-bar:hover { filter: brightness(1.06); }


/* ===== pgcal v2 (kalendar polish) ===== */

/* Današnji panel (dolasci / odlasci / in-house danas) */
.pgcal-today-panel {
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 12px;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.pgcal-today-col {
    flex: 1;
    min-width: 220px;
}
.pgcal-today-col-title {
    font-size: 0.62rem;
    font-weight: 600;
    color: #64748B;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 6px;
}
.pgcal-today-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
}
.pgcal-today-item:hover {
    background: var(--mud-palette-action-default-hover);
}

/* Legenda statusa */
.pgcal-legend {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    align-items: center;
    font-size: 0.7rem;
    color: #64748B;
    margin: 4px 0 10px;
}
.pgcal-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.pgcal-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    display: inline-block;
}
/* Iste boje kao statusne trake (.pgcal-st-*) */
.pgcal-legend-dot.pgcal-st-najavljen { background: #3B82F6; }
.pgcal-legend-dot.pgcal-st-utijeku   { background: #059669; }
.pgcal-legend-dot.pgcal-st-zatvoren  { background: #94A3B8; }

/* Shimmer skeleton (loading state) */
.pgcal-skel {
    height: 90px;
    border-radius: 8px;
    background: linear-gradient(90deg, #F1F5F9 25%, #E2E8F0 37%, #F1F5F9 63%);
    background-size: 400% 100%;
    animation: pgcal-shimmer 1.4s ease infinite;
}
@keyframes pgcal-shimmer {
    0%   { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

/* Pojačani highlight današnjeg dana (bez razbijanja layouta) */
.pgcal-today {
    background: rgba(59,130,246,0.07);
    box-shadow: inset 0 0 0 2px var(--kai, #3B82F6);
}

/* ===== Mobitel (<= 640px) ===== */
@media (max-width: 640px) {
    /* Kontrolni MudPaper se wrappa */
    .pgcal-controls {
        flex-wrap: wrap;
    }
    /* Mjesečni grid horizontalno skrolabilan */
    .pgcal-month {
        overflow-x: auto;
    }
    /* Trake manje + sakrij avatar da stane tekst */
    .pgcal-bar {
        font-size: 0.6rem;
    }
    .pgcal-bar .pgcal-avatar {
        display: none;
    }
    /* Današnji panel slaže stupce vertikalno */
    .pgcal-today-panel {
        flex-direction: column;
    }
}

/* =========================================================================
   eVisitor (PrijavaGostiju) — mobilni paritet s eracun-novi
   Uzor: list/wizard/detalj eracun-novi modula. Sve MudBlazor + kai-* dizajn.
   ========================================================================= */

/* ── "Danas" panel — avatar/ime/točka (referencirano u CalStatsBar) ── */
.pgcal-today-avatar {
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--kai, #3B82F6); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 0.66rem; font-weight: 700; flex: 0 0 auto;
}
.pgcal-today-name {
    flex: 1; min-width: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pgcal-today-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; background: #94A3B8; }
.pgcal-today-dot.pgcal-st-najavljen { background: #3B82F6; }
.pgcal-today-dot.pgcal-st-utijeku   { background: #059669; }
.pgcal-today-dot.pgcal-st-zatvoren  { background: #94A3B8; }
.pgcal-today-empty { font-size: 0.72rem; color: #94A3B8; padding: 4px 6px; }

/* ── Horizontalno skrolabilne tablice (fallback umjesto card-tree na uskim ekranima) ── */
.pg-table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ── Kalendar: mjesečni grid i timeline stvarni horizontalni scroll ── */
@media (max-width: 700px) {
    .pg-table-scroll table { min-width: 600px; }
}

@media (max-width: 640px) {
    /* Kontrolna traka kalendara — slaganje u stupac, full-width inputi */
    .pgcal-controls { flex-direction: column; align-items: stretch; gap: 8px; }
    .pgcal-controls > * { width: 100%; }
    .pgcal-controls .mud-input-control,
    .pgcal-controls .mud-select,
    .pgcal-controls .mud-button-group-root { min-width: 0 !important; width: 100% !important; }
    .pgcal-controls .pgcal-nav,
    .pgcal-controls .pgcal-scrollnav {
        margin-left: 0 !important; width: 100%;
        display: flex; align-items: center; justify-content: space-between; gap: 8px;
    }
    .pgcal-controls .pgcal-nav > span,
    .pgcal-controls .pgcal-scrollnav > span { min-width: 0 !important; flex: 1; text-align: center; }
    /* Paleta boja u Objekti dropdownu — sakrij na mobitelu (uredi kroz Boje dialog) */
    .pgcal-inline-palette { display: none !important; }

    /* Mjesečni grid i timeline — prava min-širina pa overflow-x stvarno skrola */
    .pgcal-week-grid, .pgcal-dow, .pgcal-bars { min-width: 560px; }
    .pgcal-bars { overflow: hidden; }
    .pgtl-scroll, .pgtl-track { overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
    .pgtl-label { min-width: 96px !important; max-width: 120px !important; }
    .pgtl-navbtn { width: 34px !important; height: 34px !important; }

    /* "Danas" panel ostaje stupac (već je u 640 bloku); manji razmaci */
    .pgcal-today-col { min-width: 0; }

    /* Detalj — meta grid u 1 stupac */
    .pg-detail-meta-grid { grid-template-columns: 1fr !important; }

    /* Tap-targeti: gumbi u akcijskim redovima full-width */
    .pg-scan-actions { display: flex; flex-direction: column; gap: 8px; }
    .pg-scan-actions > * { width: 100%; }
    .pg-scan-actions .mud-button-root { min-height: 44px; }
}

/* ── Postavke: akcijski red eVisitora → 2-stupčani grid na mobitelu ──
   Struktura: .pg-postavke-actions (flex) > [ div s 4 pomoćna gumba ] + [ Spremi gumb ] */
@media (max-width: 720px) {
    .pg-postavke-actions { flex-direction: column !important; align-items: stretch !important; gap: 8px !important; }
    .pg-postavke-actions > div { display: grid !important; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
    .pg-postavke-actions > div > * { width: 100%; min-width: 0; margin: 0 !important; }
    .pg-postavke-actions > .mud-button-root { width: 100%; }
}

/* ── Filter bar (lista) — slaganje u stupac na mobitelu ── */
@media (max-width: 640px) {
    .pg-filter-bar { flex-direction: column !important; align-items: stretch !important; gap: 8px !important; }
    .pg-filter-bar > * { width: 100%; min-width: 0 !important; }
    .pg-filter-bar .mud-input-control, .pg-filter-bar .mud-select { min-width: 0 !important; width: 100% !important; }
}

/* ── Sticky footer (lista) — bez offseta ladice na mobitelu (ladica je overlay) ── */
@media (max-width: 959px) {
    .pg-sticky-footer { padding-left: 12px !important; }
}

/* ── eVisitor filter sheet (Objekti/Status/pretraga/Boje) — inline na desktopu,
   donji bottom-sheet na mobitelu (paritet s eracun era-filter-bar). Donji mobilni
   bar se pojavljuje na width<768 (MainLayout _isMobile), pa sheet hvata isti prag. ── */
.pg-filter-sheet { display: contents; }
.pg-filter-sheet-header { display: none; }
.pg-filter-backdrop { display: none; }

@media (max-width: 767px) {
    .pg-hide-on-mobile { display: none !important; }

    .pg-filter-sheet {
        display: block;
        position: fixed;
        left: 0; right: 0; bottom: 0;
        z-index: 1110;
        max-height: 75vh;
        overflow-y: auto;
        margin: 0;
        padding: 8px 12px 18px;
        background: var(--mud-palette-surface, #fff);
        border-radius: 18px 18px 0 0;
        border-top: 1px solid var(--mud-palette-lines-default, #E2E8F0);
        box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.18);
        transform: translateY(100%);
        transition: transform 0.25s ease;
    }
    .pg-filter-sheet.is-open { transform: translateY(0); }
    .pg-filter-sheet > * { width: 100%; margin: 0 0 8px 0 !important; }
    .pg-filter-sheet .mud-input-control,
    .pg-filter-sheet .mud-select { min-width: 0 !important; width: 100% !important; }

    .pg-filter-sheet-header {
        display: flex; align-items: center; justify-content: space-between;
        padding: 4px 0 10px; margin-bottom: 6px;
        border-bottom: 1px solid var(--mud-palette-divider, #EAECEF);
        position: sticky; top: 0; background: var(--mud-palette-surface, #fff); z-index: 1;
    }
    .pg-filter-sheet-close {
        background: transparent; border: none; cursor: pointer;
        color: var(--mud-palette-text-secondary, #64748B);
        padding: 4px; border-radius: 6px; display: flex; align-items: center; min-height: 36px; min-width: 36px;
        justify-content: center;
    }
    .pg-filter-backdrop {
        display: block; position: fixed; inset: 0; z-index: 1105;
        background: rgba(0, 0, 0, 0.45);
    }
}

/* ── Dialozi na mobitelu: samo akcije u stupac (BEZ full-screen — full-screen je
   rastezao MudDatePicker u divovske kutije). Dijalozi ostaju normalni MudBlazor
   Small/Medium FullWidth — to dobro stane na mobitelu. ── */
@media (max-width: 599px) {
    .pg-create-dialog .mud-dialog-actions,
    .pg-guest-dialog .mud-dialog-actions,
    .pg-link-dialog .mud-dialog-actions,
    .pg-popover-dialog .mud-dialog-actions,
    .pg-pop-dialog .mud-dialog-actions {
        flex-wrap: wrap; gap: 8px;
    }
    .pg-create-dialog .mud-dialog-actions > .mud-button-root,
    .pg-guest-dialog .mud-dialog-actions > .mud-button-root,
    .pg-link-dialog .mud-dialog-actions > .mud-button-root,
    .pg-popover-dialog .mud-dialog-actions > .mud-button-root {
        flex: 1 1 100%; margin: 0 !important; min-height: 44px;
    }
    /* Popover akcijske ikone veće za prst */
    .pg-popover-dialog .mud-icon-button { min-width: 44px; min-height: 44px; }
}

/* ── Jezični/državljanstvo picker s preklopljenom zastavom (flagcdn) — prostor lijevo za sliku ── */
.pg-flag-input input { padding-left: 34px !important; }

/* ── Smanjenje pokreta ── */
@media (prefers-reduced-motion: reduce) {
    .pgcal-skel { animation: none; }
    .kai-kpi-clickable:hover { transform: none; }
}


/* ── Pomični dijalozi (kaiDialogDrag u knjigoai.js) ──
   Ručka za povlačenje dijaloga: kursor move + bez touch-scrolla na ručki. */
.era-drag-handle,
.kai-dialog-drag-handle {
    cursor: move;
    touch-action: none;
    user-select: none;
}


/* ── DIJELJENO: široka tablica → kartice na mobitelu (<768px) ─────────────────
   Stavi klasu .kai-cards-mobile na wrapper OKO MudTable/MudSimpleTable. Svaka
   ćelija (td) MORA imati atribut data-label="Naziv stupca" (ili MudBlazor
   DataLabel="…", koji renderira isti data-label). Na desktopu izgleda kao normalna
   tablica; na <768px svaki redak postaje kartica, a ćelije se slažu okomito s
   labelom lijevo i vrijednošću desno. Prag 768px = usklađeno s _isMobile drugdje. */
@media (max-width: 767px) {
    /* Kontejner tablice je stvarni okvir širine (overflow-x:auto). Sve ispod njega
       NE SMIJE biti šire od njega — inače se kartica „razlije" izvan ekrana. */
    .kai-cards-mobile .mud-table-container { width: 100% !important; max-width: 100% !important; overflow-x: hidden !important; }
    .kai-cards-mobile table,
    .kai-cards-mobile .mud-table-root,
    .kai-cards-mobile tbody,
    .kai-cards-mobile .mud-table-body,
    .kai-cards-mobile tbody tr,
    .kai-cards-mobile .mud-table-row,
    .kai-cards-mobile tbody td,
    .kai-cards-mobile .mud-table-cell {
        min-width: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    /* KLJUČNO: <table> u display:table ignorira width:100% i širi se do min-content
       najšireg djeteta (dugačak select/tekst). Prebaci ga na display:block da poštuje
       width:100% i blok-djecu — inače cijela kartica pukne izvan ekrana. */
    .kai-cards-mobile table,
    .kai-cards-mobile .mud-table-root { display: block !important; }
    /* Sakrij zaglavlje — labele nose pojedine ćelije. */
    .kai-cards-mobile thead,
    .kai-cards-mobile .mud-table-head { display: none !important; }
    .kai-cards-mobile tbody,
    .kai-cards-mobile .mud-table-body { display: block; }
    /* Redak → kartica. */
    .kai-cards-mobile tbody tr,
    .kai-cards-mobile .mud-table-row {
        display: block;
        border: 1px solid var(--mud-palette-lines-default, #E2E8F0);
        border-radius: 10px;
        margin-bottom: 10px;
        padding: 6px 4px;
        background: var(--mud-palette-surface, #fff);
    }
    .kai-cards-mobile tbody tr:hover { background: var(--mud-palette-surface, #fff) !important; }
    /* Ćelija → red labela/vrijednost. Širina VEZANA na karticu (100%/max 100%, min 0)
       da dugačak input/select ne razvuče redak izvan ekrana. */
    .kai-cards-mobile tbody td,
    .kai-cards-mobile .mud-table-cell {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        text-align: right !important;
        padding: 7px 12px !important;
        border: none !important;
        border-bottom: 1px solid var(--mud-palette-lines-default, #F1F5F9) !important;
        white-space: normal !important;
    }
    /* Vrijednosna strana (sve osim ::before labele) mora se moći skupiti. */
    .kai-cards-mobile tbody td > *,
    .kai-cards-mobile .mud-table-cell > * { min-width: 0 !important; max-width: 100% !important; }
    .kai-cards-mobile tbody tr td:last-child,
    .kai-cards-mobile .mud-table-row .mud-table-cell:last-child { border-bottom: none !important; }
    /* Labela lijevo iz data-label / DataLabel. */
    .kai-cards-mobile tbody td[data-label]::before,
    .kai-cards-mobile .mud-table-cell[data-label]::before {
        content: attr(data-label);
        flex: 0 0 auto;
        font-size: 0.62rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        color: var(--mud-palette-text-secondary, #64748B);
        text-align: left;
    }
    /* Ćelija bez labele (npr. akcije) — vrijednost desno, bez ::before razmaka. */
    .kai-cards-mobile tbody td:not([data-label]),
    .kai-cards-mobile .mud-table-cell:not([data-label]) { justify-content: flex-end; }
    /* MudBlazor mobilni „cell-label" (kad se koristi DataLabel bez naše klase) — sakrij da se ne duplira. */
    .kai-cards-mobile .mud-table-cell-custom-group,
    .kai-cards-mobile .mud-table-mobile-cell-label { display: none; }

    /* ── ANTI-OVERFLOW zaštita (vrijedi za sve .kai-cards-mobile) ──────────────
       Bez ovoga širok sadržaj u ćeliji (dugačak naziv, MudSelect s min-width,
       paleta boja, MudTextField) ne može se skupiti pa kartica probije rub
       ekrana i vrijednost se odreže (mobilni bug u Smještajnim objektima).
       Labela ostaje fiksna lijevo; VRIJEDNOST puni ostatak i smije se skupiti. */
    .kai-cards-mobile tbody td[data-label],
    .kai-cards-mobile .mud-table-cell[data-label] { min-width: 0 !important; }
    /* Sve poslije ::before labele je „vrijednost" — MudBlazor input/select se moraju
       skupiti do 0 da stanu; palette-grid isto. */
    .kai-cards-mobile tbody td .mud-input-control,
    .kai-cards-mobile tbody td .mud-input-root,
    .kai-cards-mobile tbody td .mud-select,
    .kai-cards-mobile tbody td .mud-input-slot { min-width: 0 !important; }

    /* ── MODIFIER .kai-cards-mobile--stack: svaka ćelija je „floating-label" polje —
       obrubljeni zaobljeni okvir, a LABELA (data-label) urezana u gornji rub okvira
       (fieldset/legend look, kao MudBlazor outlined polje). Vrijednost/kontrola sjedi
       unutar okvira. Time cijeli red izgleda kao niz kompaktnih polja s opisom u rubu,
       umjesto „labela iznad / vrijednost ispod". ─────────────────────────────────── */
    .kai-cards-mobile--stack tbody td[data-label],
    .kai-cards-mobile--stack .mud-table-cell[data-label] {
        position: relative !important;
        display: flex !important;                   /* JEDNA linija: vrijednost/kontrola u redu */
        align-items: center !important;
        /* ~visina pravog MudBlazor dense outlined polja (≈40px). Prethodno „gnječenje"
           na 30px je POGORŠALO dojam: kutija nije izgledala kao input nego kao stisnuti
           blok teksta, pa su se labela i vrijednost čitale kao 2 retka teksta. */
        min-height: 37px !important;
        margin: 12px 8px 0 8px !important;
        /* Asimetrični padding (3px gore / 7px dolje) blago diže centriranu vrijednost
           prema labeli — vrijednost sjedi ODMAH ispod ureza, kao u referentnom polju. */
        padding: 3px 12px 7px 12px !important;
        border: 1px solid var(--mud-palette-lines-input, #C4C4C4) !important;
        border-radius: 8px !important;
        text-align: left !important;
        line-height: 1.3 !important;                /* bez viška leadinga oko vrijednosti */
    }
    .kai-cards-mobile--stack tbody tr td[data-label]:last-child,
    .kai-cards-mobile--stack .mud-table-row .mud-table-cell[data-label]:last-child {
        margin-bottom: 12px !important;
        /* Bazno pravilo (td:last-child { border-bottom:none }) ima veću specifičnost i
           „pojede" donji rub ZADNJEG polja u kartici — vrati ga, okvir mora biti pun. */
        border-bottom: 1px solid var(--mud-palette-lines-input, #C4C4C4) !important;
    }
    /* Labela → „legend" urezan u gornji rub: apsolutno pozicioniran, s pozadinom
       kartice iza sebe da „prekine" liniju obruba.
       KLJUČNO za dojam JEDNOG polja: labela mora SJEDITI NA liniji obruba — pola
       IZNAD, pola ISPOD (top:0 + translateY(-50%)), točno kao shrunk labela pravog
       MudBlazor outlined polja. Stari top:-7px (uz line-height:1) držao je labelu
       gotovo CIJELU iznad obruba, pa se čitala kao zaseban redak teksta iznad kutije
       → korisnik je vidio „2 retka". */
    .kai-cards-mobile--stack tbody td[data-label]::before,
    .kai-cards-mobile--stack .mud-table-cell[data-label]::before {
        position: absolute !important;
        top: 0 !important;
        transform: translateY(-50%) !important;
        left: 9px !important;
        padding: 0 4px !important;
        background: var(--mud-palette-surface, #fff) !important;
        line-height: 1 !important;
        font-size: 0.6rem !important;
        z-index: 1;
    }
    /* Kontrola/vrijednost puni širinu okvira (jedan flex-child u redu). */
    .kai-cards-mobile--stack tbody td[data-label] > * { flex: 1 1 auto; }
    .kai-cards-mobile--stack tbody td .mud-input-control,
    .kai-cards-mobile--stack tbody td .mud-select { width: 100% !important; min-width: 0 !important; }
    .kai-cards-mobile--stack tbody td .mud-select { max-width: none !important; }
    /* Unutrašnja MudBlazor polja (Nadimak, Naplata) NEMAJU vlastiti obrub ni labelu —
       okvir ćelije JE obrub polja, a data-label JE floating labela. Izbjegava dvostruki
       obrub. Ostaje samo tekst/vrijednost. */
    .kai-cards-mobile--stack tbody td .mud-input-control .mud-input-outlined-border { display: none !important; }
    .kai-cards-mobile--stack tbody td .mud-input.mud-input-outlined { margin: 0 !important; }
    .kai-cards-mobile--stack tbody td .mud-input-control { margin: 0 !important; }
    .kai-cards-mobile--stack tbody td .mud-input-slot { padding-left: 0 !important; }
    /* JEDNA linija: skini visinu unutarnjeg MudBlazor inputa (default ~40px zbog
       Margin.Dense) da vrijednost sjedne odmah uz labelu, a ne u drugi vizualni red. */
    .kai-cards-mobile--stack tbody td .mud-input.mud-input-outlined,
    .kai-cards-mobile--stack tbody td .mud-input-control-input-margin-dense,
    .kai-cards-mobile--stack tbody td .mud-input-slot,
    .kai-cards-mobile--stack tbody td .mud-input-root {
        min-height: 0 !important;
        height: auto !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }
    .kai-cards-mobile--stack tbody td .mud-input-slot input,
    .kai-cards-mobile--stack tbody td .mud-select-input {
        height: 1.4rem !important;
        line-height: 1.4rem !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }
    /* Dugačak tekst u MudSelectu ne smije gurati širinu — ellipsis. */
    .kai-cards-mobile--stack tbody td .mud-select .mud-input-slot,
    .kai-cards-mobile--stack tbody td .mud-select .mud-select-input,
    .kai-cards-mobile--stack tbody td .mud-select input {
        min-width: 0 !important;
        max-width: 100% !important;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .kai-cards-mobile--stack tbody td .mud-input-slot,
    .kai-cards-mobile--stack tbody td .mud-input-root { min-width: 0 !important; }
    /* Read-only tekst (Naziv) unutar okvira. */
    .kai-cards-mobile--stack tbody td[data-label] > .mud-typography,
    .kai-cards-mobile--stack tbody td[data-label] { font-size: 0.8rem; }
    /* Switch/gumb/ikone unutar okvira — lijevo, kompaktni. */
    .kai-cards-mobile--stack tbody td .mud-switch,
    .kai-cards-mobile--stack tbody td .mud-icon-button { margin: 0 !important; }

    /* ── NAZIV + NADIMAK spajanje SAMO na mobitelu ─────────────────────────────
       Zasebna NAZIV ćelija (pg-hide-mobile) se skriva; službeni naziv je uklopljen u
       LABELU polja Nadimak (data-label = „Nadimak za „MURPHY soba""). Nema zasebnog
       opisnog retka — polje ostaje standardno jednoredno floating-label polje. */
    .kai-cards-mobile--stack tbody td.pg-hide-mobile,
    .kai-cards-mobile--stack .mud-table-cell.pg-hide-mobile { display: none !important; }
    /* Duža labela (sadrži naziv objekta) ne smije prijeći preko ruba — skrati ellipsisom. */
    .kai-cards-mobile--stack tbody td[data-label]::before,
    .kai-cards-mobile--stack .mud-table-cell[data-label]::before {
        max-width: calc(100% - 24px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* ── Zadana kategorija naplate (pg-tt-select) ─────────────────────────────────
   Odabrana vrijednost se skraćuje (ToStringFunc), a ovdje CSS-om tvrdo ograničimo
   širinu i prisilimo ellipsis — dugačak naziv NIKAD ne smije razvući stupac/redak
   izvan ekrana (ni desktop ni mobitel). Padajući popis prikazuje puni naziv. */
.pg-tt-select { max-width: 340px; }
.pg-tt-select .mud-input-slot,
.pg-tt-select .mud-select-input,
.pg-tt-select input {
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

/* ── Paleta boja objekta (pg-color-grid / pg-color-swatch) ────────────────────
   Desktop: fiksni 18px kvadratići, lome se u više redaka (do max-width:260px). */
.pg-color-swatch {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(0,0,0,.1);
    flex: 0 0 auto;
    box-sizing: border-box;
}
/* Mobitel: SVE boje (8) u JEDNOM redu, fiksne manje veličine (~22px) i lijevo
   poravnate — ne rastežu se preko cijele širine (8 kvadratića lako stane). */
@media (max-width: 767px) {
    .pg-color-grid {
        flex-wrap: nowrap !important;
        max-width: none !important;
        width: 100%;
        gap: 6px !important;
        justify-content: flex-start !important;
    }
    .pg-color-swatch {
        flex: 0 1 22px !important;   /* fiksni cilj 22px; smije se malo skupiti ako treba */
        width: 22px !important;
        max-width: 22px !important;
        min-width: 0 !important;
        height: 22px !important;
        aspect-ratio: 1 / 1;
        border-width: 1.5px;
    }
    /* Odabrani kvadratić — deblji rub da se razlikuje i na malom. */
    .pg-color-swatch.pg-color-swatch--sel { border-width: 2px; }
}

/* ── Postavke zupčanik: crveni PULS dok modul nije konfiguriran ───────────────
   Opt-in preko PageHeader SettingsPulse (npr. eVisitor stranice dok objekti nisu
   sinkronizirani). ISTI puls kao notifikacijski zvončić u zaglavlju (kai-badge-pulse):
   SCALE (vidljivo raste/smanjuje se) + crveni halo. Scale je ključan jer se vidi i
   kad je box-shadow halo odrezan overflowom. Samo taj gumb — ne dira ostale zupčanike. */
.pg-settings-gear.pg-settings-gear--pulse {
    border-color: #DC2626 !important;
    color: #DC2626 !important;
    border-radius: 8px;
    transform-origin: center;
    animation: pg-gear-pulse 1.8s ease-in-out infinite !important;
}
.pg-settings-gear.pg-settings-gear--pulse .mud-icon-root,
.pg-settings-gear.pg-settings-gear--pulse svg { color: #DC2626 !important; }
@keyframes pg-gear-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.55);
    }
    50% {
        transform: scale(1.18);
        box-shadow: 0 0 0 8px rgba(220, 38, 38, 0);
    }
}
/* Poštuj korisničku preferenciju smanjenog kretanja: NE gasimo signal (puls je
   funkcionalna obavijest "modul nije konfiguriran"), nego SCALE zamjenjujemo
   motion-safe varijantom — samo opacity + fiksni crveni sjaj koji blijedi.
   Bez scale/translate/širenja = nema prostornog kretanja koje izaziva
   vestibularne smetnje; treperenje prozirnosti i boje je prihvatljivo pod
   reduced-motion. NAPOMENA: border-color/color se u baznom pravilu postavljaju
   s !important pa ih keyframes NE može animirati (cascade: !important > animacija);
   zato soft puls animira isključivo opacity i box-shadow. Crveni obrub ostaje
   cijelo vrijeme — samo "diše" kroz prozirnost gumba. */
@keyframes pg-gear-pulse-soft {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.45);
    }
    50% {
        opacity: 0.35;
        box-shadow: 0 0 0 4px rgba(220, 38, 38, 0);
    }
}
@media (prefers-reduced-motion: reduce) {
    .pg-settings-gear.pg-settings-gear--pulse {
        animation: pg-gear-pulse-soft 1.8s ease-in-out infinite !important;
        /* Sigurnosna brava: pod reduced-motion NIKAD scale, čak i ako se
           baznom pravilu kasnije doda transform. */
        transform: none !important;
    }
}

/* ── ERROR obrub POBJEĐUJE FOKUS (globalno) ───────────────────────────────────
   MudBlazor: .mud-input.mud-input-outlined:focus-within > .mud-input-outlined-border
   crta PLAVI (primary) obrub koji je specifičniji od error pravila, pa fokusirano
   error-polje izgleda plavo umjesto crveno. Ista struktura selektora + .mud-input-error
   klasa → viša specifičnost → crveno pobjeđuje i dok je polje u fokusu. Vrijedi svugdje
   (fokusirano polje u grešci UVIJEK treba biti crveno, ne plavo). */
.mud-input.mud-input-outlined.mud-input-error:focus-within > .mud-input-outlined-border,
.mud-input.mud-input-outlined.mud-input-error:focus-within .mud-shrink > .mud-input-outlined-border {
    border-color: var(--mud-palette-error) !important;
    border-width: 2px !important;
}
.mud-input.mud-input-outlined.mud-input-error:focus-within .mud-input-label {
    color: var(--mud-palette-error) !important;
}
