/* ==========================================================================
   Exevio HQ — design system
   Sections: 1 fonts · 2 tokens · 3 base · 4 shell · 5 page layout · 6 components · 7 pages · 8 utilities · 9 motion
   Theme: <html data-theme="dark|light">  (dark "space" is the default token set)
   ========================================================================== */

/* 1 ─────────────────────────── Fonts (local, variable) ─────────────────────────── */
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('/fonts/inter-variable-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('/fonts/inter-variable-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Space Grotesk'; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url('/fonts/space-grotesk-variable-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Space Grotesk'; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url('/fonts/space-grotesk-variable-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* 2 ─────────────────────────── Tokens ─────────────────────────── */
:root {
  color-scheme: dark;
  --font-ui: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Space Grotesk', 'Inter', ui-sans-serif, system-ui, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'Cascadia Code', 'Roboto Mono', Consolas, monospace;

  /* surfaces — deep space */
  --bg: #07070e;
  --bg-sunken: #050509;
  --bg-sidebar: #08080f;
  --surface: #0c0c16;
  --surface-2: #12121e;
  --surface-3: #181826;
  --surface-hover: rgba(237, 232, 224, .045);
  --surface-active: rgba(237, 232, 224, .075);
  --overlay: rgba(2, 2, 8, .66);
  --glass: rgba(9, 9, 17, .74);
  --popover: #13131f;

  /* ink */
  --ink: #ede8e0;
  --ink-2: rgba(237, 232, 224, .68);
  --ink-3: rgba(237, 232, 224, .5);
  --ink-4: rgba(237, 232, 224, .3);
  --line: rgba(237, 232, 224, .08);
  --line-2: rgba(237, 232, 224, .13);
  --line-3: rgba(237, 232, 224, .22);

  /* brand */
  --accent: #d98e5f;
  --accent-hover: #e6a074;
  --accent-ink: #170c06;
  --accent-text: #e9a77d;
  --accent-soft: rgba(217, 142, 95, .12);
  --accent-soft-2: rgba(217, 142, 95, .2);
  --accent-line: rgba(217, 142, 95, .45);
  --brand: #a46054;
  --navy: #04143a;
  --mars: linear-gradient(135deg, #d98e5f 0%, #8a4127 100%);
  --mars-soft: linear-gradient(135deg, rgba(217, 142, 95, .18), rgba(138, 65, 39, .08));

  /* semantic */
  --ok: #7dc9a2;      --ok-soft: rgba(125, 201, 162, .12);  --ok-line: rgba(125, 201, 162, .32);
  --warn: #e7c069;    --warn-soft: rgba(231, 192, 105, .12); --warn-line: rgba(231, 192, 105, .32);
  --danger: #ff6248;  --danger-soft: rgba(255, 98, 72, .12); --danger-line: rgba(255, 98, 72, .36);
  --on-danger: #170c06; /* text on a solid --danger fill (6.5:1; white would be 2.96:1) */
  --info: #8fa8d8;    --info-soft: rgba(143, 168, 216, .13); --info-line: rgba(143, 168, 216, .32);
  --neutral-soft: rgba(237, 232, 224, .07);

  /* charts */
  --chart-1: #d98e5f; --chart-2: #8fa8d8; --chart-3: #7dc9a2; --chart-4: #e7c069;
  --chart-5: #b79cf0; --chart-6: #6fc6cf; --chart-7: #ef8fa9; --chart-8: #a8a29e;
  --chart-grid: rgba(237, 232, 224, .07);

  /* avatars / letter favicons (8 tones) */
  --tone-0: #d98e5f; --tone-1: #8fa8d8; --tone-2: #7dc9a2; --tone-3: #e7c069;
  --tone-4: #b79cf0; --tone-5: #6fc6cf; --tone-6: #ef8fa9; --tone-7: #c9b49a;

  /* inputs */
  --input-bg: rgba(237, 232, 224, .035);
  --input-bg-focus: rgba(237, 232, 224, .05);
  --input-border: rgba(237, 232, 224, .14);
  --input-border-hover: rgba(237, 232, 224, .24);

  /* depth */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .45);
  --shadow: 0 10px 30px -14px rgba(0, 0, 0, .7);
  --shadow-pop: 0 0 0 1px var(--line-2), 0 18px 50px -12px rgba(0, 0, 0, .8), 0 4px 14px -6px rgba(0, 0, 0, .6);
  --card-highlight: inset 0 1px 0 rgba(255, 255, 255, .035);
  --ring: 0 0 0 3px rgba(217, 142, 95, .3);
  --ring-danger: 0 0 0 3px rgba(255, 98, 72, .25);

  /* geometry */
  --r-xs: 6px; --r-sm: 8px; --r: 10px; --r-lg: 16px; --r-xl: 24px; --r-pill: 999px;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --ease-io: cubic-bezier(.65, 0, .35, 1);
  --dur-1: 120ms; --dur-2: 180ms; --dur-3: 250ms;

  --sidebar-w: 248px;
  --sidebar-w-collapsed: 68px;
  --topbar-h: 56px;
  --tabbar-h: 62px;
  --content-max: 1400px;
  --gutter: 32px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  --z-sticky: 10; --z-topbar: 30; --z-sidebar: 35; --z-bulk: 45; --z-drawer: 60; --z-modal: 70;
  --z-palette: 75; --z-pop: 80; --z-confirm: 85; --z-toast: 90; --z-progress: 95;

  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --star: rgba(255, 255, 255, .9);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f4f7;
  --bg-sunken: #e9e9ed;
  --bg-sidebar: #efeff3;
  --surface: #ffffff;
  --surface-2: #f8f8fa;
  --surface-3: #f0f0f4;
  --surface-hover: rgba(22, 21, 29, .04);
  --surface-active: rgba(22, 21, 29, .07);
  --overlay: rgba(22, 21, 35, .36);
  --glass: rgba(244, 244, 247, .8);
  --popover: #ffffff;

  --ink: #16151d;
  --ink-2: rgba(22, 21, 29, .7);
  --ink-3: rgba(22, 21, 29, .6);
  --ink-4: rgba(22, 21, 29, .32);
  --line: rgba(22, 21, 29, .08);
  --line-2: rgba(22, 21, 29, .12);
  --line-3: rgba(22, 21, 29, .22);

  --accent: #b0552b;
  --accent-hover: #9a4721;
  --accent-ink: #ffffff;
  --accent-text: #a14c25;
  --accent-soft: rgba(176, 85, 43, .08);
  --accent-soft-2: rgba(176, 85, 43, .15);
  --accent-line: rgba(176, 85, 43, .42);
  --mars-soft: linear-gradient(135deg, rgba(217, 142, 95, .16), rgba(176, 85, 43, .05));

  --ok: #1e7a4f;      --ok-soft: rgba(30, 122, 79, .09);   --ok-line: rgba(30, 122, 79, .3);
  --warn: #836200;    --warn-soft: rgba(196, 148, 0, .12); --warn-line: rgba(131, 98, 0, .32);
  --danger: #b8361f;  --danger-soft: rgba(184, 54, 31, .08); --danger-line: rgba(184, 54, 31, .34);
  --on-danger: #fff;
  --info: #3a5da8;    --info-soft: rgba(58, 93, 168, .09); --info-line: rgba(58, 93, 168, .3);
  --neutral-soft: rgba(22, 21, 29, .06);

  --chart-1: #b0552b; --chart-2: #3a5da8; --chart-3: #1e8a5a; --chart-4: #c08f00;
  --chart-5: #7a5cc7; --chart-6: #16889a; --chart-7: #c4466a; --chart-8: #78716c;
  --chart-grid: rgba(22, 21, 29, .07);

  --tone-0: #b0552b; --tone-1: #3a5da8; --tone-2: #1e7a4f; --tone-3: #9a7400;
  --tone-4: #6c4fc0; --tone-5: #167a8a; --tone-6: #b83d61; --tone-7: #7a6650;

  --input-bg: #ffffff;
  --input-bg-focus: #ffffff;
  --input-border: rgba(22, 21, 29, .16);
  --input-border-hover: rgba(22, 21, 29, .3);

  --shadow-sm: 0 1px 2px rgba(22, 21, 29, .06);
  --shadow: 0 1px 2px rgba(22, 21, 29, .04), 0 10px 28px -18px rgba(22, 21, 29, .22);
  --shadow-pop: 0 0 0 1px rgba(22, 21, 29, .08), 0 18px 44px -14px rgba(22, 21, 29, .28), 0 4px 12px -6px rgba(22, 21, 29, .12);
  --card-highlight: 0 1px 2px rgba(22, 21, 29, .03);
  --ring: 0 0 0 3px rgba(176, 85, 43, .2);
  --ring-danger: 0 0 0 3px rgba(184, 54, 31, .18);
  --star: rgba(4, 20, 58, .55);
}

@media (max-width: 899.98px) {
  :root { --gutter: 16px; --topbar-h: 52px; }
}

/* 3 ─────────────────────────── Base ─────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-padding-top: calc(var(--topbar-h) + var(--safe-top) + 16px);
  background: var(--bg);
}
html.is-scroll-locked { overflow: hidden; padding-right: var(--scrollbar-comp, 0px); }
html.theme-switching *, html.theme-switching *::before, html.theme-switching *::after {
  transition: background-color var(--dur-3) ease, border-color var(--dur-3) ease, color var(--dur-3) ease, fill var(--dur-3) ease !important;
}
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1.5 var(--font-ui);
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img, svg, video, canvas { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
h1, h2, h3, h4, h5, h6 { margin: 0; font-family: var(--font-display); font-weight: 600; letter-spacing: -.015em; line-height: 1.2; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
table { border-collapse: collapse; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
::selection { background: var(--accent-soft-2); color: var(--ink); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
[v-cloak] { display: none !important; }
code, kbd, samp { font-family: var(--font-mono); font-size: .92em; }
kbd, .kbd {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px;
  font: 500 11px/1 var(--font-ui); color: var(--ink-3); background: var(--surface-2); border: 1px solid var(--line-2);
  border-bottom-width: 2px; border-radius: 5px;
}

/* thin, unobtrusive scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line-3) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--line-3); }
::-webkit-scrollbar-track { background: transparent; }

.num, .tnum { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum', 'cv11'; }
.display { font-family: var(--font-display); }

/* splash (pre-mount, index.html) */
.hq-splash {
  position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg);
}
.hq-splash__mark { width: 56px; height: 38px; opacity: .9; animation: splash-pulse 1.6s var(--ease-io) infinite; }
:root[data-theme="light"] .hq-splash__mark--white, :root:not([data-theme="light"]) .hq-splash__mark--black { display: none; }
@keyframes splash-pulse { 0%, 100% { opacity: .35; transform: scale(.97); } 50% { opacity: .95; transform: scale(1); } }
.hq-boot-error { min-height: 100vh; display: grid; place-content: center; gap: 8px; padding: 24px; text-align: center; color: var(--ink-2); }
.hq-boot-error strong { color: var(--ink); }

/* top navigation progress bar */
.hq-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: var(--z-progress); pointer-events: none;
  background: var(--mars); transform-origin: 0 50%; animation: nav-progress 1.2s var(--ease) forwards;
}
@keyframes nav-progress { 0% { transform: scaleX(0); } 60% { transform: scaleX(.7); } 100% { transform: scaleX(.92); } }

/* 4 ─────────────────────────── App shell ─────────────────────────── */
.hq-app { min-height: 100vh; min-height: 100dvh; }

.hq-sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: var(--z-sidebar);
  width: var(--sidebar-w); display: flex; flex-direction: column;
  background: var(--bg-sidebar); border-right: 1px solid var(--line);
  transition: width var(--dur-3) var(--ease);
  padding-left: var(--safe-left);
}
.hq-sidebar__brand {
  height: var(--topbar-h); display: flex; align-items: center; gap: 10px; padding: 0 18px; flex-shrink: 0;
  border-bottom: 1px solid transparent; color: var(--ink); text-decoration: none !important;
}
.hq-logo { display: flex; align-items: center; gap: 10px; min-width: 0; }
.hq-logo__word { height: 15px; width: auto; flex-shrink: 0; }
.hq-logo__mark { height: 22px; width: auto; flex-shrink: 0; }
.hq-logo__tag {
  font: 600 10.5px/1 var(--font-display); letter-spacing: .14em; text-transform: uppercase;
  padding: 4px 6px 3px; border-radius: 5px; color: var(--accent-text); background: var(--accent-soft); border: 1px solid var(--accent-line);
}
:root[data-theme="light"] .only-dark, :root:not([data-theme="light"]) .only-light { display: none !important; }

