:root {
  color-scheme: dark;
  --bg: #0e0607;
  --bg-soft: #15090a;
  --panel: #1c0e0f;
  --panel-2: #261214;
  --panel-3: #31181a;
  --line: #4e2b2e;
  --line-soft: #3b1e21;
  --text: #f9edee;
  --muted: #c2afb4;
  --muted-2: #aa9098;
  --accent: #ed5665;
  --accent-2: #ffb7c0;
  --accent-ink: #21070c;
  --red: #ef96a0;
  --red-2: #ffc0c6;
  --blue: #ef8891;
  --amber: #d8b26c;
  --violet: #e8a9af;
  --radius: 16px;
  --shadow: 0 22px 60px rgba(0, 0, 0, .34);
  font: 15px/1.5 "Inter", "SF Pro Display", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 600px at 88% -10%, rgba(237, 86, 101, .075), transparent 62%),
    radial-gradient(760px 520px at 0% -5%, rgba(255, 124, 136, .045), transparent 58%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, dl, dd, ol, ul { margin: 0; }
h1 { font-size: clamp(1.7rem, 3vw, 2.2rem); line-height: 1.12; letter-spacing: -.04em; overflow-wrap: anywhere; }
h2 { font-size: 1.12rem; line-height: 1.3; letter-spacing: -.02em; }
h3 { font-size: .88rem; }
a { color: var(--accent); text-underline-offset: 3px; }
button { cursor: pointer; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { background: rgba(237, 86, 101, .25); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #412628; border-radius: 999px; border: 2px solid var(--bg); }

button, .button, .btn-primary, .btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 10px 15px;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease, filter .16s ease;
}
button:hover, .button:hover { filter: brightness(1.07); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
  min-height: 40px;
  font-weight: 600;
}
.btn-ghost:hover { color: var(--text); border-color: #563437; background: var(--panel-2); filter: none; }
.btn-primary svg, .btn-ghost svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

input {
  display: block;
  width: 100%;
  min-width: 0;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  background: #170a0b;
  color: var(--text);
  font: inherit;
  transition: border-color .16s ease, background-color .16s ease;
}
input:hover { border-color: #4e2d30; }
input:focus { border-color: #783c41; background: #190b0c; }
input::placeholder { color: #78585b; }
label { display: grid; gap: 0; font-size: .8rem; font-weight: 650; color: var(--muted); }
.optional { margin-left: 4px; color: var(--muted-2); font-size: .68rem; font-weight: 500; }
.hint { color: var(--muted); font-size: .78rem; line-height: 1.55; }
.eyebrow {
  color: var(--muted-2);
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .16em;
  line-height: 1.4;
  text-transform: uppercase;
}
.form-error { color: var(--red); font-size: .82rem; }
.stack { display: grid; gap: 14px; align-content: start; }
.panel {
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .018), transparent 40%),
    var(--panel);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .025) inset, var(--shadow);
  padding: 22px;
}
.narrow { width: min(100%, 420px); }
.center { min-height: 100svh; display: grid; place-items: center; padding: 24px; }

/* ===== Клиентская страница оплаты ===== */
.checkout {
  width: min(100%, 900px);
  min-height: 520px;
  padding: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: 42fr 58fr;
  border-radius: 24px;
  box-shadow: 0 32px 90px #0008;
}
.receipt {
  padding: 40px 32px;
  background:
    repeating-linear-gradient(103deg, #ffffff06 0 1px, transparent 1px 3px, #00000020 3px 4px, transparent 4px 6px),
    linear-gradient(135deg, #291a1b, #1d1112);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}
.payment-method { display: flex; align-items: center; gap: 8px; font-size: .86rem; color: var(--muted); margin-bottom: 24px; }
.payment-amount {
  font: 800 clamp(2.25rem, 5vw, 3.25rem)/1.04 "Inter", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.045em;
  color: #f7f4ed;
}
.payment-amount span { font-size: .64em; font-weight: 700; letter-spacing: -.025em; color: #b7a2a4; white-space: nowrap; }
dl { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 14px; }
dt { color: var(--muted); font-size: .78rem; margin-top: 8px; }
dd { overflow-wrap: anywhere; font-size: .9rem; }
.action { display: grid; place-items: center; padding: 24px; background: #180c0d; }
.action > .stack, .state { width: min(100%, 340px); }
.action .payment-ready { width: 100%; height: 100%; grid-template-rows: 1fr auto; gap: 24px; }
.qr-area { align-self: center; display: grid; justify-items: center; gap: 16px; padding-block: 16px; }
.qr-area p, .phone-entry > p { font-size: .84rem; color: var(--muted); }
.qr-area p { max-width: 33ch; }
.payment-buttons { display: grid; width: 100%; gap: 10px; }
.cancel-form { text-align: center; }
.phone-entry .cancel-form { margin-top: 0; }
.cancel-form .cancel-button { width: auto; min-height: 42px; background: transparent; color: var(--muted); font-size: .84rem; font-weight: 500; }
.cancel-button:hover { color: var(--text); text-decoration: underline; text-underline-offset: 4px; filter: none; }
.payment-decisions { display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap; }
.payment-decisions .decision-button { min-height: 42px; padding-inline: 10px; background: transparent; color: var(--accent); font-size: .84rem; }
.decision-button svg, .cancel-button svg, .status-tag svg { width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.decision-button, .cancel-button { gap: 6px; }
.phone-entry { gap: 12px; }
.phone-entry form { margin-top: 10px; }
.phone-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid #533639;
  background: #2e1a1c;
  border-radius: 14px;
  color: var(--accent);
  margin-bottom: 8px;
}
.phone-icon svg { width: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.phone { display: flex; align-items: center; gap: 10px; background: #170a0b; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; }
.phone:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.phone input { border: 0; outline: 0; margin: 0; padding-inline: 0; background: transparent; }
.state { display: grid; justify-items: center; text-align: center; gap: 12px; }
.state .button, .state button { width: 100%; }
.qr-frame { position: relative; width: min(100%, 246px); background: white; border-radius: 22px; overflow: hidden; }
.qr { display: block; width: 100%; height: auto; }
.scan-corners { position: absolute; inset: 8px; pointer-events: none; }
.scan-corners i { position: absolute; width: 16px; height: 16px; border: 1px solid #806f71; }
.scan-corners i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 7px; }
.scan-corners i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 7px; }
.scan-corners i:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 7px; }
.scan-corners i:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 7px; }
.qr-brand { position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%); display: grid; place-items: center; width: 17%; aspect-ratio: 1; background: #ffffff; border-radius: 23%; }
.qr-brand img { width: 67%; height: 74%; object-fit: contain; }
.spinner, .stamp { width: 58px; height: 58px; border-radius: 50%; margin-bottom: 8px; }
.spinner { border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
.stamp { display: grid; place-items: center; border: 1px solid currentColor; }
.stamp svg { width: 28px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.success { color: var(--accent); }
.error { color: var(--red); }

/* ===== Вход ===== */
.login-page {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(700px 520px at 50% 0%, rgba(237, 86, 101, .09), transparent 65%),
    var(--bg);
}
.login-card {
  width: min(100%, 420px);
  border: 1px solid var(--line-soft);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .025), transparent 45%), var(--panel);
  box-shadow: var(--shadow);
  padding: 34px 30px;
  display: grid;
  gap: 14px;
}
.login-card h1 { font-size: 1.5rem; }
.login-card .btn-primary { margin-top: 4px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  border: 1px solid rgba(237, 86, 101, .28);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(237, 86, 101, .18), rgba(237, 86, 101, .04));
  color: var(--accent);
}
.brand-mark svg { width: 21px; height: 21px; fill: currentColor; }
.brand-mark-lg { width: 52px; height: 52px; border-radius: 15px; }
.brand-mark-lg svg { width: 26px; height: 26px; }

/* ===== Админка ===== */
.workspace { width: min(100%, 1280px); margin: auto; padding: 28px 28px 48px; display: grid; gap: 20px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 2px 0 18px; border-bottom: 1px solid var(--line-soft); }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-text { display: grid; gap: 1px; min-width: 0; }
.brand-text h1 { font-size: 1.28rem; letter-spacing: -.03em; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.stats-toggle { min-height: 36px; padding: 0 11px; gap: 6px; font-size: .72rem; }
.stats-toggle svg { width: 14px; height: 14px; transition: transform .16s ease; }
.workspace.stats-collapsed .stats-panel,
.workspace.stats-collapsed .turnover-panel,
.workspace.stats-collapsed .status-panel,
.workspace.stats-collapsed .note-panel { display: none; }
.workspace.stats-collapsed .dashboard { display: block; }
.workspace.stats-collapsed .side-column { width: min(100%, 420px); }
.workspace.stats-collapsed .stats-toggle svg { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) { .stats-toggle svg { transition: none; } }
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  color: var(--muted);
  font-size: .68rem;
  white-space: nowrap;
}
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 rgba(237, 86, 101, .45); animation: live 2.4s infinite; }
@keyframes live { 70% { box-shadow: 0 0 0 6px rgba(237, 86, 101, 0); } 100% { box-shadow: 0 0 0 0 rgba(237, 86, 101, 0); } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }
.topbar-actions form { margin: 0; }

.dashboard { display: grid; grid-template-columns: minmax(0, 1fr) 352px; gap: 20px; align-items: start; }
.stats-panel { display: grid; gap: 22px; padding: 24px; }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.section-head h2 { margin-top: 2px; }
.section-head.compact { align-items: center; }
.section-head.compact h2 { font-size: 1rem; }
.date-chip { flex: none; border: 1px solid var(--line-soft); border-radius: 999px; padding: 5px 10px; color: var(--muted); font-size: .68rem; font-variant-numeric: tabular-nums; }
.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 21px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--panel-3);
  color: var(--muted);
  font-size: .68rem;
  font-weight: 650;
  vertical-align: 2px;
}

.kpi-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.kpi {
  position: relative;
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 15px 16px 13px;
  border: 1px solid var(--line-soft);
  border-radius: 13px;
  background: linear-gradient(160deg, rgba(255, 255, 255, .025), transparent 65%), var(--panel-2);
  overflow: hidden;
}
.kpi::after { content: ""; position: absolute; inset: auto -18px -38px auto; width: 110px; height: 110px; border-radius: 50%; background: rgba(255, 255, 255, .025); pointer-events: none; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: .72rem; font-weight: 600; }
.kpi-glyph { display: grid; place-items: center; width: 24px; height: 24px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); font-size: .72rem; font-weight: 700; }
.kpi strong { font-size: clamp(1.15rem, 2vw, 1.5rem); line-height: 1.1; letter-spacing: -.045em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; color: var(--muted-2); font-size: .66rem; }
.kpi-paid { border-color: rgba(237, 86, 101, .2); background: linear-gradient(150deg, rgba(237, 86, 101, .09), transparent 62%), var(--panel-2); }
.kpi-paid strong { color: var(--accent); }
.kpi-paid .kpi-glyph { color: var(--accent); border-color: rgba(237, 86, 101, .22); }
.kpi-refund strong { color: var(--red); }
.kpi-refund .kpi-glyph { color: var(--red); border-color: rgba(255, 154, 164, .2); }
.kpi-new strong { color: var(--blue); }
.kpi-new .kpi-glyph { color: var(--blue); border-color: rgba(255, 124, 136, .2); }
.kpi-neutral strong { color: var(--text); }
.trend { display: inline-flex; align-items: center; padding: 2px 6px; border-radius: 999px; font-size: .62rem; font-weight: 650; white-space: nowrap; }
.trend-up { background: rgba(237, 86, 101, .1); color: var(--accent); }
.trend-down { background: rgba(255, 154, 164, .1); color: var(--red); }
.trend-flat { background: rgba(179, 147, 150, .1); color: var(--muted); }

.chart-card { display: grid; gap: 14px; padding-top: 20px; border-top: 1px solid var(--line-soft); }
.chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.chart-head h3 { font-size: .9rem; letter-spacing: -.01em; }
.chart-sub { margin-top: 3px; color: var(--muted-2); font-size: .7rem; }
.chart-controls { display: grid; justify-items: end; gap: 9px; }
.period-switch { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line-soft); border-radius: 9px; background: #170a0b; }
.period-switch a { padding: 4px 8px; border-radius: 6px; color: var(--muted-2); font-size: .66rem; text-decoration: none; }
.period-switch a:hover { color: var(--text); }
.period-switch a.is-active { background: var(--panel-3); color: var(--text); }
.legend { display: flex; align-items: center; gap: 12px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; color: var(--muted-2); font-size: .66rem; }
.legend-item::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.legend-paid::before { background: var(--accent); }
.legend-refund::before { background: var(--red); }
.chart-wrap { width: 100%; min-width: 0; }
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; }
.grid-line { stroke: #351d1f; stroke-width: 1; stroke-dasharray: 3 5; }
.grid-base { stroke: #482b2e; stroke-dasharray: none; }
.axis-label { fill: var(--muted-2); font-family: inherit; font-size: 10px; font-variant-numeric: tabular-nums; }
.axis-x { fill: var(--muted); }
.chart-area { fill: url(#paid-fill); }
.chart-line { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.line-paid { stroke: var(--accent); }
.line-refund { stroke: var(--red); stroke-width: 1.7; stroke-dasharray: 4 4; }
.chart-dot { stroke: var(--panel); stroke-width: 2; }
.dot-paid { fill: var(--accent); }
.dot-refund { fill: var(--red); }
.chart-summary { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding-top: 2px; color: var(--muted-2); font-size: .72rem; }
.chart-scroll-hint { display: none; color: var(--muted-2); font-size: .66rem; }
.chart-summary b { color: var(--text); font-weight: 650; }
.empty-chart { min-height: 190px; display: grid; place-items: center; align-content: center; gap: 8px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted-2); font-size: .8rem; }
.empty-chart-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--panel-2); color: var(--muted); }
.empty-chart-icon svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.side-column { display: grid; gap: 16px; align-content: start; }
.form-panel { display: grid; gap: 16px; }
.money-field { display: flex; align-items: center; gap: 4px; margin-top: 6px; border: 1px solid var(--line); border-radius: 10px; background: #170a0b; padding: 0 12px; }
.money-field:focus-within { border-color: #783c41; outline: 2px solid rgba(237, 86, 101, .25); outline-offset: 1px; }
.money-field > span { color: var(--muted-2); font-size: .9rem; }
.money-field input { margin: 0; border: 0; background: transparent; padding-inline: 0; }
.money-field input:focus { outline: 0; }
.form-panel .btn-primary { width: 100%; margin-top: 2px; }
.form-panel .hint { margin-top: -4px; }

.turnover-panel { background: linear-gradient(145deg, rgba(237, 86, 101, .085), transparent 58%), var(--panel); }
.net-amount { display: block; margin-top: 5px; color: var(--accent); font-size: 1.55rem; line-height: 1.15; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.turnover-panel .hint { margin-top: 2px; }
.turnover-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--line-soft); }
.turnover-grid div { display: grid; gap: 2px; min-width: 0; }
.turnover-grid span { color: var(--muted-2); font-size: .66rem; }
.turnover-grid b { font-size: .76rem; font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.status-panel { display: grid; gap: 13px; }
.status-bar { display: block; width: 100%; height: 9px; border-radius: 999px; overflow: hidden; background: #170a0b; }
.status-bar rect { height: 10px; }
.status-bar .seg-progress { fill: var(--blue); }
.status-bar .seg-paid { fill: var(--accent); }
.status-bar .seg-refund { fill: var(--red); }
.status-bar .seg-cancelled { fill: #8b6468; }
.seg-progress { background: var(--blue); }
.seg-paid { background: var(--accent); }
.seg-refund { background: var(--red); }
.seg-cancelled { background: #8b6468; }
.status-legend { list-style: none; padding: 0; display: grid; gap: 8px; }
.status-legend li { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto auto; align-items: center; gap: 7px; color: var(--muted); font-size: .72rem; }
.status-legend b { color: var(--text); font-size: .72rem; font-variant-numeric: tabular-nums; }
.status-legend small { min-width: 32px; color: var(--muted-2); font-size: .64rem; text-align: right; font-variant-numeric: tabular-nums; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; }
.note-panel {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 14px;
  border: 1px solid rgba(245, 199, 106, .18);
  border-radius: 13px;
  background: rgba(245, 199, 106, .045);
}
.note-icon { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: rgba(245, 199, 106, .1); color: var(--amber); }
.note-icon svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.note-panel b { display: block; color: #f6dfae; font-size: .73rem; }
.note-panel p { margin-top: 2px; color: var(--muted); font-size: .68rem; line-height: 1.5; }

.registry { display: grid; gap: 14px; padding: 22px; }
.registry-head { align-items: flex-start; }
.registry-head h2 { display: flex; align-items: center; gap: 7px; }
.registry-tools { display: grid; justify-items: end; gap: 5px; }
.registry-links { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.audit-link { color: var(--accent); font-size: .68rem; text-decoration: none; white-space: nowrap; }
.audit-link:hover { text-decoration: underline; }
.search-form { position: relative; width: min(100%, 360px); }
.search-form input[type="search"] {
  width: 100%;
  height: 40px;
  margin: 0;
  padding: 0 80px 0 34px;
  border-radius: 10px;
  background: #170a0b;
}
.search-form input[type="search"]::-webkit-search-cancel-button { display: none; }
.search-icon { position: absolute; z-index: 1; top: 50%; left: 11px; display: grid; place-items: center; transform: translateY(-50%); color: var(--muted-2); pointer-events: none; }
.search-icon svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.search-clear {
  position: absolute;
  z-index: 2;
  top: 50%;
  right: 66px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  transform: translateY(-50%);
  border-radius: 5px;
  color: var(--muted-2);
  font-size: 1.05rem;
  line-height: 1;
  text-decoration: none;
}
.search-clear:hover { background: var(--panel-3); color: var(--text); }
.search-submit {
  position: absolute;
  top: 4px;
  right: 4px;
  min-height: 32px;
  height: 32px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: .69rem;
}
.orders { display: grid; }
.order {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1.05fr) 140px 160px 250px;
  align-items: center;
  gap: 18px;
  min-width: 0;
  padding: 16px 12px;
  border-top: 1px solid var(--line-soft);
  color: var(--text);
  font-size: .84rem;
}
.order:hover { background: rgba(255, 255, 255, .018); border-radius: 9px; }
.order-attention { background: linear-gradient(90deg, rgba(237, 86, 101, .1), transparent 42%); box-shadow: inset 3px 0 0 var(--accent); border-radius: 9px; }
.order-attention:hover { background: linear-gradient(90deg, rgba(237, 86, 101, .14), transparent 48%); }
.order-opened { background: rgba(237, 86, 101, .035); box-shadow: inset 2px 0 0 rgba(237, 86, 101, .38); border-radius: 9px; }
.table-head {
  padding: 6px 12px 10px;
  border-top: 0;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted-2);
  font-size: .66rem;
  font-weight: 650;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.order-main { display: grid; gap: 4px; min-width: 0; }
.order-sub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.order-link { color: var(--text); font-size: .92rem; font-weight: 650; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-link:hover { color: var(--accent); }
.order-meta { color: var(--muted-2); font-size: .7rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta-sep { color: #5b3d40; }
.copy-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 23px;
  padding: 2px 7px;
  border: 1px solid rgba(237, 86, 101, .18);
  border-radius: 6px;
  background: rgba(237, 86, 101, .045);
  color: var(--accent);
  font-size: .62rem;
  font-weight: 600;
  white-space: nowrap;
}
.copy-link:hover { background: rgba(237, 86, 101, .1); border-color: rgba(237, 86, 101, .35); filter: none; }
.copy-link svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.order-phone-cell { min-width: 0; }
.order-phone { color: var(--muted); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order-phone-empty { font-size: .72rem; color: var(--muted-2); }
.phone-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-height: 30px;
  padding: 4px 7px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font-size: .84rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.phone-copy:hover { background: var(--panel-3); border-color: var(--line-soft); filter: none; }
.phone-copy svg { width: 12px; height: 12px; flex: none; fill: none; stroke: var(--muted-2); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.phone-copy:hover svg { stroke: var(--accent); }
.order-amount { display: grid; gap: 2px; justify-items: end; text-align: right; font-variant-numeric: tabular-nums; }
.amount-base { color: var(--text); font-size: .98rem; font-weight: 700; white-space: nowrap; }
.amount-fee { color: var(--accent); font-size: .86rem; font-weight: 650; white-space: nowrap; }
.status-cell { display: grid; justify-items: start; gap: 4px; min-width: 0; }
.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: .7rem;
  font-weight: 600;
  white-space: nowrap;
}
.status-tag i { width: 5px; height: 5px; flex: none; border-radius: 50%; background: currentColor; }
.status-new { color: var(--blue); border-color: rgba(255, 124, 136, .2); background: rgba(255, 124, 136, .06); }
.status-waiting { color: var(--amber); border-color: rgba(245, 199, 106, .2); background: rgba(245, 199, 106, .06); }
.status-ready { color: var(--violet); border-color: rgba(253, 181, 187, .2); background: rgba(253, 181, 187, .06); }
.status-reported { color: var(--amber); border-color: rgba(245, 199, 106, .2); background: rgba(245, 199, 106, .06); }
.status-paid { color: var(--accent); border-color: rgba(237, 86, 101, .22); background: rgba(237, 86, 101, .07); }
.status-refund { color: var(--red); border-color: rgba(255, 154, 164, .22); background: rgba(255, 154, 164, .06); }
.status-cancelled { color: #ab8c8f; border-color: var(--line); background: rgba(179, 147, 150, .05); }
.timer-line { color: var(--muted-2); font-size: .66rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.timer-line.timer-expired { color: var(--red); }

.order-actions { display: flex; align-items: center; justify-content: flex-end; gap: 5px; flex-wrap: wrap; min-width: 0; }
.inline-form { display: inline-flex; margin: 0; }
.deal-actions { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin: 0; }
.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 32px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: .7rem;
  font-weight: 650;
  white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.action-btn:hover { filter: none; background: var(--panel-3); color: var(--text); }
.action-btn svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.action-confirm { color: var(--accent); border-color: rgba(237, 86, 101, .25); background: rgba(237, 86, 101, .05); }
.action-confirm:hover { background: rgba(237, 86, 101, .11); border-color: rgba(237, 86, 101, .4); color: var(--accent-2); }
.action-refund { color: var(--red); border-color: rgba(255, 154, 164, .25); background: rgba(255, 154, 164, .04); }
.action-refund:hover { background: rgba(255, 154, 164, .1); border-color: rgba(255, 154, 164, .4); color: var(--red-2); }
.action-qr { color: var(--blue); border-color: rgba(255, 124, 136, .22); background: rgba(255, 124, 136, .05); }
.action-qr:hover { background: rgba(255, 124, 136, .11); border-color: rgba(255, 124, 136, .4); }
.action-subtle { color: var(--muted); }
.action-delete { width: 100%; justify-content: center; min-height: 36px; margin-top: 4px; color: var(--red); border-color: rgba(255, 154, 164, .25); background: rgba(255, 154, 164, .035); font-size: .72rem; }
.action-delete:hover { color: var(--red-2); background: rgba(255, 154, 164, .09); border-color: rgba(255, 154, 164, .4); }
.icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  min-height: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted-2);
}
.icon-btn svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-danger:hover { color: var(--red); border-color: rgba(255, 154, 164, .35); background: rgba(255, 154, 164, .07); filter: none; }

.pagination-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding-top: 13px; border-top: 1px solid var(--line-soft); }
.page-summary { color: var(--muted-2); font-size: .68rem; }
.pagination { display: flex; align-items: center; gap: 3px; }
.page-btn {
  display: grid;
  place-items: center;
  min-width: 29px;
  height: 29px;
  padding: 0 7px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--muted);
  font-size: .7rem;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
}
a.page-btn:hover { background: var(--panel-2); color: var(--text); border-color: var(--line-soft); }
.page-btn.is-current { background: var(--accent); color: var(--accent-ink); font-weight: 750; }
.page-btn.is-disabled { color: #5c3f42; }
.page-gap { padding: 0 2px; color: var(--muted-2); font-size: .7rem; }
.empty-state { display: grid; justify-items: center; gap: 6px; padding: 44px 20px; text-align: center; color: var(--muted); }
.empty-icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 4px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel-2); color: var(--muted-2); }
.empty-icon svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.empty-state h3 { color: var(--text); font-size: .9rem; }
.empty-state p { max-width: 44ch; font-size: .76rem; }

/* ===== Журнал действий ===== */
.audit-page .registry { gap: 12px; }
.audit-table { display: grid; }
.audit-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1.25fr) 90px 145px 145px 80px;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-top: 1px solid var(--line-soft);
  color: var(--text);
  font-size: .78rem;
}
.audit-row:hover { background: rgba(255, 255, 255, .018); border-radius: 8px; }
.audit-table-head {
  padding: 5px 12px 9px;
  border-top: 0;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted-2);
  font-size: .64rem;
  font-weight: 650;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.audit-row time { color: var(--muted); font-size: .7rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.audit-action { font-weight: 600; overflow-wrap: anywhere; }
.audit-token { color: var(--muted-2); font-size: .7rem; font-variant-numeric: tabular-nums; }
.audit-amount { display: grid; gap: 1px; justify-items: end; text-align: right; font-variant-numeric: tabular-nums; }
.audit-amount b { font-size: .76rem; font-weight: 650; white-space: nowrap; }
.audit-amount small { color: var(--accent); font-size: .66rem; white-space: nowrap; }
.audit-actor { color: var(--muted-2); font-size: .68rem; }
.audit-hint { padding-top: 4px; }

/* ===== Проверка интеграции ===== */
.dry-run-banner { margin: 2px 0 6px; padding: 11px 13px; border: 1px solid rgba(216, 178, 108, .24); border-radius: 10px; background: rgba(216, 178, 108, .06); color: var(--muted); font-size: .76rem; }
.dry-run-banner b { color: #f0d8a4; }
.integration-table { display: grid; overflow-x: auto; }
.integration-row { display: grid; grid-template-columns: 145px minmax(0, 1.3fr) 120px 150px 90px 105px minmax(0, 1fr); align-items: center; gap: 10px; padding: 9px 12px; border-top: 1px solid var(--line-soft); font-size: .75rem; min-width: 980px; }
.integration-head { padding: 5px 12px 9px; border-top: 0; border-bottom: 1px solid var(--line-soft); color: var(--muted-2); font-size: .63rem; font-weight: 650; letter-spacing: .09em; text-transform: uppercase; }
.integration-row time { color: var(--muted); font-size: .68rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.integration-kind { display: grid; gap: 1px; min-width: 0; font-weight: 600; }
.integration-kind small { color: var(--muted-2); font-size: .62rem; font-weight: 400; }
.integration-amount { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.integration-status { color: var(--muted); font-size: .68rem; overflow-wrap: anywhere; }
.integration-token { color: var(--muted-2); font-size: .68rem; }
.integration-proposal { color: var(--text); font-size: .7rem; }
.integration-proposal small { display: block; color: var(--muted-2); font-size: .62rem; }
.integration-proposal .apply-ok { color: var(--accent); }
.integration-proposal .apply-skip { color: var(--amber); }
.match { display: inline-flex; width: fit-content; padding: 2px 6px; border: 1px solid var(--line); border-radius: 999px; font-size: .62rem; }
.match-matched { color: var(--accent); border-color: rgba(237, 86, 101, .28); background: rgba(237, 86, 101, .07); }
.match-ambiguous { color: var(--amber); border-color: rgba(216, 178, 108, .28); background: rgba(216, 178, 108, .06); }
.match-unmatched { color: var(--red); border-color: rgba(239, 150, 160, .22); background: rgba(239, 150, 160, .05); }

/* ===== Карточка заявки ===== */
.detail-page { gap: 16px; }
.breadcrumb a { color: var(--muted); font-size: .74rem; text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding-bottom: 18px; border-bottom: 1px solid var(--line-soft); }
.detail-head h1 { margin-top: 3px; font-size: 1.55rem; }
.detail-head .order-meta { margin-top: 4px; font-size: .7rem; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 358px; gap: 20px; align-items: start; }
.detail-main { display: grid; gap: 20px; padding: 24px; }
.amount-block { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; padding-bottom: 18px; border-bottom: 1px solid var(--line-soft); }
.amount-item { display: grid; gap: 3px; min-width: 0; }
.amount-item p { color: var(--muted); font-size: .7rem; }
.amount-item strong { color: var(--text); font-size: clamp(1.35rem, 2.4vw, 2rem); line-height: 1.1; letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
.amount-item-fee { padding-left: 20px; border-left: 1px solid var(--line-soft); }
.amount-item-fee strong { color: var(--accent); }
.detail-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.detail-info-grid div { display: grid; gap: 3px; }
.detail-info-grid span { color: var(--muted-2); font-size: .64rem; text-transform: uppercase; letter-spacing: .08em; }
.detail-info-grid b { font-size: .8rem; font-weight: 600; overflow-wrap: anywhere; }
.detail-info-grid .phone-copy { justify-self: start; margin-left: -7px; font-size: .84rem; }
.detail-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.detail-box { display: grid; gap: 12px; padding: 16px; border: 1px solid var(--line-soft); border-radius: 13px; background: var(--panel-2); }
.detail-box h3 { font-size: .78rem; }
.detail-box form { display: grid; gap: 10px; }
.status-controls { display: grid; gap: 14px; }
.status-controls .deal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.status-controls .deal-actions .action-btn { min-height: 35px; }
.status-controls .deal-actions .action-btn:only-child { grid-column: 1 / -1; }
.history-title { margin-top: 4px; color: var(--muted-2); font-size: .64rem; letter-spacing: .1em; text-transform: uppercase; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 5px; display: grid; }
.timeline li { position: relative; padding: 0 0 13px 18px; border-left: 1px solid var(--line); }
.timeline li::before { content: ""; position: absolute; top: 4px; left: -4px; width: 7px; height: 7px; border: 1px solid var(--accent); border-radius: 50%; background: var(--panel); }
.timeline li:last-child { padding-bottom: 0; border-left-color: transparent; }
.timeline b { font-size: .73rem; font-weight: 600; }
.timeline small { display: block; margin-top: 1px; color: var(--muted-2); font-size: .63rem; }
.delete-form { margin: 2px 0 0; }

/* ===== Модальное окно QR и уведомления ===== */
#paste-modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; background: rgba(10, 3, 4, .78); backdrop-filter: blur(4px); }
#paste-modal[hidden] { display: none; }
.paste-box { position: relative; display: grid; gap: 12px; width: min(100%, 440px); padding: 28px 24px; border: 1px solid var(--line); border-radius: 17px; background: var(--panel); box-shadow: 0 30px 80px #0009; text-align: center; }
.paste-box h3 { font-size: .95rem; }
.paste-box p { color: var(--muted); font-size: .8rem; }
.paste-close { position: absolute; top: 5px; right: 7px; min-height: 0; padding: 3px 9px; border: 0; border-radius: 8px; background: transparent; color: var(--muted-2); font-size: 1.55rem; line-height: 1; }
.paste-close:hover { background: rgba(255, 255, 255, .05); color: var(--text); filter: none; }
.paste-box kbd { padding: 1px 6px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel-2); font-family: inherit; font-size: .88em; }
.paste-status { min-height: 1.4em; color: var(--muted); }
.paste-status.error { color: var(--red); }
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 200;
  transform: translate(-50%, 16px);
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #311a1c;
  box-shadow: 0 12px 34px #0007;
  color: var(--text);
  font-size: .76rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ===== Адаптивность ===== */
@media (max-width: 1120px) {
  .dashboard, .detail-grid { grid-template-columns: 1fr; }
  .side-column { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .note-panel { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .workspace { padding: 22px 18px 40px; }
  .order { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 14px; padding: 15px 8px; }
  .table-head { display: none; }
  .order-main { grid-column: 1; grid-row: 1; }
  .order-amount { grid-column: 2; grid-row: 1; }
  .order-phone-cell { grid-column: 1; grid-row: 2; }
  .status-cell { grid-column: 1; grid-row: 3; }
  .order-actions { grid-column: 2; grid-row: 2 / span 2; align-self: center; justify-content: flex-end; }
  .amount-base { display: block; }
}
@media (max-width: 720px) {
  .topbar { flex-wrap: nowrap; }
  .topbar-actions { width: auto; margin-left: auto; gap: 6px; }
  .stats-toggle { width: 38px; min-height: 38px; padding: 0; }
  .stats-toggle-text { display: none; }
  .kpi-grid { grid-template-columns: 1fr; }
  .chart-controls { justify-items: start; }
  .chart-wrap { overflow-x: auto; padding-bottom: 4px; }
  .chart-svg { min-width: 620px; }
  .chart-scroll-hint { display: block; }
  .side-column { grid-template-columns: 1fr; }
  .registry { padding: 16px; }
  .audit-table-head { display: none; }
  .audit-row { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 12px 6px; }
  .audit-row time { grid-column: 1; }
  .audit-action { grid-column: 1; grid-row: 2; }
  .audit-token { grid-column: 2; grid-row: 1; justify-self: end; }
  .audit-amount { grid-column: 2; grid-row: 2; }
  .audit-row > span:nth-child(5), .audit-row > span:nth-child(6) { grid-column: 1; }
  .registry-head { align-items: stretch; }
  .registry-tools { width: 100%; justify-items: stretch; }
  .search-form { width: 100%; max-width: none; }
  .section-head { flex-wrap: wrap; }
  .pagination-row { align-items: flex-start; flex-direction: column; }
  .detail-head { flex-direction: column; gap: 10px; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-info-grid { grid-template-columns: 1fr; }
  .checkout { grid-template-columns: 1fr; min-height: auto; }
  .receipt { padding: 26px 22px; border-right: 0; border-bottom: 1px solid var(--line); }
  .action { padding: 22px 18px; }
  .payment-method { margin-bottom: 16px; }
  .qr-area { padding-top: 0; }
  .order { gap: 7px 10px; }
  .order-actions { gap: 4px; }
  .action-btn { font-size: .62rem; padding: 5px 6px; }
  .page-summary { order: 2; }
}
@media (max-width: 460px) {
  .workspace { padding: 18px 12px 32px; }
  .panel { padding: 17px; }
  .stats-panel { padding: 17px; }
  .kpi strong { font-size: 1.2rem; }
  .amount-block { grid-template-columns: 1fr; gap: 12px; }
  .amount-item-fee { padding-top: 10px; padding-left: 0; border-top: 1px solid var(--line-soft); border-left: 0; }
  .order-actions { flex-direction: column; align-items: flex-end; }
  .order-phone { font-size: .73rem; }
  .phone-copy { font-size: .8rem; }
  .brand-text h1 { font-size: 1.08rem; }
  .live-pill { display: none; }
}

body { background: #0e0607 url("ornament.png") center top / cover fixed no-repeat; }
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; }
  .brand { width: 100%; }
  .topbar-actions { width: 100%; margin-left: 0; flex-wrap: wrap; }
}
