/* Портал для партнёров «Вай Тай». Палитра: фиолетовый + синий (фирменные цвета сети). Без внешних зависимостей. */

:root {
  --violet: #7c3aed;
  --violet-d: #6d28d9;
  --violet-l: #ede9fe;
  --violet-xl: #f5f3ff;
  --blue: #3b82f6;
  --bg: #f0f2ff;
  --text: #334155;
  --muted: #94a3b8;
  --line: #e9e5fb;
  --danger: #ef4444;
  --radius: 14px;
  --grad: linear-gradient(90deg, #7c3aed, #3b82f6);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 Inter, "Segoe UI", Arial, sans-serif; -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
h2 { font-size: 18px; font-weight: 600; color: #1e293b; }
h3 { font-size: 14px; font-weight: 600; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled, select:disabled, input:disabled { opacity: .4; cursor: not-allowed; }
a { color: var(--blue); }
code { background: var(--violet-xl); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.icon { flex-shrink: 0; vertical-align: middle; }
.boot { padding: 40px; text-align: center; color: var(--muted); }

/* ── Утилиты ── */
.row { display: flex; align-items: center; }
.row.top { align-items: flex-start; } .row.end { align-items: flex-end; }
.between { justify-content: space-between; } .center { align-items: center; } .wrap { flex-wrap: wrap; }
.gap { gap: 8px; } .gap-xs { gap: 4px; }
.grow { flex: 1; min-width: 0; } .minw { min-width: 160px; } .maxw { max-width: 260px; } .push { margin-left: auto; }
.trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .nowrap { white-space: nowrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-lg { display: flex; flex-direction: column; gap: 20px; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; }
.stack-xs { display: flex; flex-direction: column; gap: 2px; }
.mt { margin-top: 12px; } .mt-sm { margin-top: 8px; } .mb { margin-bottom: 14px; } .pad { padding: 8px 12px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .tiny { font-size: 10.5px; } .bold { font-weight: 600; }
.normal { font-weight: 400; text-transform: none; letter-spacing: 0; } .mono { font-family: Consolas, monospace; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.center-x { text-align: center; justify-self: center; }
.ph { color: var(--muted); font-style: italic; }

/* ── Цветовые акценты разделов ── */
[class*="-violet"] { --c: #7c3aed; --cl: #ddd6fe; }
[class*="-indigo"] { --c: #4f46e5; --cl: #c7d2fe; }
[class*="-blue"] { --c: #2563eb; --cl: #bfdbfe; }
[class*="-amber"] { --c: #d97706; --cl: #fde68a; }
[class*="-rose"] { --c: #e11d48; --cl: #fecdd3; }
[class*="-cyan"] { --c: #0891b2; --cl: #a5f3fc; }
[class*="-purple"] { --c: #9333ea; --cl: #e9d5ff; }
[class*="accent-"] { color: var(--c); }
.tbl.violet { --c: #7c3aed; --cl: #ddd6fe; } .tbl.rose { --c: #e11d48; --cl: #fecdd3; } .tbl.blue { --c: #2563eb; --cl: #bfdbfe; }

/* ── Каркас ── */
.topbar { background: linear-gradient(90deg, #6d28d9, #9333ea 50%, #3b82f6); color: #fff; padding: 18px 24px; box-shadow: 0 4px 16px rgba(76, 29, 149, .25); }
.topbar-in { max-width: 1280px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.topbar h1 { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.topbar p { font-size: 12px; color: #ddd6fe; margin-top: 2px; }
.top-tiles { display: flex; gap: 10px; flex-wrap: wrap; }
.tile { background: rgba(255, 255, 255, .15); border-radius: 12px; padding: 7px 14px; text-align: center; min-width: 100px; max-width: 220px; display: flex; flex-direction: column; align-items: center; }
.tile b { font-size: 13px; font-weight: 600; max-width: 100%; }
.tile span { font-size: 11px; color: #ddd6fe; }
.btn-tile { flex-direction: row; gap: 8px; justify-content: center; color: #fff; font-weight: 500; min-width: 0; }
.btn-tile:hover { background: rgba(255, 255, 255, .28); }
.year-select { background: transparent; border: 0; color: #fff; font-weight: 600; font-size: 13px; text-align: center; cursor: pointer; }
.year-select option { color: #1e293b; }

.layout { max-width: 1280px; margin: 24px auto 40px; padding: 0 16px; display: flex; gap: 24px; align-items: flex-start; }
.side { width: 240px; flex-shrink: 0; position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.main { flex: 1; min-width: 0; }
.side ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 24px; box-shadow: 0 1px 3px rgba(76, 29, 149, .06); }
.side .card { padding: 14px; }
.label-up { font-size: 11px; font-weight: 600; color: #8b5cf6; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.label-up.inline { display: inline; margin: 0; }
.nav-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; font-weight: 500; color: #475569; text-align: left; transition: background .15s, color .15s; }
.nav-item .icon { color: #a78bfa; }
.nav-item:hover { background: var(--violet-xl); color: var(--violet-d); }
.nav-item.active { background: var(--grad); color: #fff; box-shadow: 0 2px 6px rgba(124, 58, 237, .3); }
.nav-item.active .icon { color: #fff; }

.foot { text-align: center; padding: 16px 16px 28px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.versions { max-width: 760px; width: 100%; text-align: left; }
.versions summary { cursor: pointer; text-align: center; color: var(--violet); font-weight: 500; list-style: none; }
.versions summary::-webkit-details-marker { display: none; }
.versions summary::after { content: " ▾"; } .versions[open] summary::after { content: " ▴"; }
.versions-body { margin-top: 10px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 18px; max-height: 460px; overflow: auto; color: var(--text); }
.versions-body section + section { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.versions-body h4 { font-size: 13px; margin-bottom: 6px; }
.versions-body ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.versions-body li { font-size: 12.5px; }
.tag { display: inline-block; font-size: 10px; font-weight: 600; padding: 1px 7px; border-radius: 99px; margin-right: 4px; text-transform: uppercase; letter-spacing: .03em; }
.tag-sec { background: #fee2e2; color: #b91c1c; } .tag-new { background: #dcfce7; color: #15803d; }
.tag-fix { background: #dbeafe; color: #1d4ed8; } .tag-chg { background: #fef3c7; color: #b45309; }

/* ── Вход ── */
body:has(.login-page) { background: var(--bg); }
.login-page { min-height: 100vh; }
.login-page { display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 32px; max-width: 380px; width: 100%; text-align: center; display: flex; flex-direction: column; gap: 14px; }
.login-card h1 { font-size: 18px; color: #1e293b; }

/* ── Кнопки и поля ── */
.btn-primary { background: var(--grad); color: #fff; border-radius: 12px; padding: 10px 16px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn-primary:hover { opacity: .9; }
.btn-outline { border: 1px solid #ddd6fe; color: var(--violet-d); border-radius: 12px; padding: 10px 16px; font-weight: 500; }
.btn-outline:hover { background: var(--violet-xl); }
.link-btn { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: #8b5cf6; font-weight: 500; }
.link-btn:hover { color: var(--violet-d); } .link-btn.lg { font-size: 14px; } .link-btn.danger { color: #f87171; } .link-btn.danger:hover { color: var(--danger); }
.link-btn[class*="accent-"] { color: var(--c); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; color: #a78bfa; padding: 3px; border-radius: 6px; }
.icon-btn:hover { background: var(--violet-xl); }
.icon-btn.danger { color: #fca5a5; } .icon-btn.danger:hover { color: var(--danger); background: #fef2f2; }
.icon-btn.accent { color: var(--violet); }
.icon-btn[class*="accent-"] { color: var(--c); }
.icon-link { color: #60a5fa; display: inline-flex; } .icon-link:hover { color: #2563eb; }
.hover-only { opacity: 0; transition: opacity .15s; }
.group:hover .hover-only, .list-row:hover .hover-only, .comment:hover .hover-only, .row-card:hover .hover-only, .faq-head:hover .hover-only, .svc-card:hover > .row > .hover-only { opacity: .75; }
.hover-only:hover, .hover-only:focus-visible { opacity: 1 !important; }
@media (hover: none) { .hover-only { opacity: .6; } }

.sel, .inp, .month-select { border: 1px solid #ddd6fe; border-radius: 8px; padding: 5px 8px; background: #fff; font-size: 12px; min-width: 0; }
.sel[class*="b-"] { border-color: var(--cl); color: var(--c); }
.inp { font-size: 13px; padding: 7px 10px; }
.inp.block { width: 100%; resize: vertical; padding: 10px 12px; border-radius: 10px; }
.inp.num { width: 54px; text-align: center; padding: 3px 4px; }
.sel:focus, .inp:focus, .ed-input:focus { outline: 2px solid #c4b5fd; outline-offset: 0; }
.month-select { font-size: 18px; font-weight: 600; color: var(--violet-d); border: 0; background: transparent; cursor: pointer; }
.nav-btn { width: 32px; height: 32px; border: 1px solid #ddd6fe; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; color: #8b5cf6; }
.nav-btn:hover:not(:disabled) { background: var(--violet-xl); }
.field { display: flex; flex-direction: column; gap: 2px; }
.field-label { display: block; font-size: 11px; font-weight: 600; color: #7c3aed; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 3px; }
input[type="checkbox"] { accent-color: var(--violet); }
.color-input { width: 32px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; background: #fff; }

/* ── Заголовок раздела, чипы ── */
.section-header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.bar { width: 4px; height: 32px; border-radius: 4px; flex-shrink: 0; margin-top: 2px; background: linear-gradient(#8b5cf6, #3b82f6); }
.bar[class*="bar-"] { background: linear-gradient(var(--c), color-mix(in srgb, var(--c) 55%, #3b82f6)); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { font-size: 12px; font-weight: 500; padding: 6px 12px; border-radius: 99px; background: var(--violet-xl); color: var(--violet); display: inline-flex; align-items: center; gap: 6px; transition: opacity .15s; }
.chip:hover { background: var(--violet-l); }
.chip.active { background: var(--grad); color: #fff; box-shadow: 0 1px 4px rgba(124, 58, 237, .3); }
.chip.type.dim { opacity: .55; } .chip.type:hover { opacity: 1; }
.dot { width: 6px; height: 6px; border-radius: 50%; }
.badge { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; flex-shrink: 0; }
.pill { font-size: 12px; padding: 2px 8px; border-radius: 99px; } .pill-rose { background: #fff1f2; color: #e11d48; }
.fmt { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; }
.fmt-green { background: #dcfce7; color: #15803d; } .fmt-red { background: #fee2e2; color: #b91c1c; } .fmt-blue { background: #dbeafe; color: #1d4ed8; }
.fmt-purple { background: #f3e8ff; color: #7e22ce; } .fmt-gray { background: #f1f5f9; color: #475569; }

/* ── Календарь ── */
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-grid.head { margin-bottom: 4px; } .cal-grid.head div { text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); padding: 4px 0; }
.cal-cell { min-height: 92px; border: 1px solid #f5f3ff; border-radius: 10px; padding: 6px; text-align: left; display: flex; flex-direction: column; gap: 4px; background: #fff; transition: border-color .15s, background .15s; }
.cal-cell:hover { border-color: #ddd6fe; background: #faf8ff; }
.cal-cell.selected { border-color: #a78bfa; background: var(--violet-xl); box-shadow: 0 0 0 2px #ddd6fe; }
.day-num { font-size: 12px; color: var(--muted); } .day-num.today { width: 20px; height: 20px; border-radius: 50%; background: var(--violet); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; }
.cal-chip { font-size: 10px; line-height: 1.25; padding: 2px 4px; border-radius: 5px; border: 1px solid; overflow-wrap: anywhere; }
.day-panel { margin-top: 16px; padding: 14px; border-radius: 14px; background: rgba(245, 243, 255, .7); border: 1px solid var(--line); }
.act-bar { border-radius: 10px; border: 1px solid var(--line); overflow: hidden; } .act-bar.inline { background: #fff; }
.act-head { width: 100%; display: flex; align-items: center; gap: 8px; padding: 8px 12px; text-align: left; font-weight: 500; }
.act-head:disabled { opacity: 1; cursor: default; }
.act-body { padding: 8px 14px 14px; border-top: 1px solid var(--line); background: rgba(255, 255, 255, .7); }
.city { font-size: 12px; color: #fb7185; } .scope { font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 5px; }
.scope-federal { background: #e0e7ff; color: #4338ca; } .scope-regional { background: #dbeafe; color: #1d4ed8; } .scope-local { background: var(--violet-l); color: #6d28d9; }

/* ── Списки и строки ── */
.row-card { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.row-card[class*="b-"] { border-color: var(--cl); }
.list-row { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid #f5f3ff; border-radius: 9px; padding: 6px 10px; }
.chip-count { font-size: 11px; background: var(--violet-l); color: var(--violet-d); border-radius: 99px; padding: 1px 7px; font-weight: 600; flex-shrink: 0; }
.manage-grid { display: grid; grid-template-columns: 24px 128px minmax(130px, 1fr) 96px 92px 44px 124px 10px 124px 24px; gap: 8px; align-items: center; }
.manage-grid > * { min-width: 0; } .manage-grid input[type="date"], .row-card input[type="date"] { font-size: 11px; padding: 4px 5px; }
.manage-head { padding: 0 12px; margin-bottom: 4px; } .manage-head span { font-size: 10px; font-weight: 600; color: #8b5cf6; text-transform: uppercase; letter-spacing: .05em; }
.add-bar { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.faq-head { display: flex; align-items: center; gap: 12px; padding: 13px 16px; cursor: pointer; } .faq-head:hover { background: rgba(245, 243, 255, .6); }
.faq-head .rot { transform: rotate(180deg); } .faq-head .icon { color: #a78bfa; }

/* ── Редактирование на месте ── */
.ed { cursor: pointer; display: inline-flex; align-items: center; gap: 4px; border-radius: 5px; padding: 0 4px; margin: 0 -4px; transition: background .15s; white-space: pre-wrap; overflow-wrap: anywhere; }
.ed:hover { background: var(--violet-xl); } .ed .icon { opacity: 0; color: #a78bfa; transition: opacity .15s; } .ed:hover .icon { opacity: .7; }
.ed.empty { color: var(--muted); font-style: italic; }
.ed.editing { display: inline-block; padding: 0; background: none; }
.ed-input { border: 1px solid #a78bfa; border-radius: 6px; padding: 3px 7px; background: var(--violet-xl); min-width: 180px; width: 100%; font-size: 13px; resize: vertical; }

/* ── Карточка активности ── */
.detail { display: flex; flex-direction: column; gap: 16px; padding-top: 6px; }
.detail-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; } .detail-head .label-up { margin: 0; }
.info-box { background: #fff; border: 1px solid #f5f3ff; border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.info-row { display: flex; align-items: center; gap: 8px; } .info-label { font-size: 12px; font-weight: 600; color: #a78bfa; width: 110px; flex-shrink: 0; }
.info-block .info-label { display: block; width: auto; margin-bottom: 2px; }
.toggle-head { display: flex; align-items: center; gap: 6px; width: 100%; background: none; }
.comment { background: #fff; border: 1px solid #f5f3ff; border-radius: 9px; padding: 6px 10px; } .author { font-size: 12px; font-weight: 600; color: var(--violet-d); }
.check { width: 17px; height: 17px; border-radius: 5px; border: 1px solid #c4b5fd; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; color: #fff; }
.check:hover:not(.static) { border-color: var(--violet); } .check.on { background: #22c55e; border-color: #22c55e; }
.done { color: var(--muted); text-decoration: line-through; }
.dropzone { display: flex; align-items: center; gap: 10px; border: 2px dashed #ddd6fe; border-radius: 12px; padding: 12px 16px; cursor: pointer; color: #8b5cf6; transition: border-color .15s, background .15s; }
.dropzone:hover { border-color: #a78bfa; background: rgba(245, 243, 255, .5); }
.dropzone.small { padding: 6px 10px; font-size: 12px; border-radius: 9px; margin-top: 8px; }
.dz-icon { width: 40px; height: 40px; border-radius: 50%; background: var(--violet-l); display: inline-flex; align-items: center; justify-content: center; color: #8b5cf6; }

/* ── Главная ── */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat { border-radius: 18px; padding: 18px; color: #fff; box-shadow: 0 2px 8px rgba(76, 29, 149, .15); }
.stat .icon { opacity: .8; margin-bottom: 10px; display: block; } .stat-value { font-size: 24px; font-weight: 700; overflow-wrap: anywhere; } .stat-label { font-size: 12px; opacity: .75; margin-top: 3px; }
.g1 { background: linear-gradient(135deg, #8b5cf6, #9333ea); } .g2 { background: linear-gradient(135deg, #a855f7, #7c3aed); }
.g3 { background: linear-gradient(135deg, #6366f1, #2563eb); } .g4 { background: linear-gradient(135deg, #3b82f6, #06b6d4); }

/* ── Таблицы ── */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; padding: 10px 14px; font-weight: 600; font-size: 12px; color: var(--c, #6d28d9); border-bottom: 1px solid var(--cl, var(--line)); background: color-mix(in srgb, var(--c, #7c3aed) 6%, white); white-space: nowrap; }
.tbl td { padding: 9px 14px; border-bottom: 1px solid #f5f3ff; vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; } .tbl tbody tr:hover { background: rgba(245, 243, 255, .5); }
.audit td { font-size: 12px; } .audit-details { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 420px; max-height: 120px; overflow: auto; color: #475569; }
.row-bad { background: #fff7f7; }
.status { font-size: 12px; font-weight: 500; padding: 3px 10px; border-radius: 99px; border: 0; }
.st-done { background: #dcfce7; color: #15803d; } .st-work { background: #dbeafe; color: #1d4ed8; } .st-late { background: #fee2e2; color: #dc2626; } .st-new { background: #f1f5f9; color: #64748b; }
select.status { cursor: pointer; }

/* ── KPI и услуги ── */
.kpi-table { margin-bottom: 16px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.kpi-head { padding: 9px 16px; background: linear-gradient(90deg, #eff6ff, #ecfeff); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.kpi-head .label-up { color: #3b82f6; }
.svc-card { border: 1px solid var(--line); border-radius: 12px; padding: 20px; transition: box-shadow .15s; } .svc-card:hover { box-shadow: 0 2px 10px rgba(76, 29, 149, .08); }
.svc-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.svc-grid2 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } .svc-grid2 .span2 { grid-column: span 2; }
.svc-grid3 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; } .sep { padding-top: 16px; border-top: 1px solid #f5f3ff; }
ol.stack-sm { list-style: none; margin: 0; padding: 0; }

/* ── Настройки ── */
.toggle { width: 36px; height: 20px; border-radius: 99px; background: #e2e8f0; position: relative; flex-shrink: 0; transition: background .15s; }
.toggle span { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s; }
.toggle.on { background: var(--violet); } .toggle.on span { transform: translateX(16px); }
.attached { margin-top: 8px; display: inline-flex; align-items: center; gap: 8px; background: rgba(245, 243, 255, .7); border: 1px solid var(--line); border-radius: 9px; padding: 5px 10px; }
.attached img { width: 40px; height: 40px; object-fit: cover; border-radius: 5px; }
.notice { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; border-radius: 10px; padding: 10px 14px; font-size: 13px; text-align: left; }

/* ── Уведомления на экране ── */
#toasts { pointer-events: none; position: fixed; top: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 50; max-width: 360px; }
.toast { pointer-events: auto; padding: 10px 14px; border-radius: 10px; color: #fff; font-size: 13px; box-shadow: 0 4px 14px rgba(0, 0, 0, .18); animation: toast-in .2s ease-out; }
.toast-ok { background: #16a34a; } .toast-error { background: #dc2626; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } }

/* ── Узкие экраны ── */
@media (max-width: 1000px) {
  .layout { flex-direction: column; } .side { width: 100%; position: static; max-height: none; overflow: visible; }
  .side ul { flex-direction: row; flex-wrap: wrap; } .side li { flex: 0 0 auto; } .nav-item { padding: 7px 12px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .svc-grid, .svc-grid2, .svc-grid3 { grid-template-columns: 1fr; } .svc-grid2 .span2 { grid-column: auto; }
  .manage-grid { grid-template-columns: 1fr 1fr; } .manage-head { display: none; }
  .card { padding: 16px; }
}

/* ── Вход по паролю, пользователи, выбор салонов ── */
.login-card form { text-align: left; }
.login-card .inp { width: 100%; padding: 10px 12px; font-size: 14px; }
.dev-box { border-top: 1px dashed var(--line); padding-top: 14px; }
.pwform { max-width: 380px; }
.pwform .inp { width: 100%; }
.user-edit { background: rgba(245, 243, 255, .5); padding: 14px 18px !important; }
.notice.issued { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
code.pw { font-size: 16px; padding: 4px 10px; background: #fff; border: 1px solid #a7f3d0; letter-spacing: .04em; user-select: all; }
.picks-tools { margin: 4px 0 6px; } .picks-tools .inp { flex: 1; font-size: 12px; padding: 4px 8px; }
.salon-picks { max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; background: #fff; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 2px 12px; }
.pick { display: flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 2px 0; cursor: pointer; }
.pick[hidden], #salon-table tr[hidden] { display: none; }
.tbl code { font-size: 12px; }

/* ── Телефон и планшет ── */
.nav-toggle { display: none; }

@media (max-width: 1000px) {
  .topbar { padding: 12px 14px; }
  .topbar-in { gap: 10px; }
  .topbar h1 { font-size: 17px; }
  .topbar p { display: none; }
  .topbar-in { flex-wrap: wrap; align-items: center; gap: 8px; }
  .topbar-in > div:first-child { flex: 1 1 calc(100% - 118px); min-width: 0; }
  .topbar h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .top-tiles { display: contents; }
  .tile { min-width: 0; max-width: none; padding: 5px 10px; order: 3; flex: 0 1 auto; flex-direction: row; border-radius: 9px; }
  .tile span { display: none; }
  .tile:nth-child(2) { flex: 1 1 0; min-width: 0; }
  .tile.btn-tile { order: 2; flex: 0 0 auto; }
  .btn-tile { padding: 5px 10px; }

  .layout { margin-top: 10px; padding: 0 10px; gap: 12px; align-items: stretch; }
  .main { width: 100%; max-width: 100%; }
  .side { position: sticky; top: 0; z-index: 20; width: 100%; }
  .side .card { padding: 6px; box-shadow: 0 4px 14px rgba(76, 29, 149, .12); }
  .nav-title { display: none; }
  .nav-toggle { display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 12px; border-radius: 10px; font-weight: 600; color: var(--violet-d); background: var(--violet-xl); text-align: left; }
  .nav-caret { transition: transform .15s; display: inline-flex; }
  .nav-open .nav-caret { transform: rotate(180deg); }
  .side ul { display: none; flex-direction: column; flex-wrap: nowrap; max-height: calc(100vh - 150px); overflow-y: auto; padding-top: 6px; }
  .nav-open ul { display: flex; }
  .nav-item { padding: 12px; font-size: 15px; }
  .main .card { padding: 14px; }
}

@media (max-width: 700px) {
  body { font-size: 15px; }
  .inp, .sel, .ed-input, .month-select, .inp.block { font-size: 16px; } /* 16px — чтобы iOS не увеличивал страницу при вводе */
  .sel, .inp { padding: 8px 10px; }
  .month-select { font-size: 18px; }
  .icon-btn { padding: 8px; } .link-btn { padding: 6px 2px; }
  .nav-btn { width: 40px; height: 40px; }
  .chip { padding: 8px 12px; }
  .check { width: 24px; height: 24px; border-radius: 7px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; } .stat { padding: 14px; } .stat-value { font-size: 20px; }
  .section-header { margin-bottom: 12px; }
  h2 { font-size: 16px; }

  /* Календарь: в ячейке дня вместо текста — цветные метки, подробности — в панели выбранного дня */
  .cal-grid { gap: 3px; }
  .cal-cell { min-height: 58px; padding: 4px 3px; border-radius: 8px; align-items: center; }
  .cal-cell .stack-xs { flex-direction: row; flex-wrap: wrap; gap: 2px; justify-content: center; }
  .cal-chip { font-size: 0; width: 8px; height: 8px; min-height: 0; padding: 0; border: 0; border-radius: 50%; background-color: currentColor !important; }
  .day-num { font-size: 12px; } .cal-grid.head div { font-size: 11px; }
  .day-panel { padding: 10px; scroll-margin-top: 70px; }
  .act-head { flex-wrap: wrap; row-gap: 4px; padding: 10px; }
  .act-head > .grow { flex-basis: 100%; order: 2; }
  .act-body { padding: 6px 10px 12px; }
  .detail-head { flex-wrap: wrap; }
  .info-row { flex-wrap: wrap; gap: 2px 8px; } .info-label { width: 100%; }
  .row.between.top { flex-wrap: wrap; }

  /* Списки акций: строка превращается в карточку */
  .manage-grid { grid-template-columns: 36px 1fr 1fr 36px; gap: 8px 8px; padding: 10px; }
  .manage-grid > :nth-child(1) { grid-column: 1; grid-row: 1; }
  .manage-grid > :nth-child(2) { grid-column: 2 / 4; grid-row: 1; }
  .manage-grid > :nth-child(10) { grid-column: 4; grid-row: 1; justify-self: end; }
  .manage-grid > :nth-child(3) { grid-column: 1 / 5; grid-row: 2; white-space: normal; }
  .manage-grid > :nth-child(4) { grid-column: 1 / 3; grid-row: 3; }
  .manage-grid > :nth-child(5) { grid-column: 3 / 5; grid-row: 3; }
  .manage-grid > :nth-child(6) { grid-column: 1 / 5; grid-row: 4; justify-self: start; display: flex; gap: 6px; align-items: center; }
  .manage-grid > :nth-child(6)::after { content: "весь месяц"; font-size: 13px; color: var(--muted); }
  .manage-grid > :nth-child(7) { grid-column: 1 / 3; grid-row: 5; }
  .manage-grid > :nth-child(8) { display: none; }
  .manage-grid > :nth-child(9) { grid-column: 3 / 5; grid-row: 5; }
  .row-card > .row.pad { gap: 8px; }
  .row-card > .row.pad > .grow { flex-basis: 100%; order: 3; }

  /* Таблицы прокручиваются внутри карточки, а не растягивают страницу */
  .kpi-table, .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .kpi-table table { min-width: 460px; } .tbl th, .tbl td { padding: 8px 10px; }
  .audit-details { max-width: 260px; }
  .svc-card { padding: 14px; }
  .salon-picks { grid-template-columns: 1fr; max-height: 260px; }
  .pwform { max-width: none; }
  .row.gap.wrap > .grow { flex-basis: 100%; }
  .manage-head { display: none; }

  #toasts { left: 10px; right: 10px; top: 8px; max-width: none; }
  .versions-body { max-height: 60vh; }
  .login-page { padding: 12px; } .login-card { padding: 20px; }
}

@media (max-width: 380px) {
  .stats { grid-template-columns: 1fr; }
}

/* ── Страница входа ── */
.login-wide { max-width: 440px; gap: 18px; padding: 28px 28px 22px; }
.login-brand { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; }
.login-brand h1 { font-size: 18px; line-height: 1.25; }
/* Фирменный логотип «Вай Тай СПА» (брендбук) на белой карточке */
.login-logo { display: block; width: 190px; max-width: 60%; height: auto; }
.crm-box { background: linear-gradient(160deg, #f5f3ff, #eff6ff); border: 1px solid #ddd6fe; border-radius: 16px; padding: 20px 18px; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.crm-lead { font-size: 16px; font-weight: 600; color: #1e293b; }
.crm-btn { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; padding: 16px 18px; border-radius: 14px; background: var(--grad); color: #fff; font-size: 18px; font-weight: 600; text-decoration: none; box-shadow: 0 6px 18px rgba(99, 52, 220, .35); transition: transform .12s, box-shadow .12s; }
.crm-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(99, 52, 220, .45); }
.crm-btn:focus-visible, .staff-login summary:focus-visible { outline: 3px solid #c4b5fd; outline-offset: 2px; }
.crm-btn span { flex: 1; text-align: center; }
.crm-host { font-size: 14px; color: var(--violet-d); font-weight: 500; text-decoration: none; letter-spacing: .01em; }
.crm-host:hover { text-decoration: underline; }
.staff-login { border: 1px solid var(--line); border-radius: 12px; text-align: left; background: #fff; }
.staff-login summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; cursor: pointer; list-style: none; font-size: 13px; font-weight: 500; color: #64748b; border-radius: 12px; }
.staff-login summary::-webkit-details-marker { display: none; }
.staff-login summary:hover { color: var(--violet-d); background: var(--violet-xl); }
.staff-login summary .icon { transition: transform .15s; flex-shrink: 0; }
.staff-login[open] summary { color: var(--violet-d); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.staff-login[open] summary .icon { transform: rotate(180deg); }
.staff-login > form, .staff-login > .stack { padding: 4px 14px 14px; }
.staff-login.dev-box { border-style: dashed; }
.dev-box { padding-top: 0; }
@media (max-width: 700px) {
  .login-wide { padding: 20px 16px 16px; gap: 14px; }
  .crm-btn { padding: 18px 14px; font-size: 17px; }
}

/* Черновики и баннеры активностей */
.pub-tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; white-space: nowrap; flex-shrink: 0; }
.pub-tag.on { background: #dcfce7; color: #166534; }
.pub-tag.off { background: #fff7ed; color: #9a3412; border: 1px dashed #fdba74; }
.cal-chip.draft { border-style: dashed; }
.banner { display: block; width: 100%; max-height: 260px; object-fit: cover; border-radius: 10px; margin: 0 0 10px; background: #f5f3ff; }
.banner.small { width: 120px; height: 60px; max-height: none; margin: 0; flex-shrink: 0; }
.link-btn:disabled { opacity: .45; cursor: not-allowed; }
@media (max-width: 700px) {
  .cal-chip.draft { background-color: #fff !important; box-shadow: inset 0 0 0 1.5px currentColor; }
  .banner { max-height: 180px; }
}
/* Ссылка на телеграм-бота на странице входа */
.bot-box { display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 14px 16px; border-radius: 14px; background: #e8f6fd; border: 1px solid #b6e3f8; }
.bot-icon { width: 38px; height: 38px; border-radius: 50%; background: #00b2fe; color: #fff; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.bot-lead { font-weight: 600; color: #0b3b52; line-height: 1.35; margin: 0 0 2px; }
.bot-link { display: inline-block; margin-top: 4px; font-weight: 600; color: #0a7fb0; word-break: break-all; }
.bot-link:hover { color: #075f86; }
@media (max-width: 700px) { .bot-box { padding: 12px; gap: 10px; } .bot-icon { width: 34px; height: 34px; } }
/* Раскрытая карточка активности: при переходе к ней сверху остаётся небольшой отступ (на телефоне — под закреплённым меню) */
.act-bar { scroll-margin-top: 12px; }
@media (max-width: 700px) { .act-bar { scroll-margin-top: 70px; } }