.hq-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 6px 10px 16px; }
.hq-nav__group + .hq-nav__group { margin-top: 14px; }
.hq-nav__label {
  height: 26px; display: flex; align-items: center; padding: 0 10px; white-space: nowrap; overflow: hidden;
  font: 600 10.5px/1 var(--font-ui); letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3);
  transition: opacity var(--dur-2) var(--ease);
}
.hq-nav__item {
  position: relative; display: flex; align-items: center; gap: 11px; height: 36px; padding: 0 10px; margin: 1px 0;
  border-radius: var(--r-sm); color: var(--ink-2); font-weight: 500; font-size: 13.5px; white-space: nowrap;
  text-decoration: none !important; transition: background var(--dur-1) ease, color var(--dur-1) ease;
}
.hq-nav__item .x-icon { flex-shrink: 0; color: var(--ink-3); transition: color var(--dur-1) ease; }
.hq-nav__item:hover { background: var(--surface-hover); color: var(--ink); }
.hq-nav__item:hover .x-icon { color: var(--ink-2); }
.hq-nav__item.is-active { background: var(--accent-soft); color: var(--ink); }
.hq-nav__item.is-active .x-icon { color: var(--accent); }
.hq-nav__item.is-active::before {
  content: ''; position: absolute; left: -10px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--mars);
}
.hq-nav__text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; transition: opacity var(--dur-2) var(--ease); }
.hq-nav__badge { margin-left: auto; }
/* collapsed sidebar: a small tone-coloured dot at the icon's top-right corner instead of the count (the count is in the
   item's tooltip "Transakcije · 2.890"); the ring in the sidebar colour keeps it off the glyph */
.hq-nav__dot {
  position: absolute; left: calc(50% + 7px); top: calc(50% - 14px); width: 7px; height: 7px; border-radius: 50%;
  background: var(--ink-2); box-shadow: 0 0 0 2px var(--bg-sidebar); pointer-events: none;
}
.hq-nav__dot--danger { background: var(--danger); }
.hq-nav__dot--warn { background: var(--warn); }
.hq-nav__dot--ok { background: var(--ok); }
.hq-nav__dot--info { background: var(--info); }
.hq-nav__dot--accent { background: var(--accent); }

/* one row: connection dot + company (left) and an icon-only collapse toggle (right; its name is in the tooltip) */
.hq-sidebar__foot { padding: 8px 10px 8px 12px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 6px; min-height: 52px; }
/* company (Postavke → Općenito) + connection dot: green "Povezano" / red "Bez veze — prikazani su spremljeni podaci" (tooltip) */
.hq-sidebar__company { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; padding: 6px 0 6px 8px; color: var(--ink-3); font-size: 12px; white-space: nowrap; overflow: hidden; cursor: default; }
.hq-sidebar__company-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.hq-sidebar__toggle {
  flex: none; width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent;
  color: var(--ink-3); cursor: pointer; transition: background var(--dur-1) ease, color var(--dur-1) ease;
}
.hq-sidebar__toggle:hover { background: var(--surface-hover); color: var(--ink); }
.hq-sidebar__toggle:focus-visible { outline: none; box-shadow: var(--ring); }
.hq-sidebar__toggle .x-icon { transition: transform var(--dur-2) var(--ease); }
.hq-sidebar__company .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); flex-shrink: 0;
  transition: background var(--dur-2) ease, box-shadow var(--dur-2) ease;
}
.hq-sidebar__company.is-offline .dot { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); animation: hq-conn-pulse 2.4s ease-in-out infinite; }
@keyframes hq-conn-pulse { 50% { box-shadow: 0 0 0 5px var(--danger-soft); } }
@media (prefers-reduced-motion: reduce) { .hq-sidebar__company.is-offline .dot { animation: none; } }

html[data-sidebar-collapsed] .hq-sidebar { width: var(--sidebar-w-collapsed); }
html[data-sidebar-collapsed] .hq-sidebar .hq-nav__text,
html[data-sidebar-collapsed] .hq-sidebar .hq-nav__label { opacity: 0; pointer-events: none; width: 0; flex: 0 0 0; }
/* collapsed: only the mark stays — hidden parts must not keep flex gaps/padding or the mark drifts off-centre */
html[data-sidebar-collapsed] .hq-sidebar .hq-logo__word,
html[data-sidebar-collapsed] .hq-sidebar .hq-logo__tag,
html[data-sidebar-collapsed] .hq-sidebar .hq-sidebar__company-name { display: none; }
html[data-sidebar-collapsed] .hq-sidebar .hq-logo { gap: 0; }
html[data-sidebar-collapsed] .hq-sidebar .hq-sidebar__foot { justify-content: center; gap: 8px; padding: 8px 0; }
html[data-sidebar-collapsed] .hq-sidebar .hq-sidebar__company { flex: none; justify-content: center; padding: 6px 0; gap: 0; }
html[data-sidebar-collapsed] .hq-sidebar .hq-nav__label { height: 12px; }
html[data-sidebar-collapsed] .hq-sidebar .hq-nav__badge { display: none; } /* (the dot replaces it — see .hq-nav__dot) */
html[data-sidebar-collapsed] .hq-sidebar__brand { padding: 0; justify-content: center; }
html[data-sidebar-collapsed] .hq-nav__item { justify-content: center; padding: 0; gap: 0; }
html[data-sidebar-collapsed] .hq-sidebar .hq-sidebar__toggle .x-icon { transform: rotate(180deg); }

.hq-main { margin-left: var(--sidebar-w); min-width: 0; transition: margin-left var(--dur-3) var(--ease); }
html[data-sidebar-collapsed] .hq-main { margin-left: var(--sidebar-w-collapsed); }

.hq-topbar {
  position: sticky; top: 0; z-index: var(--z-topbar);
  height: calc(var(--topbar-h) + var(--safe-top)); padding: var(--safe-top) var(--gutter) 0;
  display: flex; align-items: center; gap: 12px;
  background: var(--glass); border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(16px) saturate(160%); backdrop-filter: blur(16px) saturate(160%);
}
.hq-topbar__title { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 0 1 auto; }
.hq-crumb { color: var(--ink-3); font-size: 13px; white-space: nowrap; }
.hq-crumb-sep { color: var(--ink-4); }
/* a long page name (partner, project …) ellipsizes; tooltip.js shows the full name on hover */
.hq-topbar__page { min-width: 0; font: 600 14.5px/1.2 var(--font-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }
.hq-topbar__slot { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hq-topbar__spacer { flex: 1; }
.hq-topbar__actions { display: flex; align-items: center; gap: 4px; }
/* gives up its width before the page title does (flex-shrink 1000 ≫ the title's 1; down to min-width): at 1024 px with the
   sidebar open a title like "ZABA revolving 200.000 €" used to lose its last digits while the search placeholder kept 300 px */
.hq-searchbtn {
  display: flex; align-items: center; gap: 10px; height: 34px; width: min(340px, 30vw); min-width: 168px; flex: 0 1000 auto; padding: 0 8px 0 11px;
  border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--input-bg); color: var(--ink-3);
  font-size: 13px; transition: border-color var(--dur-1) ease, background var(--dur-1) ease, color var(--dur-1) ease;
}
.hq-searchbtn:hover { border-color: var(--input-border-hover); color: var(--ink-2); }
.hq-searchbtn span { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hq-iconbtn-wrap { position: relative; }
.hq-bell-count {
  position: absolute; top: 3px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  display: grid; place-items: center; font: 600 10px/1 var(--font-ui); color: var(--on-danger); background: var(--danger);
  box-shadow: 0 0 0 2px var(--bg); pointer-events: none;
}
.hq-userbtn { display: flex; align-items: center; gap: 8px; padding: 3px; border-radius: var(--r-pill); transition: background var(--dur-1) ease; }
.hq-userbtn:hover { background: var(--surface-hover); }

.hq-content {
  width: 100%; max-width: calc(var(--content-max) + var(--gutter) * 2); margin: 0 auto;
  padding: 28px var(--gutter) 72px;
}
.hq-devbar, .hq-offline {
  display: flex; align-items: center; gap: 10px; padding: 8px var(--gutter); font-size: 12.5px;
  border-bottom: 1px solid var(--line);
}
.hq-devbar { background: var(--warn-soft); color: var(--warn); }
/* "Bez veze" strip — mobile only (the desktop sidebar has the connection dot) */
.hq-offline { display: none; background: var(--danger-soft); color: var(--danger); }
.hq-offline span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* mobile shell */
.hq-mobile-logo { display: none; }
.hq-tabbar { display: none; }
@media (max-width: 899.98px) {
  .hq-sidebar { display: none; }
  .hq-main, html[data-sidebar-collapsed] .hq-main { margin-left: 0; }
  .hq-topbar { gap: 8px; padding-left: max(var(--gutter), var(--safe-left)); padding-right: max(12px, var(--safe-right)); }
  .hq-mobile-logo { display: flex; align-items: center; flex-shrink: 0; }
  .hq-mobile-logo img { height: 20px; width: auto; }
  .hq-topbar .hq-crumb, .hq-topbar .hq-crumb-sep { display: none; }
  .hq-topbar__page { font-size: 15.5px; }
  /* safety net: one too-wide card or table must not make the whole page scroll sideways (clip, not hidden: keeps
     position: sticky working and creates no scroll container) */
  .hq-content { padding: 18px var(--gutter) calc(var(--tabbar-h) + var(--safe-bottom) + 32px); overflow-x: clip; }
  .hq-devbar { padding: 8px var(--gutter); }
  .hq-offline { display: flex; gap: 6px; padding: 4px var(--gutter); font-size: 12px; line-height: 1.35; border-bottom-color: var(--danger-line); }
  /* the sticky topbar keeps a thin red edge while the strip scrolls away */
  .hq-topbar.is-offline { box-shadow: inset 0 -2px 0 var(--danger); }
  .hq-tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-topbar);
    display: grid; grid-template-columns: repeat(5, 1fr);
    height: calc(var(--tabbar-h) + var(--safe-bottom)); padding: 0 var(--safe-right) var(--safe-bottom) var(--safe-left);
    background: var(--glass); border-top: 1px solid var(--line);
    -webkit-backdrop-filter: blur(18px) saturate(170%); backdrop-filter: blur(18px) saturate(170%);
  }
  .hq-tab {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: 44px; color: var(--ink-3); font: 500 10.5px/1.1 var(--font-ui); text-decoration: none !important;
    transition: color var(--dur-1) ease;
  }
  .hq-tab .x-icon { width: 22px; height: 22px; }
  .hq-tab.is-active { color: var(--accent-text); }
  .hq-tab.is-active::before {
    content: ''; position: absolute; top: 0; left: 50%; width: 28px; height: 2px; margin-left: -14px; border-radius: 0 0 2px 2px; background: var(--mars);
  }
  /* right of the 22px icon (Lucide glyphs end at 50% + 10px), so even "99+" never covers the glyph (it used to hide the
     Transakcije arrow head and the Dospijeća calendar corner) */
  .hq-tab__badge { position: absolute; top: 2px; left: calc(50% + 10px); line-height: 0; }
  .hq-tab__badge .x-badge { min-width: 16px; height: 16px; padding: 0 4px; font-size: 10px; }
}

