/* Drip: paleta z loga (krémová, piesková, béžová, šedé tóny, takmer čierna), tenký geometrický Jost na nadpisy a čísla.
   Rozloženie: tmavý bočný panel s navigáciou, obsah v kartách; tabuľky sú hlavný nástroj. */
:root {
  --bg: #eeebe4;           /* cream */
  --surface: #f8f6f2;
  --surface-2: #e9e4db;
  --text: #1b1918;         /* ink */
  --muted: #6f6a64;
  --border: #ddd6ca;
  --accent: #1b1918;
  --accent-hover: #2a2725; /* graphite */
  --accent-soft: #e3dccf;  /* sand */
  --on-accent: #eeebe4;
  --compare: #8c857c;      /* stone */
  --chart: #b07a4f;        /* crema */
  --chart-hover: #96643d;
  --sidebar: #1b1918;
  --sidebar-text: #eeebe4;
  --sidebar-muted: #8c857c;
  --sidebar-hover: rgba(238,235,228,.07);
  --sidebar-active: #2a2725;
  --good: #3d7552;
  --good-soft: #dde6da;
  --bad: #a8473a;
  --bad-soft: #f0ddd6;
  --warn: #9a6a24;
  --warn-soft: #efe2c9;
  --info: #5d5852;         /* ash */
  --toast: #1b1918;
  --toast-text: #eeebe4;
  --backdrop: rgba(27,25,24,.5);
  --font: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Jost", "Futura", "Avenir Next", "Helvetica Neue", sans-serif;
  --radius: 8px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161413; --surface: #201d1b; --surface-2: #2a2725; --text: #eeebe4; --muted: #a39b91; --border: #3a3633;
    --accent: #eeebe4; --accent-hover: #ffffff; --accent-soft: #34302c; --on-accent: #1b1918; --compare: #a39b91;
    --chart: #c9925f; --chart-hover: #dba774;
    --sidebar: #0f0e0d; --sidebar-text: #eeebe4; --sidebar-muted: #8c857c; --sidebar-hover: rgba(238,235,228,.06); --sidebar-active: #2a2725;
    --good: #86bd94; --good-soft: #223228; --bad: #e3907f; --bad-soft: #3e2622; --warn: #d9a95e; --warn-soft: #3a2f20; --info: #a39b91;
    --toast: #eeebe4; --toast-text: #1b1918; --backdrop: rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161413; --surface: #201d1b; --surface-2: #2a2725; --text: #eeebe4; --muted: #a39b91; --border: #3a3633;
  --accent: #eeebe4; --accent-hover: #ffffff; --accent-soft: #34302c; --on-accent: #1b1918; --compare: #a39b91;
  --chart: #c9925f; --chart-hover: #dba774;
  --sidebar: #0f0e0d; --sidebar-text: #eeebe4; --sidebar-muted: #8c857c; --sidebar-hover: rgba(238,235,228,.06); --sidebar-active: #2a2725;
  --good: #86bd94; --good-soft: #223228; --bad: #e3907f; --bad-soft: #3e2622; --warn: #d9a95e; --warn-soft: #3a2f20; --info: #a39b91;
  --toast: #eeebe4; --toast-text: #1b1918; --backdrop: rgba(0,0,0,.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0; display: flex; min-height: 100vh;
  font: 15px/1.45 var(--font); background: var(--bg); color: var(--text);
}
a { color: var(--accent); }

