:root {
  --bg: #0F0F10;
  --surface: #19191B;
  --surface-2: #242427;
  --line: #303034;
  --text: #F3F0EA;
  --text-2: #D9D4CC;
  --muted: #A39E96;
  --accent: #FF8A3D;
  --accent-ink: #1E1004;
  --ok: #3FB97A;
  --bad: #E5534B;
  --r: 18px;
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Newsreader", Georgia, serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
svg { display: block; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 50;
  background: var(--accent); color: var(--accent-ink);
  padding: 10px 14px; border-radius: 10px; font-weight: 700; text-decoration: none;
}
.skip:focus { top: 12px; }

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

/* ---------- Raspored ---------- */
.app { min-height: 100dvh; }
.sidebar { display: none; }
main {
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  padding: 20px 16px calc(100px + env(safe-area-inset-bottom));
  outline: none;
}

.top {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  margin-bottom: 18px;
}
.eyebrow { color: var(--muted); font-size: 14px; font-weight: 600; }
h1 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(34px, 9vw, 44px);
  line-height: 1.05;
  letter-spacing: -0.01em;
}
.top-actions { display: flex; gap: 8px; align-items: center; }

/* ---------- Dugmad ---------- */
.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;
  font-weight: 700; font-size: 15px; text-decoration: none;
  transition: background-color .15s, border-color .15s;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #FF9C5A; }
