/* Týždenný rozvrh – vzhľad na obrazovke.
   Čistý moderný dizajn: bočný panel, pastelové karty predmetov, svetlý aj tmavý režim.
   Písmo Lexend (navrhnuté pre ľahšie čítanie), žiadne animácie ani prechody. */

@font-face {
  font-family: 'Lexend';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url(../fonts/lexend-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Lexend';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url(../fonts/lexend-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- farby a rozmery (svetlý a tmavý režim) ---------- */

:root {
  --bg: #F7F8FC;
  --side: #F0F2F8;
  --surface: #FFFFFF;
  --surface-2: #F7F8FC;
  --ink: #243047;
  --ink-2: #5B6478;
  --ink-3: #8A93A6;
  --on-ink: #FFFFFF;
  --border: #E6E9F0;
  --border-strong: #CDD3DF;
  --line: #ECEFF5;
  --line-soft: #F4F5F9;
  --accent: #4059D9;
  --accent-hover: #3247B8;
  --accent-soft: #DDE8FF;
  --today-col: #F6F8FF;
  --now: #E5484D;
  --danger: #C62828;
  --danger-soft: #FDECEC;
  --danger-line: #F3C0C0;
  --ok: #2F9E44;
  --warn: #E8A33D;
  --radius-s: 10px;
  --radius: 14px;
  --radius-l: 20px;
  --shadow: 0 1px 2px rgba(36, 48, 71, .05), 0 4px 16px rgba(36, 48, 71, .05);
  --shadow-l: 0 16px 48px rgba(20, 27, 45, .22);
  --side-w: 17rem;
  --time-col: 3.8rem;
  --pad: 10px;           /* okraj nad prvou a pod poslednou hodinou (GRID_PAD v app.js) */
  --ppm: 1.4;            /* pixely na minútu – výška rozvrhu */
  color-scheme: light;
  font-size: 17px;
}
html[data-font="large"]  { font-size: 20px; --ppm: 1.8; }
html[data-font="xlarge"] { font-size: 24px; --ppm: 2.2; }

html[data-theme="dark"] {
  --bg: #11151F;
  --side: #161B26;
  --surface: #1B2130;
  --surface-2: #202738;
  --ink: #E7EAF2;
  --ink-2: #AAB2C5;
  --ink-3: #7D869B;
  --on-ink: #11151F;
  --border: #2A3142;
  --border-strong: #3A4357;
  --line: #262D3D;
  --line-soft: #1F2533;
  --accent: #8A9CFF;
  --accent-hover: #A3B1FF;
  --accent-soft: #263052;
  --today-col: #1A2133;
  --now: #FF6B6F;
  --danger: #FF8A80;
  --danger-soft: #3A1E22;
  --danger-line: #5C2A2F;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-l: 0 16px 48px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
/* Žiadne animácie ani prechody – pokojné a predvídateľné rozhranie. */
* { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Lexend, "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { letter-spacing: -.01em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.ico { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }
.print-only { display: none; }
.mobile-only { display: none !important; }

/* ---------- tlačidlá a prepínače ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  min-height: 2.6rem;
  padding: .4rem 1rem;
  font: inherit;
  font-size: .95rem;
  font-weight: 500;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-s);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { color: #fff; background: var(--accent); border-color: var(--accent); font-weight: 600; }
html[data-theme="dark"] .btn.primary { color: #11151F; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--line-soft); color: var(--ink); }
.btn.wide { width: 100%; min-height: 2.9rem; }
.btn.danger { color: var(--danger); border-color: var(--danger-line); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.danger-solid { color: #fff; background: #C62828; border-color: #C62828; }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn:disabled:hover { background: transparent; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  color: var(--ink-2);
  background: transparent;
  border: 0;
  border-radius: var(--radius-s);
  cursor: pointer;
}
.icon-btn:hover { background: var(--line-soft); color: var(--ink); }

.segmented {
  display: inline-flex;
  padding: 4px;
  background: var(--line);
  border-radius: 12px;
}
.segmented button {
  min-height: 2.3rem;
  min-width: 5rem;
  padding: .3rem 1rem;
  font: inherit;
  font-size: .95rem;
  font-weight: 500;
  color: var(--ink-2);
  background: transparent;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
}
.segmented button:hover { color: var(--ink); }
.segmented button[aria-pressed="true"] {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(20, 27, 45, .14);
  font-weight: 600;
}

.check { display: flex; align-items: center; gap: .55rem; margin: .4rem 0; cursor: pointer; }
.check input { width: 1.2rem; height: 1.2rem; margin: 0; accent-color: var(--accent); }

/* Štítok osoby: farebná bodka + meno */
.who { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; }
.who-dot {
  flex: none;
  width: .55rem;
  height: .55rem;
  background: var(--p);
  border-radius: 50%;
}

/* ---------- rozloženie: bočný panel + hlavná časť ---------- */

.app {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  height: 100vh;
  padding: 1.25rem 1rem 1rem;
  overflow-y: auto;
  background: var(--side);
  border-right: 1px solid var(--border);
}

.side-brand { display: flex; align-items: center; gap: .75rem; }
.brand-logo {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.75rem;
  height: 2.75rem;
  font-size: 1.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.brand-text { flex: 1; min-width: 0; }
.date-line { color: var(--ink-3); font-size: .78rem; }
.side-brand h1 { margin: 0; font-size: 1.15rem; font-weight: 700; line-height: 1.2; }

.side-section { display: flex; flex-direction: column; gap: .5rem; }
.side-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  padding: 0;
  font: inherit;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: none;
  border: 0;
}
.side-title.toggle { width: 100%; cursor: pointer; }
.side-title.toggle:hover { color: var(--ink); }
.side-title[aria-expanded="false"] .chevron { transform: rotate(-90deg); }
.hint { margin: 0; color: var(--ink-3); font-size: .8rem; }

.who-filter { display: flex; flex-direction: column; gap: .1rem; }
.who-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  min-height: 2.2rem;
  padding: .15rem .4rem;
  border-radius: 8px;
  cursor: pointer;
}
.who-row:hover { background: var(--line); }
.who-row input {
  appearance: none;
  display: grid;
  place-items: center;
  flex: none;
  width: 1.15rem;
  height: 1.15rem;
  margin: 0;
  border: 2px solid var(--p);
  border-radius: 5px;
  cursor: pointer;
}
.who-row input:checked { background: var(--p); }
.who-row input:checked::after { content: "✓"; color: #fff; font-size: .75rem; font-weight: 700; line-height: 1; }
.who-name { flex: 1; font-weight: 500; }
.who-count { color: var(--ink-3); font-size: .8rem; font-variant-numeric: tabular-nums; }

/* Zoznam predmetov sa posúva vo vnútri panela, aby boli Tlačiť a Nastavenia vždy vidno. */
.side-section.palette { flex: 1 1 0; min-height: 9rem; }
#palette-body { display: flex; flex-direction: column; gap: .4rem; flex: 1; min-height: 0; }
.palette-list { display: flex; flex-direction: column; gap: .2rem; flex: 1; min-height: 0; overflow-y: auto; margin: 0 -.3rem; padding: 0 .3rem; }
.pal-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  width: 100%;
  min-height: 2.5rem;
  padding: .25rem .6rem .25rem .3rem;
  font: inherit;
  font-size: .9rem;
  font-weight: 500;
  text-align: left;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-s);
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.pal-item:hover { background: var(--surface); border-color: var(--border); }
.pal-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 2rem;
  height: 2rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--fg);
  background: var(--soft);
  border-radius: 9px;
}
.pal-item[aria-pressed="true"] { background: var(--soft); border-color: var(--c); }
.pal-item[aria-pressed="true"]::after { content: "✓"; margin-left: auto; font-weight: 700; color: var(--fg); }

.side-footer { display: flex; flex-direction: column; gap: .6rem; margin-top: auto; padding-top: .5rem; }
.side-nav { display: flex; flex-direction: column; }
.side-nav button {
  display: flex;
  align-items: center;
  gap: .7rem;
  min-height: 2.5rem;
  padding: .3rem .5rem;
  font: inherit;
  font-size: .95rem;
  color: var(--ink-2);
  text-align: left;
  background: none;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
.side-nav button:hover { color: var(--ink); background: var(--line); }

.sync-pill {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: .45rem;
  padding: .25rem .7rem;
  font-size: .78rem;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.sync-pill .dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--ink-3); }
.sync-pill[data-status="saved"] .dot { background: var(--ok); }
.sync-pill[data-status="saving"] .dot,
.sync-pill[data-status="offline"] .dot { background: var(--warn); }
.sync-pill[data-status="error"] { color: var(--danger); background: var(--danger-soft); border-color: var(--danger-line); }
.sync-pill[data-status="error"] .dot { background: var(--danger); }

.side-backdrop { display: none; }

.main { min-width: 0; padding: 1.25rem 1.5rem 2.5rem; }

.main-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem 1.25rem;
  margin-bottom: 1.1rem;
}
.title-block { margin-right: auto; }
.kicker {
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
}
.range-title { margin: 0; font-size: 1.75rem; font-weight: 700; line-height: 1.15; }

