/* Палитра и шрифты как на сайте. Шрифты сайта подключим с нашего сервера при переносе. */
:root {
  --milk: #F6F1E8;
  --paper: #FBF8F3;
  --sand: #E9DDCC;
  --olive: #5C613B;
  --olive-dark: #33361F;
  --ink: #251E19;
  --ink-soft: #594F47;
  --line: rgba(37, 30, 25, .14);
  --accent: #B24E28;
  --accent-hover: #963F1E;
  --f-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --f-text: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 20px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--milk);
  color: var(--ink);
  font-family: var(--f-text);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.page {
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 16px calc(116px + env(safe-area-inset-bottom));
  display: grid;
  gap: 16px;
}

.title {
  font-family: var(--f-display);
  font-weight: 500;
  font-size: 2.5rem;
  line-height: 1.05;
}
.title em { font-style: italic; color: var(--olive); }
.section-title { font-size: 15px; font-weight: 600; margin-top: 8px; }
.muted { color: var(--ink-soft); font-size: 14px; }

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  display: grid;
  gap: 10px;
}
.card-dark { background: var(--olive-dark); border-color: transparent; color: var(--milk); }
.card-dark .muted { color: rgba(246, 241, 232, .75); }
.card-link { width: 100%; text-align: left; cursor: pointer; }
.big { font-family: var(--f-display); font-size: 2rem; line-height: 1.1; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}
.btn-primary { background: var(--accent); color: #FFF8F1; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-light { background: var(--milk); color: var(--ink); }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.between { justify-content: space-between; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--sand);
  font-size: 13px;
}
.badge-warn { background: #F3D9CC; color: #7A3216; }

label { display: grid; gap: 6px; font-size: 14px; color: var(--ink-soft); }
input, select, textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-size: 16px; /* меньше 16px iPhone приближает страницу */
  color: var(--ink);
}
.pw { position: relative; display: block; }
.pw input { padding-right: 52px; }
.pw-eye {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}
.chip {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  font-size: 14px;
  cursor: pointer;
}
.check { display: flex; gap: 10px; align-items: flex-start; color: var(--ink); }
.check input { width: 22px; min-height: 22px; flex: none; margin: 1px 0 0; }
.error { color: #A3341A; font-size: 14px; }

.progress {
  width: 100%;
  height: 8px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  appearance: none;
  background: rgba(37, 30, 25, .1);
}
.progress::-webkit-progress-bar { background: rgba(37, 30, 25, .1); }
.progress::-webkit-progress-value { background: var(--olive); }
.progress::-moz-progress-bar { background: var(--olive); }
[data-back] { justify-self: start; }
.section-title.flush { margin-top: 0; }

.tabs {
  position: fixed;
  inset: auto 0 0 0;
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
  background: var(--paper);
  border-top: 1px solid var(--line);
}
.icon { width: 26px; height: 26px; flex: none; }
.tab, .tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  background: var(--milk);
  cursor: pointer;
}
.tab {
  flex: 0 1 60px;
  min-width: 0;
  gap: 3px;
  padding: 2px;
  border-radius: 12px;
  font-size: 10.5px;
  line-height: 1.1;
}
.tab .icon { width: 20px; height: 20px; }
.tab[aria-current="page"] { background: var(--olive-dark); border-color: transparent; color: var(--milk); font-weight: 500; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 100px)); gap: 8px; }
.tiles .icon { width: 22px; height: 22px; }
.tile {
  gap: 4px;
  padding: 6px;
  border-radius: 14px;
  background: var(--paper);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.15;
  text-align: center;
}
.tile[aria-expanded="true"] { background: var(--sand); }
.home-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.home-tiles .tile { color: var(--ink); }
.home-tiles .icon { width: 24px; height: 24px; color: var(--olive); }
.tile-note {
  display: -webkit-box;
  max-width: 100%;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.2;
}
.home-settings { justify-self: center; gap: 8px; }
.home-settings .icon { width: 20px; height: 20px; }

.layout-row { grid-template-columns: 1fr auto; align-items: center; }
.layout-name { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.layout-move { display: flex; gap: 6px; }
.layout-name .icon { width: 22px; height: 22px; }
.layout-checks { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px 20px; }
.layout-move .step { width: 36px; height: 36px; font-size: 15px; border-radius: 10px; }

.step {
  flex: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--milk);
  font-size: 18px;
  cursor: pointer;
}
.step:disabled { opacity: .35; cursor: default; }
.stepper { display: flex; gap: 6px; align-items: center; }
.stepper input { min-width: 0; text-align: center; padding: 10px 4px; }
.counts { display: grid; gap: 10px; }

