/* Računi – pastelni dizajn */
:root {
  --bg: #f6f4fb;
  --surface: #ffffff;
  --surface-2: #faf9fe;
  --line: #e8e4f3;
  --text: #2d2940;
  --muted: #6e6886;
  --primary: #7c65d0;
  --primary-hover: #6d56c4;
  --primary-rgb: 124, 101, 208;
  --accent: #d9cff7;
  --chip-ink: #3e2f86;
  --glow-1: #efe9fd;
  --glow-2: #e3f5ed;
  --primary-ink: #ffffff;
  --primary-soft: #ece6fb;
  --lavender: #d9cff7;
  --mint: #cdeee0;
  --mint-ink: #2f7a5e;
  --peach: #ffe1cf;
  --peach-ink: #a3562a;
  --sky: #d4e9f8;
  --sky-ink: #2e6a93;
  --butter: #fbf0c4;
  --rose: #fbd9e1;
  --rose-ink: #a33a55;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(45, 41, 64, .04), 0 8px 24px rgba(var(--primary-rgb), .08);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --nav-h: 64px;
  --tab-h: 68px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 100% -10%, var(--glow-1) 0%, transparent 60%),
    radial-gradient(900px 500px at -10% 110%, var(--glow-2) 0%, transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

/* ---------- Gumbi in polja ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
  background: var(--primary); color: var(--primary-ink); font-weight: 600; cursor: pointer;
  transition: transform .08s ease, background .2s ease, box-shadow .2s ease;
  box-shadow: 0 4px 14px rgba(var(--primary-rgb), .25);
}
.btn:hover { background: var(--primary-hover); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn.ghost { background: transparent; color: var(--primary); border-color: var(--line); box-shadow: none; }
.btn.ghost:hover { background: var(--primary-soft); }
.btn.soft { background: var(--primary-soft); color: var(--primary); box-shadow: none; }
.btn.block { width: 100%; }
.btn { white-space: nowrap; }
.btn svg { width: 18px; height: 18px; flex: none; }
#app { min-height: 100%; }
.link-btn { background: none; border: 0; padding: 0; color: var(--primary); cursor: pointer; font-weight: 500; }
.link-btn:hover { text-decoration: underline; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface-2);
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.input:focus { outline: none; border-color: var(--primary); background: #fff; box-shadow: 0 0 0 4px var(--primary-soft); }
.input.code { letter-spacing: .4em; text-align: center; font-size: 22px; font-weight: 600; }

.alert { padding: 10px 14px; border-radius: 12px; font-size: 14px; margin-bottom: 14px; }
.alert.error { background: var(--rose); color: var(--rose-ink); }
.alert.ok { background: var(--mint); color: var(--mint-ink); }
.alert.info { background: var(--sky); color: var(--sky-ink); }

/* ---------- Prijava ---------- */
.auth-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card {
  width: 100%; max-width: 400px; background: var(--surface); border-radius: 24px;
  padding: 32px 28px; box-shadow: var(--shadow); border: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.brand img { width: 36px; height: 36px; border-radius: 10px; }
.auth-card h1 { font-size: 22px; margin: 24px 0 6px; }
.auth-card .sub { color: var(--muted); margin: 0 0 22px; font-size: 14px; }
.auth-foot { margin-top: 18px; display: flex; justify-content: space-between; gap: 12px; font-size: 14px; flex-wrap: wrap; }
.qr { display: grid; place-items: center; background: var(--surface-2); border: 1px dashed var(--accent); border-radius: 16px; padding: 16px; margin: 4px 0 16px; }
.qr img { width: 180px; height: 180px; }
.secret { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; word-break: break-all; color: var(--muted); text-align: center; margin-top: 8px; }
.steps { padding-left: 18px; color: var(--muted); font-size: 14px; margin: 0 0 16px; }

.demo-ribbon {
  background: var(--butter); color: #7a6213; font-size: 12px; font-weight: 600;
  text-align: center; padding: 5px 12px;
}

/* ---------- Lupina aplikacije ---------- */
.app { min-height: 100%; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--nav-h);
  display: flex; align-items: center; gap: 16px; padding: 0 24px;
  background: rgba(255, 255, 255, .78); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar .company { color: var(--muted); font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tabs { display: flex; gap: 4px; margin-left: 16px; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 12px;
  color: var(--muted); font-weight: 600; font-size: 14px; text-decoration: none !important;
}
.tab:hover { background: var(--surface-2); color: var(--text); }
.tab.active { background: var(--primary-soft); color: var(--primary); }
.tab svg { width: 18px; height: 18px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.icon-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; border-radius: 12px;
  border: 0; background: transparent; color: var(--muted); cursor: pointer; font-weight: 500; font-size: 14px;
  text-decoration: none !important;
}
.icon-btn:hover, .icon-btn.active { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

.main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 28px 24px 48px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; margin: 0; letter-spacing: -.01em; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--chip-ink); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.table-card { overflow: hidden; }
.thead {
  display: grid; gap: 12px; padding: 12px 20px; background: var(--surface-2); border-bottom: 1px solid var(--line);
  font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
}
.empty { padding: 48px 24px; text-align: center; }
.empty .art { width: 132px; height: 104px; margin: 0 auto 14px; display: block; }
.empty h2 { margin: 0 0 6px; font-size: 18px; }
.empty p { margin: 0 auto 18px; color: var(--muted); max-width: 440px; }

.search { position: relative; }
.search input { padding-left: 38px; min-height: 42px; width: 220px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.mint { background: var(--mint); color: var(--mint-ink); }
.badge.peach { background: var(--peach); color: var(--peach-ink); }
.badge.sky { background: var(--sky); color: var(--sky-ink); }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.tile { padding: 20px; }
.tile h3 { margin: 10px 0 4px; font-size: 16px; }
.tile p { margin: 0; color: var(--muted); font-size: 14px; }
.tile .dot { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; }
.tile .dot svg { width: 20px; height: 20px; }
.stat { padding: 18px 20px; }
.stat .k { color: var(--muted); font-size: 13px; font-weight: 600; }
.stat .v { font-size: 26px; font-weight: 700; margin-top: 4px; letter-spacing: -.02em; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0; z-index: 60;
  background: var(--text); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px;
  transition: opacity .2s ease, transform .2s ease; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.fab { display: none; }
.bottom-nav { display: none; }

/* ---------- Telefon ---------- */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .topbar { padding: 0 16px; height: 56px; }
  .tabs, .top-actions .label, .topbar .company { display: none; }
  .auth-wrap { min-height: calc(100dvh - 28px); }
  .main { padding: 18px 14px calc(var(--tab-h) + 96px + env(safe-area-inset-bottom)); }
  .page-head h1 { font-size: 22px; }
  .page-head .btn.primary-action { display: none; }
  .search input { width: 100%; }
  .search { flex: 1; }
  .toolbar { width: 100%; }
  .chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -14px 14px; padding: 0 14px; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { white-space: nowrap; }
  .thead { display: none; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: rgba(255, 255, 255, .92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
  }
  .bottom-nav a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none;
  }
  .bottom-nav a svg { width: 22px; height: 22px; padding: 4px 14px; box-sizing: content-box; border-radius: 999px; }
  .bottom-nav a.active { color: var(--primary); }
  .bottom-nav a.active svg { background: var(--primary-soft); }
  .fab {
    display: inline-flex; position: fixed; right: 18px; z-index: 31;
    bottom: calc(var(--tab-h) + 16px + env(safe-area-inset-bottom));
    height: 56px; padding: 0 20px; border-radius: 18px; gap: 8px; align-items: center;
    background: var(--primary); color: #fff; border: 0; font-weight: 700; box-shadow: 0 10px 24px rgba(var(--primary-rgb), .35);
  }
  .fab[disabled] { opacity: .7; }
  .fab svg { width: 20px; height: 20px; }
  .auth-card { padding: 28px 20px; border-radius: 20px; }
}

/* ---------- Barvne teme ---------- */
[data-theme="breskev"] { --bg: #fbf6f2; --primary: #b5552d; --primary-hover: #a04a26; --primary-rgb: 181, 85, 45; --primary-soft: #fde9de; --accent: #ffd3bd; --chip-ink: #7a3417; --glow-1: #ffe6d8; --glow-2: #fdf1d8; }
[data-theme="rozna"] { --bg: #fbf5f7; --primary: #b8476f; --primary-hover: #a23d61; --primary-rgb: 184, 71, 111; --primary-soft: #fbe4ec; --accent: #f6c8d8; --chip-ink: #7d2347; --glow-1: #fde1eb; --glow-2: #ece6fb; }
[data-theme="meta"] { --bg: #f3f8f5; --primary: #2f7d5e; --primary-hover: #276b50; --primary-rgb: 47, 125, 94; --primary-soft: #def2e8; --accent: #c2e8d6; --chip-ink: #1f5a43; --glow-1: #d9f1e5; --glow-2: #eef5dc; }
[data-theme="nebo"] { --bg: #f3f7fb; --primary: #2f6fa6; --primary-hover: #285f8f; --primary-rgb: 47, 111, 166; --primary-soft: #e0edf8; --accent: #c6def3; --chip-ink: #1d4b73; --glow-1: #d9e9f8; --glow-2: #e2f3f0; }
[data-theme="pesek"] { --bg: #f8f5ef; --primary: #8a6a40; --primary-hover: #765a36; --primary-rgb: 138, 106, 64; --primary-soft: #f2eadd; --accent: #e6d6bd; --chip-ink: #5c4425; --glow-1: #f0e5d3; --glow-2: #eaeedf; }
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; margin-top: 14px; }
.theme-btn {
  display: grid; gap: 8px; justify-items: center; padding: 14px 10px; border-radius: 14px;
  border: 2px solid var(--line); background: var(--surface); cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text);
  transition: border-color .2s ease, transform .08s ease;
}
.theme-btn:hover { border-color: var(--accent); }
.theme-btn[aria-pressed="true"] { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.swatch { display: flex; }
.swatch span { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; margin-left: -7px; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.swatch span:first-child { margin-left: 0; }