/* ---------- Teraz / Potom ---------- */

.now-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: .9rem;
  margin-bottom: 1.1rem;
}
.now-tile {
  display: flex;
  align-items: center;
  gap: .9rem;
  padding: .9rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 6px solid var(--c, var(--border-strong));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.now-tile.is-now { background: var(--soft, var(--surface)); border-color: var(--edge, var(--border)); border-left-color: var(--c, var(--border-strong)); }
.now-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 3rem;
  height: 3rem;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--fg, var(--ink));
  background: var(--surface);
  border-radius: 12px;
}
.now-tile:not(.is-now) .now-icon { background: var(--soft, var(--line-soft)); }
.now-body { flex: 1; min-width: 0; }
.now-label {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.now-title { font-size: 1.3rem; font-weight: 700; line-height: 1.2; color: var(--fg, var(--ink)); }
.now-meta { color: var(--ink-2); font-size: .9rem; }
.now-meta strong { color: var(--ink); }
.progress { height: .45rem; margin-top: .45rem; background: rgba(127, 127, 127, .18); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--c, var(--accent)); border-radius: 999px; }

.who-badge {
  flex: none;
  align-self: center;
  padding: .3rem .7rem;
  font-size: .82rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}

/* ---------- oznámenia ---------- */

.mode-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem 1rem;
  margin-bottom: 1rem;
  padding: .75rem 1rem;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
}
.mode-banner p { margin: 0; flex: 1; }

