/* Tudučka – vzhľad. Farby sú premenné, tmavý režim ich len prepíše. */
:root {
  --bg: #F2F4FA; --surface: #FFFFFF; --sunk: #E8EBF4; --fg: #1C1E33; --muted: #5D6280; --line: #DCE0EC;
  --accent: #3D63F5; --on-accent: #FFFFFF; --today: #FFF4D6; --danger: #D93A4A; --ink: #1C1E33;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 18px;
  --shadow: 0 1px 3px rgba(20, 22, 40, .10);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11121C; --surface: #1B1D2B; --sunk: #242737; --fg: #EEF0F8; --muted: #A4A9C4; --line: #2D3045;
    --accent: #7D98FF; --on-accent: #0F1020; --today: #2B2716; --danger: #FF6B78; --shadow: 0 1px 3px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11121C; --surface: #1B1D2B; --sunk: #242737; --fg: #EEF0F8; --muted: #A4A9C4; --line: #2D3045;
  --accent: #7D98FF; --on-accent: #0F1020; --today: #2B2716; --danger: #FF6B78; --shadow: 0 1px 3px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 16px; line-height: 1.45;
  padding-top: env(safe-area-inset-top, 0px);
  -webkit-tap-highlight-color: transparent;
}
body.noscroll { overflow: hidden; }
#app {
  max-width: 560px; margin: 0 auto; display: grid; gap: 16px;
  padding-block: 14px calc(110px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
h1, h2, h3 { margin: 0; text-wrap: balance; letter-spacing: -.015em; }
h1 { font-size: 1.6rem; font-weight: 800; }
p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
svg { flex: none; }

/* tlačidlá */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 18px; border-radius: 14px; border: 1.5px solid var(--line);
  background: var(--surface); font-weight: 700; text-decoration: none; color: var(--fg);
}
.btn svg { width: 20px; height: 20px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.big { min-height: 56px; font-size: 1.05rem; width: 100%; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-ghost { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn:disabled { opacity: .55; }
.btn .g { width: 22px; height: 22px; background: #fff; border-radius: 50%; padding: 2px; }
.link { background: none; border: 0; color: var(--accent); font-weight: 700; padding: 10px 4px; display: inline-flex; align-items: center; gap: 4px; }
.link svg { width: 18px; height: 18px; }
.back { justify-self: start; }
.iconbtn { width: 44px; height: 44px; border-radius: 12px; border: 0; background: transparent; display: grid; place-items: center; color: var(--fg); }
.iconbtn svg { width: 24px; height: 24px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* úvodné obrazovky */
.center { min-height: 70vh; display: grid; place-content: center; justify-items: center; text-align: center; gap: 16px; }
.narrow { max-width: 420px; width: 100%; margin: 0 auto; }
.page { display: grid; gap: 16px; }
.logo { width: 46px; height: 46px; border-radius: 12px; flex: none; }
.logo.big { width: 104px; height: 104px; border-radius: 26px; box-shadow: 0 10px 30px rgba(60, 90, 200, .25); }
.hero { font-size: 2.4rem; }
.lead { color: var(--muted); font-size: 1.02rem; }
.choices { display: grid; gap: 12px; width: 100%; }
.choice {
  display: grid; grid-template-columns: 44px 1fr; grid-template-rows: auto auto; column-gap: 12px; text-align: left;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r); padding: 16px; align-items: center;
}
.choice svg { grid-row: span 2; width: 44px; height: 44px; padding: 9px; border-radius: 12px; background: var(--sunk); color: var(--accent); }
.choice b { font-size: 1.08rem; }
.choice span { color: var(--muted); font-size: .9rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.h2s { font-size: 1.1rem; margin-top: 8px; }
.tile { display: grid; justify-items: center; gap: 10px; padding: 18px 10px; border-radius: var(--r); background: var(--surface); border: 1.5px solid var(--line); font-size: 1.1rem; }

/* formuláre */
.form { display: grid; gap: 16px; padding-bottom: 8px; }
.fld { display: grid; gap: 6px; min-width: 0; }
.fld > span { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.fld > span em { text-transform: none; letter-spacing: 0; font-weight: 500; font-style: normal; }
input:not([type=checkbox]), textarea {
  width: 100%; min-height: 50px; padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--line);
  background: var(--surface); font-size: 1rem; min-width: 0;
}
textarea { resize: vertical; }
input:focus, textarea:focus { border-color: var(--accent); outline: none; }
input.code { font-size: 1.6rem; letter-spacing: .3em; text-transform: uppercase; text-align: center; font-weight: 800; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.switch { display: flex; gap: 12px; align-items: center; font-weight: 600; min-height: 44px; }
.switch input { width: 24px; height: 24px; accent-color: var(--accent); flex: none; }
.err { color: var(--danger); font-weight: 700; }
.repbox { display: grid; gap: 12px; background: var(--sunk); border-radius: 16px; padding: 12px 14px; }
#w-rep { display: grid; gap: 12px; }
.inline { display: flex; gap: 8px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { border: 1.5px solid var(--line); background: var(--surface); border-radius: 999px; padding: 9px 15px; font-weight: 700; min-height: 44px; }
.seg button[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }

.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.sw { width: 42px; height: 42px; border-radius: 50%; border: 3px solid var(--surface); background: var(--c); box-shadow: 0 0 0 1.5px var(--line); }
.sw[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--fg); }
.icongrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 8px; }
.ic { height: 52px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); display: grid; place-items: center; color: var(--fg); padding: 0; }
.ic svg { width: 26px; height: 26px; }
.ic[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.icongrid.evi { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); }
.evi .ic { height: 66px; gap: 2px; align-content: center; }
.evi .ic small { font-size: .68rem; font-weight: 600; }
.pickrow { display: flex; flex-wrap: wrap; gap: 8px; }
.day-chip { width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--surface); font-weight: 700; padding: 0; }
.day-chip[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

/* avatary */
.av { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--c); color: var(--ink); flex: none; }
.av svg { width: 58%; height: 58%; }
.av.lg { width: 40px; height: 40px; }
.av.xl { width: 64px; height: 64px; }

/* hlavička */
.top { display: flex; align-items: center; gap: 12px; }
.top .t { flex: 1; min-width: 0; }
.top h1 { font-size: 1.45rem; display: flex; align-items: baseline; gap: 8px; }
.ver { font-size: .72rem; font-weight: 700; color: var(--muted); background: var(--sunk); border-radius: 999px; padding: 2px 8px; letter-spacing: 0; }
.top .sub { color: var(--muted); font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me { border: 0; background: none; padding: 2px; border-radius: 50%; }
.me .av { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--c); }

.banner { display: flex; gap: 12px; align-items: center; text-align: left; border: 1.5px dashed var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); border-radius: var(--r); padding: 12px 14px; color: var(--fg); }
.banner > svg { width: 28px; height: 28px; color: var(--accent); }

.tabs { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--sunk); border-radius: 14px; padding: 4px; gap: 4px; }
.tabs button { border: 0; background: transparent; border-radius: 11px; min-height: 44px; font-weight: 700; color: var(--muted); }
.tabs button[aria-pressed="true"] { background: var(--surface); color: var(--fg); box-shadow: var(--shadow); }

.nav { display: flex; align-items: center; gap: 4px; }
.navlabel { flex: 1; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 0; }
.today-btn { border: 1.5px solid var(--accent); color: var(--accent); background: transparent; border-radius: 999px; padding: 6px 12px; font-weight: 700; }

.people { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; margin-inline: -4px; padding-inline: 4px; }
.people::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 7px; border: 1.5px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 13px 5px 5px; font-weight: 600; white-space: nowrap; min-height: 42px; flex: none; }
.chip .av { width: 30px; height: 30px; }
.chip.txt { padding-left: 14px; }
.people .chip[aria-pressed="false"] { opacity: .45; }
.chip.txt[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.pickrow .chip[aria-pressed="true"]:not(.txt) { border-color: var(--fg); box-shadow: inset 0 0 0 1.5px var(--fg); }
.pickrow .chip[aria-pressed="false"] { opacity: .6; }

/* týždeň / deň */
.week { display: grid; gap: 14px; }
.day { display: grid; gap: 8px; border-radius: calc(var(--r) + 4px); transition: background .15s; }
.day.drop { background: color-mix(in srgb, var(--accent) 14%, transparent); outline: 2px dashed var(--accent); outline-offset: 4px; }
.dh { display: flex; align-items: baseline; gap: 8px; padding-inline: 4px; flex-wrap: wrap; }
.dh b { font-size: 1.02rem; font-weight: 800; }
.dh span { color: var(--muted); font-size: .88rem; font-variant-numeric: tabular-nums; }
.dh .pill { margin-left: auto; font-size: .7rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; background: var(--fg); color: var(--bg); border-radius: 999px; padding: 3px 9px; }
.dh .hol { margin-left: auto; font-size: .78rem; font-weight: 600; }
.events { background: var(--surface); border-radius: var(--r); border: 1px solid var(--line); overflow: hidden; display: grid; }
.day.today .events { background: var(--today); }
.empty { border: 0; background: transparent; padding: 14px 16px; color: var(--muted); text-align: left; display: flex; justify-content: space-between; align-items: center; min-height: 50px; }
.empty svg { width: 20px; height: 20px; opacity: .6; }
.ev {
  display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 12px; padding: 12px 14px; align-items: start;
  border: 0; background: transparent; text-align: left; width: 100%;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.ev + .ev { border-top: 1px solid var(--line); }
.ev.lifted { opacity: .3; }
.ev.ghost { position: fixed; z-index: 50; pointer-events: none; background: var(--surface); border-radius: 16px; box-shadow: 0 16px 40px rgba(20, 22, 50, .3); }
body.dragging { -webkit-user-select: none; user-select: none; }
.time { font-weight: 700; font-variant-numeric: tabular-nums; font-size: .95rem; line-height: 1.25; }
.time small { display: block; color: var(--muted); font-weight: 500; font-size: .8rem; }
.body { display: grid; gap: 6px; min-width: 0; }
.title { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.title .who { display: flex; }
.title .who .av { width: 24px; height: 24px; border: 2px solid var(--surface); margin-left: -6px; }
.title .who .av:first-child { margin-left: 0; }
.title .tx { min-width: 0; overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: .85rem; }
.meta span { display: inline-flex; align-items: center; gap: 4px; }
.meta svg { width: 15px; height: 15px; }
.drive { display: inline-flex; align-items: center; gap: 6px; justify-self: start; font-size: .82rem; font-weight: 700; padding: 3px 10px 3px 6px; border-radius: 999px; background: color-mix(in srgb, var(--c) 24%, var(--surface)); }
.drive svg { width: 15px; height: 15px; }
.drive .av { width: 20px; height: 20px; }
.hint { color: var(--muted); font-size: .82rem; text-align: center; }

/* prebiehajúci výlet */
.trip { display: flex; align-items: center; gap: 14px; text-align: left; width: 100%; border: 0; border-radius: var(--r); padding: 14px 16px; background: var(--fg); color: var(--bg); }
.trip > span:nth-child(2) { flex: 1; display: grid; min-width: 0; }
.trip b { font-size: 1.1rem; }
.trip > span:nth-child(2) > span { opacity: .8; font-size: .9rem; }
.trip > svg { width: 22px; height: 22px; }
.trip-ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); flex: none; }
.trip-ic svg { width: 28px; height: 28px; }

/* zoznam na odškrtávanie */
.check { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 6px 6px 8px; display: grid; }
.check-head { display: flex; justify-content: space-between; padding: 8px 10px; }
.check-head span { color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 700; }
.citem { display: flex; align-items: center; gap: 4px; }
.cbox { flex: 1; display: flex; align-items: center; gap: 12px; text-align: left; border: 0; background: transparent; padding: 9px 10px; border-radius: 12px; min-height: 48px; min-width: 0; }
.tick { width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--line); display: grid; place-items: center; font-weight: 800; flex: none; }
.citem.done .tick { background: #22D39A; border-color: #22D39A; color: #0F1020; }
.ct { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.citem.done .ct { text-decoration: line-through; color: var(--muted); }
.av.sm { width: 22px; height: 22px; }
.iconbtn.sm { width: 36px; height: 36px; color: var(--muted); }
.iconbtn.sm svg { width: 18px; height: 18px; }
.addrow { display: flex; gap: 8px; }
.addrow .btn { min-width: 52px; padding: 0; }
.pre a { color: var(--accent); overflow-wrap: anywhere; }

/* mesiac */
.month { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; }
.mg { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; font-variant-numeric: tabular-nums; }
.wd { font-size: .72rem; font-weight: 700; color: var(--muted); text-align: center; padding: 2px 0 4px; }
.mc { border: 0; background: transparent; border-radius: 10px; padding: 6px 2px 8px; min-height: 56px; display: grid; align-content: start; justify-items: center; gap: 5px; font-weight: 600; }
.mc.out { opacity: .38; }
.mc.hol > span:first-child { color: var(--danger); }
.mc.now { background: var(--fg); color: var(--bg); }
.mc.now.hol > span:first-child { color: var(--bg); }
.dots { display: flex; gap: 2px; justify-content: center; flex-wrap: wrap; max-width: 34px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }

/* jednoduchý režim pre deti */
.kid { display: grid; gap: 12px; }
.kh { font-size: 1.7rem; }
.kid h3 { font-size: 1.1rem; margin-top: 6px; }
.kid h3 span { color: var(--muted); font-weight: 600; font-size: .9rem; }
.kcard {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px; align-items: center; text-align: left; width: 100%;
  padding: 16px; border-radius: 24px; color: var(--fg);
  background: color-mix(in srgb, var(--c) 26%, var(--surface)); border: 2px solid color-mix(in srgb, var(--c) 60%, transparent);
}
.kcard > span:last-child, .kcard > div:last-child { display: grid; gap: 2px; min-width: 0; }
.kicon { width: 72px; height: 72px; border-radius: 22px; background: var(--c); display: grid; place-items: center; color: var(--ink); }
.kicon svg { width: 44px; height: 44px; }
.kcard .big { font-size: 1.7rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kcard .big + span { font-size: 1.2rem; font-weight: 700; overflow-wrap: anywhere; }
.kcard .by { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-weight: 600; color: var(--muted); }
.kcard .by svg { width: 20px; height: 20px; }
.kcard.calm { opacity: .85; }

/* plávajúce tlačidlo */
.fab {
  position: fixed; z-index: 20; right: max(18px, calc(env(safe-area-inset-right, 0px) + 18px)); bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  display: flex; align-items: center; gap: 8px; border: 0; border-radius: 20px; background: var(--accent); color: var(--on-accent);
  font-weight: 800; font-size: 1.05rem; padding: 16px 22px; box-shadow: 0 8px 24px rgba(40, 60, 160, .35);
}
.fab svg { width: 22px; height: 22px; stroke-width: 2.6; }

/* okná */
#layer { position: relative; z-index: 40; }
.sheet-wrap { position: fixed; inset: 0; background: rgba(10, 12, 25, .45); display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity .18s; }
.sheet-wrap.in { opacity: 1; }
.sheet {
  width: 100%; max-width: 560px; max-height: calc(100% - 24px - env(safe-area-inset-top, 0px)); overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg); border-radius: 24px 24px 0 0;
  padding: 6px max(18px, env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px));
  transform: translateY(30px); transition: transform .2s ease-out;
}
.sheet-wrap.in .sheet { transform: none; }
.sh-head { display: flex; align-items: center; gap: 8px; position: sticky; top: -6px; background: var(--bg); padding: 12px 0 10px; z-index: 2; }
.sh-head h2 { flex: 1; font-size: 1.3rem; min-width: 0; overflow-wrap: anywhere; }
.actions { display: grid; gap: 10px; margin-top: 8px; }
.actions.sticky { position: sticky; bottom: -24px; background: var(--bg); padding: 10px 0 4px; }
.detail { display: grid; gap: 14px; padding-bottom: 8px; }
.drow { display: flex; gap: 12px; align-items: flex-start; font-size: 1.02rem; }
.drow > svg { width: 22px; height: 22px; color: var(--muted); margin-top: 1px; }
.drow .dicon { color: var(--accent); }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.people-list { flex-wrap: wrap; gap: 8px; }
.person { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px 4px 4px; font-weight: 600; }
.person .av { width: 28px; height: 28px; }

.ask-wrap { position: fixed; inset: 0; z-index: 60; background: rgba(10, 12, 25, .5); display: grid; place-items: center; padding: 16px; }
.ask { background: var(--surface); border-radius: 22px; padding: 20px; width: 100%; max-width: 380px; display: grid; gap: 10px; box-shadow: 0 20px 50px rgba(0, 0, 0, .3); }
.ask p { color: var(--muted); }
.ask-btns { display: grid; gap: 8px; margin-top: 6px; }

/* nastavenia */
.settings { display: grid; gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: grid; gap: 14px; }
.card h3 { font-size: 1.05rem; }
.meline { display: flex; gap: 14px; align-items: center; }
.meline > div { display: grid; min-width: 0; }
.meline .muted { font-size: .88rem; overflow-wrap: anywhere; }
.codebox { display: flex; gap: 10px; align-items: center; justify-content: space-between; background: var(--sunk); border-radius: 14px; padding: 8px 8px 8px 16px; }
b.code { font-size: 1.5rem; letter-spacing: .22em; font-variant-numeric: tabular-nums; }
.mlist { display: grid; gap: 6px; }
.mrow { display: flex; align-items: center; gap: 12px; text-align: left; border: 0; background: transparent; padding: 8px 4px; border-radius: 12px; width: 100%; }
.mrow:disabled { cursor: default; opacity: 1; }
.mrow > span:nth-child(2) { display: grid; flex: 1; min-width: 0; }
.mrow .muted { font-size: .85rem; }
.state { font-size: .75rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--sunk); color: var(--muted); }
.state.on { background: color-mix(in srgb, #22D39A 25%, var(--surface)); color: var(--fg); }

/* toast a pruh s novou verziou */
#toast {
  position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px);
  background: var(--fg); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 600; z-index: 80;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100% - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#updbar {
  position: fixed; z-index: 70; left: 50%; transform: translateX(-50%); top: calc(10px + env(safe-area-inset-top, 0px));
  width: calc(100% - 32px); max-width: 528px; display: flex; gap: 12px; align-items: center; justify-content: space-between;
  background: var(--surface); border: 1.5px solid var(--accent); border-radius: 16px; padding: 8px 8px 8px 16px; box-shadow: 0 10px 30px rgba(20, 30, 80, .2); font-weight: 700;
}

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