:root {
  --bg: #f4f1ea;
  --surface: #fffdf8;
  --surface-2: #f9f6ef;
  --ink: #1e2330;
  --muted: #6c7180;
  --line: #e3ddd1;
  --accent: #1f5f5b;
  --accent-ink: #ffffff;
  --today: #c8442b;

  --cd: #4a3fb0;
  --ranni: #b9680a;
  --odpo: #0e7868;

  --w-komunal: #7b8089;
  --w-bio: #8b5a2b;
  --w-plast: #dfae00;
  --w-papir: #2f6fd0;

  --radius: 16px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171d;
    --surface: #1c2028;
    --surface-2: #232832;
    --ink: #eceef2;
    --muted: #9aa0ad;
    --line: #2f3541;
    --accent: #58b3a8;
    --accent-ink: #0d1a19;
    --today: #ff7a5c;
    --cd: #9d94ff;
    --ranni: #f0a440;
    --odpo: #46c7b3;
    --w-komunal: #9ba1ab;
    --w-bio: #b98350;
    --w-plast: #f0c419;
    --w-papir: #6aa0f5;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- aplikace ---------- */
.app { height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; background: var(--bg); }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px 4px; }
.brand { font-weight: 700; letter-spacing: .02em; font-size: 15px; color: var(--accent); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 14px;
}
main { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.screen { padding: 8px 16px 24px; display: none; }
.app[data-tab="today"] #today, .app[data-tab="month"] #month { display: block; }

.tabbar { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar a { text-decoration: none; padding: 10px 0 12px; display: grid; justify-items: center; gap: 2px; font-size: 12px; color: var(--muted); }
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a.active { color: var(--accent); font-weight: 600; }

h1 { font-size: 26px; line-height: 1.15; margin: 8px 0 2px; letter-spacing: -.01em; }
.sub { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 22px 0 8px; font-weight: 600; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }

/* dnešek */
.today-card { padding: 6px; display: grid; gap: 6px; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.item .bar { width: 5px; align-self: stretch; border-radius: 3px; background: var(--c, var(--muted)); }
.item .t { font-weight: 600; }
.item .d { color: var(--muted); font-size: 14px; }
.item.shift { background: color-mix(in srgb, var(--c) 12%, var(--surface)); }
.item .time { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--c); white-space: nowrap; }
.empty { padding: 14px 12px; color: var(--muted); }

/* týden */
.week { overflow: hidden; }
.day-row { display: grid; grid-template-columns: 56px 1fr; gap: 10px; align-items: center; width: 100%; text-align: left; padding: 11px 14px; min-height: 56px; }
.day-row + .day-row { border-top: 1px solid var(--line); }
.day-row .dow { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.day-row .num { font-size: 20px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.day-row.weekend .num { color: var(--today); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 13px; background: var(--surface-2); border: 1px solid var(--line); }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.chip.shift { background: color-mix(in srgb, var(--c) 14%, var(--surface)); border-color: color-mix(in srgb, var(--c) 35%, var(--surface)); color: var(--c); font-weight: 700; }
.chip.shift small { font-weight: 500; font-size: 12px; opacity: .85; }
.free { color: var(--muted); font-size: 13px; }

/* měsíc */
.month-head { display: flex; align-items: center; gap: 6px; margin: 8px 0 12px; }
.month-head h1 { margin: 0; flex: 1; font-size: 22px; text-transform: capitalize; }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; background: var(--surface); border: 1px solid var(--line); }
.pill-btn { height: 44px; padding: 0 16px; border-radius: 12px; background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.dows, .grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.dows span { text-align: center; font-size: 12px; color: var(--muted); padding: 4px 0; letter-spacing: .06em; text-transform: uppercase; }
.cell {
  position: relative; aspect-ratio: 1 / 1.2; border-radius: 10px; background: var(--surface); border: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: stretch; padding: 5px 4px 4px; text-align: left; min-width: 0;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.cell.blank { visibility: hidden; }
.cell .n { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; padding-left: 2px; }
.cell.weekend .n { color: var(--today); }
.cell.is-today { border-color: var(--today); box-shadow: inset 0 0 0 1px var(--today); }
.cell.selected { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.cell .sh {
  margin-top: 3px; border-radius: 6px; text-align: center; font-size: 12px; font-weight: 700; padding: 3px 0;
  background: color-mix(in srgb, var(--c) 16%, var(--surface)); color: var(--c);
}
.cell .sh .full { display: none; }
.cell .ev { position: absolute; top: 7px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--ink); }
.cell .waste { margin-top: auto; display: flex; gap: 2px; }
.cell .waste i { flex: 1; height: 5px; border-radius: 3px; background: var(--c); }
.cell:active { transform: scale(.96); }
.app[data-edit="1"] .cell { border-style: dashed; }
.app[data-edit="1"] .cell:has(.sh) { border-style: solid; border-color: color-mix(in srgb, var(--c) 50%, var(--line)); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 12px 2px 0; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 5px; border-radius: 3px; background: var(--c); }

.detail { margin-top: 14px; padding: 6px; }
.detail h3 { margin: 8px 10px 6px; font-size: 15px; }
.detail .today-card { padding: 0; }

.palette {
  position: sticky; bottom: 0; margin: 14px -16px -24px; padding: 12px 16px 14px;
  background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(0,0,0,.08);
}
.app[data-tab="month"] #month { display: flex; flex-direction: column; min-height: 100%; }
.app[data-edit="1"] .legend { margin-bottom: 14px; }
.palette { margin-top: auto; }
.palette p { margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.types { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.type {
  min-height: 56px; border-radius: 12px; padding: 6px 4px; display: grid; place-content: center; gap: 1px; text-align: center;
  border: 2px solid color-mix(in srgb, var(--c) 35%, var(--surface)); color: var(--c); background: color-mix(in srgb, var(--c) 8%, var(--surface));
}
.type b { font-size: 15px; }
.type small { font-size: 11px; opacity: .85; font-variant-numeric: tabular-nums; }
.type[aria-pressed="true"] { background: var(--c); color: var(--surface); border-color: var(--c); }
.pal-actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.pal-actions .count { flex: 1; font-size: 13px; color: var(--muted); }
.ghost { height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); font-weight: 600; }
.ghost:disabled { opacity: .4; cursor: default; }
[hidden] { display: none !important; }

/* ---------- notebook: obě části vedle sebe ---------- */
@media (min-width: 900px) {
  .app { grid-template-rows: auto 1fr; }
  .topbar { padding: 16px 32px 8px; }
  .brand { font-size: 18px; }
  .tabbar { display: none; }
  main { display: grid; grid-template-columns: minmax(340px, 400px) minmax(0, 1fr); gap: 32px; padding: 0 32px; max-width: 1280px; width: 100%; margin: 0 auto; overflow: hidden; }
  .screen { display: block !important; padding: 8px 0 32px; overflow-y: auto; min-height: 0; }
  #month { padding-right: 4px; }
  .dows, .grid { gap: 8px; }
  .cell { aspect-ratio: auto; min-height: 92px; padding: 8px; border-radius: 12px; }
  .cell .n { font-size: 15px; }
  .cell .sh { font-size: 13px; padding: 4px 0; }
  .cell .sh .full { display: inline; }
  .cell .sh .short { display: none; }
  .cell .ev { top: 11px; right: 10px; }
  .cell:hover { border-color: var(--muted); }
  .palette { margin: 16px 0 0; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.08); bottom: 8px; }
  .types { grid-template-columns: repeat(3, minmax(0, 180px)); }
}

/* ---------- přihlášení, hlášky, účet ---------- */
.splash { height: 100dvh; display: grid; place-content: center; gap: 8px; text-align: center; color: var(--accent); font-weight: 700; font-size: 22px; letter-spacing: .02em; background: var(--bg); }
.splash a { font-size: 15px; font-weight: 500; color: var(--muted); }
.login { min-height: 100dvh; display: grid; place-items: center; padding: 16px; background: var(--bg); }
.login-card { width: 100%; max-width: 360px; padding: 24px; display: grid; gap: 16px; }
.login-card .brand { font-size: 24px; text-align: center; margin-bottom: 4px; }
.login-card label { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
.login-card input {
  font: inherit; color: var(--ink); height: 48px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface-2);
}
.login-card input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.login-card .pill-btn { height: 48px; }
.pill-btn:disabled { opacity: .6; cursor: default; }
.error { margin: 0; color: var(--today); font-size: 14px; }
.banner { margin: 8px 16px 0; padding: 10px 14px; border-radius: 12px; font-size: 14px; background: color-mix(in srgb, var(--today) 14%, var(--surface)); color: var(--today); border: 1px solid color-mix(in srgb, var(--today) 35%, var(--surface)); }
.user { position: relative; }
.menu { position: absolute; right: 0; top: 44px; z-index: 10; padding: 12px; display: grid; gap: 10px; min-width: 180px; box-shadow: 0 8px 24px rgba(0,0,0,.14); }
.menu .who { font-weight: 600; padding: 0 4px; }
@media (min-width: 900px) { .banner { grid-column: 1 / -1; margin: 0; align-self: start; } }

#blazor-error-ui { display: none; position: fixed; inset: auto 0 0 0; z-index: 1000; padding: 12px 16px; background: var(--today); color: #fff; font-size: 14px; }
#blazor-error-ui a { color: inherit; margin-left: 8px; }