.notices { display: flex; flex-direction: column; gap: .5rem; }
.notices:not(:empty) { margin-bottom: 1rem; }
.notice {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: 0;
  padding: .55rem .6rem .55rem 1rem;
  font-size: .92rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--warn);
  border-radius: var(--radius-s);
}
.notice span { flex: 1; }
.notice.error { border-left-color: var(--danger); }
.notice.info { border-left-color: var(--accent); }

.empty-hint {
  margin: 0 0 1rem;
  padding: .9rem 1.1rem;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}

/* ---------- týždenný rozvrh ---------- */

.week-view {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.grid-scroll { overflow-x: auto; }

.grid {
  display: grid;
  grid-template-columns: var(--time-col) repeat(var(--days), minmax(8.5rem, 1fr));
}

.corner, .day-head { border-bottom: 1px solid var(--border); }
.day-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .1rem;
  padding: .7rem .4rem .6rem;
}
.day-name {
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.day-num {
  display: grid;
  place-items: center;
  min-width: 2.3rem;
  height: 2.3rem;
  padding: 0 .3rem;
  font-size: 1.3rem;
  font-weight: 700;
  border-radius: 999px;
}
.day-full { display: none; }
.day-head.today .day-name { color: var(--accent); }
.day-head.today .day-num { color: #fff; background: var(--accent); }
html[data-theme="dark"] .day-head.today .day-num { color: #11151F; }

.time-col, .day-col {
  position: relative;
  height: calc(var(--total) * var(--ppm) * 1px + 2 * var(--pad));
}
.day-col { border-left: 1px solid var(--line); cursor: pointer; }
.day-col.today { background: var(--today-col); }
.grid.stamp-mode .day-col { cursor: copy; }
.grid.stamp-mode .day-col:hover { background: var(--accent-soft); }

.hour-line, .hour-label, .block, .now-line {
  position: absolute;
  top: calc(var(--s) * var(--ppm) * 1px + var(--pad));
}

.hour-line { left: 0; right: 0; border-top: 1px solid var(--line); pointer-events: none; }
.hour-line.half { border-top: 1px dashed var(--line-soft); }

.hour-label {
  right: .55rem;
  transform: translateY(-50%);
  font-size: .78rem;
  font-weight: 500;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* ---------- bloky hodín ---------- */

.block {
  top: calc(var(--s) * var(--ppm) * 1px + var(--pad) + 2px);
  height: calc(var(--d) * var(--ppm) * 1px - 4px);
  left: calc(var(--lane, 0) * 100% / var(--lanes, 1) + 4px);
  width: calc(100% / var(--lanes, 1) - 8px);
  display: flex;
  flex-direction: column;
  gap: .1rem;
  padding: .3rem .5rem .35rem .6rem;
  color: var(--ink);
  background: var(--soft);
  border-left: 4px solid var(--c);
  border-radius: 10px;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
  z-index: 1;
}
.block:hover { box-shadow: 0 2px 10px rgba(20, 27, 45, .12); }
.b-head { display: flex; align-items: flex-start; gap: .35rem; }
.b-icon { flex: none; font-size: 1rem; line-height: 1.2; }
.b-title { font-weight: 700; font-size: .92rem; line-height: 1.2; color: var(--fg); overflow-wrap: anywhere; }
.b-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0 .6rem; font-size: .76rem; color: var(--ink-2); }
.b-clock { display: inline-flex; align-items: center; gap: .25rem; font-variant-numeric: tabular-nums; }
.b-clock .ico { width: .9em; height: .9em; opacity: .7; }
.b-who { font-weight: 500; }
.b-note { margin-top: .1rem; font-size: .75rem; color: var(--ink-2); overflow-wrap: anywhere; }
.b-note::before { content: "✎ "; }

.block.compact { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0 .5rem; padding-top: .1rem; padding-bottom: .1rem; }
.block.compact .b-note { display: none; }

.resize { position: absolute; left: 0; right: 0; bottom: 0; height: .7rem; cursor: ns-resize; }
.resize::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 3px;
  width: 1.8rem;
  height: 4px;
  margin-left: -.9rem;
  background: var(--c);
  border-radius: 999px;
  opacity: 0;
}
.block:hover .resize::after, .block:focus-visible .resize::after { opacity: .6; }
body.readonly .resize { display: none; }
body.readonly .block, body.readonly .day-col { cursor: default; }

.block.is-dragging { z-index: 5; box-shadow: var(--shadow-l); outline: 2px dashed var(--c); }
.block.preview { opacity: .75; outline: 2px dashed var(--c); pointer-events: none; z-index: 5; }
.block.past { opacity: .3; filter: grayscale(.7); }
.block.current { z-index: 2; box-shadow: 0 0 0 2px var(--c), 0 4px 14px rgba(20, 27, 45, .15); }

.b-badge {
  position: absolute;
  top: .3rem;
  right: .3rem;
  padding: .05rem .4rem;
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .05em;
  color: #fff;
  background: var(--c);
  border-radius: 999px;
}
.b-badge.next { color: var(--fg); background: var(--surface); border: 1px solid var(--c); }
.block.badged .b-head { padding-right: 3.4rem; }

.now-line {
  left: 0;
  right: 0;
  border-top: 2px solid var(--now);
  z-index: 0;            /* pod blokmi, aby neprekrývala text */
  pointer-events: none;
}
.now-line::before {
  content: "";
  position: absolute;
  left: -1px;
  top: -6px;
  width: 10px;
  height: 10px;
  background: var(--now);
  border-radius: 50%;
}

body.dragging, body.dragging * { cursor: grabbing !important; user-select: none !important; }

/* ---------- pohľad „Deň“ ---------- */

.day-view { max-width: 50rem; }

.day-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(3.2rem, 1fr));
  gap: .35rem;
  margin-bottom: 1.1rem;
  padding: .5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.day-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .05rem;
  padding: .45rem .2rem .4rem;
  font: inherit;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
}
.day-tab:hover { background: var(--line-soft); }
.dt-name { font-size: .78rem; color: var(--ink-3); }
.dt-num { font-size: 1.25rem; font-weight: 700; }
.dt-dot { width: .38rem; height: .38rem; background: var(--accent); border-radius: 50%; }
.day-tab.is-today .dt-name, .day-tab.is-today .dt-num { color: var(--accent); }
.day-tab[aria-pressed="true"] { background: var(--ink); }
.day-tab[aria-pressed="true"] .dt-name,
.day-tab[aria-pressed="true"] .dt-num { color: var(--on-ink); }
.day-tab[aria-pressed="true"] .dt-dot { background: var(--on-ink); }

