@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('fonts/bricolage-grotesque-latin-wght-normal.woff2') format('woff2');
  font-weight: 200 800;
  font-display: swap;
  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;
}
@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('fonts/bricolage-grotesque-latin-ext-wght-normal.woff2') format('woff2');
  font-weight: 200 800;
  font-display: swap;
  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-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Hanken Grotesk';
  src: url('fonts/hanken-grotesk-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
  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;
}
@font-face {
  font-family: 'Hanken Grotesk';
  src: url('fonts/hanken-grotesk-latin-ext-wght-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
  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-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light dark;
  --paper: #edf0f3;
  --surface: #f8f9fb;
  --ink: #16202e;
  --ink-2: #4a586b;
  --line: #cfd6df;
  --school: #3556d8;
  --school-wash: #dde4fb;
  --on-school: #ffffff;
  --free: #2a8f6b;
  --free-wash: #d7efe4;
  --rest: #5b4e8c;
  --rest-wash: #e3dff0;
  --travel: #5d6b7e;
  --on-travel: #ffffff;
  --alert: #c2335d;
  --task: #b36a00;
  --task-wash: #f6e4bd;
  --on-task: #ffffff;
  --font-display: 'Bricolage Grotesque', ui-sans-serif, system-ui, sans-serif;
  --font-body: 'Hanken Grotesk', ui-sans-serif, system-ui, sans-serif;
  --tab-h: 58px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #111925;
    --surface: #182231;
    --ink: #e9eef5;
    --ink-2: #a4b4c8;
    --line: #2c3b50;
    --school: #8aa4ff;
    --school-wash: #243166;
    --on-school: #0f1626;
    --free: #5cc9a0;
    --free-wash: #1d3a33;
    --rest: #a597d9;
    --rest-wash: #2e2a4a;
    --travel: #8b9ab0;
    --on-travel: #0f1626;
    --alert: #ff7aa0;
    --task: #f0b24a;
    --task-wash: #4a3a17;
    --on-task: #1d1405;
  }
}

* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.45 var(--font-body);
  font-variant-numeric: tabular-nums;
}
button,
input {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
:focus-visible {
  outline: 3px solid var(--school);
  outline-offset: 2px;
}
h1,
h2,
h3,
p {
  margin: 0;
}

#app {
  max-width: 640px;
  margin: 0 auto;
}
.screen {
  padding: 0 16px calc(var(--tab-h) + 128px + env(safe-area-inset-bottom));
}
.alert {
  color: var(--alert);
}

/* Hlavička */
.head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  padding: calc(18px + env(safe-area-inset-top)) 0 4px;
}
.title h1 {
  display: flex;
  flex-direction: column;
}
.title .wd {
  font: 700 38px/1 var(--font-display);
  letter-spacing: -0.02em;
}
.title .dl {
  margin-top: 6px;
  font: 500 19px/1.2 var(--font-display);
  color: var(--ink-2);
}
.sub {
  margin-top: 10px;
  max-width: 46ch;
  color: var(--ink-2);
  font-size: 15px;
}
.tools {
  display: flex;
  margin-right: -10px;
}
.iconbtn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: transparent;
}
.iconbtn:hover {
  background: var(--surface);
}
.jump {
  margin: 10px 0 0;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}
.period {
  margin-top: 14px;
  padding: 10px 12px;
  border-left: 4px solid var(--alert);
  background: var(--surface);
  border-radius: 0 8px 8px 0;
  font-size: 14.5px;
}

