/* Панель родителя Умки. Палитра — как в приложении: кремовый фон, коричневый текст, медовый акцент. */
:root {
  --bg: #f6efe4; --card: #fffdf8; --ink: #3e2723; --muted: #8d7b6e; --line: #ece1d1; --soft: #f3ebdf;
  --brown: #6d4c41; --brown-d: #4e342e; --honey: #f9a825; --honey-d: #e08e0b; --honey-soft: #fff3d6;
  --good: #2e7d32; --good-soft: #e3f2e1; --bad: #c62828; --bad-soft: #fdecea;
  --blue: #1e63c4; --blue-soft: #e5eefb; --amber: #b26a00; --amber-soft: #fff1d6; --gray-soft: #efe9e1;
  --radius: 18px; --shadow: 0 1px 2px rgba(62, 39, 35, .06), 0 6px 20px rgba(62, 39, 35, .06);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.45; }
main { max-width: 1180px; margin: 0 auto; padding: 20px 18px 90px; }
h1 { font-size: 1.75rem; margin: 4px 0; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 0; }
h3 { font-size: 1rem; margin: 0 0 8px; }
a { color: var(--brown); }
p { margin: 6px 0; }
code { background: var(--soft); padding: 1px 6px; border-radius: 6px; font-size: .92em; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- шапка ---------- */
.top { position: sticky; top: 0; z-index: 20; color: #fff; box-shadow: 0 2px 12px rgba(62, 39, 35, .25);
       background: linear-gradient(100deg, var(--brown-d), var(--brown) 60%, #8d6e63); }
.top-in { max-width: 1180px; margin: 0 auto; padding: 10px 18px; display: flex; align-items: center; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.25rem; }
.brand img { width: 40px; height: 40px; border-radius: 12px; background: #fff7e6; padding: 3px; }
.brand small { display: block; font-weight: 500; font-size: .75rem; opacity: .75; margin-top: -3px; }
.nav { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.nav a, .nav button { color: #fff; text-decoration: none; padding: 8px 14px; border-radius: 999px; font-weight: 600;
                      font-size: .95rem; background: transparent; border: 0; cursor: pointer; opacity: .85; }
.nav a:hover, .nav button:hover { background: rgba(255, 255, 255, .12); opacity: 1; }
.nav a.on { background: var(--honey); color: var(--ink); opacity: 1; }
.nav form { margin: 0; }

/* ---------- заголовок страницы ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .sub { color: var(--muted); margin: 2px 0 0; }
.crumbs { font-size: .9rem; margin-bottom: 6px; }
.crumbs a { text-decoration: none; color: var(--muted); }
.crumbs a:hover { color: var(--brown); }

/* ---------- карточки и сетки ---------- */
.card { background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px;
        border: 1px solid rgba(109, 76, 65, .06); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.grid > .card { margin-bottom: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.grid-2 > .card { margin-bottom: 0; }
.cols-main { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }

/* ---------- плитки с цифрами ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { background: var(--card); border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow); }
.tile .k { font-size: .85rem; color: var(--muted); }
.tile .v { font-size: 1.9rem; font-weight: 750; line-height: 1.15; margin-top: 2px; }
.tile .v small { font-size: .95rem; font-weight: 600; color: var(--muted); }
.tile.alarm { background: var(--bad-soft); color: var(--bad); }
.tile.alarm .k { color: var(--bad); }
.mini-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.mini { background: var(--soft); border-radius: 12px; padding: 8px 10px; }
.mini .k { font-size: .75rem; color: var(--muted); }
.mini .v { font-size: 1.15rem; font-weight: 700; }

/* ---------- приветствие ---------- */
.hello { display: flex; align-items: center; gap: 16px; background: linear-gradient(110deg, var(--honey-soft), #fffaf0);
         border-radius: var(--radius); padding: 16px 20px; margin-bottom: 18px; box-shadow: var(--shadow); flex-wrap: wrap; }
.hello img { width: 64px; height: 64px; flex-shrink: 0; }
.hello > div { flex: 1 1 200px; }
.hello h1 { margin: 0; font-size: 1.5rem; }
.hello p { margin: 2px 0 0; color: var(--brown); }

/* ---------- карточка устройства ---------- */
.device { display: flex; flex-direction: column; gap: 14px; scroll-margin-top: 90px; }
.device:target { outline: 3px solid var(--honey); outline-offset: 2px; }
.dev-head { display: flex; align-items: center; gap: 12px; }
.avatar { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-size: 1.5rem; background: var(--soft); flex-shrink: 0; }
.dev-head h2 { line-height: 1.2; }
.meta { font-size: .85rem; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #c9bcae; display: inline-block; }
.dot.on { background: #34a853; box-shadow: 0 0 0 3px rgba(52, 168, 83, .18); }
.device.alarm { box-shadow: 0 0 0 2px var(--bad), var(--shadow); }

.hero { border-radius: 16px; padding: 14px 16px; display: flex; align-items: center; gap: 14px; }
.hero .ico { font-size: 1.9rem; }
.hero .t { font-weight: 700; font-size: 1.05rem; }
.hero .n { font-size: .88rem; opacity: .8; }
.hero .left { margin-left: auto; text-align: right; white-space: nowrap; }
.hero .left b { font-size: 2rem; line-height: 1; display: block; }
.hero .left span { font-size: .8rem; opacity: .75; }
.tone-ok { background: var(--good-soft); color: #1b5e20; }
.tone-low { background: var(--amber-soft); color: var(--amber); }
.tone-locked { background: var(--bad-soft); color: var(--bad); }
.tone-paused, .tone-off, .tone-unknown { background: var(--gray-soft); color: var(--brown); }
.tone-learning { background: var(--blue-soft); color: var(--blue); }

.bar { height: 8px; border-radius: 99px; background: rgba(62, 39, 35, .08); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--honey); }
.bar.good > i { background: #43a047; }
.bar.mid > i { background: #f0a020; }
.bar.bad > i { background: #e05545; }
.goal { display: flex; flex-direction: column; gap: 5px; }
.goal .row { font-size: .88rem; }

.alert { border-radius: 14px; padding: 10px 14px; display: flex; gap: 10px; align-items: flex-start; font-size: .93rem; }
.alert.bad { background: var(--bad-soft); color: var(--bad); }
.alert.warn { background: var(--amber-soft); color: var(--amber); }
.alert.info { background: var(--blue-soft); color: var(--blue); }
.alert.ok { background: var(--good-soft); color: #1b5e20; }

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; }
.week .d { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.week .cols { display: flex; gap: 2px; align-items: flex-end; height: 52px; }
.week .cols i { width: 9px; border-radius: 4px 4px 2px 2px; min-height: 2px; }
.u { background: #f0a36b; }
.e { background: #7cb87f; }
.week .lbl { font-size: .72rem; color: var(--muted); }
.week .d.today .lbl { color: var(--ink); font-weight: 700; }
.legend { display: flex; gap: 14px; font-size: .8rem; color: var(--muted); align-items: center; flex-wrap: wrap; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

.section-label { font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 6px; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.actions form { margin: 0; }
.custom { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.dev-foot { display: flex; gap: 6px; flex-wrap: wrap; border-top: 1px dashed var(--line); padding-top: 12px; }

/* ---------- кнопки ---------- */
input, select, textarea, button { font: inherit; color: inherit; }
.btn, button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line);
               background: #fff; border-radius: 12px; padding: 8px 14px; cursor: pointer; text-decoration: none; color: var(--ink);
               font-weight: 600; font-size: .95rem; transition: background .15s, box-shadow .15s; }
.btn:hover, button:hover { background: var(--soft); }
.btn:active, button:active { transform: translateY(1px); }
.btn.primary, button.primary { background: var(--honey); border-color: var(--honey); color: var(--ink); box-shadow: 0 2px 0 var(--honey-d); }
.btn.primary:hover, button.primary:hover { background: #ffb935; }
.btn.good, button.good { background: var(--good-soft); border-color: #bfe0bc; color: #1b5e20; }
.btn.good:hover, button.good:hover { background: #d3ead0; }
.btn.bad, button.bad { background: var(--bad-soft); border-color: #f5c6c2; color: var(--bad); }
.btn.bad:hover, button.bad:hover { background: #fbd9d5; }
.btn.blue, button.blue { background: var(--blue-soft); border-color: #c9dbf6; color: var(--blue); }
.btn.ghost, button.ghost { background: transparent; border-color: transparent; color: var(--brown); }
.btn.ghost:hover, button.ghost:hover { background: var(--soft); }
.btn.sm, button.sm { padding: 5px 10px; font-size: .86rem; border-radius: 10px; }
.btn.lg, button.lg { padding: 12px 22px; font-size: 1.05rem; border-radius: 14px; }
.btn.wide, button.wide { width: 100%; }

/* ---------- поля ---------- */
input, select, textarea { border: 1.5px solid #e2d6c5; border-radius: 11px; padding: 8px 10px; background: #fff; min-width: 0;
  color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--honey); box-shadow: 0 0 0 3px rgba(249, 168, 37, .22); }
input.num { width: 84px; }
input.num.sm { width: 64px; padding: 5px 7px; }
textarea { width: 100%; }
label { font-size: .92rem; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > b { font-weight: 600; }
.field .hint { font-size: .8rem; color: var(--muted); }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.unit { display: flex; align-items: center; gap: 6px; color: var(--muted); }

/* переключатель */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; position: relative; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 42px; height: 24px; border-radius: 99px; background: #d8cbbb; position: relative; transition: background .2s; flex-shrink: 0; }
.switch .track::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%;
                        background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: left .2s; }
.switch input:checked + .track { background: #4caf50; }
.switch input:checked + .track::after { left: 21px; }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px rgba(249, 168, 37, .4); }
.switch .txt b { display: block; font-weight: 600; }
.switch .txt span { font-size: .82rem; color: var(--muted); }
.switches { display: flex; flex-direction: column; gap: 12px; }

/* таблетки-флажки (дни недели) и плитки выбора (тип устройства) */
.pills { display: flex; gap: 4px; flex-wrap: wrap; }
.pill-check { position: relative; }
.pill-check input { position: absolute; opacity: 0; }
.pill-check span { display: inline-block; padding: 5px 10px; border-radius: 99px; background: var(--soft); font-size: .85rem; font-weight: 600;
                   cursor: pointer; border: 1.5px solid transparent; }
.pill-check input:checked + span { background: var(--honey-soft); border-color: var(--honey); }
.pill-check input:focus-visible + span { box-shadow: 0 0 0 3px rgba(249, 168, 37, .35); }
.choice-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice-tile { position: relative; }
.choice-tile input { position: absolute; opacity: 0; }
.choice-tile span { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px; border-radius: 16px;
                    border: 2px solid var(--line); background: #fff; cursor: pointer; font-weight: 700; text-align: center; }
.choice-tile span i { font-style: normal; font-size: 2rem; }
.choice-tile span small { font-weight: 500; color: var(--muted); }
.choice-tile input:checked + span { border-color: var(--honey); background: var(--honey-soft); }

/* ---------- значки ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; font-weight: 700; padding: 3px 9px; border-radius: 99px;
         background: var(--soft); color: var(--brown); white-space: nowrap; }
.badge.good { background: var(--good-soft); color: #1b5e20; }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.warn { background: var(--amber-soft); color: var(--amber); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 99px; background: var(--soft);
        text-decoration: none; color: var(--ink); font-weight: 600; font-size: .92rem; border: 1px solid transparent; }
.chip:hover { border-color: var(--honey); }
.chip.add { background: var(--honey-soft); }
.chip small { color: var(--muted); font-weight: 500; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- списки и таблицы ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .76rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--line); align-items: baseline; font-size: .92rem; }
.feed li:last-child { border-bottom: 0; }
.feed .when { color: var(--muted); font-size: .8rem; min-width: 78px; font-variant-numeric: tabular-nums; }
.feed .ico { width: 22px; text-align: center; flex-shrink: 0; }
.feed .what { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.feed .what span { color: var(--muted); }
.feed li.good .what b { color: var(--good); }
.feed li.warn { background: #fff8ec; border-radius: 8px; }
.feed li.warn .what b { color: var(--amber); }
.feed li.bad .what b { color: var(--bad); }

details > summary { cursor: pointer; color: var(--brown); font-weight: 600; font-size: .92rem; list-style: none; padding: 4px 0; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸ "; color: var(--muted); }
details[open] > summary::before { content: "▾ "; }
details .inside { padding-top: 8px; display: flex; flex-direction: column; gap: 10px; }

.empty { text-align: center; padding: 34px 18px; }
.empty img { width: 96px; }
.empty h2 { margin: 10px 0 4px; }

/* ---------- графики ---------- */
.chart { display: grid; grid-template-columns: 34px 1fr; gap: 6px; }
.chart .axis { display: flex; flex-direction: column; justify-content: space-between; font-size: .72rem; color: var(--muted);
               text-align: right; height: 180px; transform: translateY(-6px); }
.chart .plot { position: relative; height: 180px; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line);
               display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 0 4px; }
.chart .plot::before, .chart .plot::after { content: ""; position: absolute; left: 0; right: 0; border-top: 1px dashed var(--line); }
.chart .plot::before { top: 0; }
.chart .plot::after { top: 50%; }
.chart.short .axis, .chart.short .plot { height: 120px; }
.chart .day { position: relative; height: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 2px; border-radius: 6px; }
.chart .day.weekend { background: rgba(249, 168, 37, .08); }
.chart .day i { width: 36%; max-width: 16px; border-radius: 5px 5px 2px 2px; min-height: 2px; position: relative; z-index: 1; }
.chart .day i.a { width: 62%; max-width: 28px; }
.chart .day i.a.good { background: #66bb6a; }
.chart .day i.a.mid { background: #f6b23a; }
.chart .day i.a.bad { background: #e57373; }
.chart .day .pv { position: absolute; font-size: .68rem; font-weight: 700; color: var(--muted); z-index: 2; }
.chart-x { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px 4px 0; margin-left: 40px; }
.chart-x span { text-align: center; font-size: .72rem; color: var(--muted); line-height: 1.15; }
.chart-x span.weekend { color: var(--honey-d); }
.chart-x span.today { color: var(--ink); font-weight: 700; }

.subject-row { display: grid; grid-template-columns: 28px 1fr 48px; gap: 10px; align-items: center; padding: 7px 0; }
.subject-row .ico { font-size: 1.25rem; }
.subject-row .name { display: flex; justify-content: space-between; gap: 8px; font-size: .92rem; margin-bottom: 4px; }
.subject-row .p { text-align: right; font-weight: 700; }

/* ---------- уроки ---------- */
.subject-card .card-head h2 { display: flex; align-items: center; gap: 10px; font-size: 1.25rem; }
.subject-card.off .lesson-list { opacity: .5; }
.lesson { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 9px 4px;
          border-bottom: 1px solid var(--line); }
.lesson:last-child { border-bottom: 0; }
.lesson .title { font-weight: 600; }
.lesson .info { font-size: .8rem; color: var(--muted); }
.lesson .prices { display: flex; gap: 6px; }
.lesson .prices label { display: flex; flex-direction: column; align-items: center; font-size: .68rem; color: var(--muted); gap: 2px; }
.lesson.off .title { color: var(--muted); }
.lvl { color: var(--honey-d); letter-spacing: -1px; }

/* ---------- закреплённая панель «Сохранить» ---------- */
.savebar { position: sticky; bottom: 14px; z-index: 15; display: flex; align-items: center; gap: 12px; justify-content: flex-end;
           background: rgba(255, 253, 248, .97); border-radius: 16px; padding: 10px 12px 10px 18px;
           box-shadow: 0 8px 28px rgba(62, 39, 35, .18); border: 1.5px solid var(--line); margin-top: 8px; }
.savebar .state { margin-right: auto; color: var(--muted); font-size: .92rem; }
.savebar.dirty { border-color: var(--honey); }
.savebar.dirty .state { color: var(--amber); font-weight: 600; }

/* ---------- уведомления ---------- */
.toasts { position: fixed; top: 76px; right: 18px; z-index: 50; display: flex; flex-direction: column; gap: 8px; max-width: min(440px, calc(100vw - 36px)); }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
         display: flex; gap: 10px; align-items: flex-start; animation: toast-in .25s ease-out; font-size: .94rem; }
.toast.bad { background: var(--bad); }
.toast button { margin-left: auto; background: none; border: 0; color: #fff; opacity: .7; padding: 0 0 0 8px; font-size: 1.1rem; }
.toast.hide { animation: toast-out .3s ease-in forwards; }
@keyframes toast-in { from { transform: translateY(-8px); opacity: 0; } }
@keyframes toast-out { to { transform: translateY(-8px); opacity: 0; } }

/* ---------- подключение ---------- */
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 32px 1fr; gap: 12px; align-items: start; }
.steps li::before { content: counter(step); width: 32px; height: 32px; border-radius: 50%; background: var(--honey); color: var(--ink);
                    display: grid; place-items: center; font-weight: 800; }
.big-code { display: flex; gap: 8px; justify-content: center; margin: 14px 0 8px; flex-wrap: wrap; }
.big-code span { width: 54px; height: 66px; border-radius: 14px; background: var(--honey-soft); border: 2px solid var(--honey);
                 display: grid; place-items: center; font-size: 2.2rem; font-weight: 800; font-family: Consolas, "Cascadia Mono", monospace; }
.qr { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.qr svg { width: 168px; height: 168px; border-radius: 14px; box-shadow: var(--shadow); }
.code-pill { font-family: Consolas, monospace; font-weight: 700; letter-spacing: .12em; }

/* ---------- редактор ---------- */
.code-edit { font-family: Consolas, "Cascadia Mono", "Courier New", monospace; font-size: .92rem; line-height: 1.5; tab-size: 2;
             background: #fffefb; min-height: 520px; resize: vertical; white-space: pre; overflow-wrap: normal; }
.snippet { width: 100%; justify-content: flex-start; text-align: left; flex-direction: column; align-items: flex-start; gap: 0; margin-bottom: 6px; }
.snippet span { font-weight: 400; font-size: .8rem; color: var(--muted); }
.gen-list { display: flex; flex-wrap: wrap; gap: 4px; }
.gen-list code { font-size: .78rem; cursor: pointer; }
.gen-list code:hover { background: var(--honey-soft); }

/* ---------- словарь ---------- */
table.words td { padding: 4px; }
table.words input:not([type=checkbox]):not(.num) { width: 100%; min-width: 110px; padding: 6px 8px; }
table.words tr.new input { background: #fffcf4; border-style: dashed; }
table.words tr.gone td { opacity: .4; }
.topic-head { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 10px; }
.topic-head .field input:not(.num) { min-width: 220px; font-weight: 700; }

/* разделы словаря сворачиваются, у каждого — общий выключатель «в уроках» */
.topic-toggle { align-self: center; flex-shrink: 0; width: 30px; height: 30px; border: 0; border-radius: 9px;
                background: var(--soft); color: var(--brown); font-size: 1rem; cursor: pointer; transition: transform .15s; }
section.topic.open > .topic-head .topic-toggle, section.topic.search-open > .topic-head .topic-toggle { transform: rotate(90deg); }
section.topic > .table-wrap { display: none; }
section.topic.open > .table-wrap, section.topic.search-open > .table-wrap { display: block; }
section.topic.filtered-out { display: none; }
section.topic:not(.open):not(.search-open) .topic-head { margin-bottom: 0; }
.topic-head .count { cursor: pointer; }
.section-switch { align-self: center; }
.section-switch .txt { font-size: .82rem; color: var(--muted); }

/* ---------- вход ---------- */
.login { min-height: calc(100vh - 140px); display: grid; place-items: center; }
.login .card { width: min(420px, 100%); text-align: center; padding: 28px 26px; }
.login img { width: 96px; height: 96px; }
.login form { text-align: left; margin-top: 14px; }

/* ---------- узкие экраны (телефон родителя) ---------- */
@media (max-width: 860px) {
  .cols-main, .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  main { padding: 14px 12px 90px; }
  .top-in { padding: 8px 12px; gap: 8px; flex-wrap: wrap; }
  .brand small { display: none; }
  .nav { margin-left: 0; width: 100%; overflow-x: auto; justify-content: space-between; }
  .nav a, .nav button { padding: 7px 10px; font-size: .88rem; white-space: nowrap; }
  .nav button .lbl { display: none; }
  .hello { padding: 14px 16px; gap: 12px; }
  .hello img { width: 44px; height: 44px; }
  .hello h1, .page-head h1 { font-size: 1.3rem; }
  .grid { grid-template-columns: 1fr; }
  .mini-tiles { grid-template-columns: repeat(2, 1fr); }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .tiles > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .tile .v { font-size: 1.5rem; }
  .lesson { grid-template-columns: auto minmax(0, 1fr) auto; }
  .lesson .prices { grid-column: 2 / -1; }
  .big-code span { width: 42px; height: 54px; font-size: 1.7rem; }
  .toasts { top: auto; bottom: 16px; right: 12px; left: 12px; max-width: none; }
}