.day-list { display: flex; flex-direction: column; gap: .5rem; }
.dcard {
  display: grid;
  grid-template-columns: 3.6rem minmax(0, 1fr);
  align-items: center;
  gap: .8rem;
  cursor: pointer;
}
body.readonly .dcard { cursor: default; }
.dcard-time { text-align: right; font-variant-numeric: tabular-nums; line-height: 1.2; }
.dcard-time strong { display: block; font-size: 1.05rem; }
.dcard-time span { color: var(--ink-3); font-size: .8rem; }
.dcard-pill {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .75rem .9rem .75rem .75rem;
  background: var(--soft);
  border-left: 5px solid var(--c);
  border-radius: var(--radius);
}
.dcard-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.7rem;
  height: 2.7rem;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--fg);
  background: var(--surface);
  border-radius: 12px;
}
.dcard-body { flex: 1; min-width: 0; }
.dcard-title { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; font-size: 1.1rem; font-weight: 700; line-height: 1.25; color: var(--fg); }
.dcard-sub { color: var(--ink-2); font-size: .85rem; }
.dcard-note { margin-top: .15rem; color: var(--ink-2); font-size: .88rem; }
.dcard-note::before { content: "✎ "; }
.dcard-badge {
  padding: .1rem .55rem;
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .05em;
  color: #fff;
  background: var(--c);
  border-radius: 999px;
}
.dcard-badge.next { color: var(--fg); background: var(--surface); border: 1px solid var(--c); }
.dcard.current .dcard-pill { box-shadow: 0 0 0 2px var(--c), var(--shadow); }
.dcard.past { opacity: .28; }
.dcard.past .dcard-pill { filter: grayscale(.7); }
.dcard.past .dcard-title::after { content: "✓"; color: var(--ok); }