/* mobile navigation sheet ("Više") */
.hq-navsheet__user { display: flex; align-items: center; gap: 12px; padding: 4px 4px 16px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.hq-navsheet__grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.hq-navsheet__grid .hq-nav__item { height: 46px; border: 1px solid var(--line); background: var(--surface-2); }
.hq-navsheet__grid .hq-nav__item.is-active::before { display: none; }
.hq-navsheet .hq-nav__label { padding: 0 2px; margin-top: 12px; }

/* 5 ─────────────────────────── Page layout ─────────────────────────── */
.hq-page { min-width: 0; animation: page-in var(--dur-3) var(--ease) both; }
@keyframes page-in { from { transform: translateY(6px); } to { transform: none; } }
.hq-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 22px; flex-wrap: wrap; }
.hq-page-head__text { min-width: 0; flex: 1 1 320px; }
.hq-page-title { font: 600 26px/1.15 var(--font-display); letter-spacing: -.025em; display: flex; align-items: center; gap: 12px; }
.hq-page-title .x-icon { color: var(--accent); }
.hq-page-sub { color: var(--ink-2); margin-top: 6px; font-size: 13.5px; max-width: 760px; }
.hq-page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.hq-page-back { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-3); font-size: 13px; margin-bottom: 10px; }
.hq-page-back:hover { color: var(--ink); text-decoration: none; }
.hq-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.hq-filters > .x-search { flex: 1 1 240px; max-width: 340px; }
.hq-filters__spacer { flex: 1; }
.hq-section { margin-top: 28px; }
.hq-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.hq-section-title { font: 600 16px/1.3 var(--font-display); letter-spacing: -.01em; }
.hq-section-sub { color: var(--ink-3); font-size: 12.5px; }
.hq-skel-row { display: flex; gap: 24px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.hq-skel-row:last-child { border-bottom: 0; }

@media (max-width: 899.98px) {
  .hq-page-head { margin-bottom: 16px; align-items: flex-start; }
  .hq-page-title { font-size: 22px; }
  .hq-page-actions { width: 100%; }
  .hq-page-actions > .x-btn { flex: 1 1 auto; }
  .hq-filters > .x-search { max-width: none; flex-basis: 100%; }
}

.grid-kpi { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--min, 280px), 1fr)); gap: 16px; }
.grid-main-side { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
@media (max-width: 1199.98px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-main-side { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 899.98px) {
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .grid-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}

/* 6 ─────────────────────────── Components ─────────────────────────── */

/* Icon */
.x-icon {
  width: 18px; height: 18px; flex-shrink: 0; display: inline-block; vertical-align: middle;
  fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}
.x-icon--spin { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Card */
.x-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--card-highlight); min-width: 0; position: relative;
}
.x-card--pad { padding: 20px; }
.x-card--flush { overflow: hidden; }
.x-card--interactive { transition: border-color var(--dur-1) ease, background var(--dur-1) ease; cursor: pointer; }
.x-card--interactive:hover { border-color: var(--line-3); }
/* Whole-card links (loan / project / borrowing cards, dashboard mini cards, KPI tiles rendered as <a>): the global
   "a:hover → underline" must never reach their content. Hover lifts the card instead. */
a.x-card, a.x-card:hover, a.x-card:hover *, a.x-kpi, a.x-kpi:hover, a.x-kpi:hover * { text-decoration: none; }
a.x-card { color: inherit; transition: border-color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease), transform var(--dur-2) var(--ease); }
a.x-card:hover { border-color: var(--line-3); box-shadow: var(--card-highlight), var(--shadow); transform: translateY(-1px); }
a.x-card:active { transform: none; }
@media (prefers-reduced-motion: reduce) { a.x-card, a.x-card:hover { transform: none; transition: none; } }
.x-card--accent { background: var(--mars-soft), var(--surface); border-color: var(--accent-line); }
.x-card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; min-height: 56px; }
.x-card__head--border { border-bottom: 1px solid var(--line); }
.x-card__titles { min-width: 0; display: flex; align-items: center; gap: 10px; }
.x-card__icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex-shrink: 0; }
.x-card__icon .x-icon { width: 16px; height: 16px; }
.x-card__title { font: 600 14.5px/1.3 var(--font-display); letter-spacing: -.01em; }
.x-card__sub { color: var(--ink-3); font-size: 12.5px; margin-top: 2px; }
.x-card__actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.x-card__body { padding: 0 20px 20px; }
.x-card__head--border + .x-card__body { padding-top: 16px; }
.x-card__body--flush, .x-card__head--border + .x-card__body--flush { padding: 0; }
.x-card__body--solo { padding: 20px; }
.x-card__body--flush .x-table-wrap { border: 0; border-radius: 0 0 var(--r-lg) var(--r-lg); background: transparent; box-shadow: none; }
.x-card__foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
@media (max-width: 899.98px) {
  .x-card--pad { padding: 16px; }
  .x-card__head { padding: 14px 16px; }
  .x-card__body { padding: 0 16px 16px; }
  .x-card__foot { padding: 12px 16px; }
}

/* Button */
.x-btn {
  --btn-h: 34px;
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: var(--btn-h); padding: 0 13px; border-radius: var(--r-sm); border: 1px solid transparent;
  font: 500 13.5px/1 var(--font-ui); white-space: nowrap; user-select: none; text-decoration: none !important;
  transition: background var(--dur-1) ease, border-color var(--dur-1) ease, color var(--dur-1) ease, box-shadow var(--dur-1) ease, transform var(--dur-1) ease;
}
.x-btn:active:not(:disabled) { transform: translateY(1px); }
.x-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.x-btn:disabled, .x-btn.is-disabled { opacity: .5; pointer-events: none; }
.x-btn .x-icon { width: 16px; height: 16px; }
.x-btn--sm { --btn-h: 28px; padding: 0 10px; font-size: 12.5px; gap: 6px; border-radius: 7px; }
.x-btn--sm .x-icon { width: 14px; height: 14px; }
.x-btn--lg { --btn-h: 42px; padding: 0 18px; font-size: 14.5px; border-radius: var(--r); }
.x-btn--block { width: 100%; }
.x-btn--icon { width: var(--btn-h); padding: 0; }
.x-btn--primary { background: var(--accent); color: var(--accent-ink); font-weight: 600; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 1px 2px rgba(0, 0, 0, .2); }
.x-btn--primary:hover { background: var(--accent-hover); }
.x-btn--secondary { background: var(--surface-2); border-color: var(--line-2); color: var(--ink); box-shadow: var(--shadow-sm); }
.x-btn--secondary:hover { border-color: var(--line-3); background: var(--surface-3); }
:root[data-theme="light"] .x-btn--secondary { background: #fff; }
:root[data-theme="light"] .x-btn--secondary:hover { background: var(--surface-2); }
.x-btn--ghost { color: var(--ink-2); }
.x-btn--ghost:hover { background: var(--surface-hover); color: var(--ink); }
.x-btn--ghost.is-active { background: var(--surface-active); color: var(--ink); }
.x-btn--danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-line); }
.x-btn--danger:hover { background: var(--danger); color: var(--on-danger); border-color: var(--danger); }
.x-btn--danger:focus-visible { box-shadow: var(--ring-danger); }
.x-btn--subtle { background: var(--accent-soft); color: var(--accent-text); }
.x-btn--subtle:hover { background: var(--accent-soft-2); }
.x-btn--link { height: auto; padding: 0; color: var(--accent-text); border: 0; }
.x-btn--link:hover { text-decoration: underline !important; text-underline-offset: 3px; }
.x-btn.is-loading { pointer-events: none; }
.x-btn.is-loading > :not(.x-btn__spinner) { visibility: hidden; }
.x-btn__spinner { position: absolute; inset: 0; display: grid; place-items: center; }
.x-btn__kbd { margin-left: 4px; opacity: .7; }
.x-btn-group { display: inline-flex; }
.x-btn-group > .x-btn:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; }
.x-btn-group > .x-btn:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
@media (pointer: coarse) {
  .x-btn { --btn-h: 40px; }
  .x-btn--sm { --btn-h: 34px; }
  /* inline link buttons ("Plati" in a sentence) keep their line height but get an invisible ~40 px hit area */
  .x-btn--link::after { content: ''; position: absolute; inset: -10px -8px; }
  /* label-less row-selection checkboxes (tables, mobile cards, Dospijeća rows): ~40 px hit area. XCheckbox stops the
     click, so a tap next to the box toggles the selection instead of opening the drawer. */
  .dm-row__sel, .x-tcard__sel .x-check, .x-table .is-sel .x-check { position: relative; z-index: 1; } /* above the row's favicon/title */
  .dm-row__sel::after, .x-tcard__sel .x-check::after, .x-table .is-sel .x-check::after { content: ''; position: absolute; inset: -12px; }
}

/* Badge */
.x-badge {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px; height: 20px; min-width: 20px; padding: 0 7px;
  border-radius: var(--r-pill); font: 600 11.5px/1 var(--font-ui); font-variant-numeric: tabular-nums; white-space: nowrap;
  background: var(--neutral-soft); color: var(--ink-2); border: 1px solid transparent;
}
.x-badge .x-icon { width: 12px; height: 12px; }
.x-badge--lg { height: 24px; padding: 0 9px; font-size: 12.5px; }
.x-badge--accent { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-line); }
.x-badge--ok { background: var(--ok-soft); color: var(--ok); }
.x-badge--warn { background: var(--warn-soft); color: var(--warn); }
.x-badge--danger { background: var(--danger-soft); color: var(--danger); }
.x-badge--info { background: var(--info-soft); color: var(--info); }
.x-badge--solid.x-badge--danger { background: var(--danger); color: var(--on-danger); }
.x-badge--solid.x-badge--accent { background: var(--accent); color: var(--accent-ink); }
.x-badge--solid.x-badge--neutral { background: var(--ink-3); color: var(--bg); }
.x-badge--outline { background: transparent; border-color: var(--line-2); }
.x-badge__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }

/* Status pill */
.x-status {
  --st: var(--ink-2); --st-bg: var(--neutral-soft);
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px 0 8px; border-radius: var(--r-pill);
  font: 500 12px/1 var(--font-ui); color: var(--st); background: var(--st-bg); white-space: nowrap;
}
.x-status__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.x-status--planned .x-status__dot { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; }
.x-status--invoiced { --st: var(--info); --st-bg: var(--info-soft); }
.x-status--partial { --st: var(--warn); --st-bg: var(--warn-soft); }
.x-status--partial .x-status__dot { background: linear-gradient(90deg, currentColor 50%, transparent 50%); box-shadow: inset 0 0 0 1.5px currentColor; }
.x-status--paid { --st: var(--ok); --st-bg: var(--ok-soft); }
.x-status--skipped, .x-status--cancelled { --st: var(--ink-3); --st-bg: transparent; box-shadow: inset 0 0 0 1px var(--line-2); }
.x-status--cancelled .x-status__label { text-decoration: line-through; text-decoration-thickness: 1px; }
.x-status--overdue { --st: var(--danger); --st-bg: var(--danger-soft); }
.x-status--overdue .x-status__dot { animation: dot-pulse 2s var(--ease-io) infinite; }
.x-status--sm { height: 20px; font-size: 11.5px; padding: 0 7px; }
.x-status__extra { font-weight: 400; font-variant-numeric: tabular-nums; } /* no opacity: it dropped below 4.5:1 */

/* Unread dot */
.x-unread {
  position: relative; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent); vertical-align: middle;
}
.x-unread::after {
  content: ''; position: absolute; inset: -3px; border-radius: 50%; border: 1.5px solid var(--accent);
  opacity: 0; animation: unread-ring 2.4s var(--ease) infinite;
}
.x-unread--count { width: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; font: 600 10.5px/1 var(--font-ui); color: var(--accent-ink); }
.x-unread--count::after { border-radius: 12px; }
.x-unread--static::after { display: none; }
@keyframes unread-ring { 0% { transform: scale(.7); opacity: .7; } 70%, 100% { transform: scale(1.6); opacity: 0; } }
@keyframes dot-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* Avatar */
.x-avatar {
  --av: var(--tone-0);
  position: relative; display: inline-grid; place-items: center; flex-shrink: 0; border-radius: 50%;
  width: var(--size, 28px); height: var(--size, 28px); font: 600 calc(var(--size, 28px) * .38)/1 var(--font-display);
  color: var(--av); background: color-mix(in srgb, var(--av) 17%, var(--surface)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--av) 32%, transparent);
  letter-spacing: -.02em; user-select: none;
}
.x-avatar img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
/* Gravatar photo: stacked over the initials, invisible until loaded (no layout shift; failure keeps the initials) */
.x-avatar__photo { position: absolute; inset: 0; opacity: 0; background: var(--surface); transition: opacity var(--dur-2) var(--ease); }
.x-avatar__photo.is-loaded { opacity: 1; }
.x-avatar.has-photo { color: transparent; transition: color 0s linear var(--dur-2); } /* initials hidden once covered */
.x-avatar--square { border-radius: 28%; }
.tone-0 { --av: var(--tone-0); } .tone-1 { --av: var(--tone-1); } .tone-2 { --av: var(--tone-2); } .tone-3 { --av: var(--tone-3); }
.tone-4 { --av: var(--tone-4); } .tone-5 { --av: var(--tone-5); } .tone-6 { --av: var(--tone-6); } .tone-7 { --av: var(--tone-7); }

/* Favicon */
.x-favicon {
  --size: 20px;
  position: relative; display: inline-grid; place-items: center; flex-shrink: 0; overflow: hidden;
  width: var(--size); height: var(--size); border-radius: calc(var(--size) * .26);
  background: #fff; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06), 0 0 0 1px var(--line);
}
.x-favicon img { width: 74%; height: 74%; object-fit: contain; }
.x-favicon.is-letter {
  --av: var(--tone-0);
  background: color-mix(in srgb, var(--av) 18%, var(--surface)); color: var(--av); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--av) 32%, transparent);
  font: 600 calc(var(--size) * .5)/1 var(--font-display);
}
.x-favicon-link { display: inline-flex; align-items: center; gap: 8px; color: inherit; min-width: 0; }
.x-favicon-link:hover { text-decoration: none; }
.x-favicon-link:hover .x-favicon-link__ext { opacity: 1; color: var(--accent); }
.x-favicon-link__ext { opacity: .5; color: var(--ink-3); width: 13px; height: 13px; transition: opacity var(--dur-1) ease; }