/* ---------- Bočný panel ---------- */
.sidebar {
  width: 216px; flex-shrink: 0; background: var(--sidebar); color: var(--sidebar-text);
  padding: 18px 12px; position: sticky; top: env(safe-area-inset-top, 0px); height: 100vh;
  display: flex; flex-direction: column;
}
/* Logo Drip: „drip“ tenkým písmom Jost, z nožičky „r“ kvapká kvapka (ako v logu a na webe) */
.brand { display: flex; flex-direction: column; align-items: flex-start; padding: 2px 12px 24px; }
.brand-word { font-family: "Jost", "Futura", "Avenir Next", var(--font); font-weight: 200; font-size: 44px; line-height: 1; letter-spacing: .03em; color: var(--sidebar-text); }
.brand-r { position: relative; }
/* predĺžená nožička „r“ pod účiarie, z ktorej visí kvapka */
.brand-r::before { content: ""; position: absolute; left: .101em; top: .86em; width: .042em; height: .2em; margin-left: -.021em; background: currentColor; border-radius: 0 0 50% 50%; }
.brand-drop {
  position: absolute; left: .101em; top: 1.03em; width: .11em; height: .165em; margin-left: -.055em;
  background: currentColor; transform-origin: 50% 0; animation: brand-drip 3.4s infinite;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 15'%3E%3Cpath d='M5 0C5.6 3 10 7.5 10 10.2A5 4.8 0 0 1 0 10.2C0 7.5 4.4 3 5 0Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 15'%3E%3Cpath d='M5 0C5.6 3 10 7.5 10 10.2A5 4.8 0 0 1 0 10.2C0 7.5 4.4 3 5 0Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.brand-sub { margin-top: 14px; font-family: "Jost", var(--font); font-weight: 300; font-size: 9.5px; letter-spacing: .34em; text-transform: uppercase; color: var(--sidebar-muted); }
@keyframes brand-drip {
  0% { translate: 0 0; scale: .3 0; opacity: 1; animation-timing-function: cubic-bezier(.3, .1, .4, 1); }
  58% { translate: 0 0; scale: 1 1; animation-timing-function: cubic-bezier(.6, 0, .9, .55); }
  72% { scale: .92 1.14; opacity: 1; }
  100% { translate: 0 .34em; scale: .86 1.2; opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .brand-drop { animation: none; } }
#nav a { display: block; padding: 7px 12px; border-radius: 8px; color: inherit; text-decoration: none; margin-bottom: 2px; }
#nav a:hover { background: var(--sidebar-hover); }
.nav-group { font-family: var(--font-display); font-size: 10px; text-transform: uppercase; letter-spacing: .28em; color: var(--sidebar-muted); padding: 14px 12px 4px; }
.sidebar { overflow-y: auto; }
#nav a.active { background: var(--sidebar-active); color: var(--sidebar-text); font-weight: 500; }
#nav a.active::before { content: ""; display: inline-block; width: 7px; height: 10px; margin: 0 8px 0 -2px; background: var(--sidebar-text); vertical-align: -1px;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 15'%3E%3Cpath d='M5 0C5.6 3 10 7.5 10 10.2A5 4.8 0 0 1 0 10.2C0 7.5 4.4 3 5 0Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 15'%3E%3Cpath d='M5 0C5.6 3 10 7.5 10 10.2A5 4.8 0 0 1 0 10.2C0 7.5 4.4 3 5 0Z'/%3E%3C/svg%3E") center / contain no-repeat; }
.sync { margin-top: auto; padding: 10px 12px 0; font-size: 12px; color: var(--sidebar-muted); }
.sync::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; background: var(--sidebar-muted); vertical-align: 1px; }
.sync.saved::before { background: var(--good); }
.sync.saving::before, .sync.loading::before { background: var(--warn); }
.sync.error::before { background: var(--bad); }

/* ---------- Obsah ---------- */
main {
  flex: 1; min-width: 0; padding-block: 22px 70px;
  padding-left: max(28px, env(safe-area-inset-left, 0px)); padding-right: max(28px, env(safe-area-inset-right, 0px));
}
h1 { margin: 0; font-family: var(--font-display); font-size: 32px; font-weight: 300; letter-spacing: -.005em; text-wrap: balance; }
h2 { font-family: var(--font-display); font-size: 18px; font-weight: 400; letter-spacing: .01em; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 18px 0 8px; color: var(--muted); }
p { margin: 0 0 10px; }
.small { font-size: 13px; }
.muted { color: var(--muted); }
.good { color: var(--good); } .bad { color: var(--bad); } .warn { color: var(--warn); }
.nowrap { white-space: nowrap; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.banner { background: var(--warn-soft); color: var(--text); border-radius: 8px; padding: 9px 14px; margin-bottom: 14px; font-size: 14px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar.tight { margin-bottom: 0; }
.toolbar .spacer, .modal-actions .spacer { flex: 1; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; min-width: 0; }
.card.narrow { max-width: 680px; }
.card.empty, .empty { color: var(--muted); padding: 22px; text-align: center; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.card-head select { width: auto; }
.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.dash { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; grid-auto-flow: row dense; align-items: start; }
.dash > .card { margin-bottom: 0; min-width: 0; }
.dash > .span-2 { grid-column: span 2; }
.dash-list { list-style: none; margin: 0 0 12px; padding: 0; }
.dash-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; background: var(--surface); }
.dash-item label.check { flex: 1; min-width: 0; }
.dash-item select { width: auto; padding: 3px 6px; font-size: 13px; }
.dash-move { display: flex; gap: 2px; }
.dash-edit h3 { margin-top: 0; }
.grid.wide-left { grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr); align-items: start; }

/* KPI dlaždice */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 13px 15px; min-width: 0; }
.kpi .label { color: var(--muted); font-family: var(--font-display); font-size: 10.5px; font-weight: 400; text-transform: uppercase; letter-spacing: .2em; }
.kpi .value { font-family: var(--font-display); font-size: 26px; font-weight: 300; margin-top: 4px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.kpi .sub .progress { margin: 6px 0 4px; }

.progress { height: 6px; border-radius: 6px; background: var(--accent-soft); overflow: hidden; min-width: 50px; }
.progress span { display: block; height: 100%; background: var(--chart); border-radius: 6px; }
.progress.ok span { background: var(--good); }
.mini { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
.mini .progress { width: 50px; }

/* Karty (záložky) */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tab { background: none; border: none; border-bottom: 1.5px solid transparent; padding: 9px 12px; font: 400 14.5px var(--font-display); letter-spacing: .02em; color: var(--muted); cursor: pointer; white-space: nowrap; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

/* Tabuľky */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-family: var(--font-display); font-size: 10.5px; text-transform: uppercase; letter-spacing: .16em; color: var(--muted); font-weight: 400; white-space: nowrap; }
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]:hover { color: var(--text); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tbody tr:last-child td { border-bottom: none; }
td:first-child { white-space: nowrap; }
tfoot td, tfoot th { border-top: 2px solid var(--border); border-bottom: none; font-weight: 600; background: var(--surface-2); }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }
tr.strong td { font-weight: 600; }
tr.total td { border-top: 2px solid var(--border); background: var(--surface-2); }
tr.muted-row td { color: var(--muted); font-size: 13px; }
tr.current td { background: var(--accent-soft); }
td.note { color: var(--muted); font-size: 13px; max-width: 260px; }
td.actions { text-align: right; white-space: nowrap; }
table.wide { min-width: 980px; }
table.sticky-first th:first-child, table.sticky-first td:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; }
table.sticky-first tfoot td:first-child, table.sticky-first tr.total td:first-child { background: var(--surface-2); }
table.sticky-first tr.current td:first-child { background: var(--accent-soft); }
table.plan th.grp { text-align: center; border-bottom: none; }
table.small-table { font-size: 12.5px; }
table.heatmap td { text-align: center; font-size: 12px; min-width: 42px; border: 1px solid var(--surface); }
table.heatmap th { text-align: center; }
table.calendar td { min-width: 34px; padding: 4px 2px; font-size: 11px; }
table.calendar td.we { font-weight: 600; }
tr.group td { background: var(--surface-2); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.chg { font-size: 13px; }
.scenarios td.num b { font-size: 15px; }
.done { text-decoration: line-through; color: var(--muted); }
.recipe-line { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.recipe-line select { flex: 3; } .recipe-line input { flex: 1; min-width: 70px; } .recipe-line .unit { width: 24px; }
.recipe-sum { margin: 12px 0; padding: 10px 12px; background: var(--surface-2); border-radius: 8px; font-size: 14px; }
.today-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; max-width: 760px; }
.today-grid .label { color: var(--muted); font-family: var(--font-display); font-size: 10.5px; text-transform: uppercase; letter-spacing: .2em; }
.today-grid .value { font-family: var(--font-display); font-size: 26px; font-weight: 300; font-variant-numeric: tabular-nums; }
.today-grid .sub { color: var(--muted); font-size: 12px; }
table.sens td { font-size: 12.5px; font-variant-numeric: tabular-nums; }
table.sens td.cur { outline: 2px solid var(--accent); outline-offset: -2px; font-weight: 700; }

/* Rozpis zmien */
table.roster td { vertical-align: top; min-width: 96px; }
table.roster th.today, table.roster td.today { background: var(--accent-soft); }
.shift { display: block; width: 100%; margin-bottom: 4px; padding: 3px 6px; border-radius: 6px; border: 1px solid var(--accent); background: var(--surface); color: var(--text); font: 12.5px var(--font); cursor: pointer; font-variant-numeric: tabular-nums; }
.shift:hover { background: var(--accent); color: var(--on-accent); }
.add-shift { width: 100%; border: 1px dashed var(--border); background: none; color: var(--muted); border-radius: 6px; cursor: pointer; padding: 1px; font: inherit; opacity: .55; }
.add-shift:hover { opacity: 1; border-color: var(--accent); color: var(--accent); }

/* Upozornenia a checklisty */
.alerts { list-style: none; margin: 0; padding: 0; }
.alerts li { padding: 7px 10px 7px 12px; border-left: 3px solid var(--muted); margin-bottom: 6px; background: var(--surface-2); border-radius: 0 6px 6px 0; font-size: 14px; }
.alerts li.bad { border-left-color: var(--bad); }
.alerts li.warn { border-left-color: var(--warn); }
.alerts li.info { border-left-color: var(--info); }
.alerts a { color: inherit; text-decoration: none; }
.alerts a:hover { text-decoration: underline; }
.checklist ul { list-style: none; padding: 0; margin: 12px 0; }
.checklist li { padding: 4px 0; }
.checklist .progress { margin-top: 4px; }

/* Ovládacie prvky */
.btn { border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 7px 15px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 14px; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 500; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 3px 9px; font-size: 13px; }
.btn.icon { padding: 5px 11px; font-size: 16px; line-height: 1; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.period-nav { display: flex; align-items: center; gap: 6px; }
.period-nav input { width: auto; }
.period-label { font-family: var(--font-display); font-size: 17px; font-weight: 400; min-width: 60px; text-align: center; font-variant-numeric: tabular-nums; }

input, select, textarea { font: inherit; font-size: 14px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); width: 100%; }
.toolbar input, .toolbar select { width: auto; }
.toolbar #cafe-name { flex: 1; min-width: 180px; }
textarea.mono { font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; }
input[type=checkbox] { width: auto; accent-color: var(--accent); }
label { display: block; font-size: 13px; color: var(--muted); }
label > input, label > select, label > textarea { margin-top: 4px; }
label.inline { display: flex; align-items: center; gap: 8px; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; cursor: pointer; }
label small { display: block; margin-top: 3px; font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.form-grid > * { grid-column: span 6; }
.form-grid > .half { grid-column: span 3; }
.form-grid > .third { grid-column: span 2; }

/* Grafy */
.chart svg { width: 100%; height: auto; display: block; }
.chart .bar { fill: var(--chart); }
.chart .bar:hover { fill: var(--chart-hover); }
.chart .cmp { stroke: var(--text); stroke-width: 2; opacity: .45; }
.chart text { font-size: 11px; fill: var(--muted); font-family: var(--font); }
.chart .grid-line { stroke: var(--border); }
.chart .line { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chart .s-main { stroke: var(--chart); }
.chart .s-raw { stroke: var(--chart); opacity: .3; stroke-width: 1.2; }
.chart .s-ly { stroke: var(--compare); opacity: .45; }
.chart .s-target { stroke: var(--text); opacity: .75; }
.chart .s-bep { stroke: var(--bad); }
.chart .dashed { stroke-dasharray: 6 5; }
.chart .hover-col { fill: transparent; }
.chart .hover-col:hover { fill: var(--accent-soft); opacity: .5; }
.lg-line { width: 18px; height: 0; border-top: 2.5px solid var(--chart); }
.lg-line.s-raw { border-color: var(--chart); opacity: .35; }
.lg-line.s-ly { border-color: var(--compare); opacity: .45; }
.lg-line.s-target { border-color: var(--text); opacity: .75; }
.lg-line.s-bep { border-color: var(--bad); }
.lg-line.dashed { border-top-style: dashed; }
.legend { flex-wrap: wrap; display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin: 4px 0 8px 56px; }
.legend i { display: inline-block; vertical-align: middle; margin-right: 6px; }
.lg-bar { width: 10px; height: 10px; background: var(--chart); border-radius: 2px; }
.lg-cmp { width: 14px; height: 2px; background: var(--text); opacity: .45; }

.badge { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; background: var(--accent-soft); color: var(--text); white-space: nowrap; }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.good { background: var(--good-soft); color: var(--good); }

.welcome { max-width: 620px; margin: 40px auto; }
.welcome h1 { margin-bottom: 12px; }
.import-result { margin-top: 10px; padding: 12px; background: var(--surface-2); border-radius: 8px; }

/* Dialóg */
dialog { border: none; border-radius: 12px; padding: 22px; width: min(560px, 94vw); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog.wide { width: min(820px, 94vw); }
dialog::backdrop { background: var(--backdrop); }
.modal-actions { display: flex; gap: 8px; margin-top: 6px; align-items: center; }

#toast {
  position: fixed; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%) translateY(100px);
  background: var(--toast); color: var(--toast-text); padding: 10px 18px; border-radius: 8px; transition: transform .25s, opacity .25s; z-index: 100; max-width: 90vw;
  opacity: 0; pointer-events: none;
}
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }

@media (max-width: 1100px) {
  .grid.wide-left { grid-template-columns: minmax(0, 1fr); }
}
.mobile-bar, .tabbar, .only-m { display: none; }
.shift { white-space: nowrap; }

/* ---------- Telefón: horná lišta s logom, spodná lišta s hlavnými sekciami ---------- */
@media (max-width: 860px) {
  body { flex-direction: column; }
  body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--sidebar); }
  .sidebar { display: none; }
  .mobile-bar {
    display: flex; align-items: center; gap: 12px; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 25;
    background: var(--sidebar); color: var(--sidebar-text); padding-block: 8px 12px;
    padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  }
  .brand-sm { font-size: 30px; }
  .mobile-title { flex: 1; min-width: 0; font-family: var(--font-display); font-size: 10.5px; letter-spacing: .26em; text-transform: uppercase; color: var(--sidebar-muted); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sync-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--sidebar-muted); flex-shrink: 0; }
  .sync-dot.saved { background: var(--good); } .sync-dot.saving, .sync-dot.loading { background: var(--warn); } .sync-dot.error { background: var(--bad); }

  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
    background: var(--sidebar); padding-top: 6px; padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
    padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px);
  }
  .tabbar a, .tabbar button {
    display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 0; border: 0; background: none;
    color: var(--sidebar-muted); text-decoration: none; font: 400 10.5px var(--font-display); letter-spacing: .04em; cursor: pointer;
  }
  .tabbar svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar .active { color: var(--sidebar-text); }
  .tabbar .tab-add { justify-self: center; width: 48px; height: 48px; border-radius: 50%; background: var(--sidebar-text); color: var(--sidebar); justify-content: center; margin-top: -14px; box-shadow: 0 4px 14px rgba(0,0,0,.35); }
  .tabbar .tab-add svg { width: 24px; height: 24px; stroke-width: 2; }

  main { padding-block: 14px calc(96px + env(safe-area-inset-bottom, 0px)); padding-left: max(14px, env(safe-area-inset-left, 0px)); padding-right: max(14px, env(safe-area-inset-right, 0px)); }
  #toast { bottom: calc(90px + env(safe-area-inset-bottom, 0px)); }

  h1 { font-size: 26px; }
  h2 { font-size: 16.5px; }
  .page-head { gap: 10px; margin-bottom: 12px; }
  .page-head > .toolbar, .page-head > .period-nav { width: 100%; }
  .period-nav { flex: 1; }
  .period-nav input { flex: 1; min-width: 0; }
  .banner { font-size: 13px; padding: 8px 12px; }
  .card { padding: 13px; margin-bottom: 12px; border-radius: 10px; }
  .grid, .dash { gap: 12px; }
  .grid.two, .grid.wide-left { grid-template-columns: minmax(0, 1fr); }
  .dash { grid-template-columns: minmax(0, 1fr); }
  .dash > .span-2 { grid-column: auto; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
  .kpi { padding: 10px 12px; }
  .kpi .label { font-size: 9.5px; letter-spacing: .14em; }
  .kpi .value { font-size: 21px; }
  .kpi .sub { font-size: 11.5px; }
  .today-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .today-grid .value { font-size: 20px; }
  .today-grid .label { font-size: 9px; letter-spacing: .12em; }
  .page-head h1 { display: none; }
  .page-head:not(:has(.toolbar, .period-nav)) { display: none; }
  .mobile-title { font-size: 11px; color: var(--sidebar-text); opacity: .75; }
  .page-head .toolbar.tight { flex-wrap: nowrap; }
  #dash-edit { padding: 6px 12px; font-size: 13px; }
  .tabs { margin-bottom: 12px; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { padding: 9px 10px; font-size: 14px; }
  table { font-size: 13px; }
  th, td { padding: 7px 7px; }
  .toolbar { gap: 6px; }
  .btn { padding: 8px 14px; }
  .btn.sm { padding: 5px 10px; }
  input, select, textarea { font-size: 16px; }   /* iPhone pri menšom písme priblíži obrazovku */
  .form-grid > .half, .form-grid > .third { grid-column: span 6; }

  /* Okná ako panel zospodu, tlačidlá vždy na dosah */
  dialog, dialog.wide {
    width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 16px 16px 0 0; padding: 18px 16px 0;
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 24px); overflow-y: auto;
  }
  dialog[open] { animation: sheet-up .22s ease-out; }
  .modal-actions {
    position: sticky; bottom: 0; background: var(--surface); margin: 8px -16px 0; padding: 10px 16px max(12px, env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border);
  }
  .more-menu { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .more-group { grid-column: 1 / -1; font-family: var(--font-display); font-size: 10px; letter-spacing: .26em; text-transform: uppercase; color: var(--muted); margin-top: 8px; }
  .more-link { display: block; padding: 12px; border-radius: 10px; background: var(--surface-2); color: var(--text); text-decoration: none; font-size: 15px; }
  .more-link.active { background: var(--accent); color: var(--on-accent); }
  .welcome { margin: 16px auto; }
  .hide-m { display: none !important; }
  .only-m { display: block; }
  .period-label { font-size: 15px; white-space: nowrap; min-width: 0; }
  .period-nav input[type=month] { width: 0; }
  .roster-day { padding: 10px 0; border-bottom: 1px solid var(--border); }
  .roster-day:last-child { border-bottom: 0; }
  .roster-day.today { background: var(--accent-soft); margin: 0 -13px; padding: 10px 13px; }
  .roster-day-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
  .roster-shift { display: flex; justify-content: space-between; width: 100%; padding: 9px 11px; margin-bottom: 5px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: 14px var(--font); cursor: pointer; font-variant-numeric: tabular-nums; }
  .roster-day .add-shift { padding: 7px; font-size: 13px; }
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { dialog[open] { animation: none; } }
.welcome.login form { max-width: 440px; }