.gap-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding-left: 4.4rem;
  color: var(--ink-3);
  font-size: .8rem;
}
.gap-row::after { content: ""; flex: 1; border-top: 1px dashed var(--border-strong); }

.day-empty {
  padding: 2rem;
  text-align: center;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-l);
}
.day-add { margin: 1rem 0 0 4.4rem; }

.fab {
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  z-index: 20;
  display: grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  font-size: 1.4rem;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 18px;
  box-shadow: var(--shadow-l);
  cursor: pointer;
}

/* ---------- režim len na prezeranie ---------- */

body.readonly .edit-only { display: none !important; }

/* ---------- dialógy ---------- */

dialog {
  width: min(40rem, calc(100vw - 1.5rem));
  max-height: calc(100vh - 1.5rem);
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  border: 0;
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-l);
}
dialog.small { width: min(28rem, calc(100vw - 1.5rem)); }
dialog::backdrop { background: rgba(10, 14, 24, .5); }
dialog form { display: flex; flex-direction: column; max-height: calc(100vh - 1.5rem); }

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.1rem .4rem 1.5rem;
}
.dialog-head h2 { margin: 0; font-size: 1.35rem; }
.dialog-body { padding: .6rem 1.5rem 1rem; overflow: auto; }
.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .6rem;
  padding: .9rem 1.5rem;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
}
.dialog-actions.inline { padding: 0; background: none; border: 0; margin: .4rem 0 0; }
.spacer { flex: 1; }

.settings-section { padding: 1rem 0; border-bottom: 1px solid var(--border); }
.settings-section:first-child { padding-top: 0; }
.settings-section:last-child { border-bottom: 0; }
.settings-section h3 { margin: 0 0 .6rem; font-size: 1.05rem; }

.field {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  min-width: 0;
  margin: 0 0 1rem;
  padding: 0;
  border: 0;
  font-weight: 600;
  font-size: .95rem;
}
fieldset.field { display: block; }
fieldset.field legend { padding: 0; margin-bottom: .45rem; }

.field input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
.field textarea {
  width: 100%;
  padding: .6rem .8rem;
  font: inherit;
  font-weight: 400;
  font-size: 1rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-s);
}
.field input:focus, .field textarea:focus { outline: 3px solid var(--accent-soft); border-color: var(--accent); }

.row { display: flex; flex-wrap: wrap; gap: 1rem; }
.row .field { flex: 1 1 9rem; }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chips label, .chips .chip {
  display: inline-flex;
  align-items: center;
  min-height: 2.4rem;
  padding: .3rem .9rem;
  font: inherit;
  font-weight: 500;
  font-size: .92rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  cursor: pointer;
}
.chips label:hover, .chips .chip:hover { background: var(--surface-2); }
.chips input { position: absolute; opacity: 0; pointer-events: none; }
.chips label:has(input:checked) { color: var(--on-ink); background: var(--ink); border-color: var(--ink); }
.chips label:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.chips .chip[aria-pressed="true"] { color: var(--on-ink); background: var(--ink); border-color: var(--ink); }
.chips.small .chip { min-height: 2rem; padding: .15rem .7rem; font-size: .85rem; }