/* Inputs */
.x-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.x-field__label { display: flex; align-items: center; gap: 6px; font: 500 12.5px/1.3 var(--font-ui); color: var(--ink-2); }
.x-field__req { color: var(--danger); }
.x-field__opt { color: var(--ink-3); font-weight: 400; }
.x-field__hint { font-size: 12px; color: var(--ink-3); line-height: 1.4; }
.x-field__error { font-size: 12px; color: var(--danger); line-height: 1.4; display: flex; align-items: center; gap: 5px; }
.x-field__error .x-icon { width: 13px; height: 13px; }
.x-field--inline { flex-direction: row; align-items: center; justify-content: space-between; gap: 16px; }
.x-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.x-form-grid .span-2 { grid-column: span 2; }
.x-form-stack { display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 599.98px) { .x-form-grid { grid-template-columns: minmax(0, 1fr); } .x-form-grid .span-2 { grid-column: auto; } }

.x-control {
  --ctl-h: 36px;
  position: relative; display: flex; align-items: center; min-width: 0; width: 100%;
  height: var(--ctl-h); border-radius: var(--r-sm); background: var(--input-bg); border: 1px solid var(--input-border);
  transition: border-color var(--dur-1) ease, box-shadow var(--dur-1) ease, background var(--dur-1) ease;
}
.x-control:hover { border-color: var(--input-border-hover); }
.x-control:focus-within { border-color: var(--accent); box-shadow: var(--ring); background: var(--input-bg-focus); }
.x-control.is-invalid { border-color: var(--danger); }
.x-control.is-invalid:focus-within { box-shadow: var(--ring-danger); }
.x-control.is-disabled { opacity: .55; pointer-events: none; }
.x-control.is-readonly { background: transparent; border-style: dashed; }
.x-control--sm { --ctl-h: 30px; font-size: 13px; }
.x-control--lg { --ctl-h: 44px; font-size: 15px; }
.x-control--auto { width: auto; }
.x-control__input {
  flex: 1; min-width: 0; width: 100%; height: 100%; border: 0; background: transparent; outline: none;
  padding: 0 11px; font-size: 14px; color: var(--ink); border-radius: inherit;
}
.x-control--sm .x-control__input { font-size: 13px; padding: 0 9px; }
.x-control__input::placeholder { color: var(--ink-3); opacity: 1; }
.x-control__input:-webkit-autofill { -webkit-box-shadow: 0 0 0 40px var(--surface-2) inset; -webkit-text-fill-color: var(--ink); }
.x-control__icon { margin-left: 10px; color: var(--ink-3); width: 16px; height: 16px; flex-shrink: 0; }
.x-control__icon + .x-control__input { padding-left: 8px; }
.x-control__suffix { padding: 0 11px 0 0; color: var(--ink-3); font-size: 13px; white-space: nowrap; flex-shrink: 0; }
.x-control__prefix { padding: 0 0 0 11px; color: var(--ink-3); font-size: 13px; white-space: nowrap; flex-shrink: 0; }
.x-control__prefix + .x-control__input { padding-left: 6px; }
.x-control__clear { margin-right: 5px; width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; color: var(--ink-3); flex-shrink: 0; }
.x-control__clear:hover { background: var(--surface-hover); color: var(--ink); }
.x-control__clear .x-icon { width: 14px; height: 14px; }
.x-control__kbd { margin-right: 8px; }
.x-control--money .x-control__input { text-align: right; font-variant-numeric: tabular-nums; padding-right: 6px; }
.x-control--textarea { height: auto; align-items: stretch; }
.x-control--textarea .x-control__input { padding: 9px 11px; resize: vertical; min-height: 72px; line-height: 1.5; }
.x-control--textarea.is-autosize .x-control__input { resize: none; overflow: hidden; }
input[type="date"].x-control__input, input[type="month"].x-control__input { font-variant-numeric: tabular-nums; min-width: 0; }
input[type="date"]::-webkit-calendar-picker-indicator, input[type="month"]::-webkit-calendar-picker-indicator {
  opacity: .55; cursor: pointer; filter: var(--picker-filter, none); padding: 4px; border-radius: 4px;
}
:root:not([data-theme="light"]) { --picker-filter: invert(.85); }
input[type="date"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }
input[type="number"]::-webkit-inner-spin-button { opacity: .4; }
@media (max-width: 899.98px), (pointer: coarse) {
  .x-control { --ctl-h: 42px; }
  .x-control__input, .x-control--sm .x-control__input { font-size: 16px; } /* prevents iOS zoom-on-focus */
  .x-control--sm { --ctl-h: 36px; }
}

/* Date field (text + native picker) */
.x-date { position: relative; }
.x-date .x-control__input { font-variant-numeric: tabular-nums; }
.x-date__btn {
  width: 28px; height: 28px; margin-right: 4px; border-radius: 6px; display: grid; place-items: center; flex-shrink: 0;
  color: var(--ink-3); transition: background var(--dur-1) ease, color var(--dur-1) ease;
}
.x-date__btn:hover { background: var(--surface-hover); color: var(--ink); }
.x-date__btn .x-icon { width: 16px; height: 16px; }
.x-date__clear { margin-right: 0; }
.x-date__native {
  position: absolute; right: 4px; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0;
  font-size: 16px; color-scheme: inherit;
}
@media (pointer: coarse) {
  /* Touch: the transparent native input covers the field so a tap opens the OS date picker directly. */
  .x-date__native { inset: 0; width: 100%; height: 100%; pointer-events: auto; z-index: 1; }
  .x-date__clear { position: relative; z-index: 2; }
}

/* Select (native) */
.x-control--select .x-control__input { appearance: none; -webkit-appearance: none; padding-right: 32px; cursor: pointer; text-overflow: ellipsis; }
.x-control--select .x-control__input option { background: var(--popover); color: var(--ink); }
.x-control--select .x-select__chev { position: absolute; right: 10px; pointer-events: none; color: var(--ink-3); width: 16px; height: 16px; }
.x-control--select .x-control__input.is-placeholder { color: var(--ink-3); }

/* Combobox */
.x-combo { position: relative; width: 100%; min-width: 0; }
.x-combo .x-control { cursor: text; }
.x-combo__lead { margin-left: 9px; display: flex; flex-shrink: 0; }
.x-combo__lead + .x-control__input { padding-left: 8px; }
.x-combo__chev { margin-right: 8px; color: var(--ink-3); width: 16px; height: 16px; flex-shrink: 0; transition: transform var(--dur-2) var(--ease); }
.x-combo.is-open .x-combo__chev { transform: rotate(180deg); }

/* Floating panels: menus, combobox lists, popovers */
.x-pop {
  position: fixed; z-index: var(--z-pop); min-width: 180px; max-width: min(440px, calc(100vw - 16px));
  background: var(--popover); border-radius: var(--r); box-shadow: var(--shadow-pop); padding: 5px;
  overflow-y: auto; overscroll-behavior: contain; transform-origin: top left;
  animation: pop-in var(--dur-2) var(--ease);
}
.x-pop[data-placement="top"] { transform-origin: bottom left; animation-name: pop-in-up; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes pop-in-up { from { opacity: 0; transform: translateY(4px) scale(.98); } to { opacity: 1; transform: none; } }
.x-pop__item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 6px 10px; border-radius: 7px;
  font-size: 13.5px; color: var(--ink); text-align: left; cursor: pointer; text-decoration: none !important; user-select: none;
}
.x-pop__item .x-icon { width: 16px; height: 16px; color: var(--ink-3); }
.x-pop__item:hover { background: var(--surface-hover); }
.x-pop__item.is-active { background: var(--surface-active); }
.x-pop__item.is-selected { color: var(--accent-text); }
.x-pop__item.is-danger { color: var(--danger); }
.x-pop__item.is-danger .x-icon { color: var(--danger); }
.x-pop__item.is-disabled { opacity: .45; pointer-events: none; }
.x-pop__item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.x-pop__item-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.x-pop__item-sub { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.x-pop__shortcut { margin-left: auto; color: var(--ink-3); font-size: 12px; }
.x-pop__check { margin-left: auto; width: 15px !important; height: 15px !important; color: var(--accent) !important; }
.x-pop__sep { height: 1px; background: var(--line); margin: 5px -5px; }
.x-pop__head { padding: 8px 10px 6px; font: 600 11px/1 var(--font-ui); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); }
.x-pop__info { padding: 8px 10px 6px; min-width: 0; }
.x-pop__info-title { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.x-pop__info-sub { font-size: 12px; color: var(--ink-3); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.x-pop__empty { padding: 14px 10px; color: var(--ink-3); font-size: 13px; text-align: center; }
.x-pop__create { color: var(--accent-text); }
.x-pop__create .x-icon { color: var(--accent); }
.x-pop__loading { display: flex; align-items: center; gap: 8px; padding: 10px; color: var(--ink-3); font-size: 13px; }
mark.x-hl { background: transparent; color: var(--accent-text); font-weight: 600; }
@media (pointer: coarse) { .x-pop__item { min-height: 44px; } }

/* Toggle (switch) */
.x-toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; min-height: 24px; text-align: left; }
.x-toggle.is-disabled { opacity: .5; pointer-events: none; }
.x-toggle__track {
  position: relative; width: 34px; height: 20px; border-radius: 10px; flex-shrink: 0;
  background: var(--line-3); transition: background var(--dur-2) var(--ease);
}
.x-toggle__thumb {
  position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .35); transition: transform var(--dur-2) var(--ease);
}
.x-toggle.is-on .x-toggle__track { background: var(--accent); }
.x-toggle.is-on .x-toggle__thumb { transform: translateX(14px); }
.x-toggle:focus-visible { outline: none; }
.x-toggle:focus-visible .x-toggle__track { box-shadow: var(--ring); }
.x-toggle__text { display: flex; flex-direction: column; gap: 1px; }
.x-toggle__label { font-size: 13.5px; }
.x-toggle__desc { font-size: 12px; color: var(--ink-3); }

/* Checkbox */
.x-check { display: inline-flex; align-items: flex-start; gap: 9px; cursor: pointer; user-select: none; font-size: 13.5px; text-align: left; }
.x-check.is-disabled { opacity: .5; pointer-events: none; }
.x-check__box {
  position: relative; width: 16px; height: 16px; margin-top: 1px; border-radius: 5px; flex-shrink: 0;
  border: 1.5px solid var(--line-3); background: var(--input-bg); display: grid; place-items: center;
  transition: background var(--dur-1) ease, border-color var(--dur-1) ease;
}
.x-check__box .x-icon { width: 12px; height: 12px; stroke-width: 3; color: var(--accent-ink); opacity: 0; transform: scale(.6); transition: opacity var(--dur-1) ease, transform var(--dur-2) var(--ease); }
.x-check:hover .x-check__box { border-color: var(--ink-3); }
.x-check.is-on .x-check__box, .x-check.is-mixed .x-check__box { background: var(--accent); border-color: var(--accent); }
.x-check.is-on .x-check__box .x-icon, .x-check.is-mixed .x-check__box .x-icon { opacity: 1; transform: none; }
.x-check:focus-visible { outline: none; }
.x-check:focus-visible .x-check__box { box-shadow: var(--ring); }
.x-check__text { display: flex; flex-direction: column; gap: 1px; }
.x-check__desc { font-size: 12px; color: var(--ink-3); }

/* Segmented control */
.x-seg {
  position: relative; display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r-sm);
  background: var(--neutral-soft); border: 1px solid var(--line); max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.x-seg::-webkit-scrollbar { display: none; }
