:root {
  --bg: #faf6f3;
  --surface: #ffffff;
  --surface-2: #f3ece7;
  --text: #2a2220;
  --muted: #8a7d77;
  --line: #ebe2dc;
  --accent: #b5476b;
  --accent-soft: #f7e3ea;
  --accent-text: #ffffff;
  --ok: #2f8a5b;
  --ok-soft: #e2f3ea;
  --warn: #b7791f;
  --warn-soft: #fbefd9;
  --bad: #b23b3b;
  --bad-soft: #f8e1e1;
  --conflict: #e0600b;
  --alert: #f2a516;
  --alert-text: #3a2400;
  --conflict-soft: #ffeedd;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(60, 30, 20, .05), 0 4px 16px rgba(60, 30, 20, .05);
  --tabbar-h: 62px;
  color-scheme: light;
}

/* tmavý režim: podľa telefónu, ak si nevybrala svetlý; alebo vždy, ak si vybrala tmavý */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161312;
    --surface: #221d1b;
    --surface-2: #2c2624;
    --text: #f3ece8;
    --muted: #a39690;
    --line: #362f2c;
    --accent: #e27a9c;
    --accent-soft: #4a2633;
    --accent-text: #1c1214;
    --ok: #5cc48e;
    --ok-soft: #1f3a2c;
    --warn: #e0a54a;
    --warn-soft: #3d2f17;
    --bad: #ef7b7b;
    --bad-soft: #432222;
  --conflict: #ff8a3d;
  --alert: #f0b030;
  --alert-text: #2a1a00;
  --conflict-soft: #46260f;
    --conflict: #ff8a3d;
    --alert: #f0b030;
    --alert-text: #2a1a00;
    --conflict-soft: #46260f;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161312;
  --surface: #221d1b;
  --surface-2: #2c2624;
  --text: #f3ece8;
  --muted: #a39690;
  --line: #362f2c;
  --accent: #e27a9c;
  --accent-soft: #4a2633;
  --accent-text: #1c1214;
  --ok: #5cc48e;
  --ok-soft: #1f3a2c;
  --warn: #e0a54a;
  --warn-soft: #3d2f17;
  --bad: #ef7b7b;
  --bad-soft: #432222;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 12px) 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 96px);
}

h1 { font-size: 24px; line-height: 1.2; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 24px 4px 8px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.hint { font-size: 13px; color: var(--muted); margin: 0; }
.error { color: var(--bad); margin: 0; font-weight: 500; }
code { background: var(--surface-2); padding: 2px 6px; border-radius: 6px; }

/* ----- hlavička ----- */
.head { margin-bottom: 16px; display: grid; gap: 12px; }
.head.simple { gap: 4px; }
.head-row { display: flex; align-items: center; gap: 8px; }
.head-title { flex: 1; text-align: center; min-width: 0; }
.head-title h1 { font-size: 21px; }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); font-weight: 600; }
.sub { margin: 4px 0 0; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.back { color: var(--accent); font-weight: 500; padding: 4px 0; display: inline-block; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); box-shadow: var(--shadow); font-size: 26px; line-height: 1; color: var(--accent);
  flex: none; padding-bottom: 3px;
}
.today-link { justify-self: center; font-size: 14px; color: var(--accent); font-weight: 500; }

