/* =========================================================================
   Horizont — Faza 8 PWA stilovi. Tokeni doslovno iz Faze 6 design handoff-a.
   :root = light; [data-theme="dark"] override; prefers-color-scheme default.
   ========================================================================= */

:root {
  color-scheme: light;

  /* Boje — light */
  --bg-canvas: oklch(0.965 0.004 250);
  --bg-surface: oklch(0.99 0.002 250);
  --bg-surface-2: oklch(0.94 0.005 250);
  --text-1: oklch(0.20 0.01 250);
  --text-2: oklch(0.50 0.012 250);
  --text-3: oklch(0.68 0.008 250);
  --border-1: oklch(0.89 0.006 250);
  --border-2: oklch(0.80 0.007 250);
  --brand: oklch(0.50 0.14 250);
  --brand-tint: oklch(0.93 0.03 250);
  --on-brand: oklch(0.99 0.002 250);
  --danger: oklch(0.55 0.17 25);
  --danger-tint: oklch(0.93 0.04 25);
  --success: oklch(0.55 0.14 145);
  --success-tint: oklch(0.92 0.035 145);
  --attention: oklch(0.62 0.13 70);
  --attention-tint: oklch(0.92 0.035 70);

  /* Emoji → boja stuba (light) */
  --pil-blue: oklch(0.55 0.13 250);      --pil-blue-tint: oklch(0.90 0.03 250);
  --pil-green: oklch(0.55 0.13 145);     --pil-green-tint: oklch(0.90 0.03 145);
  --pil-yellow: oklch(0.68 0.13 95);     --pil-yellow-tint: oklch(0.92 0.035 95);
  --pil-orange: oklch(0.60 0.15 55);     --pil-orange-tint: oklch(0.91 0.035 55);
  --pil-purple: oklch(0.53 0.13 305);    --pil-purple-tint: oklch(0.91 0.03 305);
  --pil-red: oklch(0.55 0.16 25);        --pil-red-tint: oklch(0.92 0.035 25);
  --pil-neutral: oklch(0.50 0.01 250);   --pil-neutral-tint: oklch(0.90 0.006 250);

  /* Tipografija */
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Inter Tight", "Inter", system-ui, sans-serif;

  /* Spacing */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px;
  --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px; --sp-16: 64px;

  /* Radius */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 22px; --r-pill: 999px;

  /* Senke */
  --shadow-rgb: 20, 30, 55;
  --sh-sm: 0 1px 2px rgba(var(--shadow-rgb), .07);
  --sh-md: 0 4px 14px rgba(var(--shadow-rgb), .09);
  --sh-lg: 0 16px 40px rgba(var(--shadow-rgb), .16);

  --sidebar-w: 232px;
  --content-max: 1040px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; }
  :root:not([data-theme="light"]) {
    --bg-canvas: oklch(0.16 0.004 250);
    --bg-surface: oklch(0.21 0.006 250);
    --bg-surface-2: oklch(0.26 0.008 250);
    --text-1: oklch(0.94 0.004 250);
    --text-2: oklch(0.66 0.01 250);
    --text-3: oklch(0.48 0.01 250);
    --border-1: oklch(0.30 0.008 250);
    --border-2: oklch(0.38 0.01 250);
    --brand: oklch(0.72 0.14 250);
    --brand-tint: oklch(0.28 0.06 250);
    --on-brand: oklch(0.16 0.004 250);
    --danger: oklch(0.68 0.17 25);
    --danger-tint: oklch(0.30 0.06 25);
    --success: oklch(0.70 0.15 145);
    --success-tint: oklch(0.28 0.055 145);
    --attention: oklch(0.74 0.13 70);
    --attention-tint: oklch(0.30 0.05 70);
    --shadow-rgb: 0, 0, 0;
    --sh-sm: 0 1px 2px rgba(var(--shadow-rgb), .11);
    --sh-md: 0 4px 14px rgba(var(--shadow-rgb), .14);
    --sh-lg: 0 16px 40px rgba(var(--shadow-rgb), .24);

    --pil-blue: oklch(0.72 0.16 250);      --pil-blue-tint: oklch(0.30 0.06 250);
    --pil-green: oklch(0.72 0.16 145);     --pil-green-tint: oklch(0.30 0.06 145);
    --pil-yellow: oklch(0.78 0.14 95);     --pil-yellow-tint: oklch(0.32 0.06 95);
    --pil-orange: oklch(0.72 0.17 55);     --pil-orange-tint: oklch(0.30 0.06 55);
    --pil-purple: oklch(0.72 0.16 305);    --pil-purple-tint: oklch(0.30 0.06 305);
    --pil-red: oklch(0.72 0.17 25);        --pil-red-tint: oklch(0.30 0.06 25);
    --pil-neutral: oklch(0.68 0.01 250);   --pil-neutral-tint: oklch(0.30 0.006 250);
  }
}