.x-seg__opt {
  position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: 1 0 auto;
  height: 28px; padding: 0 12px; border-radius: 6px; color: var(--ink-2); font: 500 13px/1 var(--font-ui); white-space: nowrap;
  transition: color var(--dur-2) ease;
}
.x-seg__opt .x-icon { width: 15px; height: 15px; }
.x-seg__opt:hover { color: var(--ink); }
.x-seg__opt.is-active { color: var(--ink); }
.x-seg__opt:focus-visible { outline: none; box-shadow: var(--ring); }
.x-seg__thumb {
  position: absolute; z-index: 0; top: 3px; bottom: 3px; left: 0; border-radius: 6px; background: var(--surface-3);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25), inset 0 0 0 1px var(--line-2); transition: transform var(--dur-3) var(--ease), width var(--dur-3) var(--ease);
}
:root[data-theme="light"] .x-seg__thumb { background: #fff; box-shadow: 0 1px 3px rgba(22, 21, 29, .12), inset 0 0 0 1px var(--line); }
.x-seg--sm .x-seg__opt { height: 24px; padding: 0 9px; font-size: 12px; }
.x-seg--block { display: flex; width: 100%; }
@media (pointer: coarse) {
  /* .x-seg--sm needs the compound selector to beat ".x-seg--sm .x-seg__opt { height: 24px }" above */
  .x-seg__opt, .x-seg--sm .x-seg__opt { height: 34px; }
  .x-seg--sm .x-seg__opt { padding: 0 11px; }
}

/* Tabs */
.x-tabs { position: relative; display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; margin-bottom: 18px; }
.x-tabs::-webkit-scrollbar { display: none; }
.x-tabs--flush { margin-bottom: 0; }
.x-tab {
  position: relative; display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 12px; flex-shrink: 0;
  color: var(--ink-3); font: 500 13.5px/1 var(--font-ui); white-space: nowrap; transition: color var(--dur-1) ease;
}
.x-tab .x-icon { width: 16px; height: 16px; }
.x-tab:hover { color: var(--ink); }
.x-tab.is-active { color: var(--ink); }
.x-tab:focus-visible { outline: none; box-shadow: inset var(--ring); border-radius: 6px; }
.x-tab__count { height: 18px; min-width: 18px; padding: 0 6px; border-radius: 9px; display: inline-grid; place-items: center; background: var(--neutral-soft); color: var(--ink-2); font: 600 11px/1 var(--font-ui); font-variant-numeric: tabular-nums; }
.x-tab.is-active .x-tab__count { background: var(--accent-soft); color: var(--accent-text); }
.x-tabs__ink { position: absolute; bottom: 0; left: 0; height: 2px; border-radius: 2px 2px 0 0; background: var(--mars); transition: transform var(--dur-3) var(--ease), width var(--dur-3) var(--ease); }
.x-tabs--pills { border-bottom: 0; gap: 4px; }
.x-tabs--pills .x-tab { height: 32px; border-radius: var(--r-sm); }
.x-tabs--pills .x-tab.is-active { background: var(--surface-active); }
.x-tabs--pills .x-tabs__ink { display: none; }

/* KPI */
.x-kpi { position: relative; padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; min-height: 112px; overflow: hidden; text-decoration: none !important; color: inherit; }
a.x-kpi:hover { border-color: var(--line-3); }
.x-kpi__head { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 12.5px; font-weight: 500; }
.x-kpi__icon { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--neutral-soft); color: var(--ink-2); flex-shrink: 0; }
.x-kpi__icon .x-icon { width: 15px; height: 15px; }
.x-kpi__label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.x-kpi__value {
  font: 600 26px/1.1 var(--font-display); letter-spacing: -.025em; font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; position: relative; min-width: 0;
}
.x-kpi__value small { font-size: 15px; font-weight: 500; color: var(--ink-2); letter-spacing: 0; margin-left: 2px; }
.x-kpi__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
.x-kpi__foot { display: flex; align-items: center; gap: 4px 8px; min-height: 18px; font-size: 12px; color: var(--ink-3); flex-wrap: wrap; }
.x-kpi__delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; font-variant-numeric: tabular-nums; }
.x-kpi__delta .x-icon { width: 13px; height: 13px; stroke-width: 2.25; }
.x-kpi__delta.is-good { color: var(--ok); }
.x-kpi__delta.is-bad { color: var(--danger); }
.x-kpi__delta.is-flat { color: var(--ink-3); }
.x-kpi__spark { flex-shrink: 0; width: 92px; height: 34px; pointer-events: none; }
.x-kpi--accent { background: var(--mars-soft), var(--surface); border-color: var(--accent-line); }
.x-kpi--accent .x-kpi__icon { background: var(--accent-soft-2); color: var(--accent); }
.x-kpi--danger .x-kpi__icon { background: var(--danger-soft); color: var(--danger); }
.x-kpi--danger .x-kpi__value { color: var(--danger); }
.x-kpi--ok .x-kpi__icon { background: var(--ok-soft); color: var(--ok); }
.x-kpi--warn .x-kpi__icon { background: var(--warn-soft); color: var(--warn); }
.x-kpi--warn .x-kpi__value { color: var(--warn); }
.x-kpi--info .x-kpi__icon { background: var(--info-soft); color: var(--info); }
@media (max-width: 899.98px) {
  .x-kpi { padding: 14px; min-height: 100px; }
  .x-kpi__value { font-size: 21px; }
  .x-kpi__spark { width: 56px; height: 24px; }
}
@media (max-width: 599.98px) {
  /* 2-up on phones: compact cards, labels wrap ("Sljedećih 30 dana") instead of being cut off at 360 px */
  .x-kpi { padding: 12px; min-height: 92px; }
  .x-kpi__value { font-size: 19px; }
  .x-kpi__label { white-space: normal; line-height: 1.25; }
}

/* Stat (inline label/value pair) */
.x-stat { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.x-stat__label { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 5px; }
.x-stat__value { font: 500 14.5px/1.35 var(--font-ui); font-variant-numeric: tabular-nums; color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
.x-stat--lg .x-stat__value { font: 600 20px/1.2 var(--font-display); letter-spacing: -.02em; }
/* numbers never break ("6.024.027,53" / "€"): one line, shrunk to fit by v-fit (fittext.js); ellipsis only below 60 % */
.x-stat__value--num { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; }
.x-stat--row { flex-direction: row; align-items: baseline; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.x-stat--row:last-child { border-bottom: 0; }
.x-stat--row .x-stat__label { font-size: 13px; color: var(--ink-2); white-space: normal; }
.x-stat--row .x-stat__value { text-align: right; }
.x-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px 20px; }

/* Money text */
.x-money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.x-money.is-pos { color: var(--ok); }
.x-money.is-neg { color: var(--danger); }
.x-money.is-zero { color: var(--ink-3); }
.x-money.is-strong { font-weight: 600; }
.x-money__approx { color: var(--ink-3); margin-right: 1px; font-weight: 400; }

/* Progress */
.x-progress { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.x-progress__head { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--ink-2); }
.x-progress__head .num { color: var(--ink); font-weight: 500; }
.x-progress__track { position: relative; height: 6px; border-radius: 3px; background: var(--neutral-soft); overflow: hidden; }
.x-progress--sm .x-progress__track { height: 4px; }
.x-progress--lg .x-progress__track { height: 10px; border-radius: 5px; }
.x-progress__bar { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--mars); transition: width var(--dur-3) var(--ease); }
.x-progress--ok .x-progress__bar { background: var(--ok); }
.x-progress--warn .x-progress__bar { background: var(--warn); }
.x-progress--danger .x-progress__bar { background: var(--danger); }
.x-progress--info .x-progress__bar { background: var(--info); }
.x-progress.is-indeterminate .x-progress__bar { width: 35% !important; animation: indeterminate 1.3s var(--ease-io) infinite; }
@keyframes indeterminate { from { transform: translateX(-110%); } to { transform: translateX(310%); } }

/* Skeleton */
.x-skel {
  display: block; border-radius: 6px; max-width: 100%;
  background: linear-gradient(90deg, var(--neutral-soft) 0%, var(--surface-active) 40%, var(--neutral-soft) 80%);
  background-size: 300% 100%; animation: shimmer 1.6s ease-in-out infinite;
}
.x-skel--circle { border-radius: 50%; }
.x-skel-lines { display: flex; flex-direction: column; gap: 9px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* starfield layers (shared by login & empty states) */
:root {
  --stars-a:
    radial-gradient(1px 1px at 12% 18%, var(--star), transparent 60%), radial-gradient(1px 1px at 28% 72%, var(--star), transparent 60%),
    radial-gradient(1.5px 1.5px at 43% 32%, var(--star), transparent 60%), radial-gradient(1px 1px at 57% 84%, var(--star), transparent 60%),
    radial-gradient(1px 1px at 68% 12%, var(--star), transparent 60%), radial-gradient(1.5px 1.5px at 79% 56%, var(--star), transparent 60%),
    radial-gradient(1px 1px at 91% 28%, var(--star), transparent 60%), radial-gradient(1px 1px at 6% 88%, var(--star), transparent 60%),
    radial-gradient(1px 1px at 36% 8%, var(--star), transparent 60%), radial-gradient(1px 1px at 85% 90%, var(--star), transparent 60%);
  --stars-b:
    radial-gradient(1px 1px at 20% 45%, var(--star), transparent 60%), radial-gradient(1px 1px at 50% 58%, var(--star), transparent 60%),
    radial-gradient(1px 1px at 74% 38%, var(--star), transparent 60%), radial-gradient(1px 1px at 95% 70%, var(--star), transparent 60%),
    radial-gradient(1px 1px at 3% 35%, var(--star), transparent 60%), radial-gradient(1px 1px at 62% 96%, var(--star), transparent 60%);
}

/* Empty state */
.x-empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 48px 24px; gap: 6px; position: relative; overflow: hidden; border-radius: var(--r-lg); }
.x-empty--compact { padding: 28px 16px; }
.x-empty__icon {
  position: relative; z-index: 1; width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; margin-bottom: 10px;
  color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-line);
}
.x-empty__icon .x-icon { width: 24px; height: 24px; }
.x-empty--compact .x-empty__icon { width: 40px; height: 40px; border-radius: 12px; margin-bottom: 6px; }
.x-empty--compact .x-empty__icon .x-icon { width: 19px; height: 19px; }
.x-empty__title { position: relative; z-index: 1; font: 600 16px/1.3 var(--font-display); letter-spacing: -.01em; }
.x-empty__text { position: relative; z-index: 1; color: var(--ink-2); font-size: 13.5px; max-width: 460px; }
.x-empty__actions { position: relative; z-index: 1; display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; justify-content: center; }
.x-empty--stars::before { content: ''; position: absolute; inset: 0; background-image: var(--stars-a), var(--stars-b); background-size: 420px 300px, 260px 220px; opacity: .5; pointer-events: none; }
.x-empty--stars::after {
  content: ''; position: absolute; left: 50%; top: 42%; width: 420px; height: 260px; transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, var(--accent-soft-2), transparent); pointer-events: none; opacity: .65;
}
.x-empty--card { border: 1px dashed var(--line-2); }

/* Tooltip — any element with data-tip="…" (data-tip-pos="top|bottom|left|right"). Rendered by public/js/tooltip.js as one
   fixed-position element so it is never clipped by the viewport or an overflow:hidden ancestor; flips/clamps to fit. */