/* Denní pás */
.ribbon-wrap {
  position: relative;
  margin-top: 22px;
}
.ribbon {
  position: relative;
  height: 46px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1.5px var(--line);
  overflow: hidden;
}
.s {
  position: absolute;
  top: 0;
  bottom: 0;
}
.s.class {
  background: var(--school);
}
.s.travel {
  background: var(--travel);
}
.s.ghost {
  background: var(--school-wash);
  outline: 2px dashed var(--school);
  outline-offset: -3px;
}
.s.protected {
  background: var(--free-wash);
}
.s.used {
  background: var(--rest-wash);
  outline: 2px dashed var(--rest);
  outline-offset: -3px;
}
.s.task {
  background: var(--task);
}
.s.task.proposed {
  background: var(--task-wash);
  outline: 2px dotted var(--task);
  outline-offset: -3px;
}
.now {
  position: absolute;
  top: -7px;
  left: 0;
  width: 3px;
  height: 60px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: var(--ink);
}
.ribbon-axis {
  position: relative;
  height: 20px;
  margin-top: 6px;
  color: var(--ink-2);
  font-size: 12.5px;
}
.ribbon-axis span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
}
.ribbon-axis .edge-l {
  left: 0;
  transform: none;
}
.ribbon-axis .edge-r {
  right: 0;
  transform: none;
}

/* Souhrn kapacity, zároveň klíč k pásu */
.cap {
  margin: 14px 0 0;
  display: grid;
  gap: 8px;
}
.cap > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.cap dt {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-2);
  font-size: 15px;
}
.cap dd {
  margin: 0;
  text-align: right;
  font: 600 16px var(--font-display);
}
.cap small {
  display: block;
  font: 400 13px var(--font-body);
  color: var(--ink-2);
}
.sw {
  display: inline-block;
  flex: none;
  width: 14px;
  height: 14px;
  border-radius: 4px;
}
.sw.free {
  background: var(--surface);
  box-shadow: inset 0 0 0 1.5px var(--ink-2);
}
.sw.class {
  background: var(--school);
}
.sw.travel {
  background: var(--travel);
}
.sw.ghost {
  background: var(--school-wash);
  outline: 2px dashed var(--school);
  outline-offset: -2px;
}
.sw.protected {
  background: var(--free-wash);
  box-shadow: inset 0 0 0 1.5px var(--free);
}
.sw.used {
  background: var(--rest-wash);
  outline: 2px dashed var(--rest);
  outline-offset: -2px;
}
.sw.task {
  background: var(--task-wash);
  box-shadow: inset 0 0 0 2px var(--task);
}

/* Program dne */
.agenda {
  list-style: none;
  margin: 24px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.row {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 12px;
  padding: 12px 0 14px 14px;
  border-left: 4px solid var(--line);
}
.row.event.going {
  border-left-color: var(--school);
}
.row.event.skip {
  border-left: 4px dashed var(--school);
}
.row.event.used {
  border-left: 4px dashed var(--rest);
}
.row.event.cancelled {
  border-left: 4px dotted var(--ink-2);
}
.row.event.cancelled h3 {
  text-decoration: line-through;
  color: var(--ink-2);
}
.row.block.travel {
  border-left-color: var(--travel);
}
.row.block.protected {
  border-left-color: var(--free);
}
.row.task.pinned {
  border-left: 4px solid var(--task);
}
.row.task.proposed {
  border-left: 4px dotted var(--task);
}
.chips.act {
  margin-top: 12px;
}
.row.free {
  padding-top: 4px;
  padding-bottom: 4px;
  border-left: 4px dotted var(--line);
  color: var(--ink-2);
}
.row.past {
  opacity: 0.55;
}
.time {
  display: flex;
  flex-direction: column;
}
.time b {
  font: 600 17px/1.2 var(--font-display);
}
.time span {
  font-size: 13.5px;
  color: var(--ink-2);
}
.body h3 {
  font: 600 18px/1.25 var(--font-display);
}
.meta {
  margin-top: 2px;
  color: var(--ink-2);
  font-size: 14.5px;
}
.note {
  margin-top: 6px;
  color: var(--ink-2);
  font-size: 13.5px;
}
.note.alert {
  color: var(--alert);
}
.free-label {
  font-size: 14.5px;
}
.empty {
  margin-top: 28px;
  color: var(--ink-2);
}
.seg-ctl {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1.5px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}
.seg-ctl button {
  min-height: 44px;
  border: 0;
  background: transparent;
  font-weight: 500;
}
.seg-ctl button + button {
  border-left: 1.5px solid var(--line);
}
.seg-ctl button[aria-pressed='true'] {
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
}
.opt {
  margin-top: 12px;
}
.opt > span {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-2);
  font-size: 13.5px;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  min-height: 40px;
  padding: 0 16px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}