.mode { display: flex; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: 999px; }
.mode-btn { min-height: 34px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent; font-size: 13px; cursor: pointer; }
.mode-btn[aria-pressed="true"] { background: var(--olive-dark); color: var(--milk); }
.slot { display: grid; grid-template-columns: 64px 1fr; gap: 12px; }
.slot-time { display: grid; gap: 6px; justify-items: start; align-content: start; }
.slot-time strong { font-family: var(--f-display); font-size: 1.6rem; font-weight: 500; line-height: 1; }
.slot-time .chip { min-height: 26px; padding: 0 8px; font-size: 12px; white-space: nowrap; }
.slot-body { display: grid; gap: 4px; align-content: start; padding-left: 12px; border-left: 3px solid var(--sand-line, #D9B8A6); min-width: 0; }
.sheet h3:focus { outline: none; }
.request-comment { padding: 10px 12px; border-radius: 12px; background: var(--milk); }
.btn-danger { justify-self: start; color: #A3341A; border-color: rgba(163, 52, 26, .4); }
.btn-danger-fill { background: #A3341A; }
.btn-danger-fill:hover { background: #7A3216; }
.file-clear { justify-self: start; }
.steps-list { margin: 0; padding-left: 22px; display: grid; gap: 10px; }
.steps-list li { padding-left: 4px; }
.title-sm { font-size: 1.75rem; }
.h3-sm.h3-sm { font-family: var(--f-text); font-size: 1.05rem; font-weight: 600; }
.hw-card { gap: 8px; padding: 14px; font-size: 14px; }
.hw-card .btn { justify-self: start; }
.hw-head { display: flex; align-items: center; gap: 10px; }
.hw-num {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--olive-dark);
  color: var(--milk);
  font-size: 13px;
  font-weight: 600;
}
.hw-title { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.25; }
.hw-counts { font-weight: 500; }
.hw-short { gap: 2px; padding: 12px 14px; font-size: 14px; }
.hw-short .muted { font-size: 13px; }
.schedule { display: grid; gap: 10px; margin: 0; padding: 0; border: 0; min-width: 0; }
.schedule legend { padding: 0 0 8px; }
.schedule input[type="date"] { min-width: 0; flex: 1 1 150px; width: auto; }
.weekdays { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.weekdays label { display: block; position: relative; }
.weekdays input { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; opacity: 0; cursor: pointer; }
.weekdays span {
  display: grid;
  place-items: center;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  font-size: 13px;
}
.weekdays input:checked + span { background: var(--olive-dark); color: var(--milk); border-color: transparent; }
.weekdays input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.news-link { color: var(--accent); overflow-wrap: anywhere; min-height: 28px; }
.media { width: 100%; max-height: 60vh; border-radius: 14px; background: var(--ink); object-fit: contain; }
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
details summary { cursor: pointer; font-weight: 500; min-height: 32px; }
.choice { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 0; padding: 0; border: 0; }
.choice legend { padding: 0 0 6px; font-size: 14px; color: var(--ink-soft); }
.choice label { display: block; position: relative; }
.choice input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.choice span {
  display: grid;
  place-items: center;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  font-size: 14px;
}
.choice input:checked + span { background: var(--olive-dark); color: var(--milk); border-color: transparent; }
.choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.sheet { max-height: calc(100dvh - 32px); overflow-y: auto; }

.cal-head { display: flex; align-items: center; justify-content: space-between; }
.cal-nav { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; background: none; cursor: pointer; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { text-align: center; font-size: 12px; color: var(--ink-soft); padding-bottom: 4px; }
.day {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: transparent;
  position: relative;
  cursor: pointer;
}
.day.today { box-shadow: inset 0 0 0 1px var(--olive); }
.day.lesson, .day.lesson-past { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-weight: 600; }
.day small { font-size: 11px; font-weight: 400; line-height: 1; }
.day.lesson { background: #F3D9CC; color: #7A3216; }
.day.lesson-past { background: var(--sand); color: var(--ink-soft); }
.day.selected { background: var(--olive-dark); color: var(--milk); }
.day-more {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 18px;
  padding: 2px 3px;
  border-radius: 999px;
  background: var(--accent);
  color: #FFF8F1;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  text-align: center;
}

.sheet {
  width: min(520px, calc(100vw - 32px));
  border: 0;
  border-radius: var(--radius);
  padding: 20px;
  background: var(--paper);
  color: var(--ink);
}
.sheet::backdrop { background: rgba(37, 30, 25, .45); }
.sheet form, .stack { display: grid; gap: 12px; }
.sheet h3 { font-family: var(--f-display); font-weight: 500; font-size: 1.7rem; line-height: 1.1; }
.secret { font-family: ui-monospace, Consolas, monospace; background: var(--sand); padding: 10px 12px; border-radius: 10px; overflow-wrap: anywhere; }

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(104px + env(safe-area-inset-bottom));
  max-width: 528px;
  margin: 0 auto;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--milk);
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.toast.show { opacity: 1; }
