/* Skicár – vizuálny štýl: ČVUT modrá (Pantone 300) + sekundárna paleta ČVUT */
:root {
  --bg: #f5f6f8; --surface: #ffffff; --surface-2: #f2f4f7; --line: #e4e7ec; --line-2: #eef0f3;
  --fg: #15181d; --muted: #5d6470; --faint: #8d939d;
  --blue: #0065bd; --blue-deep: #00539c; --blue-ink: #00559f; --blue-soft: #e8f1fb; --blue-line: #c4dbf2; --blue-light: #6aade4;
  --red: #c60c30; --red-soft: #fbe8ec; --amber: #b07800; --amber-soft: #fdf3dc; --ok: #2c7a55; --ok-soft: #e3f3ea;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 2px 8px rgba(16, 24, 40, .04);
  --f-display: "Archivo", "Segoe UI", system-ui, sans-serif;
  --f-body: "Source Sans 3", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --r: 14px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body { font: 16px/1.45 var(--f-body); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
ul { list-style: none; margin: 0; padding: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { color: var(--muted); padding-top: 30vh; text-align: center; }

/* ---------- lišta ---------- */
.appbar { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.appbar[hidden] { display: none; }
.appbar-in { max-width: 980px; margin: 0 auto; padding: 10px 16px 0; display: flex; align-items: center; gap: 10px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; flex: 1; }
.brand img { height: 40px; width: auto; flex: none; }
.brand-tx { display: flex; flex-direction: column; min-width: 0; }
.brand-tx b { font: 800 1.32rem/1.1 var(--f-display); letter-spacing: -.02em; }
.brand-tx em { font-style: normal; color: var(--blue); }
.brand-tx small { font-size: .74rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sync { display: inline-flex; align-items: center; gap: 6px; flex: none; font-size: .74rem; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 3px 10px 3px 8px; }
.sync i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
body.offline .sync i { background: var(--amber); }
.gear { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 10px; color: var(--muted); }
.gear svg { width: 21px; height: 21px; }
.gear.on { color: var(--blue); background: var(--blue-soft); }
@media (max-width: 420px) { .sync span { display: none; } .sync { padding: 6px; border: 0; } }

.tabs { max-width: 980px; margin: 0 auto; display: flex; gap: 6px; overflow-x: auto; padding: 10px 16px 12px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  flex: none; text-decoration: none; font-weight: 600; font-size: .9rem; color: var(--fg);
  background: var(--surface-2); border-radius: 99px; padding: 7px 14px; transition: background .15s;
}
.tabs a.on { background: var(--blue); color: #fff; }

/* ---------- rozloženie ---------- */
#app { max-width: 980px; margin: 0 auto; padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }
.grid2 { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .grid2 { grid-template-columns: 1fr 1fr; align-items: start; } }
.card { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.grid2 > .card { margin-bottom: 0; }
.grid2 + .card, .grid2 + .stack { margin-top: 14px; }
.card.accent { border-top: 3px solid var(--blue); }
.kicker { font: 700 .7rem/1.2 var(--f-body); text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.kicker.blue { color: var(--blue); }
.kicker .right { margin-left: auto; font-family: var(--f-mono); letter-spacing: 0; font-weight: 500; text-transform: none; }
h1, h2, h3 { font-family: var(--f-display); letter-spacing: -.015em; }
.page-h { display: flex; align-items: flex-end; gap: 10px; margin: 2px 0 14px; }
.page-h h1 { font-size: 1.55rem; margin: 0; line-height: 1.15; }
.page-h p { margin: 2px 0 0; color: var(--muted); font-size: .9rem; }
.page-h .grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); } .sm { font-size: .86rem; }
.empty { color: var(--muted); margin: 4px 0; }
.links { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; }
.ulink { color: var(--fg); font-weight: 600; font-size: .9rem; text-decoration: underline; text-decoration-color: var(--blue); text-decoration-thickness: 2px; text-underline-offset: 4px; background: none; border: 0; padding: 0; cursor: pointer; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.mono { font-family: var(--f-mono); }

/* ---------- odpočet ---------- */
.hero { min-height: 100%; }
.hero .wm { position: absolute; right: -18px; bottom: -14px; width: 230px; height: auto; color: var(--blue); opacity: .07; pointer-events: none; }
.count { display: flex; align-items: baseline; gap: 8px; margin: 2px 0 2px; }
.count b { font: 800 3.4rem/1 var(--f-display); color: var(--blue); letter-spacing: -.04em; }
.count span { font-weight: 700; }
.count.today b { color: var(--red); }
.hero h2 { margin: 6px 0 4px; font-size: 1.35rem; line-height: 1.2; }
.hero h2 a { text-decoration: none; }
.hero .meta { color: var(--fg); }
.nextlist li { display: grid; grid-template-columns: 86px 1fr; gap: 8px; padding: 3px 0; font-size: .92rem; }
.nextlist .d { font-family: var(--f-mono); color: var(--blue); font-size: .82rem; padding-top: 2px; }
.nextlist a { text-decoration: none; }

/* ---------- časová os ---------- */
.tl-day { display: grid; grid-template-columns: 44px 1fr; gap: 12px; margin-top: 14px; }
.tl-day:first-of-type { margin-top: 2px; }
.tl-date { text-align: left; }
.tl-date b { display: block; font: 800 1.6rem/1 var(--f-display); letter-spacing: -.03em; }
.tl-date span { display: block; color: var(--muted); font-size: .85rem; margin-top: 2px; }
.badge { display: inline-block; font: 700 .62rem/1 var(--f-body); letter-spacing: .06em; text-transform: uppercase; border-radius: 6px; padding: 4px 6px; margin-top: 6px; }
.badge.today { background: var(--blue); color: #fff; }
.badge.tmr { background: var(--blue-soft); color: var(--blue-ink); }
.tl-list { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.blk { background: var(--surface-2); border-radius: 10px; padding: 9px 12px 9px 14px; position: relative; }
.blk::before { content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--c, var(--faint)); }
.blk .t1 { font-weight: 700; line-height: 1.25; }
.blk .t1 .code { font-family: var(--f-display); }
.blk .t2 { color: var(--muted); font-size: .86rem; }
.blk .t3 { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 4px; font-family: var(--f-mono); font-size: .8rem; color: var(--fg); }
.blk .t3 span { display: inline-flex; align-items: center; gap: 5px; }
.blk .t3 svg { width: 13px; height: 13px; color: var(--muted); }
.blk.now { background: var(--blue-soft); box-shadow: inset 0 0 0 1px var(--blue-line); }
.blk.now::before { background: var(--blue); width: 4px; }
.blk.past { opacity: .5; }
.blk .now-tag { position: absolute; right: 10px; top: 9px; font: 700 .6rem/1 var(--f-body); letter-spacing: .06em; text-transform: uppercase; color: #fff; background: var(--blue); border-radius: 5px; padding: 4px 6px; }
.gap { border: 1px dashed var(--line); border-radius: 10px; padding: 6px 12px; display: flex; justify-content: space-between; font-size: .82rem; color: var(--muted); }
.gap b { color: var(--ok); font-weight: 700; margin-right: 6px; }
.note-line { border-radius: 10px; padding: 8px 12px; font-size: .88rem; background: var(--surface-2); color: var(--muted); }
.note-line.holiday { background: var(--red-soft); color: var(--red); font-weight: 600; }
.note-line.info { background: var(--blue-soft); color: var(--blue-ink); font-weight: 600; }

/* ---------- položky ---------- */
.items li + li { border-top: 1px solid var(--line-2); }
.item { display: flex; gap: 12px; align-items: flex-start; padding: 11px 0; }
.items li:first-child .item { padding-top: 2px; }
.check {
  flex: none; width: 22px; height: 22px; margin-top: 2px; padding: 0; border-radius: 6px; cursor: pointer;
  border: 2px solid #b9c0ca; background: var(--surface); color: #fff; display: grid; place-items: center;
}
.check svg { width: 14px; height: 14px; }
.done .check { background: var(--blue); border-color: var(--blue); }
.item .body { flex: 1; min-width: 0; text-decoration: none; }
.item .ttl { font-weight: 600; line-height: 1.3; }
.done .ttl { text-decoration: line-through; color: var(--muted); }
.item .sub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; font-size: .82rem; color: var(--muted); }
.subj { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; color: var(--fg); }
.subj i { width: 8px; height: 8px; border-radius: 2px; background: var(--c); }
.when { font-family: var(--f-mono); font-size: .78rem; }
.when.late { color: var(--red); font-weight: 500; }
.when.soon { color: var(--blue); font-weight: 500; }
.type { font: 700 .62rem/1 var(--f-body); letter-spacing: .06em; text-transform: uppercase; padding: 4px 6px; border-radius: 5px; background: var(--surface-2); color: var(--muted); }
.t-test { background: var(--red-soft); color: var(--red); }
.t-odovzdanie { background: var(--blue-soft); color: var(--blue-ink); }
.t-konzultacia { background: #e5f6f5; color: #0b7f79; }
.t-uloha { background: var(--amber-soft); color: var(--amber); }
.item.big .ttl { font-size: 1.02rem; }

.group-h { display: flex; align-items: baseline; gap: 10px; margin: 18px 2px 8px; }
.group-h .d { font-family: var(--f-mono); font-weight: 500; color: var(--blue); font-size: .86rem; }
.group-h .w { font-weight: 700; }
.group-h .r { color: var(--muted); font-size: .86rem; margin-left: auto; }
.group-h.late .d, .group-h.late .r { color: var(--red); }
.group-card { padding: 4px 16px; }

/* ---------- týždeň ---------- */
.weekbar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.weekbar .lbl { flex: 1; text-align: center; min-width: 0; }
.weekbar .lbl b { display: block; font: 700 1.05rem/1.2 var(--f-display); }
.weekbar .lbl span { font-size: .82rem; color: var(--muted); }
.navbtn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; text-decoration: none; flex: none; }
.navbtn svg { width: 18px; height: 18px; }
.week { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .week { grid-template-columns: 1fr 1fr; } }
.wday { margin: 0; }
.wday.today { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue), var(--shadow); }
.wday .tl-day { margin-top: 0; }
.wday .items { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 4px; }
.wday .item { padding: 8px 0; }
.wday.off { background: transparent; box-shadow: none; border-style: dashed; padding: 12px 16px; }

/* ---------- filtre ---------- */
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 6px 13px; font-size: .86rem; font-weight: 600; cursor: pointer; }
.chip.on { background: var(--fg); border-color: var(--fg); color: #fff; }
.filters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 4px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- formuláre ---------- */
select, input, textarea {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: -1px; border-color: var(--blue); }
.row > select { flex: 1; width: auto; }
.toggle { display: inline-flex; gap: 7px; align-items: center; font-weight: 600; font-size: .9rem; white-space: nowrap; cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: var(--blue); }
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 9px 15px;
  font-weight: 600; font-size: .92rem; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:active { background: var(--blue-deep); }
.btn.danger { color: var(--red); }
.btn.wide { width: 100%; padding: 12px; }
.btn:disabled { opacity: .5; }
.fab {
  position: fixed; z-index: 15; right: max(16px, calc(50% - 490px + 16px)); bottom: calc(20px + env(safe-area-inset-bottom));
  height: 54px; padding: 0 20px 0 16px; border-radius: 16px; border: 0; cursor: pointer;
  background: var(--blue); color: #fff; font-weight: 700; font-size: .95rem; display: inline-flex; align-items: center; gap: 8px;
  box-shadow: 0 8px 22px rgba(0, 101, 189, .35);
}
.fab svg { width: 20px; height: 20px; }

dialog { border: 0; padding: 0; background: transparent; width: min(560px, calc(100% - 24px)); max-height: 92vh; }
dialog::backdrop { background: rgba(15, 23, 42, .45); }
.sheet { background: var(--surface); border-radius: 18px; padding: 20px; display: flex; flex-direction: column; gap: 14px; border-top: 4px solid var(--blue); }
.sheet h2 { margin: 0; font-size: 1.2rem; }
.sheet label, .login label { display: flex; flex-direction: column; gap: 5px; font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.sheet label small { text-transform: none; letter-spacing: 0; font-weight: 400; }
.sheet label > input, .sheet label > select, .login input { font-size: 1rem; text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--fg); }
.seg { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: inline-block; border: 1px solid var(--line); border-radius: 99px; padding: 7px 13px; color: var(--fg); font-size: .88rem; font-weight: 600; letter-spacing: 0; text-transform: none; cursor: pointer; }
.seg input:checked + span { background: var(--blue); border-color: var(--blue); color: #fff; }
.seg input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.actions { display: flex; justify-content: flex-end; gap: 8px; }
.err { color: var(--red); margin: 0; font-size: .86rem; min-height: 1.1em; }

/* ---------- detail a editory ---------- */
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 600; font-size: .9rem; text-decoration: none; margin: 0 0 12px; }
.back svg { width: 16px; height: 16px; }
.dcard { border-top: 4px solid var(--c, var(--blue)); }
.dcard h1 { font-size: 1.5rem; margin: 6px 0 6px; line-height: 1.2; }
.dmeta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: .9rem; }
.dmeta .when { font-size: .84rem; }
.dactions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-2); }
textarea.big { min-height: 46vh; resize: vertical; line-height: 1.6; font-size: 1rem; border: 0; padding: 0; background: transparent; }
textarea.big:focus { outline: 0; }
.savestate { font-size: .8rem; color: var(--muted); min-height: 1.2em; font-family: var(--f-mono); }
.savestate.bad { color: var(--red); }
.title-input { font: 700 1.35rem/1.25 var(--f-display); letter-spacing: -.015em; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 4px 0 10px; margin-bottom: 12px; background: transparent; }
.title-input:focus { outline: 0; border-bottom-color: var(--blue); }
.conflict { background: var(--red-soft); border-radius: 10px; padding: 12px; margin-bottom: 12px; font-size: .92rem; }
.conflict .row { margin-top: 10px; }

/* ---------- poznámky ---------- */
.notes { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.note { display: flex; flex-direction: column; height: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px 16px; text-decoration: none; }
.note.pinned { border-top: 3px solid var(--blue); }
.note .ttl { font: 700 1.05rem/1.25 var(--f-display); letter-spacing: -.01em; }
.note .pv { color: var(--muted); font-size: .9rem; white-space: pre-line; margin: 6px 0 10px; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; flex: 1; }
.note .ft { display: flex; justify-content: space-between; font-family: var(--f-mono); font-size: .74rem; color: var(--faint); }
.note .ft .pin { color: var(--blue); font-family: var(--f-body); font-weight: 700; font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; }

/* ---------- nastavenia ---------- */
.subjects li { display: flex; gap: 6px; margin: 8px 0; }
.subjects input[type=color] { width: 44px; height: 44px; padding: 3px; flex: none; }
.code { width: 86px !important; flex: none; font-family: var(--f-mono); font-size: .9rem; }
.subjects li input:not(.code):not([type=color]), #addSubj input:not(.code) { flex: 1; width: auto; }
#pw { margin: 12px 0; } #pw input { flex: 1; width: auto; }

/* ---------- prihlásenie ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--blue); border-radius: 18px; box-shadow: var(--shadow); padding: 28px 24px; position: relative; overflow: hidden; }
.login img { width: 56px; height: 56px; }
.login h1 { margin: 14px 0 2px; font-size: 1.8rem; letter-spacing: -.025em; }
.login h1 em { font-style: normal; color: var(--blue); }
.login form { display: flex; flex-direction: column; gap: 14px; margin-top: 22px; }
.login .wm { position: absolute; right: -30px; top: -20px; width: 200px; color: var(--blue); opacity: .06; pointer-events: none; }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; z-index: 50; bottom: calc(88px + env(safe-area-inset-bottom));
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s;
  background: var(--fg); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: .92rem; font-weight: 600; max-width: 90vw;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--red); }

/* drobné opravy pre úzke displeje */
.tl-day { grid-template-columns: 50px 1fr; }
.badge { font-size: .56rem; padding: 4px 5px; letter-spacing: .04em; }
@media (max-width: 559px) {
  .fab { width: 56px; height: 56px; padding: 0; justify-content: center; border-radius: 18px; font-size: 0; gap: 0; }
  .fab svg { width: 24px; height: 24px; }
}

.hero .wm.lion { width: 240px; right: -30px; bottom: -22px; opacity: .055; }

/* ---------- spodná navigácia ---------- */
.appbar-in { padding-bottom: 10px; }
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; max-width: none; margin: 0;
  display: flex; justify-content: center; gap: 2px; overflow: visible;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -2px 14px rgba(16, 24, 40, .05);
}
.tabs[hidden] { display: none; }
.tabs a {
  flex: 1; max-width: 160px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 4px 2px 3px; border-radius: 12px; background: transparent; color: var(--muted);
  font-size: .72rem; font-weight: 600; text-decoration: none;
}
.tabs a .ic { display: grid; place-items: center; width: 58px; height: 30px; border-radius: 99px; transition: background .15s; }
.tabs a svg { width: 22px; height: 22px; }
.tabs a.on { background: transparent; color: var(--blue); font-weight: 700; }
.tabs a.on .ic { background: var(--blue); color: #fff; }
#app { padding-bottom: calc(160px + env(safe-area-inset-bottom)); }
.fab { bottom: calc(82px + env(safe-area-inset-bottom)); }
#toast { bottom: calc(150px + env(safe-area-inset-bottom)); }