/* Ručni toggle — pobeđuje media query u oba smera */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg-canvas: oklch(0.16 0.004 250);
  --bg-surface: oklch(0.21 0.006 250);
  --bg-surface-2: oklch(0.26 0.008 250);
  --text-1: oklch(0.94 0.004 250);
  --text-2: oklch(0.66 0.01 250);
  --text-3: oklch(0.48 0.01 250);
  --border-1: oklch(0.30 0.008 250);
  --border-2: oklch(0.38 0.01 250);
  --brand: oklch(0.72 0.14 250);
  --brand-tint: oklch(0.28 0.06 250);
  --on-brand: oklch(0.16 0.004 250);
  --danger: oklch(0.68 0.17 25);
  --danger-tint: oklch(0.30 0.06 25);
  --success: oklch(0.70 0.15 145);
  --success-tint: oklch(0.28 0.055 145);
  --attention: oklch(0.74 0.13 70);
  --attention-tint: oklch(0.30 0.05 70);
  --shadow-rgb: 0, 0, 0;
  --sh-sm: 0 1px 2px rgba(var(--shadow-rgb), .11);
  --sh-md: 0 4px 14px rgba(var(--shadow-rgb), .14);
  --sh-lg: 0 16px 40px rgba(var(--shadow-rgb), .24);
  --pil-blue: oklch(0.72 0.16 250);      --pil-blue-tint: oklch(0.30 0.06 250);
  --pil-green: oklch(0.72 0.16 145);     --pil-green-tint: oklch(0.30 0.06 145);
  --pil-yellow: oklch(0.78 0.14 95);     --pil-yellow-tint: oklch(0.32 0.06 95);
  --pil-orange: oklch(0.72 0.17 55);     --pil-orange-tint: oklch(0.30 0.06 55);
  --pil-purple: oklch(0.72 0.16 305);    --pil-purple-tint: oklch(0.30 0.06 305);
  --pil-red: oklch(0.72 0.17 25);        --pil-red-tint: oklch(0.30 0.06 25);
  --pil-neutral: oklch(0.68 0.01 250);   --pil-neutral-tint: oklch(0.30 0.006 250);
}

/* ---- Reset / base ------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-1);
  background: var(--bg-canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3 { font-family: var(--font-head); margin: 0; }
h1 { font-size: clamp(26px, 5vw, 34px); line-height: 1.2; font-weight: 800; }
h2 { font-size: clamp(20px, 3.5vw, 24px); line-height: 1.25; font-weight: 700; }
h3 { font-family: var(--font-body); font-size: 15px; line-height: 1.3; font-weight: 600; }
p { margin: 0; }
button { font: inherit; cursor: pointer; }
a { color: var(--brand); }
.num { font-variant-numeric: tabular-nums; font-weight: 600; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- Boot spinner ------------------------------------------------------- */
.app-loading { display: grid; place-items: center; min-height: 100vh; }
.spinner {
  width: 34px; height: 34px; display: inline-block;
  border: 3px solid var(--border-1); border-top-color: var(--brand);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2s; }
  .xp-fill { transition: none; }
  .toast { animation: none; }
  .skel { animation: none; }
  .switch input[type="checkbox"],
  .switch input[type="checkbox"]::after { transition: none; }
}

/* ---- App layout --------------------------------------------------------- */
.app-shell { display: flex; min-height: 100vh; }