[data-tip] { position: relative; }
.x-tip {
  position: fixed; left: 0; top: 0; z-index: var(--z-toast);
  padding: 6px 9px; border-radius: 7px; max-width: min(280px, calc(100vw - 16px)); width: max-content;
  background: #1d1d2b; color: #f3efe9; font: 500 12px/1.35 var(--font-ui); letter-spacing: 0; text-transform: none; text-align: left;
  white-space: normal; overflow-wrap: anywhere;
  box-shadow: 0 6px 20px -6px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .06);
  pointer-events: none; opacity: 0; transform: translate(0, 3px);
  transition: opacity var(--dur-2) var(--ease), transform var(--dur-2) var(--ease);
}
.x-tip[hidden] { display: none; }
.x-tip[data-placement="bottom"] { transform: translate(0, -3px); }
.x-tip[data-placement="left"] { transform: translate(3px, 0); }
.x-tip[data-placement="right"] { transform: translate(-3px, 0); }
.x-tip.is-visible { opacity: 1; transform: none; }
:root[data-theme="light"] .x-tip { background: #16151d; }
@media (prefers-reduced-motion: reduce) { .x-tip { transition: none; transform: none; } }
.x-tooltip { display: inline-flex; vertical-align: middle; }
.x-tooltip--help { color: var(--ink-3); cursor: help; }
.x-tooltip--help .x-icon { width: 14px; height: 14px; }
/* Table */
.x-table-wrap {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--card-highlight); min-width: 0;
}
.x-table-wrap.is-bare { background: transparent; border: 0; border-radius: 0; box-shadow: none; }
.x-table-wrap.is-scroll-x { overflow-x: auto; overscroll-behavior-x: contain; }
.x-table-wrap.has-maxh { overflow-y: auto; }
.x-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.x-table th {
  position: sticky; top: var(--x-table-top, calc(var(--topbar-h) + var(--safe-top))); z-index: 2;
  height: 38px; padding: 0 12px; text-align: left; vertical-align: middle; white-space: nowrap;
  font: 500 12px/1.2 var(--font-ui); color: var(--ink-3); background: var(--surface); border-bottom: 1px solid var(--line-2);
}
.x-table-wrap.is-scroll-x .x-table th, .x-table-wrap.no-sticky .x-table th { position: static; }
.x-table-wrap.has-maxh .x-table th { position: sticky; top: 0; }
.x-table-wrap.is-bare .x-table th { background: var(--surface); }
.x-table th:first-child { border-top-left-radius: var(--r-lg); }
.x-table th:last-child { border-top-right-radius: var(--r-lg); }
.x-table-wrap.is-bare .x-table th { border-radius: 0; }
.x-table td {
  height: 46px; padding: 6px 12px; vertical-align: middle; border-bottom: 1px solid var(--line);
  color: var(--ink); transition: background var(--dur-1) ease;
}
.x-table tbody tr:last-child td { border-bottom: 0; }
.x-table tbody tr:last-child td:first-child { border-bottom-left-radius: var(--r-lg); }
.x-table tbody tr:last-child td:last-child { border-bottom-right-radius: var(--r-lg); }
.x-table.is-dense td { height: 36px; padding-top: 3px; padding-bottom: 3px; }
.x-table.is-dense th { height: 34px; }
.x-table th:first-child, .x-table td:first-child { padding-left: 16px; }
.x-table th:last-child, .x-table td:last-child { padding-right: 16px; }
.x-table .is-right { text-align: right; }
.x-table .is-center { text-align: center; }
.x-table .is-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.x-table .is-nowrap { white-space: nowrap; }
.x-table .is-muted { color: var(--ink-2); }
.x-table .is-sel { width: 40px; padding-right: 0; }
.x-table tbody tr.is-clickable { cursor: pointer; }
.x-table tbody tr:hover td { background: var(--surface-hover); }
.x-table tbody tr.is-selected td { background: var(--accent-soft); }
.x-table tbody tr.is-dim td { color: var(--ink-3); }
.x-table tbody tr.is-dim td .x-money { color: var(--ink-3); }
.x-table tbody tr:focus-visible { outline: none; }
.x-table tbody tr:focus-visible td { background: var(--surface-active); box-shadow: inset 0 1px 0 var(--accent-line), inset 0 -1px 0 var(--accent-line); }
.x-table tbody tr:focus-visible td:first-child { box-shadow: inset 2px 0 0 var(--accent), inset 0 1px 0 var(--accent-line), inset 0 -1px 0 var(--accent-line); }
.x-table tfoot td {
  height: 42px; padding: 6px 12px; font-weight: 600; background: var(--surface-2); border-top: 1px solid var(--line-2);
  font-variant-numeric: tabular-nums;
}
.x-table tfoot td:first-child { border-bottom-left-radius: var(--r-lg); padding-left: 16px; }
.x-table tfoot td:last-child { border-bottom-right-radius: var(--r-lg); padding-right: 16px; }
.x-table.has-foot tbody tr:last-child td { border-bottom: 0; border-radius: 0; }
.x-th-sort { display: inline-flex; align-items: center; gap: 4px; color: inherit; font: inherit; height: 100%; border-radius: 4px; }
.x-th-sort:hover { color: var(--ink); }
.x-th-sort .x-icon { width: 13px; height: 13px; opacity: 0; transition: opacity var(--dur-1) ease; }
.x-th-sort:hover .x-icon { opacity: .6; }
.x-th-sort.is-sorted { color: var(--ink); }
.x-th-sort.is-sorted .x-icon { opacity: 1; color: var(--accent); }
.is-right .x-th-sort { flex-direction: row-reverse; }
.x-table__loading td { height: 46px; }
.x-table__empty td { padding: 0 !important; }
.x-table__more { display: flex; justify-content: center; padding: 10px; border-top: 1px solid var(--line); }
.x-cell-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.x-cell-title { font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.x-cell-sub { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.x-cell-stack { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.x-row-actions { display: flex; justify-content: flex-end; gap: 2px; opacity: .55; transition: opacity var(--dur-1) ease; }
.x-table tbody tr:hover .x-row-actions, .x-table tbody tr:focus-within .x-row-actions { opacity: 1; }
@media (hover: none) { .x-row-actions { opacity: 1; } }

/* Table → cards (mobile) */
.x-tcards { display: flex; flex-direction: column; gap: 8px; }
.x-tcard {
  position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; min-height: 56px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  transition: border-color var(--dur-1) ease, background var(--dur-1) ease;
}
.x-tcard.is-clickable { cursor: pointer; }
.x-tcard.is-clickable:active { background: var(--surface-2); }
.x-tcard.is-selected { border-color: var(--accent-line); background: var(--accent-soft); }
.x-tcard.is-dim { opacity: .7; }
.x-tcard__sel { padding-top: 2px; }
.x-tcard__body { flex: 1; min-width: 0; }
.x-tcard__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.x-tcard__title { font-weight: 500; min-width: 0; flex: 1; overflow: hidden; }
.x-tcard__value { flex-shrink: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.x-tcard__bottom { display: flex; align-items: flex-end; gap: 8px; margin-top: 6px; }
.x-tcard__meta { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 12.5px; color: var(--ink-3); }
.x-tcard__meta-item { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.x-tcard__meta-label { color: var(--ink-3); }
.x-tcard__meta-label::after { content: ':'; }
.x-tcard__actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; margin: -6px -8px -6px 0; }
.x-tcards__foot { display: flex; justify-content: space-between; padding: 12px 14px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); font-weight: 600; font-variant-numeric: tabular-nums; }
.x-tcards__sort { display: flex; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 4px; }

/* Bulk action bar */
.x-bulkbar {
  position: fixed; z-index: var(--z-bulk); left: calc(50% + var(--sidebar-w) / 2); bottom: 24px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px; padding: 7px 7px 7px 14px; width: max-content; max-width: calc(100vw - var(--sidebar-w) - 32px);
  background: var(--popover); border-radius: 14px; box-shadow: var(--shadow-pop);
}
html[data-sidebar-collapsed] .x-bulkbar { left: calc(50% + var(--sidebar-w-collapsed) / 2); max-width: calc(100vw - var(--sidebar-w-collapsed) - 32px); }
.x-bulkbar__count { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px; white-space: nowrap; padding-right: 8px; margin-right: 2px; border-right: 1px solid var(--line-2); }
.x-bulkbar__count .x-badge { min-width: 24px; }
.x-bulkbar__actions { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.x-bulkbar__close { flex-shrink: 0; } /* outside the actions strip: never scrolled away on phones */
@media (max-width: 899.98px) {
  .x-bulkbar, html[data-sidebar-collapsed] .x-bulkbar {
    left: 10px; right: 10px; transform: none; width: auto; max-width: none; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 10px);
    padding: 8px 8px 8px 12px;
  }
  /* one row: actions scroll horizontally instead of wrapping into a tall block */
  .x-bulkbar__actions { flex: 1; min-width: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; justify-content: flex-start; }
  .x-bulkbar__actions::-webkit-scrollbar { display: none; }
  .x-bulkbar__actions > * { flex-shrink: 0; }
  .x-bulkbar__actions.is-scroll:not(.is-end) {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
            mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
  }
}

/* Pagination */
.x-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 2px 0; font-size: 13px; color: var(--ink-2); flex-wrap: wrap; }
.x-pager__info { font-variant-numeric: tabular-nums; }
.x-pager__nav { display: flex; align-items: center; gap: 4px; }
.x-pager__page { min-width: 30px; height: 30px; padding: 0 8px; border-radius: 7px; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.x-pager__page:hover { background: var(--surface-hover); color: var(--ink); }
.x-pager__page.is-active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.x-pager__gap { color: var(--ink-3); padding: 0 4px; }

/* Overlay base (modal / drawer / palette / sheet) */
.x-overlay {
  position: fixed; inset: 0; z-index: var(--z-modal); background: var(--overlay);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}

/* Modal */
.x-modal-layer { position: fixed; inset: 0; z-index: var(--z-modal); display: grid; place-items: center; padding: 24px; overflow-y: auto; }
/* confirm dialogs (opened from popovers / menus) sit above them */
.x-modal-root--top .x-overlay, .x-modal-root--top .x-modal-layer { z-index: var(--z-confirm); }
.x-modal {
  position: relative; width: min(var(--w, 520px), 100%); max-height: calc(100dvh - 48px); display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); outline: none;
}
.x-modal__head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 10px; }
.x-modal__titles { flex: 1; min-width: 0; }
.x-modal__title { font: 600 17px/1.3 var(--font-display); letter-spacing: -.015em; }
.x-modal__sub { margin-top: 4px; color: var(--ink-2); font-size: 13.5px; }
.x-modal__close { margin: -4px -6px 0 0; }
.x-modal__body { padding: 10px 20px 20px; overflow-y: auto; overscroll-behavior: contain; flex: 1; min-height: 0; }
.x-modal__foot { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.x-modal__foot .grow { flex: 1; }
.x-modal__grab { display: none; }
.x-modal__icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; background: var(--accent-soft); color: var(--accent); }
.x-modal__icon.is-danger { background: var(--danger-soft); color: var(--danger); }
.x-modal__icon .x-icon { width: 20px; height: 20px; }
@media (max-width: 899.98px) {
  /* minmax(0, 1fr): a long nowrap/.truncate line inside the sheet must not widen it past the screen */
  .x-modal-layer { place-items: end stretch; padding: 0; padding-top: calc(var(--safe-top) + 24px); grid-template-columns: minmax(0, 1fr); }
  .x-modal { width: 100%; max-height: calc(100dvh - var(--safe-top) - 24px); border-radius: 20px 20px 0 0; }
  .x-modal__grab { display: block; width: 36px; height: 4px; border-radius: 2px; background: var(--line-3); margin: 8px auto 0; flex-shrink: 0; }
  .x-modal__head { padding: 12px 16px 8px; }
  .x-modal__body { padding: 8px 16px 16px; }
  .x-modal__foot { padding: 12px 16px calc(12px + var(--safe-bottom)); }
  .x-modal__body:last-child { padding-bottom: calc(16px + var(--safe-bottom)); } /* no footer → body is last */
  .x-modal__foot > .x-btn { flex: 1 1 auto; }
  .x-modal.is-full { height: calc(100dvh - var(--safe-top) - 24px); }
}

/* Drawer */
.x-drawer-layer { position: fixed; inset: 0; z-index: var(--z-drawer); pointer-events: none; }
.x-drawer-layer > * { pointer-events: auto; }
.x-drawer-layer .x-overlay { z-index: 0; }
.x-drawer {
  position: absolute; top: 0; right: 0; bottom: 0; z-index: 1; width: min(var(--w, 720px), 100vw);
  display: flex; flex-direction: column; background: var(--surface); outline: none;
  border-left: 1px solid var(--line-2); box-shadow: -24px 0 60px -20px rgba(0, 0, 0, .55);
}
:root[data-theme="light"] .x-drawer { box-shadow: -24px 0 60px -24px rgba(22, 21, 29, .25); }
.x-drawer__head { display: flex; align-items: flex-start; gap: 12px; padding: 16px 20px 14px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.x-drawer__head.has-tabs { border-bottom: 0; padding-bottom: 6px; }
.x-drawer__lead { flex-shrink: 0; padding-top: 2px; }
.x-drawer__titles { flex: 1; min-width: 0; }
.x-drawer__title { font: 600 18px/1.25 var(--font-display); letter-spacing: -.02em; overflow-wrap: anywhere; }
.x-drawer__sub { margin-top: 4px; color: var(--ink-2); font-size: 13px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.x-drawer__actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.x-drawer__tabs { padding: 0 20px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.x-drawer__tabs .x-tabs { border-bottom: 0; margin-bottom: 0; margin-left: -12px; }
.x-drawer__body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 20px; }
.x-drawer__body.is-flush { padding: 0; }
.x-drawer__foot { display: flex; align-items: center; gap: 8px; padding: 12px 20px calc(12px + var(--safe-bottom)); border-top: 1px solid var(--line); flex-shrink: 0; background: var(--surface); flex-wrap: wrap; }
.x-drawer__foot .grow { flex: 1; }
.x-drawer__section + .x-drawer__section { margin-top: 24px; }
.x-drawer__section-title { font: 600 12px/1 var(--font-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
@media (max-width: 899.98px) {
  .x-drawer { width: 100vw; border-left: 0; top: 0; box-shadow: none; }
  .x-drawer__head { padding: calc(12px + var(--safe-top)) 16px 12px; }
  .x-drawer__tabs { padding: 0 16px; }
  .x-drawer__body { padding: 16px; padding-bottom: calc(16px + var(--safe-bottom)); }
  .x-drawer__foot { padding: 10px 16px calc(10px + var(--safe-bottom)); }
  .x-drawer__foot > .x-btn { flex: 1 1 auto; }
}

/* Toasts */
.x-toasts {
  position: fixed; z-index: var(--z-toast); right: 20px; bottom: 20px; width: min(400px, calc(100vw - 24px));
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.x-toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 11px 10px 11px 13px;
  background: var(--popover); border-radius: 12px; box-shadow: var(--shadow-pop); font-size: 13.5px; line-height: 1.45;
}
.x-toast__icon { width: 18px; height: 18px; margin-top: 1px; flex-shrink: 0; }
.x-toast--success .x-toast__icon { color: var(--ok); }
.x-toast--error .x-toast__icon { color: var(--danger); }
.x-toast--warn .x-toast__icon { color: var(--warn); }
.x-toast--info .x-toast__icon { color: var(--info); }
.x-toast__body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.x-toast__title { font-weight: 600; }
.x-toast__count { margin-left: 6px; }
.x-toast__action { margin-top: 1px; }
.x-toast__close { width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; color: var(--ink-3); flex-shrink: 0; }
.x-toast__close:hover { background: var(--surface-hover); color: var(--ink); }
.x-toast__close .x-icon { width: 14px; height: 14px; }
@media (max-width: 899.98px) {
  .x-toasts { left: 12px; right: 12px; width: auto; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 10px); }
  .hq-app--blank .x-toasts, .x-toasts.is-blank { bottom: calc(var(--safe-bottom) + 12px); }
}
@media (min-width: 900px) {
  /* A modal/drawer/palette is open (overlay.js lockScroll) → top-centre over the dialog title area: bottom-right would
     cover the footer's primary button ("Spremi"); top-right would cover the close buttons. Newest toast on top. */
  html.is-scroll-locked .x-toasts {
    top: 16px; bottom: auto; right: auto; left: 50%; transform: translateX(-50%); flex-direction: column-reverse;
  }
  html.is-scroll-locked .x-toast-enter-from { transform: translateY(-10px) scale(.98); }
}

/* File drop */
.x-drop {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  padding: 26px 20px; border: 1.5px dashed var(--line-3); border-radius: var(--r-lg); background: var(--surface-2); cursor: pointer;
  transition: border-color var(--dur-1) ease, background var(--dur-1) ease;
}
.x-drop:hover { border-color: var(--ink-3); }
.x-drop:focus-visible { outline: none; box-shadow: var(--ring); border-color: var(--accent); }
.x-drop.is-over { border-color: var(--accent); background: var(--accent-soft); }
.x-drop.is-disabled { opacity: .5; pointer-events: none; }
.x-drop--compact { padding: 14px; flex-direction: row; gap: 12px; text-align: left; }
.x-drop__icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 4px; flex-shrink: 0; }
.x-drop--compact .x-drop__icon { margin: 0; }
.x-drop__title { font-weight: 500; }
.x-drop__title u { color: var(--accent-text); text-decoration: none; }
.x-drop__hint { font-size: 12px; color: var(--ink-3); }
.x-drop input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.x-files { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.x-file { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 10px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; }
.x-file__icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--neutral-soft); color: var(--ink-2); flex-shrink: 0; }
.x-file__icon .x-icon { width: 16px; height: 16px; }
.x-file__main { flex: 1; min-width: 0; }
.x-file__name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.x-file__meta { font-size: 12px; color: var(--ink-3); }
.x-file.is-error { border-color: var(--danger-line); }
.x-file.is-error .x-file__meta { color: var(--danger); }

/* Comments */
.x-comments { display: flex; flex-direction: column; gap: 14px; }
.x-comments__list { display: flex; flex-direction: column; gap: 14px; }
.x-cmt { display: flex; gap: 10px; align-items: flex-start; }
.x-cmt__main { flex: 1; min-width: 0; }
.x-cmt__meta { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.x-cmt__author { font-weight: 600; font-size: 13px; }
.x-cmt__time { font-size: 12px; color: var(--ink-3); }
.x-cmt__edited { font-size: 11.5px; color: var(--ink-3); font-style: italic; }
.x-cmt__ctx { font-size: 11.5px; }
.x-cmt__bubble {
  position: relative; padding: 9px 12px; border-radius: 4px 12px 12px 12px; background: var(--surface-2); border: 1px solid var(--line);
  font-size: 13.5px; line-height: 1.55; overflow-wrap: anywhere; white-space: normal;
}
.x-cmt.is-own .x-cmt__bubble { background: var(--accent-soft); border-color: var(--accent-line); }
.x-cmt.is-new .x-cmt__bubble { box-shadow: 0 0 0 1px var(--accent-line); }
.x-cmt.is-deleted .x-cmt__bubble { color: var(--ink-3); font-style: italic; background: transparent; border-style: dashed; }
.x-cmt__bubble a { word-break: break-all; }
.x-cmt__tools { opacity: 0; transition: opacity var(--dur-1) ease; margin-left: auto; }
.x-cmt:hover .x-cmt__tools, .x-cmt:focus-within .x-cmt__tools { opacity: 1; }
@media (hover: none) { .x-cmt__tools { opacity: 1; } }
.x-cmt-sep { display: flex; align-items: center; gap: 10px; color: var(--accent-text); font: 600 11px/1 var(--font-ui); letter-spacing: .06em; text-transform: uppercase; }
.x-cmt-sep::before, .x-cmt-sep::after { content: ''; flex: 1; height: 1px; background: var(--accent-line); }
.x-composer { display: flex; flex-direction: column; gap: 8px; }
.x-composer__row { display: flex; align-items: flex-end; gap: 8px; }
.x-composer__hint { font-size: 11.5px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; justify-content: space-between; flex-wrap: wrap; }
.x-composer .x-control--textarea .x-control__input { min-height: 42px; max-height: 220px; }

/* Chart */
.x-chart { position: relative; width: 100%; height: var(--h, 260px); min-width: 0; }
.x-chart canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }
.x-chart__state { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-3); font-size: 13px; }
.x-chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--ink-2); }
.x-chart-legend__item { display: inline-flex; align-items: center; gap: 7px; }
.x-chart-legend__swatch { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }

