/* Оформление в стиле группы «Формула развития»: небесно-голубой, тёмно-синий, оранжевый, округлый шрифт */
@font-face {
  font-family: "Nunito"; font-style: normal; font-weight: 500 900; font-display: swap;
  src: url(/static/fonts/nunito-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Nunito"; font-style: normal; font-weight: 500 900; font-display: swap;
  src: url(/static/fonts/nunito-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;
}

:root {
  --bg: #F2F7FD;
  --sky: #E3F0FD;
  --card: #FFFFFF;
  --navy: #17407A;
  --text: #1C2B4A;
  --text2: #7486A6;
  --text3: #A9B6CC;
  --orange: #F7931E;
  --orange2: #FF7A1A;
  --orange-bg: #FFF1E0;
  --coral: #EF5B45;
  --coral-bg: #FDEAE6;
  --teal: #1FAE8B;
  --teal-bg: #E2F6F0;
  --blue: #3B8BEB;
  --chip: #EEF3FA;
  --chip-press: #E1EAF6;
  --sep: #E8EEF6;
  --shadow: 0 1px 2px rgba(23, 64, 122, .04), 0 8px 24px rgba(23, 64, 122, .08);
  --shadow-up: 0 -2px 24px rgba(23, 64, 122, .10);
  --radius: 20px;
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 500 15.5px/1.4 "Nunito", -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; color: var(--navy); font-weight: 900; letter-spacing: -.2px; }

/* ---------- каркас ---------- */
.app { max-width: 640px; margin: 0 auto; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.head {
  position: relative; overflow: hidden; padding: 20px 18px 18px; display: flex; align-items: flex-start; gap: 12px;
  background:
    radial-gradient(circle at 92% -10%, rgba(247, 147, 30, .22) 0 70px, transparent 71px),
    radial-gradient(circle at 70% 130%, rgba(59, 139, 235, .14) 0 80px, transparent 81px),
    linear-gradient(180deg, var(--sky), var(--bg));
}
.head .titles { flex: 1; min-width: 0; }
.head h1 { font-size: 26px; line-height: 1.15; }
.head .sub { color: var(--text2); font-weight: 700; margin-top: 4px; font-size: 14.5px; }
.round {
  width: 46px; height: 46px; border-radius: 16px; border: 0; cursor: pointer; flex: none; color: #fff;
  background: linear-gradient(135deg, #FFA53A, var(--orange2)); box-shadow: 0 6px 16px rgba(247, 122, 26, .35);
  display: grid; place-items: center; transition: transform .12s;
}
.round:active { transform: scale(.94); }
.round svg { width: 24px; height: 24px; }
.text-btn { border: 0; background: none; color: var(--blue); font-weight: 800; cursor: pointer; padding: 12px 4px; }

.group { background: var(--card); border-radius: var(--radius); margin: 12px 14px 0; overflow: hidden; box-shadow: var(--shadow); }
.group-h { padding: 16px 18px 6px; font-size: 15px; font-weight: 900; color: var(--navy); display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.group-h span { font-weight: 700; color: var(--text2); font-size: 13px; }
.section-title { margin: 18px 18px 8px; font-size: 17px; font-weight: 900; color: var(--navy); display: flex; justify-content: space-between; align-items: baseline; }
.section-title span { font-size: 13.5px; font-weight: 700; color: var(--text2); }

/* ---------- строки ---------- */
.cell {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px;
  padding: 10px 18px; border: 0; background: none; text-align: left; color: inherit; position: relative;
}
button.cell { cursor: pointer; transition: background .12s; }
button.cell:active { background: var(--chip); }
@media (hover: hover) { button.cell:hover { background: #F7FAFE; } }
.cell + .cell::before { content: ""; position: absolute; top: 0; left: 18px; right: 18px; border-top: 1px solid var(--sep); }
.cell .main { flex: 1; min-width: 0; }
.cell .t { font-size: 16px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell .s { font-size: 13.5px; color: var(--text2); font-weight: 600; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell .s.warn { color: var(--orange2); }
.cell .chev { color: var(--text3); font-size: 24px; line-height: 1; }
.cell.accent .t { color: var(--blue); }
.cell.danger .t { color: var(--coral); }
.cell .ic { width: 30px; text-align: center; font-size: 20px; flex: none; }
.ava {
  width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; font-weight: 900; color: #fff;
  background: var(--c, var(--blue)); flex: none; font-size: 17px; overflow: hidden;
}
.ava img { width: 100%; height: 100%; object-fit: cover; }
.ava.round-ava { border-radius: 50%; }
.ava.emoji { background: color-mix(in srgb, var(--c) 16%, #fff); font-size: 21px; }

/* ---------- дни ---------- */
.days { display: flex; gap: 8px; overflow-x: auto; padding: 4px 14px 6px; scrollbar-width: none; scroll-snap-type: x proximity; }
.days::-webkit-scrollbar { display: none; }
.day {
  flex: none; width: 52px; height: 70px; border-radius: 18px; border: 0; cursor: pointer; scroll-snap-align: start;
  background: var(--card); box-shadow: 0 2px 8px rgba(23, 64, 122, .06); color: var(--navy);
  display: grid; place-content: center; justify-items: center; gap: 1px; position: relative; transition: transform .12s;
}
.day:active { transform: scale(.95); }
.day small { font-size: 12px; font-weight: 800; color: var(--text2); text-transform: uppercase; }
.day b { font-size: 20px; font-weight: 900; }
.day.has::after { content: ""; position: absolute; bottom: 8px; width: 5px; height: 5px; border-radius: 50%; background: var(--orange); }
.day.today:not(.on) { box-shadow: inset 0 0 0 2px var(--orange); }
.day.on { background: var(--navy); color: #fff; box-shadow: 0 6px 16px rgba(23, 64, 122, .3); }
.day.on small { color: #B8CBEA; }
.day.past:not(.on) { background: transparent; box-shadow: none; }
.day.past:not(.on) b { color: var(--text3); }

/* ---------- карточки занятий ---------- */
.cards { display: grid; gap: 10px; padding: 0 14px; }
.lcard {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px; border: 0; cursor: pointer; text-align: left;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); color: inherit; transition: transform .12s;
}
.lcard:active { transform: scale(.985); }
.lcard .em { width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; font-size: 24px; flex: none; background: color-mix(in srgb, var(--c) 16%, #fff); }
.lcard .main { flex: 1; min-width: 0; }
.lcard .time { font-size: 13.5px; font-weight: 900; color: var(--c); }
.lcard .t { font-size: 16.5px; font-weight: 900; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lcard .s { font-size: 13.5px; color: var(--text2); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lcard.canceled .t, .lcard.canceled .time { text-decoration: line-through; color: var(--text3); }
.lcard.canceled .em { filter: grayscale(1); opacity: .6; }
.lcard.moved_out { opacity: .55; box-shadow: none; background: transparent; outline: 2px dashed var(--sep); }
.badge { font-size: 12px; font-weight: 900; padding: 4px 9px; border-radius: 9px; flex: none; }
.badge.red { background: var(--coral-bg); color: var(--coral); }
.badge.orange { background: var(--orange-bg); color: var(--orange2); }
.badge.green { background: var(--teal-bg); color: var(--teal); }
.badge.gray { background: var(--chip); color: var(--text2); }
.empty { margin: 0 14px; padding: 30px 16px; text-align: center; color: var(--text2); font-weight: 700; display: grid; gap: 12px; justify-items: center; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.empty .big { font-size: 40px; }

/* ---------- кнопки ---------- */
.btn {
  height: 50px; border-radius: 16px; border: 0; padding: 0 18px; cursor: pointer; font-weight: 900; font-size: 16px;
  background: var(--chip); color: var(--navy); display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; transition: transform .12s, opacity .12s;
}
.btn.primary { background: linear-gradient(135deg, #FFA53A, var(--orange2)); color: #fff; box-shadow: 0 8px 18px rgba(247, 122, 26, .3); }
.btn.navy { background: var(--navy); color: #fff; }
.btn.danger { background: var(--coral); color: #fff; box-shadow: 0 8px 18px rgba(239, 91, 69, .25); }
.btn.soft-danger { background: var(--coral-bg); color: var(--coral); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; box-shadow: none; }
.btn:active:not(:disabled) { transform: scale(.98); }

/* ---------- выбор кнопками ---------- */
.field { display: grid; gap: 10px; }
.label { font-size: 15px; font-weight: 900; color: var(--navy); display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.label em { font-style: normal; font-weight: 800; color: var(--orange2); font-size: 14.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 40px; padding: 0 15px; border-radius: 13px; border: 0; background: var(--chip); color: var(--navy); cursor: pointer;
  font-size: 15px; font-weight: 800; display: inline-flex; align-items: center; gap: 6px; transition: transform .1s;
}
.chip:active { transform: scale(.95); }
.chip.on { background: var(--navy); color: #fff; }
.chip.add { background: var(--orange-bg); color: var(--orange2); }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 8px; }
.slots .chip { justify-content: center; padding: 0; }
.wd { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.wd .chip { justify-content: center; padding: 0; }
.sheet .days { padding: 2px 0 6px; margin: 0 -2px; }
.sheet .day { background: var(--chip); box-shadow: none; width: 54px; height: 76px; }
.sheet .day.on { background: var(--navy); }
.seg { display: flex; background: var(--chip); border-radius: 14px; padding: 4px; }
.seg button { flex: 1; height: 38px; border: 0; background: none; border-radius: 11px; cursor: pointer; font-size: 14.5px; font-weight: 800; color: var(--text2); }
.seg button.on { background: var(--card); color: var(--navy); box-shadow: 0 2px 8px rgba(23, 64, 122, .12); }

input[type=text], input[type=time], textarea {
  width: 100%; border: 2px solid transparent; background: var(--chip); border-radius: 14px; padding: 0 14px; height: 50px;
  outline: none; font-weight: 700; color: var(--text); transition: border-color .12s, background .12s;
}
textarea { height: auto; min-height: 90px; padding: 12px 14px; resize: vertical; }
input:focus, textarea:focus { border-color: var(--blue); background: #fff; }
input::placeholder, textarea::placeholder { color: var(--text3); }
.check { display: flex; gap: 10px; align-items: center; cursor: pointer; font-weight: 700; }
.check input { width: 22px; height: 22px; accent-color: var(--navy); }

/* ---------- нижнее окно ---------- */
dialog.sheet {
  border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 560px; max-height: 92vh;
  border-radius: 28px 28px 0 0; background: var(--card); color: var(--text); box-shadow: var(--shadow-up);
}
dialog.sheet[open] { display: flex; flex-direction: column; animation: up .22s cubic-bezier(.2, .8, .2, 1); }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
dialog.sheet::backdrop { background: rgba(23, 40, 70, .45); backdrop-filter: blur(2px); }
@media (min-width: 700px) { dialog.sheet { margin: auto; border-radius: 28px; } }
dialog.sheet::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--sep); margin: 8px auto 0; flex: none; }
.sh-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px 4px 20px; }
.sh-head h2 { flex: 1; font-size: 21px; }
.icon { width: 36px; height: 36px; border-radius: 12px; border: 0; background: var(--chip); color: var(--navy); cursor: pointer; display: grid; place-items: center; flex: none; font-size: 16px; font-weight: 900; }
.sh-sub { padding: 0 20px 6px; color: var(--text2); font-size: 14.5px; font-weight: 700; }
.sh-body { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 12px 20px 18px; display: flex; flex-direction: column; gap: 22px; flex: 1; min-height: 0; }
.sh-body > * { flex-shrink: 0; }
.sh-body > .group { margin: 0; box-shadow: none; border: 2px solid var(--sep); }
.sh-foot { padding: 12px 20px calc(14px + env(safe-area-inset-bottom)); display: grid; gap: 8px; box-shadow: 0 -1px 0 var(--sep); }
.notify { font-size: 13.5px; color: var(--text2); text-align: center; font-weight: 700; }
.notify details { margin-top: 2px; text-align: left; }
.notify summary { color: var(--blue); cursor: pointer; text-align: center; list-style: none; }
.notify summary::-webkit-details-marker { display: none; }
.bubble { margin-top: 8px; background: var(--chip); color: var(--text); border-radius: 18px 18px 18px 6px; padding: 11px 14px; white-space: pre-wrap; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.summary { background: linear-gradient(135deg, var(--sky), #F6FAFF); border-radius: 20px; padding: 16px 18px; display: grid; gap: 10px; font-weight: 800; color: var(--navy); }
.summary div { display: flex; gap: 12px; align-items: center; }
.summary div span:first-child { width: 24px; text-align: center; flex: none; font-size: 18px; }
.hint { color: var(--text2); font-size: 14.5px; font-weight: 600; margin: 0; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatches button { width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer; }
.swatches button.on { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--navy); }
.parents { display: grid; gap: 8px; }
.parent { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; background: var(--chip); }
.parent .main { flex: 1; min-width: 0; font-weight: 800; }
.parent .x { border: 0; background: none; color: var(--text2); font-size: 18px; cursor: pointer; padding: 6px; }

/* ---------- нижние вкладки (плавающая панель) ---------- */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 6;
  width: min(420px, calc(100% - 28px)); background: rgba(255, 255, 255, .92); backdrop-filter: blur(14px);
  border-radius: 24px; box-shadow: 0 10px 30px rgba(23, 64, 122, .18); display: flex; padding: 6px;
}
.tabbar button {
  flex: 1; border: 0; background: none; color: var(--text2); padding: 7px 0 6px; cursor: pointer; border-radius: 18px;
  display: grid; justify-items: center; gap: 1px; font-size: 11.5px; font-weight: 800; transition: background .15s, color .15s;
}
.tabbar svg { width: 24px; height: 24px; }
.tabbar button.on { color: var(--orange2); background: var(--orange-bg); }

.banner { margin: 0 14px 10px; padding: 12px 16px; border-radius: 16px; background: var(--orange-bg); color: #A65300; font-size: 14px; font-weight: 700; }
.search { padding: 0 14px 4px; }

/* загрузка */
.skeleton { margin: 0 14px; display: grid; gap: 10px; }
.skeleton div { height: 76px; border-radius: var(--radius); background: linear-gradient(90deg, #E8EFF8 25%, #F4F8FD 50%, #E8EFF8 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- всплывашка ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translate(-50%, 16px); opacity: 0; z-index: 50;
  background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 16px; font-size: 14.5px; font-weight: 800;
  transition: .22s; pointer-events: none; max-width: calc(100% - 32px); text-align: center; box-shadow: 0 10px 24px rgba(23, 64, 122, .3);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--coral); }

/* ---------- страницы входа и приветствия ---------- */
.center-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(180deg, var(--sky), var(--bg)); }
.login-card { background: var(--card); border-radius: 28px; padding: 30px 24px; max-width: 400px; width: 100%; text-align: center; box-shadow: var(--shadow); }
.login-card h1 { font-size: 23px; margin-bottom: 8px; }
.login-card p { color: var(--text2); font-weight: 600; }
.login-card ol { text-align: left; padding-left: 22px; line-height: 1.6; }
.login-card form { margin-top: 16px; }
.logo.big { font-size: 48px; margin-bottom: 8px; }
.btn.vk { background: linear-gradient(135deg, #FFA53A, var(--orange2)); color: #fff; }

/* ---------- котик-помощник ---------- */
.cat { width: 120px; height: 120px; display: block; margin: 0 auto; }
.cat.small { width: 84px; height: 84px; }
.cat .tail { transform-origin: 86px 96px; animation: wag 1.1s ease-in-out infinite alternate; }
.cat .eyes { transform-box: fill-box; transform-origin: center; animation: blink 4.2s infinite; }
.cat .bob { animation: bob 2.4s ease-in-out infinite; }
@keyframes wag { from { transform: rotate(-10deg); } to { transform: rotate(14deg); } }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes bob { 50% { transform: translateY(-3px); } }
.loading { text-align: center; padding: 40px 16px; color: var(--text2); font-weight: 800; display: grid; gap: 6px; justify-items: center; }
.loading .dots::after { content: ""; animation: dots 1.4s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
.empty .cat { margin-bottom: -4px; }
.tip { display: flex; gap: 10px; align-items: center; background: var(--sky); border-radius: 16px; padding: 10px 12px; font-size: 14px; font-weight: 700; color: var(--navy); }
.tip .cat { width: 44px; height: 44px; margin: 0; flex: none; }