.btn-ghost { background: var(--surface-2); border-color: var(--line); }
.btn-ghost:hover { border-color: #46464C; }
.btn-danger { background: transparent; border-color: #5A2A27; color: #F08A83; }
.btn-danger:hover { background: #2A1514; }
.btn-block { width: 100%; }

.icon-btn {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface);
  transition: background-color .15s, border-color .15s;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover:not(:disabled) { background: var(--surface-2); }
.icon-btn:disabled { opacity: .35; }
.icon-btn-accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.icon-btn-accent:hover:not(:disabled) { background: #FF9C5A; }

/* ---------- Nedelja ---------- */
.week { display: flex; align-items: center; gap: 4px; margin-bottom: 18px; }
.week > .icon-btn { border: 0; background: transparent; width: 32px; }
.week-days { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; min-width: 0; }
.day {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 8px 0 10px; min-height: 76px;
  background: transparent; border: 1px solid transparent; border-radius: 14px;
}
.day:hover:not(:disabled) { background: var(--surface); }
.day.is-sel { background: var(--surface-2); border-color: var(--line); }
.day:disabled { opacity: .35; }
.day-name { font-size: 12px; font-weight: 600; color: var(--muted); }
.day.is-today .day-name { color: var(--accent); }
.day-ring { position: relative; width: 38px; height: 38px; }
.day-ring .ring { position: absolute; inset: 0; }
.day-num {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 14px; font-weight: 700;
}
.day.is-perfect .day-num { color: var(--accent-ink); }
.day.is-perfect .day-ring::before {
  content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--accent);
}

/* ---------- Sažetak dana ---------- */
.summary { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; font-size: 14px; color: var(--text-2); }
.summary strong { color: var(--text); }
.bar { flex: 1; height: 6px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .4s ease; }

/* ---------- Grupe ---------- */
.group { margin-top: 18px; }
.group-head {
  width: 100%; display: flex; align-items: center; gap: 10px;
  background: transparent; border: 0; padding: 8px 2px; min-height: 44px; text-align: left;
}
.group-h { font-size: inherit; font-weight: inherit; }
.group-head > svg:first-child { width: 20px; height: 20px; color: var(--muted); }
.group-label { font-size: 17px; font-weight: 700; }
.group-count { margin-left: auto; color: var(--muted); font-size: 14px; font-weight: 600; }
.group-chev { width: 18px; height: 18px; color: var(--muted); transition: transform .2s; }
.group.is-collapsed .group-chev { transform: rotate(-90deg); }
.group.is-collapsed .habits { display: none; }

.habits { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 8px; }

/* ---------- Kartica navike ---------- */
.habit {
  --c: var(--accent);
  position: relative;
  display: flex; align-items: stretch;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  min-height: 70px;
}
.habit-fill {
  position: absolute; inset: 0 auto 0 0;
  background: color-mix(in srgb, var(--c) 26%, var(--surface));
  transition: width .45s cubic-bezier(.2,.7,.2,1);
}
.habit.is-done .habit-fill { background: color-mix(in srgb, var(--c) 36%, var(--surface)); }
.habit.is-slip .habit-fill { width: 100% !important; background: color-mix(in srgb, var(--bad) 18%, var(--surface)); }
.habit-main {
  position: relative; flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 6px 12px 14px;
  background: transparent; border: 0; text-align: left;
}
.habit-icon {
  width: 42px; height: 42px; flex: none;
  display: grid; place-items: center;
  border-radius: 12px;
  background: color-mix(in srgb, var(--c) 22%, transparent);
  font-size: 21px; line-height: 1;
}
.habit-text { min-width: 0; display: grid; }
.habit-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.habit-sub { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.habit-streak {
  margin-left: auto; flex: none;
  display: inline-flex; align-items: center; gap: 2px;
  font-size: 14px; font-weight: 800; padding-right: 4px;
}
.habit-streak svg { width: 15px; height: 15px; color: var(--accent); }
.habit-act {
  position: relative; flex: none; width: 62px;
  display: grid; place-items: center;
  background: transparent; border: 0;
}
.habit-act > span {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  border: 2px solid var(--c);
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  transition: background-color .15s, transform .15s;
}
.habit-act svg { width: 20px; height: 20px; }
.habit-act:hover > span { background: color-mix(in srgb, var(--c) 30%, var(--surface)); }
.habit.is-done .habit-act > span { background: var(--c); color: #141414; }
.habit.is-running .habit-act > span { background: var(--c); color: #141414; }
.habit.bad .habit-act > span { border-color: color-mix(in srgb, var(--bad) 70%, transparent); }
.habit.just-done .habit-act > span { animation: pop .45s ease; }
@keyframes pop { 40% { transform: scale(1.18); } }

.note { color: var(--muted); font-size: 14px; margin-top: 18px; }

.empty {
  margin-top: 8px; padding: 28px 22px;
  border: 1px dashed var(--line); border-radius: var(--r);
}
.empty h2 { font-family: var(--display); font-weight: 500; font-size: 26px; margin-bottom: 6px; }
.empty p { color: var(--text-2); margin-bottom: 18px; max-width: 42ch; }
.empty-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- Kartice i kalendar ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.card-head .card-title { margin: 0; }
.card-title { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.card-nav { display: flex; gap: 6px; }
.card-nav .icon-btn { width: 44px; height: 44px; }

.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal-h { font-size: 12px; color: var(--muted); font-weight: 600; padding-bottom: 4px; }
.cal-d {
  position: relative; aspect-ratio: 1; min-height: 36px;
  display: grid; place-items: center;
  border: 0; background: transparent; border-radius: 50%;
  font-size: 13px; font-weight: 600; color: var(--text-2);
}
.cal-d .ring { position: absolute; inset: 2px; width: calc(100% - 4px); height: calc(100% - 4px); }
.cal-d > b { position: relative; font-weight: inherit; }
button.cal-d:hover { background: var(--surface-2); }
.cal-d.is-future { color: #5C5A56; }
.cal-d.is-off { color: #6E6B66; }
.cal-d.is-done { background: var(--c, var(--accent)); color: #141414; }
.cal-d.is-miss::after {
  content: ""; position: absolute; inset: 5px; border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--c, var(--accent)) 45%, transparent);
}
.cal-d.is-sel { box-shadow: inset 0 0 0 2px var(--text); }
.cal-d.is-today b { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Statistika ---------- */
.field-inline { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.field-inline .field-label { margin: 0; white-space: nowrap; }
.field-inline select { flex: 1; max-width: 320px; }

.stats-grid { display: grid; gap: 14px; }
.records { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rec { background: var(--surface-2); border-radius: 14px; padding: 14px; }
.rec-num { font-family: var(--display); font-size: 34px; line-height: 1; font-weight: 500; }
.rec-num small { font-family: var(--font); font-size: 14px; color: var(--muted); font-weight: 600; margin-left: 2px; }
.rec-label { font-size: 13px; color: var(--muted); margin-top: 6px; }

.table-wrap { overflow-x: auto; }
.wk { width: 100%; border-collapse: collapse; font-size: 13px; }
.wk th { font-weight: 600; color: var(--muted); padding: 4px 0 8px; }
.wk th:first-child, .wk td:first-child { text-align: left; padding-right: 8px; }
.wk td { padding: 5px 0; text-align: center; }
.wk td:first-child { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--text-2); }
.dot { display: inline-block; width: 20px; height: 20px; border-radius: 50%; vertical-align: middle; }
.dot.is-done { background: var(--c); }
.dot.is-miss { border: 2px solid color-mix(in srgb, var(--c) 45%, transparent); }
.dot.is-off { width: 8px; height: 2px; border-radius: 2px; background: #3A3A3F; }
.dot.is-future { width: 6px; height: 6px; background: #3A3A3F; }
.dot.is-slip {
  border: 2px solid var(--bad);
  background: linear-gradient(45deg, transparent 44%, var(--bad) 44% 56%, transparent 56%);
}
.wk abbr { text-decoration: none; }

.per-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.per { display: grid; grid-template-columns: 34px 1fr auto; gap: 4px 12px; align-items: center; }
.per .habit-icon { width: 34px; height: 34px; font-size: 17px; border-radius: 10px; grid-row: span 2; }
.per-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.per-meta { font-size: 13px; color: var(--muted); text-align: right; white-space: nowrap; }
.per .bar { grid-column: 2 / 4; }
.per .bar > span { background: var(--c); }

/* ---------- Strana desno (računar) ---------- */
.danas-side { display: none; }
.top-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.top-list li { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.top-list .habit-icon { width: 32px; height: 32px; font-size: 16px; border-radius: 9px; }
.top-list .t-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.top-list .t-num { display: inline-flex; align-items: center; gap: 3px; font-weight: 800; }
.top-list .t-num svg { width: 14px; height: 14px; color: var(--accent); }

/* ---------- Dostignuća ---------- */
.ach-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.ach { display: flex; gap: 14px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.medal {
  flex: none; width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--display); font-size: 20px; font-weight: 600;
  background: var(--surface-2); color: var(--muted);
  border: 2px dashed #3A3A3F;
}
.ach.is-got .medal { background: var(--accent); color: var(--accent-ink); border: 0; }
.ach h2 { font-size: 16px; font-weight: 700; }
.ach p { font-size: 14px; color: var(--text-2); margin-top: 2px; }
.ach .bar { margin-top: 10px; height: 5px; }
.ach-prog { font-size: 12px; color: var(--muted); margin-top: 6px; }
.ach:not(.is-got) h2 { color: var(--text-2); }

/* ---------- Donja traka (telefon) ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(15, 15, 16, .96);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  min-height: 60px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: transparent; border: 0; color: var(--muted); font-size: 12px; font-weight: 600;
}
.tabbar svg { width: 22px; height: 22px; }
.tabbar button.is-active { color: var(--accent); }

/* ---------- Dijalozi ---------- */
dialog { border: 0; padding: 0; color: var(--text); background: var(--surface); }
dialog::backdrop { background: rgba(0, 0, 0, .62); }
.sheet {
  width: 100%; max-width: 100%;
  margin: auto 0 0; max-height: 92dvh;
  border-radius: 22px 22px 0 0;
  border-top: 1px solid var(--line);
}
.sheet[open] { animation: up .28s cubic-bezier(.2,.8,.2,1); }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }
.sheet-body { padding: 18px 16px calc(24px + env(safe-area-inset-bottom)); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.sheet-head h2 { font-family: var(--display); font-weight: 500; font-size: 28px; line-height: 1.1; }

/* detalj */
.dt-top { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.dt-top .habit-icon { width: 48px; height: 48px; font-size: 24px; }
.dt-top-text { flex: 1; min-width: 0; }
.dt-top h2 { font-family: var(--display); font-weight: 500; font-size: 26px; line-height: 1.1; overflow-wrap: anywhere; }
.dt-top p { font-size: 14px; color: var(--muted); }
.dt-date { text-align: center; color: var(--muted); font-size: 14px; font-weight: 600; }
.dt-ring { position: relative; width: 220px; height: 220px; margin: 10px auto 18px; }
.dt-ring .ring { position: absolute; inset: 0; }
.dt-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.dt-big { font-family: var(--display); font-size: 52px; line-height: 1; font-weight: 500; font-variant-numeric: tabular-nums; }
.dt-small { color: var(--muted); font-size: 14px; margin-top: 6px; }
.dt-controls { display: flex; justify-content: center; align-items: center; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.round {
  width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 13px; font-weight: 800;
}
.round svg { width: 22px; height: 22px; }
.round:hover:not(:disabled) { border-color: #4A4A50; }
.round:disabled { opacity: .35; }
.round-main { width: 72px; height: 72px; background: var(--c); border-color: var(--c); color: #141414; }
.round-main svg { width: 28px; height: 28px; }
.round-main:hover:not(:disabled) { filter: brightness(1.08); }
.dt-rule { background: var(--surface-2); border-radius: 14px; padding: 14px 16px; margin: 0 0 18px; font-size: 15px; }
.dt-rule dt { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.dt-rule dd { margin: 2px 0 10px; }
.dt-rule dd:last-child { margin-bottom: 0; }
.dt-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 18px; }
.dt-stats .rec { padding: 12px; }
.dt-stats .rec-num { font-size: 28px; }
.dt-cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.dt-cal-head h3 { font-size: 15px; font-weight: 700; }

/* forma */
.field { display: block; border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
.field-label { display: block; font-size: 13px; font-weight: 700; color: var(--text-2); margin-bottom: 6px; padding: 0; }
.field-hint { font-size: 13px; color: var(--muted); margin-top: 6px; }
.field-error { display: block; font-size: 13px; color: #F08A83; margin-top: 6px; }
input[type="text"], input[type="number"], input[type="time"], select {
  width: 100%; min-height: 46px; padding: 0 14px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
}
input[type="text"]:focus, input[type="number"]:focus, input[type="time"]:focus, select:focus { border-color: var(--accent); outline: none; }
.remind-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.remind-row input { font-variant-numeric: tabular-nums; }

.dt-remind {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  padding: 12px 14px; margin-bottom: 14px; border-radius: 14px;
  background: var(--surface-2); font-size: 14px; color: var(--text-2);
}
.dt-remind svg { width: 18px; height: 18px; color: var(--accent); flex: none; }
.dt-remind a { margin-left: auto; color: var(--accent); font-weight: 700; text-decoration: none; padding: 6px 0; }
.dt-remind a:hover { text-decoration: underline; }

.menu-sec { padding: 16px 0; border-top: 1px solid var(--line); }
.menu-sec:first-of-type { border-top: 0; padding-top: 4px; }
.menu-sec h3 { font-size: 15px; font-weight: 800; margin-bottom: 6px; }
.menu-sec .btn-primary { margin-top: 12px; }
input[aria-invalid="true"] { border-color: #F08A83; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.segmented-4 { grid-template-columns: repeat(4, 1fr); }
.segmented label { position: relative; }
.segmented input, .chips input, .swatches input, .icons input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented span {
  display: grid; place-items: center; min-height: 40px; border-radius: 9px;
  font-size: 14px; font-weight: 700; color: var(--muted); cursor: pointer; text-align: center; padding: 0 4px;
}
.segmented input:checked + span { background: var(--surface-2); color: var(--text); }
.segmented input:focus-visible + span,
.chips input:focus-visible + span,
.swatches input:focus-visible + span,
.icons input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.chips { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.chips label { position: relative; }
.chips span {
  display: grid; place-items: center; min-height: 44px; border-radius: 12px;
  background: var(--bg); border: 1px solid var(--line);
  font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer;
}
.chips input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches label { position: relative; }
.swatches span { display: block; width: 44px; height: 44px; border-radius: 50%; background: var(--sw); cursor: pointer; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line); }
.swatches input:checked + span { box-shadow: 0 0 0 2px var(--text); }

.icons { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
.icons label { position: relative; }
.icons span { display: grid; place-items: center; height: 44px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); font-size: 21px; cursor: pointer; }
.icons input:checked + span { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--bg)); }

.form-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; }
.form-actions .btn-primary { margin-left: auto; min-width: 140px; }

.menu-list { display: grid; gap: 10px; margin-top: 16px; }
.file-btn { position: relative; cursor: pointer; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.file-btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Ciljevi ---------- */
.small { font-size: 13px; }
textarea {
  width: 100%; padding: 12px 14px; resize: vertical; min-height: 84px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
  font: inherit; color: inherit; line-height: 1.45;
}
textarea:focus, input[type="date"]:focus { border-color: var(--accent); outline: none; }
input[type="date"] {
  width: 100%; min-height: 46px; padding: 0 12px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px; color-scheme: dark;
}
input[type="file"] { font-size: 14px; max-width: 100%; }

.seg-tabs {
  display: inline-grid; grid-auto-flow: column; gap: 4px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px;
  margin-bottom: 18px; max-width: 100%;
}
.seg-tabs button {
  min-height: 40px; padding: 0 16px; border: 0; border-radius: 9px;
  background: transparent; color: var(--muted); font-weight: 700; font-size: 14px;
}
.seg-tabs button[aria-selected="true"] { background: var(--surface-2); color: var(--text); }
.seg-tabs-sm { display: grid; grid-template-columns: repeat(4, 1fr); width: 100%; margin: 4px 0 18px; }
.seg-tabs-sm button { padding: 0 4px; font-size: 13px; }

.g-overview { display: grid; gap: 12px; margin-bottom: 16px; }
.g-recs .rec { background: var(--surface); border: 1px solid var(--line); }
.cat-card .card-title { margin-bottom: 10px; }
.cat-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 14px; font-weight: 600; margin-top: 10px; }
.cat-row .muted { font-weight: 500; font-size: 13px; }
.cat-row .bar { grid-column: 1 / -1; height: 5px; }
.cat-row .bar > span, .goal-card .bar > span, .side-goals .bar > span { background: var(--c); }

.filters { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.filter {
  flex: none; min-height: 40px; padding: 0 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--text-2); font-weight: 600; font-size: 14px;
}
.filter[aria-pressed="true"] { background: var(--text); color: #141414; border-color: var(--text); }

.goal-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.goal-card {
  width: 100%; display: grid; gap: 6px; text-align: left;
  padding: 16px 18px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--c);
  transition: border-color .15s, background-color .15s;
}
.goal-card:hover { background: #1D1D20; }
.goal-card.is-achieved { opacity: .72; }
.goal-meta { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.goal-cat { color: var(--c); font-weight: 700; font-size: 13px; }
.goal-due { color: var(--muted); text-align: right; }
.goal-due.is-late { color: #F08A83; }
.goal-title { font-family: var(--display); font-size: 23px; line-height: 1.15; font-weight: 500; }
.goal-next { font-size: 14px; color: var(--text-2); }
.goal-prog { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.goal-prog b { font-size: 14px; min-width: 38px; text-align: right; }

.side-goals { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.side-goals button {
  width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center;
  padding: 8px; margin: 0 -8px; width: calc(100% + 16px);
  border: 0; border-radius: 10px; background: transparent; text-align: left;
}
.side-goals button:hover { background: var(--surface-2); }
.sg-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-pct { font-size: 13px; color: var(--muted); font-weight: 700; }
.side-goals .bar { grid-column: 1 / -1; height: 4px; }

.link-goal {
  display: inline-block; margin-top: 4px; padding: 6px 0; min-height: 32px;
  background: none; border: 0; color: var(--accent); font-size: 13px; font-weight: 700; text-align: left;
}
.link-goal:hover { text-decoration: underline; }

.goal-icon svg { width: 24px; height: 24px; color: var(--c); }
.dt-top .goal-cat { margin-bottom: 2px; }
.g-top { display: flex; gap: 18px; align-items: center; margin-bottom: 18px; }
.g-ring { position: relative; width: 120px; height: 120px; flex: none; }
.g-ring .ring { position: absolute; inset: 0; }
.g-ring > span { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--display); font-size: 30px; }
.g-due { font-weight: 700; }
.g-top .btn { margin-top: 10px; }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: 14px; }

.g-sec { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 18px; }
.g-sec h3 { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.g-sec > .muted { margin-bottom: 10px; }
.g-money { font-family: var(--display); font-size: 26px; margin: 4px 0 8px; }
.g-money .muted { font-family: var(--font); font-size: 14px; }

.inline-form { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 12px; }
.inline-sm { grid-template-columns: 1fr auto; margin-top: 8px; }
.inline-sm input { min-height: 40px; }
.inline-sm .btn { min-height: 40px; }
@media (min-width: 420px) { .inline-form:not(.inline-sm) { grid-template-columns: 1fr 1fr auto; } }

.entries { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 2px; font-size: 14px; }
.entries li { display: grid; grid-template-columns: 56px 1fr auto; gap: 8px; align-items: center; color: var(--text-2); }
.entries li > span:first-child { color: var(--muted); }

.mini-del {
  width: 36px; height: 36px; flex: none; display: grid; place-items: center;
  border: 0; border-radius: 10px; background: transparent; color: var(--muted);
}
.mini-del svg { width: 16px; height: 16px; }
.mini-del:hover { background: var(--surface-2); color: #F08A83; }

.ms-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 10px; }
.ms { background: var(--surface-2); border-radius: 14px; padding: 12px 12px 12px 14px; }
.ms-head { display: flex; align-items: flex-start; gap: 10px; }
.ms-text { flex: 1; min-width: 0; padding-top: 6px; }
.ms-text h4 { margin: 0; font-size: 15px; font-weight: 700; }
.ms-text p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.ms-check, .tasks input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; margin: 7px 0 0; }
.tasks { list-style: none; margin: 8px 0 0; padding: 0; }
.tasks li { display: flex; align-items: center; gap: 4px; }
.tasks label { flex: 1; display: flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; font-size: 15px; }
.tasks input { margin: 0; }
.tasks input:checked + span { color: var(--muted); text-decoration: line-through; }
.ms .inline-sm input { background: var(--surface); }
.ms-form { margin-top: 14px; display: grid; }
.ms-form .field { margin-bottom: 10px; }
.ms-form .btn { justify-self: start; }

.g-habits { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.g-habits button {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 8px 10px;
  background: var(--surface-2); border: 0; border-radius: 12px; text-align: left;
}
.g-habits .habit-icon { width: 36px; height: 36px; font-size: 18px; }
.gh-name { flex: 1; min-width: 0; display: grid; font-weight: 700; }
.gh-name small { font-weight: 500; color: var(--muted); font-size: 13px; }
.gh-meta { font-size: 13px; color: var(--text-2); white-space: nowrap; }

.g-entry-form { display: grid; margin-bottom: 18px; }
.g-entry-form .btn { justify-self: start; }
.journal { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.journal li { background: var(--surface-2); border-radius: 14px; padding: 10px 10px 12px 14px; }
.j-head { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); font-weight: 600; }
.j-head time { flex: 1; }
.journal p { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; padding-right: 4px; }
.journal .r-q { color: var(--accent); font-weight: 700; font-size: 14px; }

.mood-scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.mood-scale label { position: relative; }
.mood-scale input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.mood-scale span {
  display: grid; place-items: center; height: 44px; border-radius: 12px; cursor: pointer;
  background: var(--bg); border: 2px solid color-mix(in srgb, var(--m) 55%, transparent); font-weight: 800;
}
.mood-scale input:checked + span { background: var(--m); border-color: var(--m); color: #141414; }
.mood-scale input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (min-width: 420px) { .mood-scale { grid-template-columns: repeat(10, 1fr); } }
.mood-chart { display: flex; align-items: flex-end; gap: 4px; height: 110px; margin-bottom: 16px; padding: 10px; background: var(--surface-2); border-radius: 14px; }
.mood-chart span { flex: 1; height: var(--h); background: var(--m); border-radius: 6px 6px 3px 3px; display: grid; align-content: start; justify-items: center; min-height: 18px; }
.mood-chart b { font-size: 11px; color: #141414; padding-top: 2px; }
.mood-pill { background: var(--m); color: #141414; border-radius: 999px; padding: 2px 10px; font-weight: 800; }

.habit-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.habit-pick label { position: relative; }
.habit-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.habit-pick label > span {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px;
  border-radius: 999px; background: var(--bg); border: 1px solid var(--line); cursor: pointer; font-size: 14px; font-weight: 600;
}
.habit-pick input:checked + span { border-color: var(--c); background: color-mix(in srgb, var(--c) 22%, var(--bg)); }
.habit-pick input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.vision-intro { color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.vision { list-style: none; margin: 0; padding: 0; columns: 2 220px; column-gap: 12px; }
.vision > .empty { column-span: all; }
.v-item {
  position: relative; break-inside: avoid; margin-bottom: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
}
.v-item img { display: block; width: 100%; height: auto; }
.v-item p { margin: 0; padding: 16px 48px 16px 16px; }
.v-slika p { font-size: 14px; color: var(--text-2); padding: 10px 48px 12px 14px; }
.v-citat p { font-family: var(--display); font-size: 22px; line-height: 1.25; }
.v-meta { border-left: 4px solid var(--accent); }
.v-meta p { font-weight: 700; font-size: 17px; padding-top: 10px; }
.v-tag { display: block; padding: 14px 16px 0; font-size: 12px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; }
.v-meta .v-tag { order: -1; }
.v-del {
  position: absolute; top: 6px; right: 6px; width: 36px; height: 36px; display: grid; place-items: center;
  border: 0; border-radius: 10px; background: rgba(15, 15, 16, .7); color: var(--text);
}
.v-del svg { width: 16px; height: 16px; }
.v-meta { display: flex; flex-direction: column; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 60;
  transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  background: var(--text); color: #141414;
  padding: 12px 18px; border-radius: 12px; font-weight: 700; font-size: 14px;
  max-width: calc(100% - 32px); width: max-content;
  transition: opacity .2s, transform .2s;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Tablet ---------- */
@media (min-width: 640px) {
  main { padding-left: 24px; padding-right: 24px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .card-wide { grid-column: 1 / -1; }
  .sheet-form { max-width: 560px; margin: auto; border-radius: 22px; border: 1px solid var(--line); }
  .sheet-body { padding: 24px; }
}

/* ---------- Računar ---------- */
@media (min-width: 960px) {
  .app { display: grid; grid-template-columns: 248px minmax(0, 1fr); }
  .tabbar { display: none; }
  .sidebar {
    display: flex; flex-direction: column; gap: 18px;
    position: sticky; top: 0; height: 100dvh;
    padding: 24px 18px;
    border-right: 1px solid var(--line);
  }
  .brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-size: 28px; font-weight: 600; padding: 0 6px 6px; }
  .brand-mark { width: 26px; height: 26px; border-radius: 50%; border: 5px solid var(--accent); border-right-color: var(--surface-2); transform: rotate(-30deg); }
  .side-nav { display: grid; gap: 4px; }
  .nav-item {
    display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px;
    background: transparent; border: 0; border-radius: 12px; color: var(--text-2); font-weight: 600; text-align: left;
  }
  .nav-item svg { width: 20px; height: 20px; color: var(--muted); }
  .nav-item:hover { background: var(--surface); }
  .nav-item.is-active { background: var(--surface-2); color: var(--text); }
  .nav-item.is-active svg { color: var(--accent); }
  .side-note { margin-top: auto; font-size: 13px; color: var(--muted); padding: 0 6px; }

  main { max-width: none; margin: 0; padding: 36px 40px 48px; }
  #view-statistika, #view-dostignuca, #view-ciljevi { max-width: 980px; }
  .g-overview { grid-template-columns: 300px 1fr; align-items: stretch; }
  .g-recs { align-content: start; }
  .goal-list { grid-template-columns: 1fr 1fr; }
  .goal-list > .empty, .goal-list > .muted { grid-column: 1 / -1; }
  .vision { columns: 3 220px; }
  .top-actions [data-add] { display: none; }

  .toast { bottom: 28px; }

  .sheet:not(.sheet-form) {
    margin: 0 0 0 auto; width: 440px; height: 100dvh; max-height: 100dvh;
    border-radius: 0; border-top: 0; border-left: 1px solid var(--line);
  }
  .sheet:not(.sheet-form)[open] { animation: side .28s cubic-bezier(.2,.8,.2,1); }
  .sheet-wide:not(.sheet-form) { width: 540px; }
  @keyframes side { from { transform: translateX(24px); opacity: 0; } }
}

@media (min-width: 1180px) {
  .danas-grid { display: grid; grid-template-columns: minmax(0, 640px) 320px; gap: 40px; align-items: start; }
  .danas-side { display: grid; gap: 14px; position: sticky; top: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