/* Sparkline */
.x-spark { display: block; overflow: visible; }

/* Search input */
.x-search { position: relative; min-width: 0; }

/* Menu trigger wrapper */
.x-menu { position: relative; display: inline-flex; }

/* Command palette */
.x-palette-layer { position: fixed; inset: 0; z-index: var(--z-palette); display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; }
.x-palette {
  position: relative; width: min(640px, 100%); max-height: 72vh; display: flex; flex-direction: column; overflow: hidden;
  background: var(--popover); border-radius: 16px; box-shadow: var(--shadow-pop);
}
.x-palette__input { display: flex; align-items: center; gap: 12px; padding: 0 16px; height: 56px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.x-palette__input .x-icon { color: var(--ink-3); width: 19px; height: 19px; }
.x-palette__input input { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: transparent; font-size: 16px; color: var(--ink); }
.x-palette__input input::placeholder { color: var(--ink-3); }
.x-palette__list { overflow-y: auto; padding: 6px; overscroll-behavior: contain; flex: 1; min-height: 0; }
.x-palette__item { min-height: 42px; gap: 12px; }
.x-palette__item .x-palette__item-icon { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--neutral-soft); flex-shrink: 0; }
.x-palette__item.is-active .x-palette__item-icon { background: var(--accent-soft); color: var(--accent); }
.x-palette__item.is-active .x-palette__item-icon .x-icon { color: var(--accent); }
.x-palette__type { font-size: 11.5px; color: var(--ink-3); margin-left: auto; white-space: nowrap; }
.x-palette__foot { display: flex; align-items: center; gap: 14px; padding: 9px 16px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 12px; flex-shrink: 0; }
.x-palette__foot span { display: inline-flex; align-items: center; gap: 5px; }
@media (max-width: 899.98px) {
  .x-palette-layer { padding: 0; }
  .x-palette { width: 100%; max-height: none; height: 100dvh; border-radius: 0; padding-top: var(--safe-top); }
  .x-palette__foot { display: none; }
}