.nav {
  background: var(--bg-surface);
  border-color: var(--border-1);
}
/* Desktop sidebar */
.nav-sidebar {
  position: sticky; top: 0; align-self: flex-start;
  width: var(--sidebar-w); height: 100vh; flex: 0 0 var(--sidebar-w);
  border-right: 1px solid var(--border-1);
  padding: var(--sp-5) var(--sp-3);
  display: flex; flex-direction: column; gap: var(--sp-2);
}
.nav-brand {
  font-family: var(--font-head); font-weight: 800; font-size: 20px;
  padding: var(--sp-2) var(--sp-3) var(--sp-4);
  display: flex; align-items: center; gap: var(--sp-2);
}
.nav-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 10px var(--sp-3); border-radius: var(--r-md);
  color: var(--text-2); background: none; border: none; width: 100%;
  text-align: left; min-height: 44px; text-decoration: none; font-weight: 600;
}
.nav-item:hover { background: var(--bg-surface-2); color: var(--text-1); }
.nav-item.active { background: var(--brand-tint); color: var(--brand); }
.nav-item .ico { font-size: 20px; width: 24px; text-align: center; }
.nav-spacer { flex: 1; }

.main {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
}
.content {
  width: 100%; max-width: var(--content-max); margin: 0 auto;
  padding: var(--sp-5) var(--sp-5) var(--sp-16);
  flex: 1;
}

/* Top bar (avatar + theme) */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  background: color-mix(in oklab, var(--bg-canvas) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-1);
}
.topbar .grow { flex: 1; }
.icon-btn {
  display: inline-grid; place-items: center;
  min-width: 44px; min-height: 44px; border-radius: var(--r-pill);
  background: var(--bg-surface); border: 1px solid var(--border-1);
  color: var(--text-1); font-size: 18px;
}
.icon-btn:hover { background: var(--bg-surface-2); }
.avatar {
  min-width: 44px; height: 44px; padding: 0 var(--sp-3);
  border-radius: var(--r-pill); border: 1px solid var(--border-1);
  background: var(--bg-surface); color: var(--text-1);
  display: inline-flex; align-items: center; gap: var(--sp-2); font-weight: 600;
}
.avatar .dot {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--brand-tint); color: var(--brand);
  display: grid; place-items: center; font-weight: 700;
}

/* Account switcher dropdown (desktop/tablet) */
.acct-menu {
  position: absolute; top: calc(100% - var(--sp-2)); right: var(--sp-5);
  z-index: 40; width: min(280px, calc(100vw - 2 * var(--sp-4)));
  background: var(--bg-surface); border: 1px solid var(--border-1);
  border-radius: var(--r-lg); box-shadow: var(--sh-lg);
  padding: var(--sp-3);
}

/* Bottom nav (mobile) */
.nav-bottom {
  position: fixed; inset: auto 0 0 0; z-index: 30;
  display: none; grid-auto-flow: column; grid-auto-columns: 1fr;
  border-top: 1px solid var(--border-1);
  background: color-mix(in oklab, var(--bg-surface) 92%, transparent);
  backdrop-filter: blur(10px);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.nav-bottom .nav-item {
  flex-direction: column; gap: 2px; padding: var(--sp-2) 4px;
  border-radius: 0; font-size: 11px; font-weight: 600; letter-spacing: .02em;
  min-height: 56px; justify-content: center; text-align: center;
}
.nav-bottom .nav-item.active { background: none; color: var(--brand); }
.nav-bottom .ico { font-size: 20px; width: auto; }

/* ---- Account banner ----------------------------------------------------- */
.acct-banner {
  display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
  background: var(--attention-tint); color: var(--text-1);
  border: 1px solid color-mix(in oklab, var(--attention) 40%, transparent);
  border-radius: var(--r-md); padding: 10px var(--sp-4);
  margin-bottom: var(--sp-4); font-size: 14px;
}
.acct-banner .grow { flex: 1; }
.acct-banner strong { font-weight: 700; }

/* ---- Cards / sections --------------------------------------------------- */
.card {
  background: var(--bg-surface); border: 1px solid var(--border-1);
  border-radius: var(--r-lg); padding: var(--sp-4); box-shadow: var(--sh-sm);
}
.section { margin-top: var(--sp-6); }
.section-head {
  display: flex; align-items: center; gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}
.section-head .grow { flex: 1; }
.muted { color: var(--text-2); }
.muted-3 { color: var(--text-3); }
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: var(--sp-3); }
.wrap { flex-wrap: wrap; }