.chip[aria-pressed='true'] {
  border-color: var(--rest);
  background: var(--rest-wash);
  font-weight: 600;
}

/* Spodní lišty */
.confirm-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px 16px 10px;
  background: linear-gradient(to bottom, transparent, var(--paper) 45%);
  pointer-events: none;
}
.confirm-bar > * {
  pointer-events: auto;
}
.confirm-bar.done {
  color: var(--ink-2);
}
.primary {
  width: 100%;
  max-width: 608px;
  min-height: 52px;
  border: 0;
  border-radius: 10px;
  background: var(--school);
  color: var(--on-school);
  font: 600 17px var(--font-display);
}
.quiet {
  min-height: 40px;
  padding: 0 14px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.danger {
  min-height: 48px;
  width: 100%;
  border: 1.5px solid var(--alert);
  border-radius: 10px;
  background: transparent;
  color: var(--alert);
  font-weight: 600;
}
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.tabbar button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 0;
  border-top: 3px solid transparent;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
}
.tabbar button[aria-current='page'] {
  color: var(--ink);
  border-top-color: var(--school);
  font-weight: 600;
}

/* Nastavení */
.backdrop {
  position: fixed;
  inset: 0;
  background: rgb(0 0 0 / 0.45);
}
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 640px;
  max-height: 88vh;
  margin: 0 auto;
  padding: 22px 16px calc(20px + env(safe-area-inset-bottom));
  overflow: auto;
  display: grid;
  gap: 12px;
  border-radius: 20px 20px 0 0;
  background: var(--paper);
  box-shadow: 0 -8px 30px rgb(0 0 0 / 0.25);
}
.sheet h2 {
  font: 700 24px var(--font-display);
}
.file {
  display: grid;
  gap: 2px;
  padding: 14px 16px;
  border: 1.5px dashed var(--line);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
}
.file.small {
  padding: 12px 16px;
  border-style: solid;
}
.file.done {
  border-style: solid;
  border-color: var(--free);
}
.file .t {
  font-weight: 600;
}
.file .h {
  color: var(--ink-2);
  font-size: 14px;
}
.file input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.file:focus-within {
  outline: 3px solid var(--school);
  outline-offset: 2px;
}
.sheet .quiet,
.sheet .danger {
  width: 100%;
  min-height: 48px;
}