.segmented { display: flex; background: var(--surface-2); border-radius: 12px; padding: 3px; }
.segmented a { flex: 1; text-align: center; padding: 7px 4px; border-radius: 9px; font-size: 14px; font-weight: 500; color: var(--muted); }
.segmented a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ----- karty a formuláre ----- */
.card { background: var(--surface); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stack { display: grid; gap: 12px; }
form.stack + .row2, .card > .row2 { margin-top: 0; }
fieldset { border: 0; margin: 0; min-width: 0; }
legend { font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 0; margin-bottom: 4px; float: left; width: 100%; }
legend + * { clear: both; }
label { display: grid; gap: 6px; font-size: 14px; color: var(--muted); font-weight: 500; }
input, textarea, select {
  font: inherit; font-size: 17px; color: var(--text); width: 100%;
  background: var(--surface-2); border: 1px solid transparent; border-radius: 12px; padding: 11px 12px;
  -webkit-appearance: none; appearance: none; min-height: 46px;
}
input:focus, textarea:focus { outline: none; border-color: var(--accent); background: var(--surface); }
input[type="date"], input[type="time"] { display: block; }
textarea { resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row2 > form { display: contents; }
.row2 > form > .btn, .row2 > .btn { width: 100%; }

.btn {
  font: inherit; font-weight: 600; font-size: 16px; border: 0; cursor: pointer;
  background: var(--surface-2); color: var(--text); border-radius: 12px; padding: 12px 14px;
  min-height: 46px; display: inline-flex; align-items: center; justify-content: center; text-align: center;
}
.btn.primary { background: var(--accent); color: var(--accent-text); }
.btn.big { min-height: 54px; font-size: 17px; }
.btn:active { transform: scale(.98); }
.danger-zone { text-align: center; margin-top: 24px; }
.danger-link { background: none; color: var(--bad); font-weight: 500; }
.actions-row { display: flex; gap: 8px; padding: 10px; }
.actions-row .btn { flex: 1; font-size: 15px; padding: 10px 8px; }

details > summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary { margin-bottom: 14px; }
.service summary span:first-child { color: var(--text); }
.service.inactive { opacity: .6; }
.toggle { display: flex; align-items: center; gap: 10px; color: var(--text); }
.toggle input { width: 22px; height: 22px; min-height: 0; padding: 0; accent-color: var(--accent); -webkit-appearance: checkbox; appearance: auto; }
.copy { font-size: 13px; }

/* ----- čipy služieb ----- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: block; cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: grid; padding: 10px 14px; border-radius: 12px; background: var(--surface-2);
  color: var(--text); font-size: 16px; font-weight: 600; border: 2px solid transparent;
}
.chip small { font-weight: 400; font-size: 12px; color: var(--muted); }
.chip input:checked + span { background: var(--accent-soft); border-color: var(--accent); }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.stepper { display: flex; gap: 8px; }
.stepper input { text-align: center; }
.stepper button { flex: none; width: 52px; border: 0; border-radius: 12px; background: var(--surface-2); color: var(--accent); font-size: 24px; font-weight: 600; }

/* našepkávač klientov */
.autocomplete { position: relative; }
.suggestions {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 10; margin-top: 4px;
  background: var(--surface); border-radius: 12px; box-shadow: 0 8px 30px rgba(0, 0, 0, .15);
  overflow: hidden; border: 1px solid var(--line);
}
.suggestions button {
  display: flex; justify-content: space-between; width: 100%; padding: 12px 14px; border: 0;
  background: none; font: inherit; color: var(--text); text-align: left; border-bottom: 1px solid var(--line);
}
.suggestions button:last-child { border-bottom: 0; }
.suggestions small { color: var(--muted); }

/* ----- zoznam termínov ----- */
.list { display: grid; gap: 8px; }
.appt {
  display: flex; gap: 12px; align-items: center; background: var(--surface); border-radius: 14px;
  padding: 12px 14px; box-shadow: var(--shadow); border-left: 4px solid var(--accent);
}
.appt-time { display: grid; text-align: center; min-width: 46px; }
.appt-time strong { font-size: 17px; font-variant-numeric: tabular-nums; }
.appt-time span { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.appt-body { flex: 1; min-width: 0; }
.appt-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt-services { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt-side { display: grid; justify-items: end; gap: 4px; text-align: right; }
.price { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.appt.status-done { border-left-color: var(--ok); }
.appt.status-cancelled, .appt.status-no_show { border-left-color: var(--line); opacity: .65; }
.appt.status-cancelled .appt-name { text-decoration: line-through; }
.appt.attention { border-left-color: var(--warn); }
.list.compact .appt { padding: 9px 12px; }

.pill { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill.done { background: var(--ok-soft); color: var(--ok); }
.pill.planned { background: var(--accent-soft); color: var(--accent); }
.pill.attention { background: var(--warn-soft); color: var(--warn); }
.pill.no_show { background: var(--bad-soft); color: var(--bad); }

.day-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.day-stats div { background: var(--surface); border-radius: 14px; padding: 10px; text-align: center; box-shadow: var(--shadow); display: grid; }
.day-stats strong { font-size: 17px; font-variant-numeric: tabular-nums; }
.day-stats span { font-size: 12px; color: var(--muted); }

.empty { text-align: center; color: var(--muted); padding: 40px 16px; }

.fab {
  position: fixed; right: max(20px, calc(50% - 300px)); bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 18px);
  width: 60px; height: 60px; border-radius: 50%; background: var(--accent); color: var(--accent-text);
  display: grid; place-items: center; box-shadow: 0 6px 20px rgba(181, 71, 107, .4); z-index: 5;
}
.fab svg { width: 28px; height: 28px; }

/* ----- týždeň ----- */
.week-day { margin-bottom: 14px; }
.week-day-head { display: flex; justify-content: space-between; align-items: center; margin: 0 4px 6px; }
.week-day-head a:first-child { display: flex; gap: 8px; align-items: baseline; }
.dow { font-weight: 700; }
.dnum { color: var(--muted); font-size: 14px; }
.week-day.is-today .dow, .week-day.is-today .dnum { color: var(--accent); }
.add-small { width: 30px; height: 30px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow); display: grid; place-items: center; color: var(--accent); font-size: 20px; }
.free { margin: 0 4px; }

/* ----- mesiac ----- */
.month { padding: 8px; }
.month-row { display: grid; grid-template-columns: repeat(7, 1fr); }
.month-dow span { text-align: center; font-size: 12px; color: var(--muted); padding: 6px 0; font-weight: 600; }
.month-cell { aspect-ratio: 1 / 1.1; display: grid; align-content: center; justify-items: center; gap: 2px; border-radius: 12px; }
.month-cell .num { font-size: 16px; font-variant-numeric: tabular-nums; }
.month-cell .count { font-size: 11px; font-weight: 700; background: var(--accent-soft); color: var(--accent); border-radius: 999px; min-width: 20px; padding: 1px 6px; text-align: center; }
.month-cell.out { opacity: .35; }
.month-cell.is-today .num { background: var(--accent); color: var(--accent-text); border-radius: 50%; width: 30px; height: 30px; display: grid; place-items: center; font-weight: 700; }

/* ----- detail ----- */
.lines { list-style: none; margin: 0; padding: 0; }
.lines li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.lines li:last-child { border-bottom: 0; }
.lines li.total { font-weight: 600; }
.lines li.paid span:last-child { color: var(--ok); }
.lines a { color: var(--text); }
.note { white-space: pre-wrap; color: var(--muted); margin: 12px 0 0; }
section.note { margin: 0 0 8px; color: var(--text); }
.card + .card, .card + section, section + .card { margin-top: 12px; }

/* ----- klienti ----- */
.search input { background: var(--surface); box-shadow: var(--shadow); margin-top: 8px; }
.client-row { display: flex; align-items: center; gap: 12px; background: var(--surface); border-radius: 14px; padding: 10px 14px; box-shadow: var(--shadow); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; flex: none; }
.client-main { flex: 1; display: grid; min-width: 0; }
.client-main strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client-main small { color: var(--muted); }
.client-side { display: flex; gap: 6px; align-items: center; }
.add-client { margin-top: 16px; }

/* ----- súhrn ----- */
.hero { text-align: center; display: grid; gap: 4px; padding: 22px 16px; margin-bottom: 8px; }
.hero-num { font-size: 40px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* ----- prihlásenie ----- */
.login { max-width: 360px; margin: 12vh auto 0; display: grid; gap: 16px; justify-items: center; }
.login .card { width: 100%; }
.login-logo { width: 84px; height: 84px; border-radius: 20px; box-shadow: var(--shadow); }

/* ----- spodná lišta ----- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: space-around;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(18px); backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid var(--line);
  padding: 6px 4px calc(env(safe-area-inset-bottom) + 6px);
}
.tabbar a { flex: 1; display: grid; justify-items: center; gap: 2px; color: var(--muted); font-size: 11px; font-weight: 500; padding: 4px 0; }
.tabbar svg { width: 25px; height: 25px; }
.tabbar a.active { color: var(--accent); }

.toast {
  position: fixed; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 92px); left: 50%; transform: translateX(-50%); z-index: 30;
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-size: 14px; font-weight: 500;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .2); animation: toast 3s ease forwards; max-width: calc(100% - 32px); text-align: center;
}
@keyframes toast { 0%, 80% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }

/* iOS dáva poliam dátumu a času vnútornú minimálnu šírku – nesmú pretekať z mriežky */
html, body { overflow-x: clip; }
.row2 > *, label, fieldset { min-width: 0; }
input, textarea, select { min-width: 0; max-width: 100%; }
input[type="date"], input[type="time"] { width: 100%; }
.chip { position: relative; }
.month-cell .count.none { visibility: hidden; }

/* prestávka medzi termínmi */
.gap { font-size: 12px; color: var(--muted); text-align: center; margin: -2px 0; display: flex; align-items: center; gap: 10px; }
.gap::before, .gap::after { content: ""; flex: 1; border-top: 1px dashed var(--line); }

/* voľný termín medzi objednávkami */
.free-slot {
  border: 1.5px dashed color-mix(in srgb, var(--accent) 45%, var(--line));
  border-radius: 14px; padding: 8px 12px; display: grid; gap: 6px;
  background: color-mix(in srgb, var(--accent-soft) 35%, transparent);
}
.free-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; }
.free-head strong { color: var(--accent); font-weight: 600; }
.free-head span { color: var(--muted); font-size: 13px; }
.free-tiles { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -12px; padding: 0 12px 2px; }
.free-tiles::-webkit-scrollbar { display: none; }
.free-tiles a {
  flex: none; display: grid; background: var(--surface); border-radius: 10px; padding: 5px 10px;
  font-size: 13px; font-weight: 600; box-shadow: var(--shadow); line-height: 1.25;
}
.free-tiles small { font-weight: 400; font-size: 11px; color: var(--muted); }
.free-tiles a:active { background: var(--accent-soft); }
.page { touch-action: pan-y pinch-zoom; }

/* náklady a zisk */
.day-stats .profit strong { color: var(--ok); }
.lines li.two-line > * { display: grid; }
.lines li.two-line > span { text-align: right; }
.lines li.two-line small { font-size: 12px; }

/* osobné udalosti z Apple kalendára */
.personal {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px; font-size: 13px; color: var(--muted);
  border-radius: 10px; background: repeating-linear-gradient(-45deg, transparent 0 6px, color-mix(in srgb, var(--line) 55%, transparent) 6px 8px);
}
.personal svg { width: 14px; height: 14px; flex: none; opacity: .7; }
.personal-time { font-variant-numeric: tabular-nums; white-space: nowrap; }
.personal-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.allday { font-size: 13px; color: var(--muted); background: var(--surface-2); border-radius: 10px; padding: 6px 12px; margin-bottom: 8px; }
.week-day .allday { margin: 0 0 6px; }
.overlap-warn { font-size: 13px; color: var(--warn); background: var(--warn-soft); border-radius: 10px; padding: 8px 12px; margin: 0; }

/* termín sa prekrýva s rodinnou udalosťou */
.appt.conflict { border-left-color: var(--conflict); background: var(--conflict-soft); box-shadow: 0 0 0 1.5px var(--conflict) inset; }
.appt-conflict { font-size: 12px; font-weight: 600; color: var(--conflict); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.personal.conflict { color: var(--conflict); }


/* spodná lišta so 6 kartami */
.tabbar a { position: relative; font-size: 10px; }
.tabbar svg { width: 24px; height: 24px; }
.tabbar .badge {
  position: absolute; top: 0; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--conflict); color: #fff; font-size: 11px; font-weight: 700;
  display: grid; place-items: center; line-height: 1;
}

/* dlaždica v súhrne ako odkaz */
.day-stats .tile-link { background: var(--surface); border-radius: 14px; padding: 10px; text-align: center; box-shadow: var(--shadow); display: grid; }
.day-stats .tile-link strong { font-size: 17px; color: var(--accent); }
.day-stats .tile-link span { font-size: 12px; color: var(--accent); }

/* objednávka */
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; border-radius: 10px; }
.btn.small.icon { width: 36px; padding: 0; color: var(--muted); }
.order-list { display: grid; gap: 0; padding: 6px 14px; }
.order-row { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.order-row:last-of-type { border-bottom: 0; }
.order-main { flex: 1; min-width: 0; display: grid; }
.order-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-main small { color: var(--muted); font-size: 13px; }
.order-row.low .order-main small { color: var(--conflict); }
.inline-qty { display: flex; gap: 6px; align-items: center; }
.qty-input { width: 58px; min-height: 36px; padding: 6px 8px; text-align: center; font-size: 15px; border-radius: 10px; }
.order-add { display: flex; gap: 6px; padding: 10px 0 6px; border-top: 1px solid var(--line); margin-top: 4px; }
.order-add .qty-input { min-height: 40px; }
.order-add .btn { min-width: 40px; font-size: 20px; }
.empty-inline { margin: 8px 0; }
.received summary { font-size: 14px; color: var(--muted); font-weight: 500; }
.received[open] summary { margin-bottom: 4px; }

.stock { padding: 8px 14px; }
.stock-cat { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 4px 0 2px; }
.stock-row { border-bottom: 1px solid var(--line); }
.stock-row:last-child { border-bottom: 0; }
.stock-row > summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; font-weight: 500; margin: 0; }
.stock-row[open] > summary { margin-bottom: 8px; }
.stock-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.stock-name .pill { font-size: 10px; vertical-align: middle; }
.stock-qty { display: flex; align-items: center; gap: 6px; flex: none; font-variant-numeric: tabular-nums; }
.stock-qty strong { min-width: 26px; text-align: right; }
.stock-qty small { color: var(--muted); font-size: 12px; min-width: 26px; }
.stock-row.low .stock-qty strong { color: var(--conflict); }
.step { width: 32px; height: 32px; border: 0; border-radius: 50%; background: var(--surface-2); color: var(--accent); font-size: 18px; font-weight: 700; display: grid; place-items: center; padding: 0; }
.stock-edit { padding-bottom: 8px; }

/* našepkávač materiálu v „Na objednanie“ */
.order-name { flex: 1; display: block; }
.order-name input { width: 100%; min-height: 40px; font-size: 15px; padding: 8px 10px; border-radius: 10px; }
.order-name .suggestions { z-index: 15; }
.suggestions small.low { color: var(--conflict); }
.order-add { position: relative; }
.order-name.autocomplete { position: static; }
.order-name .suggestions { left: 0; right: 0; top: calc(100% - 2px); }
.order-name .suggestions button { display: grid; gap: 1px; padding: 10px 14px; }
.order-name .suggestions small { font-size: 12px; }

/* prepínač Deň/Týždeň/Mesiac + tlačidlo Dnes */
.seg-row { display: flex; gap: 8px; align-items: stretch; }
.seg-row .segmented { flex: 1; }
.today-btn {
  display: grid; place-items: center; padding: 0 14px; border-radius: 12px; font-size: 14px; font-weight: 600;
  background: var(--accent); color: var(--accent-text);
}
.today-btn.is-current { background: var(--surface-2); color: var(--muted); }
.list { grid-template-columns: minmax(0, 1fr); }
.day-stats > * { align-content: start; }

/* hlavička kalendára ostáva pri rolovaní hore */
.sticky-head {
  position: sticky; top: 0; z-index: 12; background: var(--bg);
  margin: calc(-1 * (env(safe-area-inset-top) + 12px)) -16px 16px;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 10px;
  transition: box-shadow .15s ease;
}
.sticky-head.stuck { box-shadow: 0 1px 0 var(--line), 0 6px 14px rgba(0, 0, 0, .06); }

/* chybová hláška – červená a dlhšie */
.toast.error { background: var(--bad); color: #fff; animation-duration: 7s; font-weight: 600; }

/* nadpis dňa v týždni a v Naplánovaných sa lepí pod hlavnú hlavičku */
.week-day-head {
  position: sticky; top: var(--head-h, 0px); z-index: 11; background: var(--bg);
  margin: 0 -16px 6px; padding: 8px 20px;
}
.week-day-head::after { content: ""; position: absolute; left: 16px; right: 16px; bottom: 0; border-bottom: 1px solid var(--line); }

/* listovanie prstom – susedná stránka vedľa aktuálnej */
.page { position: relative; }
.page-ghost {
  position: absolute; top: 0; width: 100%; pointer-events: none;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 0;
}
.page-ghost .sticky-head { position: relative; box-shadow: none; }
.page-ghost .week-day-head { position: static; }
.page-ghost .fab, .page.swiping > .fab { display: none; }

/* čas termínu: hodiny : minúty (po 15) */
.time-field { display: flex; align-items: center; gap: 4px; }
.time-field select { flex: 1; min-width: 0; text-align: center; text-align-last: center; font-variant-numeric: tabular-nums; padding: 11px 4px; }
.time-colon { font-size: 18px; font-weight: 600; color: var(--muted); }

/* aktuálny deň / týždeň / mesiac – výrazný štítok nad dátumom */
.eyebrow.now {
  display: inline-block; background: var(--accent); color: var(--accent-text);
  padding: 3px 12px; border-radius: 999px; margin-bottom: 3px; letter-spacing: .06em;
}
.eyebrow:not(.now) { color: var(--muted); }

/* dnešný deň v týždni */
.week-day.is-today .week-day-head { background: var(--accent-soft); border-radius: 12px; margin-left: 0; margin-right: 0; padding-left: 12px; padding-right: 12px; }
.week-day.is-today .week-day-head::after { display: none; }
.week-day.is-today .dow, .week-day.is-today .dnum { color: var(--accent); }
.today-pill {
  align-self: center; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  background: var(--accent); color: var(--accent-text); padding: 2px 8px; border-radius: 999px;
}
.week-day.is-today .add-small { background: var(--accent); color: var(--accent-text); }

/* koniec dňa – čiara pod posledným termínom */
.day-end { display: flex; align-items: center; gap: 10px; margin: 10px 0 0; font-size: 12px; color: var(--muted); }
.day-end::before { content: ""; flex: 1; border-top: 2px dashed var(--line); order: 0; }
.day-end-label { order: -1; white-space: nowrap; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.day-end-add { order: 1; white-space: nowrap; color: var(--accent); font-weight: 600; font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); }
.week-day { margin-bottom: 30px; }

/* zbaliteľné skupiny v Nastaveniach */
.group { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); margin-top: 16px; }
.group > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px; margin: 0; }
.group > summary::after { content: "›"; font-size: 22px; color: var(--muted); transition: transform .15s ease; line-height: 1; }
.group[open] > summary::after { transform: rotate(90deg); }
.group-title { font-size: 17px; font-weight: 600; flex: 1; }
.group-meta { font-size: 13px; color: var(--muted); font-weight: 500; }
.group[open] { padding: 0 12px 12px; }
.group[open] > summary { padding: 16px 4px; }
.group .card { background: var(--surface-2); box-shadow: none; }
.group .card input:not([type=checkbox]), .group .card textarea { background: var(--surface); }
.group-sub { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 12px 4px 8px; }
.group-sub:first-of-type { margin-top: 0; }
.lines .profit-line { color: var(--ok); font-weight: 600; }
.lines li.two-line > span:first-child { text-align: left; }
.row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.row3 input { text-align: center; padding-left: 6px; padding-right: 6px; }
.stepper output.dur {
  flex: 1; display: grid; place-items: center; min-height: 46px; border-radius: 12px;
  background: var(--surface-2); color: var(--text); font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.stepper output.dur.empty { color: var(--muted); font-weight: 400; padding: 0; text-align: inherit; } /* nie zoznamové .empty */
.group .card .stepper output.dur { background: var(--surface); }

/* tlačidlo Plán vľavo od Deň/Týždeň/Mesiac */
.plan-btn {
  display: grid; place-items: center; padding: 0 12px; border-radius: 12px; font-size: 14px; font-weight: 600;
  background: var(--surface); color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent);
}
.plan-btn.active { background: var(--accent); color: var(--accent-text); box-shadow: none; }
.seg-row .segmented a { padding-left: 2px; padding-right: 2px; }
.center-sub { justify-content: center; margin: 0; }

/* neukončené termíny */
.unclosed-link {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0 0 16px;
  padding: 14px 16px; border-radius: var(--radius); background: var(--warn-soft); color: var(--warn); font-weight: 600;
}
.unclosed { display: grid; gap: 6px; }
.unclosed + .unclosed { margin-top: 6px; }
.quick-actions { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 6px; }
.quick-actions .btn { width: 100%; }
.sticky-head .unclosed-link { margin: 0; padding: 10px 14px; }
.page-ghost .unclosed-link { pointer-events: none; }

/* výrazná výstraha na neukončené termíny */
.unclosed-link {
  background: var(--alert); color: var(--alert-text); font-weight: 700;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--alert) 45%, transparent);
}
.unclosed-link span:last-child { font-size: 22px; line-height: 1; }
.unclosed-link:active { transform: scale(.99); }
.h1-count { color: var(--muted); font-weight: 500; }