/* ---- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 44px; padding: 0 var(--sp-5); border-radius: var(--r-md);
  border: 1px solid transparent; font-weight: 600; font-size: 15px;
  background: var(--bg-surface-2); color: var(--text-1);
}
.btn:hover { filter: brightness(0.98); }
.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-ghost { background: transparent; border-color: var(--border-1); color: var(--text-1); }
.btn-danger { background: var(--danger); color: var(--on-brand); }
.btn-sm { min-height: 44px; padding: 0 var(--sp-3); font-size: 14px; }
.btn:disabled, .btn[aria-disabled="true"] {
  opacity: .5; cursor: not-allowed; filter: none;
}
.btn-block { width: 100%; }

/* ---- Toggle switch ------------------------------------------------------ */
.switch {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  min-height: 44px; cursor: pointer; flex: 0 0 auto;
}
.switch input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; margin: 0;
  position: relative; flex: 0 0 auto;
  width: 46px; height: 28px; min-width: 46px;
  border-radius: var(--r-pill); border: 1px solid var(--border-2);
  background: var(--bg-surface-2); cursor: pointer;
  transition: background .2s ease, border-color .2s ease;
}
.switch input[type="checkbox"]::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--bg-surface); box-shadow: var(--sh-sm);
  transition: transform .2s ease;
}
.switch input[type="checkbox"]:checked {
  background: var(--brand); border-color: var(--brand);
}
.switch input[type="checkbox"]:checked::after { transform: translateX(18px); }
.switch input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 2px;
}
.switch .switch-label { font-size: 13px; font-weight: 600; color: var(--text-2); }

/* ---- Forms -------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--sp-4); }
/* Dve kolone u formi (npr. Težina + Poeni u istom redu). */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.form-grid-2 .field { margin-bottom: var(--sp-4); }

/* Zvezdice za težinu 1–5 (jedan klik). */
.stars { display: inline-flex; gap: 2px; }
.stars .star {
  min-width: 44px; min-height: 44px; padding: 0;
  border: none; background: none; cursor: pointer;
  font-size: 26px; line-height: 1; color: var(--text-3);
}
.stars .star.on { color: var(--attention); }
.stars .star:hover { color: var(--attention); }
.field label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px var(--sp-3);
  background: var(--bg-surface-2); border: 1px solid var(--border-1);
  border-radius: var(--r-md); color: var(--text-1); font: inherit;
}
.textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus {
  outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand);
}
.input.invalid, .textarea.invalid { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: 13px; font-weight: 500; min-height: 0; }

.form-banner {
  background: var(--danger-tint); color: var(--text-1);
  border: 1px solid color-mix(in oklab, var(--danger) 40%, transparent);
  border-radius: var(--r-md); padding: 10px var(--sp-4); margin-bottom: var(--sp-4);
  font-size: 14px;
}

/* ---- Badges / pills ----------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: var(--r-pill);
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  background: var(--bg-surface-2); color: var(--text-2);
}
.badge-brand { background: var(--brand-tint); color: var(--brand); }
.badge-success { background: var(--success-tint); color: var(--success); }
.badge-danger { background: var(--danger-tint); color: var(--danger); }
.badge-attention { background: var(--attention-tint); color: var(--attention); }

/* ---- Progress ring ------------------------------------------------------ */
.ring {
  --p: 0; --ring-color: var(--pil-neutral);
  width: 64px; height: 64px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; position: relative;
  background: conic-gradient(var(--ring-color) calc(var(--p) * 1%), var(--bg-surface-2) 0);
}
.ring::after {
  content: ""; position: absolute; inset: 7px; border-radius: 50%;
  background: var(--bg-surface);
}
.ring .ring-label {
  position: relative; z-index: 1; font-weight: 700; font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.ring.no-data {
  background: var(--bg-surface);
  border: 2px dashed var(--border-2);
}
.ring.no-data::after { inset: 0; background: none; }
.ring.no-data .ring-label { color: var(--text-3); }
.ring.done .ring-label { color: var(--success); }
.ring-lg { width: 108px; height: 108px; }
.ring-lg::after { inset: 11px; }
.ring-lg .ring-label { font-size: 22px; }

/* ---- Pillar grid -------------------------------------------------------- */
.pillar-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-4); }
.pillar-card {
  display: flex; flex-direction: column; gap: var(--sp-3); align-items: flex-start;
  cursor: pointer; text-align: left; width: 100%;
  background: var(--bg-surface); border: 1px solid var(--border-1);
  border-radius: var(--r-lg); padding: var(--sp-4); box-shadow: var(--sh-sm);
}
.pillar-card:hover { box-shadow: var(--sh-md); }
.pillar-card .emoji { font-size: 22px; }
.pillar-card .name { font-weight: 700; font-family: var(--font-head); }

