/* CRM садика ASILADIY — большой экран для директора и администрации.

   Цвета те же, что у кабинета в Telegram и у логотипа: садик узнаётся по
   фиолетовому. Оранжевый — только главное действие на экране, голубой —
   ссылки и выбранное. Зелёный, оранжевый и розовый у статусов различаются
   ещё и светлотой, а не только оттенком.
*/

:root {
    --bg:       #430d59;
    --side:     #3a0b4d;
    --card:     #55176e;
    --sunk:     #3a0b4d;
    --hover:    #5f1c7a;
    --sel:      #6a2386;
    --text:     #ffffff;
    --soft:     #e6d8ee;
    --dim:      #bda3cc;
    --line:     rgba(255, 255, 255, .12);
    --edge:     rgba(255, 255, 255, .2);

    --accent:   #35b6ec;
    --brand:    #ff9501;
    --ink:      #2a0838;
    --good:     #4fd18b;
    --warn:     #ffb547;
    --bad:      #ff8fa3;
    --crimson:  #e91a50;

    --r-card: 16px;
    --r-item: 11px;
}

* { box-sizing: border-box; }

html, body { margin: 0; }
body {
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.45 'Onest', 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
a:hover { color: #7fd3f5; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.boot { padding: 40px; color: var(--dim); }

/* --- каркас: меню слева, содержимое справа --- */
.app { display: flex; min-height: 100vh; }
.side {
    flex: none; width: 236px; height: 100vh; position: sticky; top: 0;
    overflow-y: auto; background: var(--side);
    padding: 20px 14px; display: flex; flex-direction: column; gap: 3px;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 18px; text-decoration: none; color: var(--text); }
.brand img { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; }
.logo-stub { width: 44px; height: 44px; border-radius: 12px; background: var(--card); display: grid; place-items: center; font-size: 24px; flex: none; }
.login .logo-stub { width: 84px; height: 84px; border-radius: 22px; font-size: 44px; }
.brand b { display: block; font-size: 16px; letter-spacing: .02em; }
.brand small { color: var(--dim); font-size: 12px; }

.nav {
    display: flex; align-items: center; gap: 12px; min-height: 44px;
    padding: 10px 12px; border-radius: var(--r-item);
    color: var(--soft); text-decoration: none; font-size: 15px;
}
.nav svg { flex: none; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
a.nav:hover { background: #4d1465; color: var(--text); }
.nav.on { background: var(--card); color: var(--text); }
.nav.on svg { stroke: var(--brand); }
.nav.soon { color: #9c84ab; cursor: default; font-size: 14px; white-space: nowrap; }
.nav.soon small { margin-left: auto; font-size: 11px; padding: 1px 7px; border-radius: 999px; border: 1px solid #6e4a80; }

.who { margin-top: auto; padding: 16px 8px 0; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: #1d0628; display: grid; place-items: center; font-weight: 700; }
.who .meta { min-width: 0; flex: 1; line-height: 1.25; }
.who .meta b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who .meta small { color: var(--dim); font-size: 13px; }
.linkish { background: none; border: 0; padding: 4px 0; color: var(--accent); cursor: pointer; font-size: 13px; }

main { flex: 1; min-width: 0; padding: 24px clamp(16px, 3vw, 36px) 48px; display: flex; flex-direction: column; gap: 20px; }

/* --- шапка страницы --- */
.head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.head .title { flex: 1 1 280px; min-width: 0; }
.crumb { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--brand); }
h1 { margin: 4px 0 0; font-size: 30px; line-height: 1.15; font-weight: 700; letter-spacing: -.02em; }
.sub { color: var(--dim); font-size: 14px; margin-top: 4px; }
h2 { margin: 0; font-size: 18px; font-weight: 600; }
h3 { margin: 0 0 8px; font-size: 16px; font-weight: 600; }

/* --- кнопки --- */
.btn {
    min-height: 44px; padding: 0 18px; border-radius: 12px; cursor: pointer;
    border: 1px solid var(--edge); background: transparent; color: var(--text); font-weight: 600;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
}
.btn:hover { background: #4d1465; }
.btn.main { border: 0; background: var(--brand); color: var(--ink); font-weight: 700; }
.btn.main:hover { background: #ffa526; }
.btn.danger { border-color: var(--crimson); color: var(--bad); }
.btn.danger:hover { background: rgba(233, 26, 80, .15); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .55; cursor: progress; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 0; background: transparent; color: var(--dim); cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover { background: var(--sunk); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* --- карточки и сетки --- */
.card { background: var(--card); border-radius: var(--r-card); padding: 18px 20px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.card-head .aside { margin-left: auto; font-size: 13px; color: var(--dim); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.kpi { display: flex; flex-direction: column; gap: 6px; }
.kpi .label { color: var(--dim); font-size: 14px; }
.kpi .value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.kpi .value small { font-size: 15px; font-weight: 500; color: var(--dim); }
.kpi .note { font-size: 14px; color: var(--dim); }
.kpi.edge { box-shadow: inset 0 0 0 2px var(--brand); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(400px, 100%), 1fr)); gap: 16px; align-items: start; }
.split { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.split > .wide { flex: 999 1 560px; min-width: 0; }
.split > .narrow { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }

.good { color: var(--good); }
.warn { color: var(--warn); }
.bad  { color: var(--bad); }
.dim  { color: var(--dim); }
.blue { color: var(--accent); }

/* --- строки списков --- */
.row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .small { font-size: 13px; color: var(--dim); }
.row .end { font-size: 13px; white-space: nowrap; text-align: right; }
.dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--dim); }
.dot.good { background: var(--good); }
.dot.warn { background: var(--brand); }
.dot.bad  { background: var(--crimson); }
.dot.blue { background: var(--accent); }

.track { height: 8px; border-radius: 4px; background: var(--sunk); overflow: hidden; }
.track > i { display: block; height: 100%; border-radius: 4px; background: var(--good); }
.track.thick { height: 10px; border-radius: 5px; }
.track.orange > i { background: var(--brand); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; }
.tile { background: var(--sunk); border-radius: var(--r-item); padding: 10px 12px; }
.tile b { display: block; font-size: 20px; }
.tile small { font-size: 13px; color: var(--dim); }

.inset { background: var(--sunk); border-radius: var(--r-item); padding: 12px 14px; }
.empty { color: var(--dim); padding: 6px 0; }

/* --- фильтры и поиск --- */
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chip {
    min-height: 40px; padding: 0 16px; border-radius: 999px; cursor: pointer;
    border: 1px solid var(--edge); background: transparent; color: var(--text); font-size: 14px; font-weight: 500;
}
.chip:hover { background: #4d1465; }
.chip[aria-pressed="true"] { background: #fff; color: var(--ink); border-color: #fff; }
.search {
    margin-left: auto; flex: 0 1 320px; display: flex; align-items: center; gap: 10px;
    height: 44px; padding: 0 14px; border-radius: 12px; background: var(--sunk); color: var(--dim);
}
.search svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 14px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- таблицы: строки — кнопки, чтобы до них доходил Tab --- */
.scroll { overflow-x: auto; }
.table { min-width: 640px; }
.thead, .trow {
    display: grid; gap: 12px; align-items: center; padding: 10px 16px;
    grid-template-columns: var(--cols);
}
.thead { font-size: 13px; color: var(--dim); }
.trow { width: 100%; min-height: 52px; border: 0; border-top: 1px solid var(--line); background: transparent; color: var(--text); font-size: 14px; text-align: left; }
button.trow { cursor: pointer; }
button.trow:hover { background: var(--hover); }
.trow.on { background: var(--sel); }
.trow .name { font-weight: 600; }
.right { text-align: right; }
.kids-table { --cols: minmax(180px, 2fr) minmax(100px, 1fr) minmax(130px, 1.2fr) minmax(110px, 1fr) 80px; }
.cash-table { --cols: 92px minmax(140px, 1fr) minmax(200px, 2fr) minmax(110px, .8fr) 120px 40px; min-width: 760px; }

/* --- карточка ребёнка --- */
.kid { display: flex; flex-direction: column; gap: 16px; }
.kid-top { display: flex; gap: 14px; align-items: center; }
.kid-top .avatar { width: 56px; height: 56px; font-size: 22px; }
.kid-top h2 { font-size: 20px; line-height: 1.2; }
.months { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
.month { background: var(--sunk); border-radius: 10px; padding: 8px 6px; text-align: center; }
.month small { display: block; font-size: 13px; color: var(--dim); }
.month b { font-size: 13px; font-weight: 600; }
.kv { display: flex; flex-direction: column; gap: 2px; }
.kv small { font-size: 13px; color: var(--dim); }
.pay-list .row { padding: 8px 0; font-size: 14px; }
.placeholder { color: var(--dim); text-align: center; padding: 40px 10px; }

/* --- окно (dialog) --- */
dialog {
    width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto;
    border: 0; border-radius: 18px; padding: 22px; background: var(--card); color: var(--text);
    box-shadow: 0 24px 60px rgba(15, 0, 25, .55);
}
dialog::backdrop { background: rgba(20, 2, 30, .6); }
dialog h2 { font-size: 20px; margin-bottom: 4px; }
.form { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--dim); }
.field input, .field select {
    min-height: 46px; padding: 0 12px; border-radius: 12px; border: 1px solid transparent;
    background: var(--sunk); color: var(--text); font-size: 15px;
}
.field input:focus, .field select:focus { border-color: var(--accent); outline: 0; }
.pair { display: grid; grid-template-columns: 1fr 120px; gap: 10px; }
.actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 6px; }
.actions .btn { flex: 1 1 140px; }
.error { color: var(--bad); font-size: 14px; }
.effects { margin: 10px 0 0; padding-left: 18px; color: var(--soft); }
.effects li { margin: 4px 0; }
.choice { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.choice .btn { justify-content: flex-start; text-align: left; }

/* --- всплывающее сообщение --- */
#toast {
    position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 10;
    max-width: min(560px, calc(100vw - 32px)); padding: 12px 18px; border-radius: 12px;
    background: #1f0630; color: var(--text); box-shadow: 0 12px 30px rgba(0, 0, 0, .35); font-size: 14px;
}
#toast.bad { background: #5a0b25; }

/* --- загрузка --- */
.skeleton { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.skeleton i { height: 110px; border-radius: var(--r-card); background: linear-gradient(90deg, #4d1465, #5c1b78, #4d1465); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton i { animation: none; } }

/* --- вход --- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login .card { width: min(440px, 100%); padding: 32px 28px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.login img { width: 84px; height: 84px; border-radius: 22px; }
.login h1 { font-size: 26px; }
.login p { margin: 0; color: var(--soft); }
.login .hint { font-size: 13px; color: var(--dim); }
#tg-widget { min-height: 48px; display: grid; place-items: center; }

/* --- второй этап: вкладки, отметки, шаги, табель, меню недели --- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--dim); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--brand); }

.att-row { flex-wrap: wrap; padding: 8px 0; }
.att-row .grow { flex: 1 1 160px; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.seg button {
    min-height: 36px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--edge);
    background: transparent; color: var(--soft); font-size: 13px; cursor: pointer;
}
.seg button:hover { background: #4d1465; }
.seg button[aria-pressed="true"] { background: var(--bad); border-color: var(--bad); color: #3a0b1a; font-weight: 600; }
.seg button.ok[aria-pressed="true"] { background: var(--good); border-color: var(--good); color: #12301f; }

.stepper { display: flex; gap: 4px; margin: 12px 0 2px; }
.stepper i { flex: 1; height: 4px; border-radius: 2px; background: var(--sunk); }
.stepper i.on { background: var(--brand); }
.grid-choice { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
.grid-choice .btn { justify-content: center; }
.kv-list { display: flex; flex-direction: column; gap: 8px; }
.kv-list > div { display: flex; justify-content: space-between; gap: 12px; }
.kv-list small { color: var(--dim); font-size: 13px; }

table.tabel, table.week { border-collapse: collapse; font-size: 13px; width: 100%; }
.tabel th, .tabel td { border-top: 1px solid var(--line); padding: 7px 6px; text-align: center; white-space: nowrap; }
.tabel th { color: var(--dim); font-weight: 500; }
.tabel .who { text-align: left; position: sticky; left: 0; background: var(--card); min-width: 190px; padding-left: 16px; }
.tabel td.good, .tabel td.bad, .tabel td.blue, .tabel td.warn { font-weight: 700; }
.week { min-width: 900px; }
.week th, .week td { border-top: 1px solid var(--line); padding: 10px; vertical-align: top; text-align: left; }
.week thead th { color: var(--dim); font-weight: 500; }
.week tbody th { color: var(--brand); font-weight: 600; white-space: nowrap; width: 90px; }
.week .now { background: rgba(53, 182, 236, .08); }
.dish { display: block; width: 100%; margin: 0 0 4px; padding: 4px 6px; border: 0; border-radius: 8px; background: transparent; color: var(--text); text-align: left; font-size: 13px; cursor: pointer; }
.dish:hover { background: var(--hover); }
.dish-link { font-size: 15px; padding: 0; text-align: left; }

.plan-table { --cols: minmax(180px, 2fr) 100px 100px 110px 110px; min-width: 600px; }
.stock-table { --cols: minmax(170px, 2fr) minmax(120px, 1.2fr) 110px 110px minmax(120px, 1fr); }
.staff-table { --cols: minmax(170px, 1.6fr) minmax(130px, 1.2fr) minmax(120px, 1.1fr) 100px 110px 100px 100px 90px 96px; min-width: 1090px; }
.staff-table .btn { min-height: 36px; padding: 0 12px; }

/* --- третий этап: воронка заявок и академия --- */
.board { display: grid; grid-template-columns: repeat(5, minmax(210px, 1fr)); gap: 12px; overflow-x: auto; align-items: start; padding-bottom: 4px; }
.column { background: var(--sunk); border-radius: var(--r-card); padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 120px; }
.column.muted { opacity: .8; }
.column-head { display: flex; align-items: center; gap: 8px; padding: 4px 4px 2px; }
.column-head .count { margin-left: auto; min-width: 24px; padding: 1px 8px; border-radius: 999px; background: var(--card); color: var(--dim); font-size: 12px; text-align: center; }
.lead { display: flex; flex-direction: column; gap: 4px; width: 100%; padding: 10px 12px; border: 0; border-radius: 12px; background: var(--card); color: var(--text); text-align: left; cursor: pointer; font-size: 14px; }
.lead:hover { background: var(--hover); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; background: rgba(255, 255, 255, .1); color: var(--soft); font-size: 12px; font-weight: 500; vertical-align: middle; }
.tag.bad { background: rgba(255, 143, 163, .18); color: var(--bad); }
.tag.warn { background: rgba(255, 181, 71, .16); color: var(--warn); }
.tag.good { background: rgba(79, 209, 139, .16); color: var(--good); }
.tag.blue { background: rgba(53, 182, 236, .16); color: var(--accent); }
.tag.dim { color: var(--dim); }
.field textarea { padding: 10px 12px; border-radius: 12px; border: 1px solid transparent; background: var(--sunk); color: var(--text); font: inherit; font-size: 15px; resize: vertical; }
.field textarea:focus { border-color: var(--accent); outline: 0; }
.roles { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 12px; max-height: 220px; overflow: auto; font-size: 14px; }
.roles legend { color: var(--dim); font-size: 13px; padding: 0 4px; }
.roles label, .check { display: flex; align-items: center; gap: 8px; color: var(--soft); font-size: 14px; }
.roles input, .check input { width: 18px; height: 18px; accent-color: var(--brand); }
.lesson-text { white-space: pre-line; font-size: 14px; margin: 0 0 6px; }

/* --- телефон: меню сверху строкой --- */
@media (max-width: 900px) {
    .app { flex-direction: column; }
    .side { width: auto; height: auto; position: static; flex-direction: row; align-items: center; overflow-x: auto; padding: 10px 12px; gap: 4px; }
    .brand { padding: 0 8px 0 0; }
    .brand span, .nav.soon, .who .meta { display: none; }
    .nav { flex: none; padding: 8px 10px; }
    .who { margin: 0 0 0 auto; padding: 0; border: 0; }
    h1 { font-size: 24px; }
    .search { margin-left: 0; flex: 1 1 100%; }
}
.login .card.setup { width: min(560px, 100%); }

/* --- телефон: таблицы карточками, карточка ребёнка вместо списка --- */
.back-kids { display: none; }
.inv-row .grow { overflow-wrap: anywhere; }
.inv-cost { white-space: nowrap; }
@media (max-width: 900px) {
    .split.picked > .wide, main:has(.split.picked) .bar { display: none; }
    .split.picked .back-kids { display: inline-flex; align-self: flex-start; }
    .inv-row { flex-wrap: wrap; }
    .inv-row .grow { flex: 1 1 100%; }
    .inv-row .inv-cost { margin-right: auto; }
}
@media (max-width: 640px) {
    .scroll .table { min-width: 0; }
    .table .thead { display: none; }
    .table .trow { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; padding: 12px 16px; }
    .table .trow > * { min-width: 0; overflow-wrap: anywhere; text-align: left; }
    .table .trow > :first-child { flex: 1 1 100%; }
    .table .trow > :empty { display: none; }
    .table .trow > [data-label]::before { content: attr(data-label) " "; color: var(--dim); font-size: 12px; font-weight: 400; }
}

/* --- «Замечание» на каждой странице --- */
.fb-button { position: fixed; right: 16px; bottom: 16px; z-index: 50; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); }

/* Переключатель языка (23.10): справа вверху на каждой странице. */
.lang-switch { position: fixed; top: 12px; right: 16px; z-index: 30; display: flex; gap: 2px; padding: 3px;
    border-radius: 999px; background: var(--card, #fff); box-shadow: 0 2px 10px rgba(0, 0, 0, .12); }
.lang-switch button { border: 0; background: transparent; color: inherit; font: inherit; font-size: 13px;
    font-weight: 600; padding: 5px 10px; border-radius: 999px; cursor: pointer; }
.lang-switch button[aria-pressed="true"] { background: var(--sel, #0A8F92); color: #fff; }
@media (max-width: 900px) { .lang-switch { top: 8px; right: 8px; } }

/* Тема «Qyen» (23.10): садики без своих цветов — тёмно-синий, бирюзовый, оранжевый.
   Включается настройкой садика theme = qyen; ASILADIY остаётся в своих цветах. */
html[data-theme="qyen"] {
    --bg:     #0F1B33;
    --side:   #0B1426;
    --card:   #16264A;
    --sunk:   #0B1426;
    --hover:  #1C2F57;
    --sel:    #0A8F92;
    --soft:   #DCE6EF;
    --dim:    #8FA3B8;
    --accent: #2CCBC6;
    --brand:  #FF8A1F;
    --ink:    #0F1B33;
}
html[data-theme="qyen"] a.nav:hover,
html[data-theme="qyen"] .btn:hover,
html[data-theme="qyen"] .chip:hover,
html[data-theme="qyen"] .seg button:hover { background: #1C2F57; }
html[data-theme="qyen"] .skeleton i { background: linear-gradient(90deg, #16264A, #1C2F57, #16264A); background-size: 200% 100%; }