.duration-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: -.4rem 0 1.1rem; }

.swatches { display: flex; flex-wrap: wrap; gap: .5rem; }
.swatch {
  display: grid;
  place-items: center;
  width: 2.3rem;
  height: 2.3rem;
  padding: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--fg);
  background: var(--c);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--c); }

.custom-color { display: inline-flex; align-items: center; gap: .5rem; margin-top: .7rem; font-weight: 400; font-size: .9rem; }
.custom-color input { width: 2.8rem; height: 2rem; padding: 0; border: 1px solid var(--border-strong); border-radius: 6px; background: none; }

.icon-grid { display: flex; flex-wrap: wrap; gap: .35rem; }
.icon-opt {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  font: inherit;
  font-size: 1.3rem;
  color: var(--ink-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}
.icon-opt:hover { background: var(--surface-2); }
.icon-opt.none { font-size: .7rem; font-weight: 600; }
.icon-opt[aria-pressed="true"] { background: var(--accent-soft); border: 2px solid var(--accent); color: var(--ink); }

.error {
  margin: .5rem 0 0;
  padding: .6rem .9rem;
  font-weight: 600;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid var(--danger-line);
  border-radius: var(--radius-s);
}

.info-note {
  margin: .5rem 0 0;
  padding: .6rem .9rem;
  font-weight: 500;
  color: var(--ink);
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--radius-s);
}

.muted { color: var(--ink-2); font-weight: 400; font-size: .88rem; }
.confirm-text { margin: .8rem 0 0; font-size: 1.1rem; }

.tpl-list { list-style: none; margin: 0 0 .8rem; padding: 0; display: flex; flex-direction: column; gap: .35rem; }
.tpl-list li {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .3rem .4rem .3rem .3rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
}
.tpl-list .btn { margin-left: auto; min-height: 2rem; padding: .15rem .75rem; font-size: .82rem; }
.tpl-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 1.9rem;
  height: 1.9rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--fg);
  background: var(--soft);
  border-radius: 7px;
  box-shadow: inset 4px 0 0 var(--c);
}


.muted-who { margin-left: .5rem; color: var(--ink-3); font-size: .82rem; }

/* ---------- tablet ---------- */

@media (max-width: 1100px) {
  :root { --side-w: 15rem; }
  .main { padding: 1rem; }
}

/* ---------- mobil: bočný panel sa vysúva, prednosť má pohľad „Deň“ ---------- */

@media (max-width: 760px) {
  .mobile-only { display: revert !important; }
  .hide-narrow { display: none; }
  .app { grid-template-columns: minmax(0, 1fr); }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    width: min(20rem, 86vw);
    transform: translateX(-105%);
    box-shadow: var(--shadow-l);
  }
  body.side-open .sidebar { transform: none; }
  .side-backdrop { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(10, 14, 24, .45); }

  .main { padding: .75rem .75rem 6rem; }
  .main-head { gap: .5rem .6rem; margin-bottom: .8rem; }
  .main-head .view-switch { order: 3; width: 100%; }
  .main-head .view-switch button { flex: 1; }
  .range-title { font-size: 1.35rem; }

  .now-card { grid-template-columns: minmax(0, 1fr); gap: .6rem; margin-bottom: .8rem; }
  .now-tile { padding: .75rem .85rem; }
  .now-title { font-size: 1.15rem; }

  .day-strip { padding: .35rem; gap: .2rem; }
  .dcard { grid-template-columns: 3rem minmax(0, 1fr); gap: .55rem; }
  .dcard-pill { padding: .65rem .7rem; gap: .6rem; }
  .dcard-icon { width: 2.3rem; height: 2.3rem; font-size: 1.2rem; }
  .who-badge { padding: .2rem .55rem; font-size: .75rem; }
  .gap-row { padding-left: 3.6rem; }
  .day-add { margin-left: 3.6rem; }

  .grid { grid-template-columns: var(--time-col) repeat(var(--days), minmax(7.5rem, 1fr)); }
}