/* ---- Due date list ------------------------------------------------------ */
.due-row {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-1);
}
.due-row:last-child { border-bottom: none; }
.due-dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; background: var(--pil-neutral); }
.due-main { flex: 1; min-width: 0; }
.due-main .name { font-weight: 600; }
.due-main .meta { font-size: 13px; color: var(--text-2); }
.due-when { font-size: 13px; font-weight: 600; text-align: right; white-space: nowrap; }
.due-when.late { color: var(--danger); }
.due-when.soon { color: var(--attention); }

/* ---- Phase / milestone -------------------------------------------------- */
.phase {
  border: 1px solid var(--border-1); border-radius: var(--r-lg);
  padding: var(--sp-4); margin-bottom: var(--sp-4); background: var(--bg-surface);
}
.phase.future { border-style: dashed; border-color: var(--border-2); opacity: .82; }
.phase-head { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-2); }
.phase-head .grow { flex: 1; }
.phase-head .title { font-weight: 700; font-family: var(--font-head); }

.ms-row {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-2) 0; border-top: 1px solid var(--border-1);
}
.ms-row:first-of-type { border-top: none; }
.ms-check {
  width: 26px; height: 26px; border-radius: 50%; flex: 0 0 auto;
  border: 2px solid var(--border-2); background: transparent; padding: 0;
  display: grid; place-items: center; color: var(--on-brand);
}
.ms-check[aria-pressed="true"] { background: var(--success); border-color: var(--success); }
.ms-check:disabled { opacity: .45; cursor: not-allowed; }
.ms-row.overdue .ms-check { border-color: var(--danger); }
.ms-main { flex: 1; min-width: 0; }
.ms-main .name { font-weight: 500; }
.ms-row.done .ms-main .name { text-decoration: line-through; color: var(--text-3); }
.ms-main .meta { font-size: 12px; color: var(--text-2); }
.ms-row.overdue .meta { color: var(--danger); }

/* ---- Backlog ------------------------------------------------------------ */
.chip {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: 6px var(--sp-3); border-radius: var(--r-pill);
  background: var(--bg-surface-2); border: 1px solid var(--border-1); font-size: 14px;
}

/* ---- XP / gamification -------------------------------------------------- */
.xp-card {
  background: linear-gradient(135deg, var(--brand-tint), var(--bg-surface));
  border: 1px solid var(--border-1); border-radius: var(--r-xl);
  padding: var(--sp-5); box-shadow: var(--sh-sm);
}
.xp-bar { height: 12px; border-radius: var(--r-pill); background: var(--bg-surface-2); overflow: hidden; margin-top: var(--sp-2); }
.xp-fill { height: 100%; background: var(--brand); border-radius: var(--r-pill); transition: width .4s ease; }
.stat-tiles { display: flex; gap: var(--sp-3); flex-wrap: wrap; margin-top: var(--sp-4); }
.stat-tile {
  flex: 1; min-width: 90px; text-align: center;
  background: var(--bg-surface); border: 1px solid var(--border-1);
  border-radius: var(--r-md); padding: var(--sp-3);
}
.stat-tile .v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-tile .k { font-size: 12px; color: var(--text-2); }

.tabs {
  display: flex; gap: 4px; background: var(--bg-surface-2); border-radius: var(--r-pill);
  padding: 4px; margin-bottom: var(--sp-4);
  overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto; min-height: 44px; padding: 0 16px; border: none; background: none;
  border-radius: var(--r-pill); color: var(--text-2); font-weight: 600; white-space: nowrap;
}
.tab.active { background: var(--bg-surface); color: var(--text-1); box-shadow: var(--sh-sm); }