/* návody zbalené do jedného riadku */
.howto { border-top: 1px solid var(--line); padding-top: 10px; }
.howto > summary { font-size: 14px; font-weight: 600; color: var(--accent); margin: 0; }
.howto > summary::after { content: " ›"; }
.howto[open] > summary::after { content: " ⌄"; }
.howto[open] > summary { margin-bottom: 8px; }
.howto p { font-size: 13px; color: var(--muted); margin: 0 0 8px; }
.alarm-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.alarm-choices .toggle { font-size: 15px; }
.alarm-choices .toggle.disabled { opacity: .4; }

/* dohodnutá cena (líši sa od cenníka) */
.hint.agreed, .lines .agreed { color: var(--warn); }
.agreed-mark { color: var(--warn); font-weight: 700; margin-left: 1px; }

/* susedné stránky pre listovanie prstom sú vidieť len počas ťahu
   (na telefóne sú aj tak mimo obrazovky, na širokej obrazovke by trčali po stranách) */
.page:not(.swiping) > .page-ghost { visibility: hidden; }

/* ----- notebook / počítač: široká obrazovka a myš; telefón a tablet sa nemenia ----- */
@media (min-width: 900px) and (hover: hover) and (pointer: fine) {
  :root { --tabbar-h: 0px; --rail-w: 92px; }
  .page { max-width: 760px; padding-bottom: 72px; }
  /* spodná lišta → zvislý panel vľavo */
  .tabbar {
    top: 0; right: auto; width: var(--rail-w); flex-direction: column; justify-content: flex-start; gap: 6px;
    padding: 20px 6px; border-top: 0; border-right: 1px solid var(--line);
  }
  .tabbar a { flex: none; padding: 10px 0; border-radius: 12px; font-size: 12px; }
  .tabbar a:hover { background: var(--surface-2); color: var(--text); }
  .tabbar a.active:hover { color: var(--accent); }
  .tabbar .badge { top: 4px; }
  .fab { right: max(24px, calc(50% - 360px)); bottom: 32px; }
  .toast { bottom: 40px; }
  /* aby bolo jasné, čo sa dá kliknúť */
  a.appt, .btn, .chip, button { cursor: pointer; }
  a.appt, a.card, .list > a { transition: background-color .12s ease, box-shadow .12s ease; }
  a.appt:hover, a.card:hover, .list > a:hover { box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow); }
  .btn:hover { filter: brightness(.96); }
  .btn.primary:hover { filter: brightness(1.06); }
}
/* rozdiel zaplatenej sumy oproti cenníku pod poľom Zaplatené */
.paid-diff { display: block; margin-top: 4px; font-size: 12px; color: var(--warn); }
.paid-diff.minus { color: var(--bad); }
.row2 > label { align-content: start; } /* susedné pole sa neposunie, keď má jedno pod sebou poznámku */
.paid-diff.profit { color: var(--ok); }
.paid-diff.profit.minus { color: var(--bad); }
/* pod skutočným časom: vľavo porovnanie s plánom, vpravo € na hodinu */
.hint-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.hint.rate { font-weight: 600; color: var(--text); white-space: nowrap; }
