@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("/fonts/manrope-cyrillic-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("/fonts/manrope-latin-wght-normal.woff2") format("woff2-variations");
  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;
}
@font-face {
  font-family: "DM Mono";
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url("/fonts/dm-mono-latin-400-normal.woff2") format("woff2");
}

:root {
  --bg: #f4f1eb;
  --surface: #fffdf9;
  --ink: #18212a;
  --muted: #5d6670;
  --line: rgba(24, 33, 42, .12);
  --field: #ffffff;
  --hover: rgba(24, 33, 42, .045);
  --accent: #e0452a;
  --accent-soft: rgba(224, 69, 42, .1);
  --dark: #18212a;
  --good: #1d7f46;
  --good-soft: rgba(29, 127, 70, .11);
  --warn: #8a5d00;
  --warn-soft: rgba(214, 156, 20, .16);
  --bad: #b3261e;
  --bad-soft: rgba(179, 38, 30, .1);
  --radius: 16px;
  --sidebar: 236px;
  --shadow: 0 10px 30px rgba(24, 33, 42, .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10161d;
    --surface: #18212b;
    --ink: #eef1f4;
    --muted: #9aa5b1;
    --line: rgba(255, 255, 255, .1);
    --field: #1e2934;
    --hover: rgba(255, 255, 255, .05);
    --accent-soft: rgba(240, 96, 70, .16);
    --dark: #eef1f4;
    --good: #5cc98a;
    --good-soft: rgba(92, 201, 138, .13);
    --warn: #e7bb55;
    --warn-soft: rgba(231, 187, 85, .13);
    --bad: #ff8a7a;
    --bad-soft: rgba(255, 138, 122, .12);
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { min-height: 100vh; color: var(--ink); background: var(--bg); font: 14px/1.45 Manrope, system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }
.hidden { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Поля и кнопки */
label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
input, select, textarea { width: 100%; color: var(--ink); background: var(--field); border: 1px solid var(--line); border-radius: 10px; outline: none; }
input, select { height: 40px; padding: 0 12px; }
textarea { padding: 10px 12px; resize: vertical; line-height: 1.4; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.check { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: 14px; font-weight: 600; }
fieldset { display: grid; gap: 10px; margin: 0; padding: 0; border: 0; }
legend { margin-bottom: 10px; color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 16px; color: var(--ink); background: var(--hover); border: 1px solid transparent; border-radius: 10px; font-weight: 700; white-space: nowrap; }
.btn.primary { color: #fff; background: var(--accent); }
.btn.primary:hover { filter: brightness(.95); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost:hover { background: var(--hover); }
.btn.small { min-height: 32px; padding: 0 11px; font-size: 12px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.danger-text, .danger-text { color: var(--bad); }
.icon-btn { display: inline-grid; place-items: center; flex: 0 0 36px; width: 36px; height: 36px; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; }
.icon-btn:hover { background: var(--hover); }
.icon-btn.danger { color: var(--bad); }
.link-btn { padding: 0; color: inherit; background: none; border: 0; font-weight: 800; text-decoration: underline; }
.form-error { color: var(--bad); font-size: 13px; }

/* Вход */
.login { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-card { display: grid; gap: 14px; width: min(100%, 380px); padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 24px; letter-spacing: -.03em; }
.brand-mark { display: grid; place-items: center; flex: 0 0 32px; width: 32px; height: 32px; color: #fff; background: var(--accent); border-radius: 10px; font-weight: 800; }
.brand-mark.big { width: 48px; height: 48px; border-radius: 14px; font-size: 20px; }

/* Каркас: боковое меню + контент */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; gap: 18px; height: 100vh; padding: 18px 14px; background: var(--surface); border-right: 1px solid var(--line); }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; font-weight: 800; letter-spacing: -.02em; }
.nav { display: grid; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 10px; color: var(--muted); background: none; border: 0; border-radius: 10px; font-weight: 700; text-align: left; }
.nav-item:hover { color: var(--ink); background: var(--hover); }
.nav-item.active { color: var(--accent); background: var(--accent-soft); }
.nav-ico { display: grid; place-items: center; width: 22px; font-size: 14px; }
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; color: #fff; background: var(--accent); border-radius: 10px; font-size: 11px; line-height: 20px; text-align: center; }
.sidebar-foot { display: grid; gap: 10px; margin-top: auto; padding: 12px 6px 0; border-top: 1px solid var(--line); }
.actor { color: var(--muted); font-size: 12px; }
.actor strong { display: block; color: var(--ink); font-size: 14px; }
.sidebar-backdrop { position: fixed; inset: 0; z-index: 39; background: rgba(10, 14, 18, .4); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px 24px; background: color-mix(in srgb, var(--bg) 90%, transparent); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.menu-button { display: none; }
.page-title { font-size: 20px; letter-spacing: -.03em; }
.topbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.dev-badge { padding: 4px 9px; color: var(--warn); background: var(--warn-soft); border-radius: 999px; font-size: 11px; font-weight: 800; }
.tg-indicator { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 11px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; font-size: 12px; font-weight: 700; }
.tg-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.tg-indicator[data-state="active"] .tg-dot { background: #22a35a; }
.tg-indicator[data-state="limited"] .tg-dot, .tg-indicator[data-state="disabled"] .tg-dot { background: #d69c14; }
.tg-indicator[data-state="blocked"] .tg-dot, .tg-indicator[data-state="unavailable"] .tg-dot { background: var(--bad); }
.tg-alert { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 9px 24px; color: var(--bad); background: var(--bad-soft); font-size: 13px; font-weight: 600; }
.tg-alert[data-state="limited"] { color: var(--warn); background: var(--warn-soft); }

.content { width: 100%; max-width: 1360px; padding: 22px 24px 60px; }
.page { display: grid; gap: 16px; }
.card { padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.flush { padding: 0; overflow: hidden; }
.card h3 { font-size: 15px; letter-spacing: -.01em; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.toolbar .muted { max-width: 640px; }

/* Обзор */
.metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.metric { padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.metric span { color: var(--muted); font-size: 12px; font-weight: 700; }
.metric strong { display: block; margin-top: 6px; font-size: 26px; letter-spacing: -.04em; }
.metric.attention strong { color: var(--accent); }
.bars { display: grid; gap: 12px; margin-top: 14px; }
.bar-label { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 5px; font-size: 13px; }
.bar-track { height: 8px; overflow: hidden; background: var(--hover); border-radius: 999px; }
.bar-track i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.quick { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
.quick .muted { margin-top: 4px; }
.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Переключатели */
.segmented { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; max-width: 100%; overflow-x: auto; }
.segmented.wrap { flex-wrap: wrap; }
.seg { min-height: 34px; padding: 0 14px; color: var(--muted); background: none; border: 0; border-radius: 9px; font-weight: 700; white-space: nowrap; }
.seg.active { color: #fff; background: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 30px; padding: 0 12px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; font-size: 12px; font-weight: 700; }
.chip.active { color: var(--surface); background: var(--ink); border-color: var(--ink); }

/* Таблицы */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 11px 14px; color: var(--muted); background: var(--hover); font-size: 11px; font-weight: 800; text-align: left; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
tr:hover td { background: var(--hover); }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
td.actions { white-space: nowrap; text-align: right; }
td.actions .btn + .btn { margin-left: 6px; }
.cell-title strong { display: block; }
.cell-title small { display: block; max-width: 420px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.empty-row td { padding: 34px 14px; color: var(--muted); text-align: center; }
.thumb { display: grid; place-items: center; width: 44px; height: 44px; overflow: hidden; color: var(--accent); background: var(--accent-soft); border-radius: 10px; font-weight: 800; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.status { display: inline-flex; align-items: center; padding: 3px 9px; color: var(--muted); background: var(--hover); border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.status.good { color: var(--good); background: var(--good-soft); }
.status.warn { color: var(--warn); background: var(--warn-soft); }
.status.bad { color: var(--bad); background: var(--bad-soft); }
.code { font-family: "DM Mono", ui-monospace, monospace; font-size: 12px; }

/* Чаты */
.chat-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; height: calc(100vh - 170px); min-height: 520px; }
.conv-pane { display: flex; flex-direction: column; min-height: 0; }
.conv-tools { display: grid; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line); }
.conv-list { flex: 1; overflow-y: auto; padding: 6px; }
.conv { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; color: var(--ink); background: none; border: 0; border-radius: 12px; text-align: left; }
.conv:hover { background: var(--hover); }
.conv.selected { background: var(--accent-soft); }
.avatar { display: grid; place-items: center; flex: 0 0 38px; width: 38px; height: 38px; color: var(--surface); background: var(--dark); border-radius: 50%; font-weight: 800; }
.conv-text { flex: 1; min-width: 0; }
.conv-text strong, .conv-text small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-text small { color: var(--muted); font-size: 12px; }
.conv-meta { display: grid; justify-items: end; gap: 4px; font-size: 11px; color: var(--muted); }
.count { min-width: 20px; height: 20px; padding: 0 6px; color: #fff; background: var(--accent); border-radius: 10px; font-size: 11px; font-weight: 800; line-height: 20px; text-align: center; }
.count.warn { background: #c48a0d; }
.tag { padding: 1px 7px; color: var(--muted); background: var(--hover); border-radius: 999px; font-size: 10px; font-weight: 700; }
.thread-pane { display: flex; min-height: 0; }
.thread-empty { display: grid; place-items: center; width: 100%; color: var(--muted); }
.thread { display: flex; flex-direction: column; width: 100%; min-height: 0; }
.thread-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.thread-head select { width: auto; height: 32px; font-size: 12px; }
.back-btn { display: none; }
.thread-who { flex: 1; min-width: 0; }
.thread-who strong, .thread-who small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-who small { color: var(--muted); font-size: 12px; }
.suggestion { padding: 6px 14px; color: var(--accent); background: var(--accent-soft); font-size: 12px; font-weight: 600; }
.suggestion button { margin-left: 8px; }
.thread-body { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 260px; min-height: 0; }
.messages { display: flex; flex-direction: column; gap: 6px; min-height: 0; padding: 16px; overflow-y: auto; }
.msg { max-width: 72%; padding: 8px 12px 6px; background: var(--hover); border-radius: 14px 14px 14px 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.own { align-self: flex-end; background: var(--accent-soft); border-radius: 14px 14px 4px 14px; }
.msg .sender { display: block; margin-bottom: 2px; color: var(--accent); font-size: 11px; font-weight: 800; }
.msg time { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; text-align: right; }
.msg .delivery { display: block; margin-top: 2px; font-size: 11px; font-weight: 700; text-align: right; }
.msg .delivery.failed { color: var(--bad); }
.msg .delivery.pending { color: var(--warn); }
.msg .delivery.sent { color: var(--good); }
.msg img, .msg video { display: block; max-width: 100%; max-height: 260px; margin-bottom: 6px; border-radius: 10px; }
.day { align-self: center; padding: 2px 10px; color: var(--muted); background: var(--hover); border-radius: 999px; font-size: 11px; }
.customer-panel { padding: 14px; overflow-y: auto; border-left: 1px solid var(--line); }
.customer-panel h4 { margin-bottom: 10px; font-size: 13px; }
.mini-order { display: grid; gap: 4px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 12px; }
.mini-order strong { font-size: 13px; }
.composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); }
.composer select { width: 120px; flex: 0 0 auto; height: 40px; font-size: 12px; }
.composer-field { flex: 1; display: grid; gap: 4px; min-width: 0; }
.composer textarea { min-height: 40px; max-height: 160px; resize: none; }
.attach { position: relative; flex: 0 0 40px; width: 40px; height: 40px; cursor: pointer; }
.attach input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.attach-name { padding: 3px 8px; color: var(--muted); background: var(--hover); border-radius: 8px; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.send { flex: 0 0 40px; width: 40px; padding: 0; font-size: 18px; }
.team-chat { display: flex; flex-direction: column; height: calc(100vh - 170px); min-height: 480px; }
.team-chat .messages { flex: 1; }

/* Формы настроек */
.form-card { display: grid; gap: 18px; max-width: 860px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.provider-status { display: flex; flex-wrap: wrap; gap: 8px; }

/* Модальные окна */
.modal { width: min(100% - 24px, 620px); max-height: calc(100vh - 40px); padding: 0; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 30px 80px rgba(0, 0, 0, .25); }
.modal.small { width: min(100% - 24px, 440px); }
.modal::backdrop { background: rgba(10, 14, 18, .45); }
.modal-form { display: flex; flex-direction: column; max-height: calc(100vh - 40px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 18px; letter-spacing: -.02em; }
.modal-body { display: grid; gap: 14px; padding: 18px; overflow-y: auto; }
.modal-form > .form-error { padding: 0 18px 10px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--line); }
.image-picker { display: flex; align-items: center; gap: 12px; }
.image-picker img { width: 72px; height: 72px; object-fit: cover; border-radius: 12px; }

/* Инструкция */
.guide figure { margin: 0; }
.guide img { display: block; width: 100%; height: auto; }
.guide ol { display: grid; gap: 8px; margin: 12px 0 0; padding-left: 20px; line-height: 1.5; }

/* Уведомления */
.toast-root { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: grid; gap: 8px; width: min(100% - 40px, 380px); }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; color: #fff; background: #18212a; border-radius: 12px; box-shadow: 0 12px 30px rgba(0, 0, 0, .2); font-size: 13px; }
.toast.error { background: #a8291f; }
.toast.success { background: #1c7a44; }
.toast span { flex: 1; }
.toast button { padding: 0; color: inherit; background: none; border: 0; opacity: .8; }

/* Адаптив */
@media (max-width: 1200px) {
  .thread-body { grid-template-columns: minmax(0, 1fr); }
  .customer-panel { display: none; }
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 40; width: 260px; transform: translateX(-105%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(0, 0, 0, .2); }
  .sidebar.open { transform: none; }
  .menu-button { display: inline-grid; }
  .topbar { padding: 10px 14px; }
  .tg-alert { padding: 9px 14px; }
  .content { padding: 14px 14px 40px; }
  .grid-2, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chat-layout { grid-template-columns: minmax(0, 1fr); height: calc(100dvh - 160px); }
  .chat-layout.thread-open .conv-pane { display: none; }
  .chat-layout:not(.thread-open) .thread-pane { display: none; }
  .back-btn { display: inline-grid; }
  .thread-head { flex-wrap: wrap; }
  .thread-head .thread-who { flex-basis: calc(100% - 100px); }
  .msg { max-width: 88%; }
  .composer select { width: 44px; padding: 0 4px; color: transparent; background: var(--field) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M4 6h16M4 12h16M4 18h10'/%3E%3C/svg%3E") center / 18px no-repeat; }
  .composer select option { color: var(--ink); }
  td.actions { text-align: left; }
  .toolbar .btn.primary { width: 100%; }
  .toast-root { right: 50%; transform: translateX(50%); }
  .page-title { font-size: 18px; }
  #telegram-label { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* --- Доработки после проверки на скриншотах --- */
/* Элементы сетки не должны распирать страницу шириной таблицы. */
.page > *, .main, .content { min-width: 0; }
/* У полей уже есть подсветка рамкой — двойной контур фокуса не нужен. */
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }
.mini-order .status { justify-self: start; }
.nav-ico svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* На телефоне таблицы превращаются в карточки: каждая строка — блок с подписями полей. */
@media (max-width: 900px) {
  .table-wrap table, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; width: 100%; }
  .table-wrap thead { display: none; }
  .table-wrap tr { padding: 12px 14px; border-top: 1px solid var(--line); }
  .table-wrap tr:first-child { border-top: 0; }
  .table-wrap td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 0; border: 0; text-align: right; }
  .table-wrap td::before { content: attr(data-label); flex: 0 0 auto; color: var(--muted); font-size: 12px; font-weight: 700; text-align: left; }
  .table-wrap td[data-label=""]::before { display: none; }
  .table-wrap td.cell-title { display: block; text-align: left; }
  .table-wrap td.cell-title::before { display: none; }
  .table-wrap td.actions { flex-wrap: wrap; justify-content: flex-start; gap: 6px; padding-top: 8px; }
  .table-wrap td.actions::before { display: none; }
  .table-wrap td.actions .btn + .btn { margin-left: 0; }
  .table-wrap tr:hover td { background: none; }
  .cell-title small { max-width: none; white-space: normal; }
  .empty-row td { justify-content: center; }
  .empty-row td::before { display: none; }
}

/* Финансы */
.finance-filter { display: grid; gap: 12px; }
.finance-range { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.finance-range label { width: 170px; }
.metric small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; font-weight: 700; }
.metric small.up { color: var(--good); }
.metric small.down { color: var(--bad); }
.metric.share { background: var(--accent); border-color: var(--accent); }
.metric.share span, .metric.share strong, .metric.share small { color: #fff; }
.insights { display: grid; gap: 8px; margin: 12px 0 0; padding-left: 18px; line-height: 1.5; }
.share-card { display: grid; gap: 12px; align-content: start; }
.chart-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.legend { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.legend i { display: inline-block; width: 10px; height: 10px; margin-left: 8px; border-radius: 3px; }
.lg-revenue { background: rgba(224, 69, 42, .28); }
.lg-share { background: var(--accent); }
.day-chart { display: flex; align-items: flex-end; gap: 3px; height: 190px; margin-top: 16px; padding-bottom: 20px; overflow-x: auto; }
.day-col { position: relative; display: flex; flex: 1 0 14px; flex-direction: column; justify-content: flex-end; min-width: 14px; height: 100%; }
.day-col .bar { position: relative; width: 100%; min-height: 2px; background: rgba(224, 69, 42, .28); border-radius: 5px 5px 2px 2px; }
.day-col .bar i { position: absolute; left: 0; right: 0; bottom: 0; background: var(--accent); border-radius: inherit; }
.day-col span { position: absolute; left: 50%; bottom: -18px; color: var(--muted); font-size: 10px; white-space: nowrap; transform: translateX(-50%); }
.share-input { width: 76px; height: 32px; padding: 0 8px; text-align: right; }
.transfer-info { display: block; color: var(--muted); font-size: 12px; }
.paid-flag { color: var(--accent); font-weight: 800; }
@media (max-width: 900px) {
  .finance-range label { width: calc(50% - 5px); }
  .finance-range .btn { flex: 1; }
  .day-chart { height: 150px; }
}

/* Этап 1 */
.warn-alert { color: var(--warn); background: var(--warn-soft); }
#code-form { margin-top: 0; }
.recipient-box { display: grid; gap: 4px; padding: 12px; background: var(--hover); border-radius: 12px; font-size: 13px; }
.recipient-box strong { font-size: 14px; }
.legal-form textarea { font-family: inherit; }
#legal-form textarea { min-height: 120px; }
.limit-bar { display: block; height: 5px; margin-top: 4px; overflow: hidden; background: var(--hover); border-radius: 999px; }
.limit-bar i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.limit-bar.full i { background: var(--bad); }

/* Этап 2 */
.variant-editor { display: grid; gap: 8px; }
.variant-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) auto auto; gap: 8px; align-items: center; }
.variant-row input[type=checkbox] { justify-self: center; }
.variant-head { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.progress { display: block; height: 6px; margin-top: 4px; overflow: hidden; background: var(--hover); border-radius: 999px; }
.progress i { display: block; height: 100%; background: var(--accent); }
.items-list { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; font-size: 13px; }
.items-list li { display: flex; justify-content: space-between; gap: 10px; }
@media (max-width: 900px) { .variant-row { grid-template-columns: 1fr 1fr; } .variant-head { display: none; } }

/* Этап 3: ученики, клиенты, отзывы, склад, расходы */
#modal-body:has(select[name=type] option[value=product]:checked) .course-only { display: none; }
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.inline-form label { display: flex; align-items: center; gap: 8px; }
.inline-form input[type=number] { width: 90px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card.flush .card-head { padding: 14px 16px 0; }
.chip b { margin-left: 4px; opacity: .7; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft, rgba(230,69,42,.1)); font-size: 12px; white-space: nowrap; }
.expense-groups { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.metric.profit strong { color: var(--good, #1f8a4c); }
.metric.neg strong { color: var(--bad, #c0352b); }
td.pos { color: var(--good, #1f8a4c); } td.neg { color: var(--bad, #c0352b); }
.student-steps { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.answers { display: grid; gap: 4px; margin: 0; padding: 12px; border-radius: 12px; background: var(--hover); }
.answers dt { font-size: 12px; opacity: .7; } .answers dd { margin: 0 0 6px; white-space: pre-wrap; }
.checkins, .mini-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; font-size: 13px; }
.checkins li { padding: 8px 10px; border-radius: 10px; background: var(--hover); }
.mini-list li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line, rgba(0,0,0,.08)); }
.metrics.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metrics.compact .metric strong { font-size: 18px; }
@media (max-width: 700px) { .metrics.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.reviews-list { display: grid; gap: 12px; }
.review-card { display: grid; gap: 8px; }
.review-head { display: flex; justify-content: space-between; align-items: center; }
.stars-big { color: #f2a516; font-size: 18px; letter-spacing: 1px; } .stars-big i { color: var(--line, #ddd); font-style: normal; }
.review-text { margin: 0; white-space: pre-wrap; }
.review-card textarea { width: 100%; box-sizing: border-box; }
.link { padding: 0; border: 0; background: none; color: var(--accent, #e6452a); font: inherit; cursor: pointer; text-decoration: underline; }
#customers-search { flex: 1; min-width: 200px; }