.g-grid { display: grid; grid-template-columns: 1fr; gap: var(--sp-3); }

/* segmented control (progress method) */
.segmented { display: inline-flex; background: var(--bg-surface-2); border-radius: var(--r-pill); padding: 3px; gap: 3px; }
.segmented button {
  border: none; background: none; border-radius: var(--r-pill);
  padding: 7px var(--sp-3); min-height: 44px; color: var(--text-2); font-weight: 600; font-size: 13px;
}
.segmented button.active { background: var(--brand); color: var(--on-brand); }

/* ---- Empty / loading / error ------------------------------------------- */
.empty { text-align: center; padding: var(--sp-10) var(--sp-4); color: var(--text-2); }
.empty .big { font-size: 40px; margin-bottom: var(--sp-3); }
.empty h3 { color: var(--text-1); margin-bottom: var(--sp-2); }

.skel { background: var(--bg-surface-2); border-radius: var(--r-md); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .55; } }
.skel-line { height: 14px; margin: 8px 0; }
.skel-card { height: 120px; border-radius: var(--r-lg); }

.error-block { text-align: center; padding: var(--sp-10) var(--sp-4); }
.error-block h3 { margin-bottom: var(--sp-3); }

/* ---- Toast -------------------------------------------------------------- */
.toast-region {
  position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom, 0));
  transform: translateX(-50%); z-index: 60;
  display: flex; flex-direction: column; gap: var(--sp-2); align-items: center;
  pointer-events: none;
}
.toast {
  background: oklch(0.22 0.01 250); color: oklch(0.98 0 0);
  padding: 10px var(--sp-5); border-radius: var(--r-pill); box-shadow: var(--sh-lg);
  font-size: 14px; font-weight: 500; animation: toast-in .2s ease;
}
.toast.danger { background: var(--danger); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---- Modal -------------------------------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(10, 15, 30, .45);
  display: flex; align-items: center; justify-content: center; padding: var(--sp-4);
}
.modal {
  background: var(--bg-surface); border-radius: var(--r-xl);
  box-shadow: var(--sh-lg); width: 100%; max-width: 480px;
  padding: var(--sp-5); max-height: 90vh; overflow-y: auto;
}
.modal h2 { margin-bottom: var(--sp-3); }
.modal-actions { display: flex; gap: var(--sp-3); justify-content: flex-end; margin-top: var(--sp-5); flex-wrap: wrap; }
.modal-actions .btn { flex: 1; }
.soft-nudge { border-top: 4px solid var(--attention); }

/* ---- Login -------------------------------------------------------------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: var(--sp-5); }
.login-card { width: 100%; max-width: 380px; }
.login-brand { text-align: center; margin-bottom: var(--sp-6); }
.login-brand .logo { font-size: 44px; }

/* ---- Danas -------------------------------------------------------------- */
/* Zakasneli milestoni — naglašena kartica (levi akcenat + suptilan tint). */
.today-overdue {
  border-color: color-mix(in oklab, var(--danger) 45%, var(--border-1));
  box-shadow: inset 3px 0 0 var(--danger), var(--sh-sm);
  background: color-mix(in oklab, var(--danger-tint) 45%, var(--bg-surface));
}

/* ---- Pin / sledeći korak ------------------------------------------------ */
/* Hero pin (na pillar detalju) */
.pin-hero {
  display: flex; align-items: center; gap: var(--sp-2);
  background: var(--brand-tint); color: var(--brand);
  border-radius: var(--r-md); padding: var(--sp-2) var(--sp-3);
}
.pin-hero .pin-ico { font-size: 16px; flex: 0 0 auto; }
.pin-hero .pin-kicker {
  font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; opacity: .85;
}
.pin-hero .pin-name { font-weight: 700; font-size: 14px; overflow-wrap: anywhere; }

/* Pin dugme u milestone redu (≥44px tap target, diskretno dok nije zakačeno) */
.pin-btn {
  min-width: 44px; min-height: 44px; font-size: 15px;
  background: transparent; border-color: transparent; opacity: .4;
}
.pin-btn:hover { opacity: .8; background: var(--bg-surface-2); }
.pin-btn.pinned { opacity: 1; background: var(--brand-tint); border-color: transparent; }