/* Úkoly */
.group {
  margin-top: 26px;
}
.group h2 {
  font: 600 19px var(--font-display);
}
.group.trouble h2 {
  color: var(--alert);
}
.tasks {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 22px;
}
.task-item h3 {
  font: 600 18px/1.25 var(--font-display);
}
.task-item.done h3 {
  color: var(--ink-2);
  text-decoration: line-through;
}
.chunks {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.chunk {
  padding: 2px 0 2px 12px;
  border-left: 4px dotted var(--task);
}
.chunk.pinned {
  border-left-style: solid;
}
.chunk {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
}
.chunk .chips {
  margin-top: 0;
}
.chip.sm {
  min-height: 36px;
  padding: 0 12px;
  font-size: 14px;
}
.chunk .when {
  display: grid;
}
.chunk .when span {
  color: var(--ink-2);
  font-size: 13.5px;
}
.chunk .chips {
  margin-top: 8px;
}
.field {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  border: 0;
}
.field > span,
.field > legend {
  padding: 0;
  font-weight: 600;
}
.field input[type='text'],
.field input:not([type]),
.field input[type='date'],
.field input[type='number'] {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.inline {
  display: grid;
  gap: 4px;
  margin-top: 10px;
  color: var(--ink-2);
  font-size: 14px;
}
.inline input {
  min-height: 44px;
  padding: 0 14px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.picks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pick {
  position: relative;
}
.pick input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.pick span {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
}
.pick input:checked + span {
  border-color: var(--task);
  background: var(--task-wash);
  font-weight: 600;
}
.pick input:focus-visible + span {
  outline: 3px solid var(--school);
  outline-offset: 2px;
}
.options {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.option {
  width: 100%;
  min-height: 56px;
  padding: 8px 14px;
  display: grid;
  gap: 1px;
  text-align: left;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.option span {
  color: var(--ink-2);
  font-size: 13.5px;
}
.sync {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.sync label {
  font-weight: 600;
}
.sync input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}
.sync p {
  font-size: 14.5px;
}
.onboarding {
  display: grid;
  gap: 14px;
  align-content: start;
  padding-top: calc(48px + env(safe-area-inset-top));
}
.onboarding h1 {
  font: 700 34px/1.05 var(--font-display);
  letter-spacing: -0.02em;
}
.onboarding p {
  color: var(--ink-2);
}
.fine {
  font-size: 14px;
}

/* Týden */
.week {
  margin-top: 16px;
}
.whead,
.wbody {
  display: grid;
  grid-template-columns: 26px repeat(7, 1fr);
  gap: 2px;
}
.wh {
  min-height: 62px;
  padding: 4px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  line-height: 1.15;
}
.wh .wd {
  font-size: 12px;
  color: var(--ink-2);
}
.wh .num {
  font: 700 18px var(--font-display);
}
.wh .free-h {
  font-size: 11px;
  color: var(--ink-2);
}
.wh .free-h.short {
  color: var(--alert);
  font-weight: 600;
}
.wh.today {
  background: var(--ink);
  color: var(--paper);
}
.wh.today .wd,
.wh.today .free-h {
  color: var(--paper);
}
.haxis,
.col {
  position: relative;
}
.haxis span {
  position: absolute;
  right: 3px;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--ink-2);
}
.col {
  background-image: repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px 34px);
  background-color: var(--surface);
  border-radius: 6px;
}
.col.today {
  box-shadow: inset 0 0 0 2px var(--ink);
}
.blk {
  position: absolute;
  left: 1px;
  right: 1px;
  padding: 2px 3px;
  border: 0;
  border-radius: 5px;
  overflow: hidden;
  text-align: left;
  font: 600 10px/1.1 var(--font-body);
}
.blk .full {
  display: none;
}
.blk.going {
  background: var(--school);
  color: var(--on-school);
}
.blk.skip {
  background: var(--school-wash);
  color: var(--ink);
  outline: 1.5px dashed var(--school);
  outline-offset: -2px;
}
.blk.used {
  background: var(--rest-wash);
  color: var(--ink);
  outline: 1.5px dashed var(--rest);
  outline-offset: -2px;
}
.blk.travel {
  background: var(--travel);
  color: var(--on-travel);
}
.blk.task {
  background: var(--task);
  color: var(--on-task);
}
.blk.task.proposed {
  background: var(--task-wash);
  color: var(--ink);
  outline: 1.5px dotted var(--task);
  outline-offset: -2px;
}
.blk.protected {
  background: var(--free-wash);
  color: var(--ink);
  box-shadow: inset 0 0 0 1.5px var(--free);
}
.key {
  margin: 16px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-size: 13.5px;
  color: var(--ink-2);
}
.key > div {
  display: flex;
  align-items: center;
  gap: 8px;
}
.key dt,
.key dd {
  margin: 0;
}

@media (min-width: 640px) {
  .blk {
    font-size: 11.5px;
  }
  .blk .code {
    display: none;
  }
  .blk .full {
    display: inline;
  }
}

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