/* Notifications panel */
.hq-notif { width: min(400px, calc(100vw - 16px)); padding: 0; }
.hq-notif__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--popover); z-index: 1; }
.hq-notif__title { font: 600 14px/1 var(--font-display); }
.hq-notif__list { padding: 6px; }
.hq-notif__item { display: flex; gap: 11px; align-items: flex-start; padding: 10px; border-radius: 9px; color: var(--ink); text-decoration: none !important; }
.hq-notif__item:hover, .hq-notif__item.is-active { background: var(--surface-hover); }
.hq-notif__main { flex: 1; min-width: 0; }
.hq-notif__label { font-weight: 500; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hq-notif__meta { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.hq-notif__empty { padding: 28px 16px; text-align: center; color: var(--ink-3); font-size: 13px; }
.hq-notif__empty .x-icon { display: block; width: 28px; height: 28px; margin: 0 auto 8px; color: var(--ok); }

/* Definition list (details in drawers) */
.x-dl { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: 10px 16px; font-size: 13.5px; }
.x-dl dt { color: var(--ink-3); }
.x-dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.x-dl dd.num, .x-dl dd.nowrap { white-space: nowrap; overflow-wrap: normal; }
@media (max-width: 599.98px) { .x-dl { grid-template-columns: minmax(0, 1fr); gap: 2px; } .x-dl dd { margin-bottom: 10px; } }

/* Callout / inline alert */
.x-alert { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: var(--r); font-size: 13.5px; background: var(--info-soft); border: 1px solid var(--info-line); }
.x-alert > .x-icon { color: var(--info); margin-top: 1px; width: 17px; height: 17px; }
.x-alert--warn { background: var(--warn-soft); border-color: var(--warn-line); } .x-alert--warn > .x-icon { color: var(--warn); }
.x-alert--danger { background: var(--danger-soft); border-color: var(--danger-line); } .x-alert--danger > .x-icon { color: var(--danger); }
.x-alert--ok { background: var(--ok-soft); border-color: var(--ok-line); } .x-alert--ok > .x-icon { color: var(--ok); }
.x-alert--accent { background: var(--accent-soft); border-color: var(--accent-line); } .x-alert--accent > .x-icon { color: var(--accent); }
.x-alert__body { flex: 1; min-width: 0; }
.x-alert__title { font-weight: 600; margin-bottom: 2px; }

/* 7 ─────────────────────────── Pages ─────────────────────────── */

/* Login */
.hq-login {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(24px + var(--safe-top)) 16px calc(24px + var(--safe-bottom));
  background:
    radial-gradient(1100px 700px at 12% -12%, rgba(4, 20, 58, .95), transparent 62%),
    radial-gradient(900px 520px at 100% 0%, rgba(130, 74, 66, .22), transparent 60%),
    var(--bg);
}
:root[data-theme="light"] .hq-login {
  background:
    radial-gradient(1100px 700px at 10% -15%, rgba(58, 93, 168, .16), transparent 62%),
    radial-gradient(900px 520px at 100% 0%, rgba(217, 142, 95, .14), transparent 60%),
    linear-gradient(180deg, #f4f4f7, #e9e9ed);
}
.hq-login__stars {
  position: absolute; inset: -40% -10% 0; z-index: -3; pointer-events: none;
  background-image: var(--stars-a), var(--stars-b), var(--stars-a);
  background-size: 540px 380px, 310px 270px, 900px 700px; opacity: .75;
  animation: stars-drift 240s linear infinite;
}
:root[data-theme="light"] .hq-login__stars { opacity: .35; }
@keyframes stars-drift { to { transform: translate3d(-80px, 40px, 0); } }
.hq-login__planet {
  position: absolute; z-index: -2; left: 50%; bottom: 0; width: max(1700px, 140vw); aspect-ratio: 1; transform: translate(-50%, 85%);
  border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 50% 0%, #7a3d27 0%, #4a2216 5%, #1f0f0c 12%, #0c0709 26%);
  box-shadow: 0 -24px 90px rgba(217, 142, 95, .22), 0 -80px 220px rgba(164, 96, 84, .16),
    inset 0 2px 0 rgba(255, 196, 158, .55), inset 0 22px 50px -12px rgba(217, 142, 95, .4);
}
:root[data-theme="light"] .hq-login__planet {
  background: radial-gradient(circle at 50% 0%, #f1c9ab 0%, #ead2c2 7%, #ebe3de 16%, #ececf0 30%);
  box-shadow: 0 -24px 90px rgba(217, 142, 95, .22), inset 0 2px 0 rgba(255, 255, 255, .95), inset 0 22px 50px -12px rgba(217, 142, 95, .35);
}
.hq-login__grain { position: absolute; inset: 0; z-index: -1; pointer-events: none; background-image: var(--grain); opacity: .045; mix-blend-mode: overlay; }
.hq-login__orbit {
  position: absolute; z-index: -2; left: 50%; top: 50%; width: 760px; height: 760px; transform: translate(-50%, -54%);
  border-radius: 50%; border: 1px solid rgba(237, 232, 224, .05); pointer-events: none;
}
.hq-login__orbit::after {
  content: ''; position: absolute; top: 50%; left: -3px; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 12px var(--accent); animation: orbit 60s linear infinite; transform-origin: 383px 0;
}
:root[data-theme="light"] .hq-login__orbit { border-color: rgba(22, 21, 29, .06); }
@keyframes orbit { to { transform: rotate(360deg); } }
.hq-login__card {
  position: relative; width: min(408px, 100%); padding: 34px 32px 28px;
  background: rgba(12, 12, 22, .62); border: 1px solid rgba(237, 232, 224, .1); border-radius: 22px;
  -webkit-backdrop-filter: blur(22px) saturate(150%); backdrop-filter: blur(22px) saturate(150%);
  box-shadow: 0 40px 100px -30px rgba(0, 0, 0, .85), inset 0 1px 0 rgba(255, 255, 255, .05);
  animation: login-in .5s var(--ease) both;
}
:root[data-theme="light"] .hq-login__card { background: rgba(255, 255, 255, .78); border-color: rgba(22, 21, 29, .08); box-shadow: 0 30px 80px -30px rgba(22, 21, 29, .35); }
@keyframes login-in { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }
.hq-login__brand { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 26px; }
.hq-login__offline { margin-bottom: 20px; flex-wrap: wrap; font-size: 13px; }
.hq-login__offline .x-alert__body { flex: 1 1 200px; }
.hq-login__brand img { height: 22px; width: auto; }
.hq-login__badge { font: 600 10.5px/1 var(--font-display); letter-spacing: .32em; text-transform: uppercase; color: var(--ink-3); padding-left: .32em; }
.hq-login__title { font: 600 22px/1.25 var(--font-display); letter-spacing: -.02em; text-align: center; }
.hq-login__sub { color: var(--ink-2); font-size: 13.5px; text-align: center; margin-top: 8px; line-height: 1.5; }
.hq-login__sub strong { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.hq-login__form { display: flex; flex-direction: column; gap: 14px; margin-top: 24px; }
.hq-login__error { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 20px; color: var(--danger); font-size: 13px; text-align: center; }
.hq-login__error .x-icon { width: 15px; height: 15px; }
.hq-login__links { display: flex; justify-content: space-between; gap: 12px; margin-top: 6px; font-size: 13px; flex-wrap: wrap; }
.hq-login__links button { color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; padding: 6px 0; min-height: 32px; }
.hq-login__links button:hover:not(:disabled) { color: var(--ink); }
.hq-login__links button:disabled { color: var(--ink-3); cursor: default; }
.hq-login__links .x-icon { width: 14px; height: 14px; }
.hq-login__foot { margin-top: 22px; color: var(--ink-3); font-size: 12px; text-align: center; position: relative; }
.hq-login__theme { position: absolute; top: calc(14px + var(--safe-top)); right: 14px; }
.hq-login__step { animation: step-in var(--dur-3) var(--ease) both; }
@keyframes step-in { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: none; } }

.hq-pin { display: flex; justify-content: center; gap: 12px; }
.hq-pin__box {
  width: 62px; height: 70px; border-radius: 14px; text-align: center; padding: 0;
  font: 600 30px/1 var(--font-display); font-variant-numeric: tabular-nums; color: var(--ink);
  background: var(--input-bg); border: 1px solid var(--input-border); caret-color: var(--accent); outline: none;
  transition: border-color var(--dur-1) ease, box-shadow var(--dur-1) ease, background var(--dur-1) ease, transform var(--dur-2) var(--ease);
  -webkit-text-security: none;
}
:root[data-theme="light"] .hq-pin__box { background: #fff; }
.hq-pin__box:hover { border-color: var(--input-border-hover); }
.hq-pin__box:focus { border-color: var(--accent); box-shadow: var(--ring); background: var(--input-bg-focus); }
.hq-pin__box.is-filled { border-color: var(--line-3); }
.hq-pin.is-error .hq-pin__box { border-color: var(--danger); box-shadow: var(--ring-danger); }
.hq-pin.is-shake { animation: shake .42s cubic-bezier(.36, .07, .19, .97) both; }
.hq-pin.is-busy .hq-pin__box { opacity: .6; }
.hq-pin.is-success .hq-pin__box { border-color: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
@keyframes shake { 10%, 90% { transform: translateX(-1px); } 20%, 80% { transform: translateX(3px); } 30%, 50%, 70% { transform: translateX(-6px); } 40%, 60% { transform: translateX(6px); } }
@media (max-width: 380px) { .hq-pin { gap: 9px; } .hq-pin__box { width: 54px; height: 62px; font-size: 26px; } .hq-login__card { padding: 28px 20px 22px; } }

/* Placeholder ("U izradi") */
.hq-placeholder { display: grid; place-items: center; min-height: calc(100dvh - var(--topbar-h) - 160px); }
.hq-placeholder .x-empty { width: 100%; max-width: 720px; padding: 72px 24px; }
.hq-placeholder__chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 18px; position: relative; z-index: 1; }

/* Profile */
.hq-profile { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.hq-profile__hero { display: flex; align-items: center; gap: 16px; }
.hq-profile__name { font: 600 20px/1.2 var(--font-display); letter-spacing: -.02em; }
.hq-profile__email { color: var(--ink-2); font-size: 13.5px; margin-top: 3px; overflow-wrap: anywhere; }
.hq-profile__row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.hq-profile__row:last-child { border-bottom: 0; padding-bottom: 0; }
.hq-profile__row:first-child { padding-top: 0; }
.hq-profile__rowtext { min-width: 0; flex: 1 1 180px; }
.hq-profile__row > :not(.hq-profile__rowtext) { flex-shrink: 0; }
.hq-profile__rowtitle { font-weight: 500; }
.hq-profile__rowdesc { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
@media (max-width: 899.98px) { .hq-profile { grid-template-columns: minmax(0, 1fr); } .hq-profile__row { flex-wrap: wrap; } }

/* Styleguide */
.hq-sg { display: flex; flex-direction: column; gap: 18px; }
.hq-sg__nav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.hq-sg__nav a { font-size: 12.5px; padding: 5px 10px; border-radius: var(--r-pill); background: var(--neutral-soft); color: var(--ink-2); }
.hq-sg__nav a:hover { color: var(--ink); text-decoration: none; background: var(--surface-active); }
.hq-sg__section { scroll-margin-top: calc(var(--topbar-h) + 16px); }
.hq-sg__row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.hq-sg__row + .hq-sg__row { margin-top: 14px; }
.hq-sg__label { font-size: 11.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; margin: 18px 0 8px; }
.hq-sg__label:first-child { margin-top: 0; }
.hq-sg__swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.hq-sg__swatch { border-radius: var(--r); border: 1px solid var(--line); overflow: hidden; font-size: 12px; background: var(--surface); }
.hq-sg__swatch div:first-child { height: 52px; }
.hq-sg__swatch div:last-child { padding: 7px 9px; color: var(--ink-2); font-family: var(--font-mono); font-size: 11px; }
.hq-sg__type > * + * { margin-top: 10px; }

/* 8 ─────────────────────────── Utilities ─────────────────────────── */
.row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.row-wrap { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.stack-lg { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
.grow { flex: 1 1 auto; min-width: 0; }
.shrink-0 { flex-shrink: 0; }
.min-w-0 { min-width: 0; }
.w-full { width: 100%; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-6 { gap: 24px; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; } .mt-8 { margin-top: 32px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.ml-auto { margin-left: auto; }
.p-0 { padding: 0 !important; }
.text-xs { font-size: 11.5px; } .text-sm { font-size: 12.5px; } .text-md { font-size: 14px; } .text-lg { font-size: 16px; } .text-xl { font-size: 20px; }
.fw-400 { font-weight: 400; } .fw-500 { font-weight: 500; } .fw-600 { font-weight: 600; }
.text-ink { color: var(--ink); } .text-dim { color: var(--ink-2); } .text-faint { color: var(--ink-3); }
.text-accent { color: var(--accent-text); } .text-ok { color: var(--ok); } .text-warn { color: var(--warn); } .text-danger { color: var(--danger); } .text-info { color: var(--info); }
.text-right { text-align: right; } .text-center { text-align: center; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.nowrap { white-space: nowrap; }
.break { overflow-wrap: anywhere; }
.upper { text-transform: uppercase; letter-spacing: .06em; }
.mono { font-family: var(--font-mono); font-size: .92em; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.box { padding: 12px 14px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.hide-mobile { }
.show-mobile { display: none !important; }
@media (max-width: 899.98px) { .hide-mobile { display: none !important; } .show-mobile { display: revert !important; } }
.icon-sm { width: 14px !important; height: 14px !important; }
.icon-lg { width: 22px !important; height: 22px !important; }

/* 9 ─────────────────────────── Motion ─────────────────────────── */
.x-fade-enter-active, .x-fade-leave-active { transition: opacity var(--dur-2) ease; }
.x-fade-enter-from, .x-fade-leave-to { opacity: 0; }

.x-modal-enter-active, .x-modal-leave-active { transition: opacity var(--dur-3) var(--ease); }
.x-modal-enter-active .x-modal, .x-modal-leave-active .x-modal { transition: transform var(--dur-3) var(--ease), opacity var(--dur-3) var(--ease); }
.x-modal-enter-from, .x-modal-leave-to { opacity: 0; }
.x-modal-enter-from .x-modal, .x-modal-leave-to .x-modal { transform: translateY(8px) scale(.985); opacity: 0; }
@media (max-width: 899.98px) { .x-modal-enter-from .x-modal, .x-modal-leave-to .x-modal { transform: translateY(40%); opacity: 1; } }

.x-drawer-enter-active, .x-drawer-leave-active { transition: opacity var(--dur-3) var(--ease); }
.x-drawer-enter-active .x-drawer, .x-drawer-leave-active .x-drawer { transition: transform var(--dur-3) var(--ease); }
.x-drawer-leave-active .x-drawer { transition-duration: var(--dur-2); }
.x-drawer-enter-from .x-overlay, .x-drawer-leave-to .x-overlay { opacity: 0; }
.x-drawer-enter-active .x-overlay, .x-drawer-leave-active .x-overlay { transition: opacity var(--dur-3) var(--ease); }
.x-drawer-enter-from .x-drawer, .x-drawer-leave-to .x-drawer { transform: translateX(100%); }
@media (max-width: 899.98px) { .x-drawer-enter-from .x-drawer, .x-drawer-leave-to .x-drawer { transform: translateY(100%); } }

.x-toast-enter-active { transition: transform var(--dur-3) var(--ease), opacity var(--dur-3) var(--ease); }
.x-toast-leave-active { transition: transform var(--dur-2) ease, opacity var(--dur-2) ease; }
.x-toast-enter-from { opacity: 0; transform: translateY(10px) scale(.98); }
.x-toast-leave-to { opacity: 0; transform: translateX(16px); }
.x-toast-move { transition: transform var(--dur-3) var(--ease); }

.x-bulk-enter-active, .x-bulk-leave-active { transition: transform var(--dur-3) var(--ease), opacity var(--dur-3) var(--ease); }
.x-bulk-enter-from, .x-bulk-leave-to { opacity: 0; transform: translate(-50%, 16px); }
@media (max-width: 899.98px) { .x-bulk-enter-from, .x-bulk-leave-to { transform: translateY(16px); } }

.x-pop-leave-active { transition: opacity var(--dur-1) ease; }
.x-pop-leave-to { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .hq-login__stars, .hq-login__orbit::after { animation: none !important; }
}

@media print {
  .hq-sidebar, .hq-topbar, .hq-tabbar, .x-bulkbar, .x-toasts, .hq-devbar { display: none !important; }
  .hq-main { margin: 0 !important; }
  body { background: #fff; color: #000; }
}