/* Pin chip na dashboard kartici */
.pin-chip {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%;
  padding: 3px 8px; border-radius: var(--r-pill);
  background: var(--brand-tint); color: var(--brand);
  font-size: 12px; font-weight: 600;
}
.pin-chip .pin-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Recurrence badge (manji, uz naziv milestona) */
.recur-badge { text-transform: none; letter-spacing: 0; }
.ms-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.recur-chip {
  display: inline-flex; align-items: center; gap: 3px; flex: 0 0 auto;
  font-size: 11px; font-weight: 600; color: var(--brand);
  background: var(--brand-tint); border-radius: var(--r-pill);
  padding: 1px 8px; white-space: nowrap;
}
.ms-row.done .recur-chip { opacity: .6; }
.series-toggle {
  border: none; background: none; padding: 0; cursor: pointer;
  color: var(--brand); font-size: 12px; font-weight: 600; white-space: nowrap;
}
.series-toggle::before { content: "· "; color: var(--text-3); }
.series-history { display: none; padding: 2px 0 6px 38px; flex-direction: column; gap: 4px; }
.series-history.open { display: flex; }
.series-hist-item { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2); }
.series-hist-item .sh-check { color: var(--text-3); }
.series-hist-item .sh-check.done { color: var(--success); }

/* ---- Backlog nudge ------------------------------------------------------ */
.backlog-nudge {
  font-size: 12px; color: var(--attention);
  padding-left: var(--sp-2);
}

/* ---- Godišnja tema baner ------------------------------------------------ */
.year-theme-banner {
  display: flex; align-items: center; gap: var(--sp-3);
  background: linear-gradient(135deg, var(--brand-tint), var(--bg-surface));
  border: 1px solid var(--border-1); border-radius: var(--r-lg);
  padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-4);
}
.year-theme-banner .yt-ico { font-size: 22px; flex: 0 0 auto; }
.year-theme-banner .yt-kicker {
  font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2);
}
.year-theme-banner .yt-text {
  font-family: var(--font-head); font-weight: 700; font-size: 17px; color: var(--text-1);
  overflow-wrap: anywhere;
}

/* ---- Aktivnost feed ----------------------------------------------------- */
.activity-row {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: 10px var(--sp-4); border-bottom: 1px solid var(--border-1);
}
.activity-row:last-child { border-bottom: none; }
.activity-ico { font-size: 18px; flex: 0 0 auto; line-height: 1.4; }
.activity-main { flex: 1; min-width: 0; }
.activity-label { font-weight: 500; }
.activity-time { font-size: 12px; color: var(--text-2); }

/* ---- Responsive --------------------------------------------------------- */
/* Mobile: 0–639 → bottom nav, 2 kolone */
@media (max-width: 639px) {
  .nav-sidebar { display: none; }
  .nav-bottom { display: grid; }
  .content { padding: var(--sp-4) var(--sp-4) 96px; }
  .topbar { padding: var(--sp-3) var(--sp-4); }
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal { max-width: 100%; border-radius: var(--r-xl) var(--r-xl) 0 0; }
}

/* Tablet: 640–1023 → uski nav rail (ikone naglašene, labela mala ispod), 3 kolone */
@media (min-width: 640px) and (max-width: 1023px) {
  :root { --sidebar-w: 72px; }
  .nav-sidebar { padding: var(--sp-4) var(--sp-2); align-items: center; }
  .nav-brand { padding: var(--sp-2) 0 var(--sp-3); justify-content: center; gap: 0; }
  .nav-brand span:last-child { display: none; }
  .nav-sidebar .nav-item {
    flex-direction: column; gap: 2px; padding: var(--sp-2) 4px;
    text-align: center; justify-content: center; font-weight: 600;
  }
  .nav-sidebar .nav-item .ico { font-size: 24px; width: auto; }
  .nav-sidebar .nav-item span:last-child { font-size: 10px; letter-spacing: .02em; }
  .pillar-grid { grid-template-columns: repeat(3, 1fr); }
  .g-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Desktop: ≥1024 → sidebar, 4 kolone */
@media (min-width: 1024px) {
  .pillar-grid { grid-template-columns: repeat(4, 1fr); }
  .g-grid { grid-template-columns: repeat(3, 1fr); }
}
