:root {
    --page-bg: #070814;
    --top-bg: rgba(18, 20, 42, 0.9);
    --panel: rgba(20, 22, 48, 0.86);
    --panel-strong: rgba(28, 30, 66, 0.95);
    --text: #f6f7ff;
    --muted: #9aa4ce;
    --line: rgba(124, 140, 255, 0.38);
    --line-soft: rgba(124, 140, 255, 0.18);
    --field: rgba(8, 10, 24, 0.86);
    --blue: #4d7cff;
    --blue-deep: #224ee8;
    --blue-soft: #8b7dff;
    --cyan: #3ee7ff;
    --red: #ff4d7a;
    --green: #4be69a;
    --yellow: #ffd34d;
    --error: #ff4d7a;
    --shadow: rgba(0, 0, 0, 0.36);
}

.admin-support-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
    gap: 18px;
    align-items: start;
}

.admin-support-panel table {
    min-width: 860px;
}

.support-ticket-row {
    cursor: pointer;
}

.support-ticket-row:hover,
.support-ticket-row.is-active {
    background: #edf4ff;
}

.admin-support-chat {
    display: grid;
    gap: 14px;
    min-height: 420px;
    border: 1px solid #d7dfef;
    border-radius: 8px;
    padding: 16px;
    background: #fff;
}

.admin-support-chat h3 {
    margin: 0;
    color: #111827;
    font-size: 18px;
}

.admin-support-messages {
    display: grid;
    gap: 10px;
    max-height: 340px;
    overflow: auto;
}

.admin-support-message {
    display: grid;
    gap: 6px;
    max-width: 92%;
    border: 1px solid #e7ecf6;
    border-radius: 8px;
    padding: 12px;
    background: #f8faff;
}

.admin-support-message.partner {
    margin-right: auto;
}

.admin-support-message.admin {
    margin-left: auto;
    border-color: #c5d8ff;
    background: #edf4ff;
}

.admin-support-message strong {
    color: #063f98;
}

.admin-support-message small,
#support-chat-meta,
#support-reply-status {
    color: #667085;
    font-size: 12px;
    font-weight: 800;
}

.admin-support-reply {
    display: grid;
    gap: 10px;
}

.admin-support-reply textarea {
    width: 100%;
    min-height: 104px;
    border: 1px solid #d7dfef;
    border-radius: 8px;
    padding: 12px;
    font: inherit;
    resize: vertical;
}

.support-reply-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

@media (max-width: 1180px) {
    .admin-support-layout {
        grid-template-columns: 1fr;
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    background:
        radial-gradient(circle at 18% 0%, rgba(77, 124, 255, 0.28), transparent 34%),
        radial-gradient(circle at 78% 14%, rgba(62, 231, 255, 0.16), transparent 30%),
        linear-gradient(135deg, #070814 0%, #11122a 47%, #0a1028 100%),
        var(--page-bg);
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

[hidden] {
    display: none !important;
}

.login-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    border-top: 4px solid var(--cyan);
}

.login-card {
    width: min(420px, 100%);
    display: grid;
    gap: 16px;
    padding: 30px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel);
    box-shadow: 0 24px 70px var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(18px);
}

.login-card h1 {
    margin: 12px 0 8px;
    font-size: 38px;
    line-height: 1;
}

.login-card label,
.user-form label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.login-card input,
.user-form input,
.user-form select {
    width: 100%;
    height: 46px;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0 14px;
    color: var(--text);
    background: var(--field);
    outline: 0;
    font-size: 14px;
    font-weight: 700;
}

.login-card input:focus,
.user-form input:focus,
.user-form select:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 0 4px rgba(62, 231, 255, 0.12), 0 0 22px rgba(77, 124, 255, 0.22);
}

.login-card button,
.user-form button,
.client-account-link,
.sync-panel button {
    height: 46px;
    border: 0;
    border-radius: 10px;
    padding: 0 18px;
    color: #ffffff;
    background: linear-gradient(135deg, var(--blue), var(--blue-soft));
    font-size: 14px;
    font-weight: 800;
    box-shadow: 0 14px 34px rgba(77, 124, 255, 0.28);
}

.admin-shell {
    width: min(1540px, 100%);
    min-height: 100vh;
    margin: 0 auto;
    display: grid;
    align-content: start;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
        "sidebar"
        "workspace";
    gap: 18px;
    padding: 18px;
}

.sidebar {
    grid-area: sidebar;
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--top-bg);
    box-shadow: 0 20px 60px var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(18px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-brand {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) minmax(168px, auto);
    align-items: center;
    gap: 12px;
}

.rapay-logo-image {
    width: 82px;
    height: auto;
    display: block;
    flex: 0 0 auto;
    object-fit: contain;
}

.brand > div > span {
    display: block;
    margin-top: 0;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.admin-brand-copy h1 {
    margin: 4px 0 6px;
    font-size: clamp(28px, 3vw, 42px);
    line-height: 1;
    text-align: right;
}

.admin-brand-copy p {
    max-width: 640px;
    margin: 0 0 0 auto;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
    text-align: right;
}

.admin-brand-copy .eyebrow {
    text-align: right;
}

.account-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 5px 10px;
    min-width: 168px;
    padding: 0;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    background: transparent;
}

.account-bar span,
.account-bar strong {
    overflow: hidden;
    text-overflow: ellipsis;
}

.account-bar span {
    align-self: center;
    color: var(--text);
    font-size: 11px;
    font-weight: 900;
    padding-left: 0;
    text-align: center;
}

.account-bar span span,
.account-bar span b {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-bar span span {
    color: var(--muted);
    font-size: 9px;
    text-transform: uppercase;
}

.account-bar span b {
    color: var(--text);
    font-size: 12px;
}

.account-bar strong {
    grid-column: 1;
    color: var(--muted);
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    padding-left: 10px;
    white-space: nowrap;
}

.account-bar button {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    min-width: 72px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 0 8px 8px 0;
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
    font-size: 11px;
    font-weight: 900;
}

.account-bar button:hover {
    border-color: rgba(62, 231, 255, 0.48);
    background: rgba(62, 231, 255, 0.08);
}

.side-nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px;
    min-width: 0;
}

.side-nav.is-single {
    grid-template-columns: 1fr;
}

.side-nav a {
    min-height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 7px 9px;
    color: #c2caf0;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 800;
}

.side-nav a:hover,
.side-nav a.is-active {
    color: #ffffff;
    border-color: var(--line);
    background: linear-gradient(135deg, rgba(77, 124, 255, 0.2), rgba(62, 231, 255, 0.08));
    box-shadow: inset 0 0 0 1px rgba(62, 231, 255, 0.1);
}

.session-card {
    grid-area: session;
    display: grid;
    grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr) minmax(180px, 2fr);
    align-items: center;
    gap: 8px;
    padding: 14px;
    border: 1px solid var(--line-soft);
    border-radius: 12px;
    background: rgba(8, 10, 24, 0.54);
}

.session-card span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.session-card strong {
    color: var(--text);
    font-size: 15px;
}

.session-card button {
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
    font-weight: 800;
}

.workspace {
    grid-area: workspace;
    min-width: 0;
    display: grid;
    gap: 16px;
}

.orders-panel {
    min-width: 0;
}

.topline {
    grid-area: topline;
    min-height: 156px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel);
    box-shadow: 0 20px 60px var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(18px);
}

.eyebrow {
    display: block;
    color: var(--cyan);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

h1 {
    margin: 8px 0 10px;
    font-size: clamp(34px, 4vw, 52px);
    line-height: 0.98;
}

.topline p {
    max-width: 560px;
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.top-actions {
    display: grid;
    justify-items: end;
    gap: 10px;
}

.live-badge {
    max-width: 320px;
    padding: 10px 13px;
    color: #bfffe1;
    border: 1px solid rgba(75, 230, 154, 0.34);
    border-radius: 999px;
    background: rgba(75, 230, 154, 0.1);
    font-size: 13px;
    font-weight: 800;
    text-align: right;
}

.sync-panel {
    display: grid;
    justify-items: end;
    gap: 8px;
}

.sync-panel button:disabled {
    cursor: wait;
    opacity: 0.72;
}

.sync-result {
    max-width: 320px;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    text-align: right;
}

.ramarket-metrics {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
}
.ramarket-summary .ramarket-metric {
    min-height: 140px; padding: 18px; box-shadow: none;
    border-top: 2px solid #dce7fa;
}
.ramarket-metric > span { min-height: 36px; }
.ramarket-metric > strong { font-size: 28px; line-height: 1.25; font-variant-numeric: tabular-nums; }
.ramarket-source-notice { color: #64748b; font-size: 13px; margin: 0 0 18px; }
@media (max-width: 1200px) { .ramarket-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) { .ramarket-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px) { .ramarket-metrics { grid-template-columns: minmax(0, 1fr); } }

/* Only the two requested summary cards are hidden; bank totals stay intact. */
#payment-method-stats > [data-bank-code="raif"],
#payment-method-stats > [data-bank-code="gazprom"] {
    display: none;
}
body .top-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (max-width: 640px) {
    body .top-stats-grid { grid-template-columns: minmax(0, 1fr); }
}

.top-stats-grid,
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.stats-period-toolbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 14px;
    padding: 2px;
}

.stats-period-title {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    white-space: nowrap;
}

.stats-periods {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.stats-periods button {
    min-height: 36px;
    padding: 8px 12px;
    border: 1px solid #c9d8f5;
    border-radius: 9px;
    color: var(--blue-deep);
    background: #eef5ff;
    font-size: 11px;
    font-weight: 900;
}

.stats-periods button:hover {
    border-color: var(--blue);
    background: #e5f0ff;
}

.stats-periods button.is-active,
.stats-periods button.is-active:hover {
    color: #ffffff;
    border-color: var(--blue);
    background: linear-gradient(135deg, var(--blue), var(--blue-soft));
    box-shadow: 0 8px 18px rgba(7, 87, 200, 0.16);
}

.stats-date-range {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.rates-panel {
    padding: 18px;
}

.rates-table {
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--line-soft);
    border-radius: 12px;
    background: rgba(8, 10, 24, 0.34);
}

.rates-head,
.rate-row {
    display: grid;
    grid-template-columns: minmax(38px, 0.62fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 0.9fr);
    gap: 8px;
    align-items: center;
}

.rates-head {
    padding: 0 9px 3px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.rates-head span:nth-child(2),
.rates-head span:nth-child(3),
.rates-head span:nth-child(4) {
    justify-self: center;
    text-align: center;
}

.rates-head span span {
    display: block;
}

.rate-row {
    min-height: 34px;
    padding: 7px 9px;
    border: 1px solid var(--line-soft);
    border-radius: 9px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.035);
    font-size: 13px;
    font-weight: 800;
}

.rate-row strong {
    color: var(--text);
    font-size: 14px;
}

.rate-row b {
    justify-self: center;
    color: var(--cyan);
    text-align: center;
}

.rates-table p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.client-context-panel {
    display: grid;
    gap: 14px;
}

.client-context-body {
    display: grid;
    grid-template-columns: minmax(220px, 0.7fr) minmax(0, 1.3fr);
    gap: 12px;
}

.client-parent-card,
.client-shop-item {
    display: grid;
    gap: 6px;
    min-width: 0;
    padding: 13px;
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.035);
}

.client-parent-card span,
.client-shop-item small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.client-parent-card strong,
.client-shop-item span {
    overflow-wrap: anywhere;
    color: var(--text);
    font-size: 14px;
    font-weight: 900;
}

.client-parent-card small {
    color: var(--cyan);
    font-size: 12px;
    font-weight: 900;
}

.client-shops-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 10px;
}

.tbank-panel {
    display: none !important;
    gap: 14px;
}

.tbank-status-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.tbank-status-grid div {
    display: grid;
    gap: 7px;
    min-height: 72px;
    padding: 12px;
    border: 1px solid var(--line-soft);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.035);
}

.tbank-status-grid span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.tbank-status-grid strong {
    color: var(--text);
    font-size: 14px;
    line-height: 1.25;
}

.tbank-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.tbank-actions .sync-result {
    max-width: none;
    text-align: right;
}

.tbank-actions button:disabled {
    cursor: wait;
    opacity: 0.72;
}

.stat-card,
.panel {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel);
    box-shadow: 0 18px 54px var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(16px);
}

.stat-card {
    min-height: 128px;
    padding: 18px;
}

.stat-card span,
.panel-head span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.stat-card strong {
    display: grid;
    gap: 5px;
    margin: 14px 0 7px;
    color: var(--text);
    font-size: clamp(18px, 2vw, 24px);
    line-height: 1.12;
}

.stat-card strong span,
.success-stat-row strong span {
    color: inherit;
    font-size: inherit;
    font-weight: 900;
    line-height: inherit;
    text-transform: none;
}

.stat-card small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.stat-bank-breakdown {
    display: grid;
    gap: 6px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--line-soft);
}

.stat-bank-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
}

.stat-bank-row span {
    overflow: hidden;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    text-overflow: ellipsis;
    text-transform: none;
    white-space: nowrap;
}

.stat-bank-row b {
    color: var(--blue-deep);
    font-size: 11px;
    font-weight: 900;
    white-space: nowrap;
}

.success-stat-card {
    grid-column: span 2;
    min-height: 128px;
    display: grid;
    align-content: center;
    gap: 14px;
}

.payment-method-stats {
    display: contents;
}

.payment-method-stat-card {
    border-top: 4px solid var(--green);
}

.payment-method-stat-card > span {
    display: grid;
    gap: 2px;
    min-height: 30px;
    align-content: start;
}

.payment-method-stat-card > span span {
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
    line-height: 1.12;
    text-transform: uppercase;
}

.payment-method-refunds {
    display: block;
    color: var(--red) !important;
}

.payment-method-count {
    display: block;
}

.success-stat-row {
    display: grid;
    justify-items: start;
    gap: 7px;
}

.success-stat-row span {
    color: var(--text);
    font-size: 15px;
    line-height: 1.2;
    text-transform: none;
}

.success-stat-row strong {
    width: fit-content;
    min-width: 38px;
    margin: 0;
    padding: 5px 10px;
    border-radius: 5px;
    color: #eafff7;
    background: #3a9f8a;
    font-size: 16px;
    line-height: 1.15;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.chart-stat-card {
    grid-column: 1 / -1;
    min-height: 220px;
}

.charts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.charts > article:first-child {
    display: none;
}

.panel {
    padding: 18px;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}

.daily-chart-head {
    align-items: center;
    flex-wrap: wrap;
}

.month-input {
    min-width: 136px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 10px;
    background: #f8faff;
    color: var(--text);
    font-size: 13px;
    font-weight: 800;
}

h2 {
    margin: 0;
    font-size: 22px;
    line-height: 1.15;
}

.panel-head h2 {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    line-height: 1.15;
    text-transform: uppercase;
}

.bar-chart {
    display: grid;
    gap: 11px;
}

.bar-chart p {
    min-height: 52px;
    display: grid;
    place-items: center start;
    margin: 0;
    padding: 14px;
    border: 1px dashed var(--line-soft);
    border-radius: 10px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.025);
    font-size: 13px;
    font-weight: 800;
}

.bar-row {
    display: grid;
    grid-template-columns: 128px 1fr 118px;
    gap: 12px;
    align-items: center;
    color: #c2caf0;
    font-size: 13px;
    font-weight: 700;
}

.bar-track {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(124, 140, 255, 0.16);
}

.bar-fill {
    height: 100%;
    min-width: 3px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--cyan), var(--blue-soft));
}

.bar-row strong {
    color: var(--text);
    text-align: right;
}

.bar-rate-warning {
    display: block;
    margin-top: 2px;
    color: #b42318;
    font-size: 10px;
    font-weight: 700;
}

.daily-chart {
    min-height: 160px;
}

.daily-chart p {
    min-height: 110px;
    display: grid;
    place-items: center start;
    margin: 0;
    padding: 14px;
    border: 1px dashed var(--line-soft);
    border-radius: 10px;
    color: var(--muted);
    background: #f8faff;
    font-size: 13px;
    font-weight: 800;
}

.daily-line-chart {
    display: grid;
    gap: 8px;
}

.daily-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.daily-chart-legend span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 26px;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    padding: 5px 9px;
    background: #f8faff;
    color: var(--text);
    font-size: 11px;
    font-weight: 900;
}

.daily-chart-legend i {
    width: 10px;
    height: 10px;
    flex: 0 0 10px;
    border-radius: 999px;
}

.daily-chart-legend .daily-rate-warning {
    border-color: #fecaca;
    background: #fff1f2;
    color: #b42318;
}

.daily-line-chart svg {
    display: block;
    width: 100%;
    min-height: 150px;
    overflow: visible;
}

.daily-axis,
.daily-grid-line {
    stroke: #d5deef;
    stroke-width: 2;
}

.daily-grid-line {
    stroke-dasharray: 8 8;
}

.daily-grid-line-vertical {
    stroke-dasharray: 5 9;
}

.daily-axis-labels text {
    fill: var(--muted);
    font-size: 18px;
    font-weight: 900;
}

.daily-y-label {
    fill: var(--muted);
    font-size: 15px;
    font-weight: 900;
}

.daily-point-label {
    paint-order: stroke;
    stroke: #ffffff;
    stroke-width: 5px;
    font-size: 13px;
    font-weight: 900;
}

.table-wrap {
    overflow-x: hidden;
    overflow-y: auto;
    max-height: 520px;
}

.orders-panel .table-wrap {
    overflow-x: auto;
}

.orders-panel table {
    min-width: 1220px;
    table-layout: fixed;
}

.orders-panel th:nth-child(1),
.orders-panel td:nth-child(1) {
    width: 110px;
}

.orders-panel th:nth-child(2),
.orders-panel td:nth-child(2) {
    width: 150px;
}

.orders-panel th:nth-child(3),
.orders-panel td:nth-child(3) {
    width: 210px;
}

.orders-panel th:nth-child(4),
.orders-panel td:nth-child(4) {
    width: 112px;
}

.orders-panel th:nth-child(5),
.orders-panel td:nth-child(5) {
    width: 82px;
    white-space: nowrap;
}

.orders-panel th:nth-child(6),
.orders-panel td:nth-child(6) {
    width: 96px;
    white-space: nowrap;
}

.orders-panel th:nth-child(7),
.orders-panel td:nth-child(7) {
    width: 170px;
}

.orders-panel th:nth-child(8),
.orders-panel td:nth-child(8) {
    width: 100px;
    white-space: nowrap;
}

.orders-panel th:nth-child(9),
.orders-panel td:nth-child(9) {
    width: 92px;
    white-space: nowrap;
}

.orders-panel th:nth-child(10),
.orders-panel td:nth-child(10) {
    width: 108px;
    white-space: nowrap;
}

.orders-panel td {
    overflow-wrap: normal;
    word-break: normal;
}

.orders-filter-row th {
    padding: 6px 5px 8px;
    background: #ffffff;
}

.orders-filter-row input,
.orders-filter-row select {
    width: 100%;
    min-width: 0;
    min-height: 32px;
    padding: 6px 8px;
    border: 1px solid #c9d8f5;
    border-radius: 7px;
    color: var(--text);
    background: #ffffff;
    font-size: 10px;
    font-weight: 800;
    text-transform: none;
}

.orders-filter-row input:focus,
.orders-filter-row select:focus {
    border-color: var(--blue);
    outline: none;
    box-shadow: 0 0 0 3px rgba(7, 87, 200, 0.1);
}

.orders-filter-row input::placeholder {
    color: #8b98ad;
    opacity: 1;
}

.orders-refund-filter {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 28px;
    gap: 4px;
}

#clear-order-filters {
    width: 28px;
    min-height: 32px;
    padding: 0;
    border: 1px solid #c9d8f5;
    border-radius: 7px;
    color: var(--blue-deep);
    background: #eef5ff;
    font-size: 16px;
    font-weight: 900;
}

#clear-order-filters:hover {
    border-color: var(--blue);
    background: #e5f0ff;
}

.order-rate-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.order-usd-rate-control {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.order-usd-rate-control input {
    width: 78px;
    height: 30px;
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 0 8px;
    font: inherit;
    font-weight: 800;
    color: var(--ink);
    background: #fff;
}

.order-usd-rate-control button {
    height: 30px;
    border: 1px solid var(--blue);
    border-radius: 7px;
    padding: 0 8px;
    font: inherit;
    font-size: 11px;
    font-weight: 900;
    color: var(--blue);
    background: #eef5ff;
    cursor: pointer;
}

.order-usd-rate-control .order-usd-rate-reset {
    width: 30px;
    padding: 0;
    border-color: var(--border);
    color: var(--muted);
    background: #fff;
}

.table-wrap.compact {
    overflow-x: auto;
}

.table-wrap.compact table {
    min-width: 860px;
    table-layout: fixed;
}

.table-wrap.compact th:nth-child(1),
.table-wrap.compact td:nth-child(1) {
    width: 180px;
}

.table-wrap.compact th:nth-child(2),
.table-wrap.compact td:nth-child(2) {
    width: 130px;
}

.table-wrap.compact th:nth-child(3),
.table-wrap.compact td:nth-child(3) {
    width: 120px;
}

.table-wrap.compact th:nth-child(4),
.table-wrap.compact td:nth-child(4) {
    width: auto;
}

.table-wrap.compact td {
    overflow-wrap: normal;
    word-break: normal;
}

.table-wrap.compact td:last-child {
    overflow-wrap: anywhere;
}

.orders-panel-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}

.orders-panel-actions button {
    min-height: 38px;
    padding: 9px 13px;
    border: 1px solid rgba(124, 140, 255, 0.34);
    border-radius: 10px;
    color: #eef2ff;
    background: rgba(124, 140, 255, 0.14);
    font-size: 12px;
    font-weight: 900;
}

.orders-date-field {
    position: relative;
    display: inline-grid;
    grid-template-columns: auto minmax(96px, 1fr);
    align-items: center;
    gap: 7px;
    min-width: 166px;
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid #c9d8f5;
    border-radius: 10px;
    color: var(--text);
    background: #ffffff;
    cursor: pointer;
}

.orders-date-field:hover {
    border-color: var(--blue);
    background: #fbfdff;
}

.orders-date-field:focus-within {
    border-color: var(--blue);
    box-shadow: 0 0 0 4px rgba(7, 87, 200, 0.1);
}

.orders-date-label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    white-space: nowrap;
}

.orders-date-value {
    color: var(--blue-deep);
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.orders-date-field input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    color: transparent;
    background: transparent;
    opacity: 0;
    cursor: pointer;
}

.orders-date-field input:focus {
    outline: none;
}

.orders-date-field input::-webkit-calendar-picker-indicator {
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.refund-button {
    min-height: 34px;
    padding: 7px 11px;
    border: 1px solid rgba(7, 87, 200, 0.28);
    border-radius: 9px;
    color: var(--blue-deep);
    background: #eef5ff;
    font-size: 12px;
    font-weight: 900;
}

.refund-dialog {
    width: min(460px, calc(100vw - 32px));
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 18px;
    color: var(--text);
    background: var(--panel);
    box-shadow: 0 24px 70px rgba(12, 32, 72, 0.28);
}

.refund-dialog::backdrop {
    background: rgba(8, 17, 36, 0.42);
}

.refund-dialog form {
    display: grid;
    gap: 14px;
}

.refund-dialog .panel-head {
    margin-bottom: 0;
}

.icon-close {
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--text);
    background: var(--field);
    font-size: 22px;
    font-weight: 800;
}

.radio-row {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--text);
    font-weight: 800;
}

#refund-amount-row,
.refund-field {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

#refund-amount-row[hidden] {
    display: none;
}

#refund-amount,
#refund-totp {
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 0 10px;
    color: var(--text);
    background: var(--field);
    outline: 0;
    font-weight: 800;
}

.refund-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.refund-actions button {
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 8px 12px;
    color: var(--blue-deep);
    background: #eef5ff;
    font-size: 12px;
    font-weight: 900;
}

.refund-actions button:last-child {
    color: #ffffff;
    border-color: var(--red);
    background: linear-gradient(135deg, var(--red), #ff5a7d);
}

table {
    width: 100%;
    min-width: 0;
    border-collapse: collapse;
}

th,
td {
    padding: 13px 10px;
    border-bottom: 1px solid var(--line-soft);
    text-align: left;
}

th {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

td {
    color: #d7ddff;
    font-size: 13px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

td small,
.muted {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 86px;
    padding: 6px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.status--paid {
    color: #eafff5;
    border: 1px solid rgba(75, 230, 154, 0.52);
    background: rgba(75, 230, 154, 0.2);
    box-shadow: 0 0 0 1px rgba(75, 230, 154, 0.06), 0 8px 18px rgba(75, 230, 154, 0.1);
}

.status--created {
    color: #fff7d1;
    border: 1px solid rgba(255, 211, 77, 0.58);
    background: rgba(255, 211, 77, 0.18);
    box-shadow: 0 0 0 1px rgba(255, 211, 77, 0.06), 0 8px 18px rgba(255, 211, 77, 0.08);
}

.status--canceled {
    color: #ffeaf0;
    border: 1px solid rgba(255, 77, 122, 0.58);
    background: rgba(255, 77, 122, 0.18);
    box-shadow: 0 0 0 1px rgba(255, 77, 122, 0.06), 0 8px 18px rgba(255, 77, 122, 0.1);
}

.terminals-grid,
.terminals-grid-group {
    display: grid;
    gap: 14px;
}

.terminals-grid-group {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.terminal-group {
    display: grid;
    gap: 14px;
}

.terminal-group summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid var(--line-soft);
    border-radius: 12px;
    color: var(--text);
    background: linear-gradient(135deg, rgba(77, 124, 255, 0.16), rgba(62, 231, 255, 0.06));
    cursor: pointer;
    font-size: 16px;
    font-weight: 900;
}

.terminal-group summary::marker {
    color: var(--blue);
}

.terminal-group summary b {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.terminal-group summary > span {
    display: grid;
    gap: 4px;
}

.terminal-group summary small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.terminal-group-summary-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.parent-terminal-link {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    color: #ffffff;
    text-decoration: none;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--blue), var(--blue-soft));
    font-size: 13px;
    font-weight: 900;
    box-shadow: 0 10px 24px rgba(77, 124, 255, 0.24);
}

.catalog-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.catalog-actions button,
.hidden-catalog-item button {
    min-height: 34px;
    padding: 0 14px;
    border: 1px solid rgba(22, 103, 222, 0.32);
    border-radius: 9px;
    color: #ffffff;
    background: linear-gradient(135deg, var(--blue), var(--blue-soft));
    font-size: 13px;
    font-weight: 900;
    cursor: pointer;
}

.catalog-actions button:disabled {
    color: var(--muted);
    background: var(--surface-soft);
    cursor: not-allowed;
}

.catalog-actions span,
.catalog-select {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.catalog-select {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
}

.terminal-card-select {
    margin-bottom: 10px;
}

.hidden-catalog-list {
    display: grid;
    gap: 10px;
}

.hidden-catalog-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border: 1px solid var(--line-soft);
    border-radius: 12px;
    background: var(--surface-soft);
}

.hidden-catalog-item div {
    display: grid;
    gap: 4px;
}

.hidden-catalog-item span,
.hidden-catalog-item small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.hidden-catalog-item strong {
    color: var(--text);
    font-size: 15px;
}

.terminal-card {
    min-height: 198px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 18px;
    padding: 18px;
    border: 1px solid var(--line-soft);
    border-radius: 12px;
    background: rgba(8, 10, 24, 0.46);
}

.terminal-card span {
    display: inline-flex;
    width: fit-content;
    margin-bottom: 14px;
    padding: 6px 9px;
    color: var(--green);
    border-radius: 999px;
    background: rgba(75, 230, 154, 0.12);
    font-size: 12px;
    font-weight: 900;
}

.terminal-card h3 {
    margin: 0 0 8px;
    color: var(--text);
    font-size: 20px;
}

.terminal-card p,
.terminal-card small {
    display: block;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.terminal-card p small {
    margin-top: 3px;
}

.terminal-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.terminal-meta b {
    color: var(--blue);
    font-size: 13px;
}

.terminal-meta a {
    padding: 10px 12px;
    color: #ffffff;
    text-decoration: none;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--blue), var(--blue-soft));
    font-size: 13px;
    font-weight: 900;
}

.settings-hint {
    margin: -4px 0 16px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.payment-settings-tree {
    display: grid;
    gap: 12px;
}

.payment-settings-group {
    display: grid;
    gap: 10px;
    border: 1px solid var(--line-soft);
    border-radius: 12px;
    background: rgba(8, 10, 24, 0.28);
}

.payment-settings-group summary {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    color: var(--text);
    cursor: pointer;
    font-size: 16px;
    font-weight: 900;
}

.payment-settings-group summary span {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.payment-settings-group.nested {
    margin-left: 18px;
    background: rgba(77, 124, 255, 0.04);
}

.payment-settings-shops {
    display: grid;
    gap: 10px;
    padding: 0 12px 12px;
}

.payment-settings-shops summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 38px;
    padding: 0 4px;
    color: var(--muted);
    cursor: pointer;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.payment-settings-shops summary span {
    color: #c2caf0;
}

.payment-settings-children {
    display: grid;
    gap: 10px;
    padding: 0;
}

.payment-settings-row {
    display: grid;
    grid-template-columns: minmax(190px, 1.15fr) 140px minmax(220px, 1fr) 120px minmax(160px, 0.8fr) auto;
    gap: 10px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.035);
}

.payment-settings-row.level-legal {
    border-color: rgba(62, 231, 255, 0.34);
}

.payment-settings-row.level-parent {
    border-color: rgba(139, 125, 255, 0.28);
}

.payment-settings-row strong,
.payment-settings-row small {
    display: block;
}

.payment-settings-row small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.payment-settings-row .payment-settings-legal {
    color: var(--blue-deep);
    font-weight: 900;
}

.payment-settings-row select,
.payment-settings-row input {
    width: 100%;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 0 10px;
    color: var(--text);
    background: var(--field);
    outline: 0;
    font-weight: 700;
}

.payment-settings-row > select,
.payment-settings-actions {
    align-self: end;
}

.rate-settings-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

.rate-settings-inherited {
    align-self: end;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    color: var(--muted);
}

.markup-setting-field,
.rate-setting-field {
    display: grid;
    gap: 4px;
}

.markup-setting-field span,
.rate-setting-field span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 900;
    line-height: 1.1;
    text-align: center;
    text-transform: uppercase;
}

.markup-setting-field input,
.rate-setting-field input {
    height: 40px;
    text-align: center;
}

.payment-settings-row > span[data-setting-summary] {
    align-self: end;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
}

.payment-settings-row span {
    color: #c2caf0;
    font-size: 12px;
    font-weight: 800;
}

.payment-settings-row button {
    height: 40px;
    border: 0;
    border-radius: 9px;
    padding: 0 12px;
    color: #ffffff;
    background: linear-gradient(135deg, var(--blue), var(--blue-soft));
    font-size: 12px;
    font-weight: 900;
}

.payment-settings-actions {
    display: grid;
    gap: 6px;
}

.payment-settings-actions button.secondary {
    min-height: 40px;
    height: auto;
    color: var(--blue);
    background: #eef5ff;
    border: 1px solid rgba(20, 106, 220, 0.2);
    line-height: 1.2;
}

.payment-operation-result {
    min-height: 0;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.35;
}

.payment-operation-result.is-warning {
    color: #9a5b00;
}

.rate-change-list {
    display: grid;
    gap: 10px;
}

.rate-change-table {
    max-height: 360px;
}

.rate-change-table td b,
.rate-change-table td small {
    display: block;
}

.rate-change-table td small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.qr-badges {
    display: flex;
    gap: 5px;
    margin-top: 8px;
}

.qr-badge {
    display: inline-flex;
    width: 23px;
    height: 23px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line-soft);
    border-radius: 999px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.03);
    font-size: 11px;
    font-weight: 900;
}

.qr-badge.is-ready {
    color: #bfffe1;
    border-color: rgba(75, 230, 154, 0.34);
    background: rgba(75, 230, 154, 0.12);
}

.user-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    align-items: end;
    margin-bottom: 12px;
}

.user-payment-access {
    grid-column: 1 / -1;
    min-width: 0;
    margin: 2px 0;
    padding: 12px 0;
    border: 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.user-payment-access legend {
    padding: 0 8px 0 0;
    color: var(--text);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.user-payment-access-controls {
    display: grid;
    grid-template-columns: 160px minmax(280px, 1fr) auto;
    gap: 10px;
    align-items: end;
}

.user-merchant-count {
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.user-merchant-options {
    max-height: 220px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1px;
    overflow: auto;
    margin-top: 10px;
    padding: 1px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--line);
}

.user-form .user-merchant-option {
    min-width: 0;
    min-height: 50px;
    display: flex;
    grid-template-columns: none;
    flex-direction: row;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    color: var(--text);
    background: var(--field);
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    text-transform: none;
}

.user-form .user-merchant-option:hover {
    background: #eef5ff;
}

.user-form .user-merchant-option input {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    margin: 0;
    padding: 0;
    accent-color: var(--blue);
}

.user-merchant-option span {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.user-merchant-option strong,
.user-merchant-option small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-merchant-option small,
.user-merchant-empty,
.user-access-note {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.user-merchant-empty {
    grid-column: 1 / -1;
    margin: 0;
    padding: 14px;
    background: var(--field);
}

.user-access-note {
    display: block;
    margin-top: 3px;
    max-width: 360px;
    white-space: normal;
}

.checkbox-row {
    min-height: 46px;
    display: flex !important;
    align-items: center;
    gap: 9px !important;
}

.checkbox-row input {
    width: 18px;
    height: 18px;
    accent-color: var(--blue);
}

.link-button {
    padding: 0;
    border: 0;
    color: var(--blue);
    background: transparent;
    cursor: pointer;
    font: inherit;
    font-weight: 900;
}

.client-password {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border: 1px solid #cfd9eb;
    border-radius: 7px;
    color: var(--blue-deep);
    background: #f8faff;
    font-family: inherit;
    font-size: 12px;
    font-weight: 900;
}

.totp-result {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 12px;
    padding: 10px 12px;
    border: 1px solid #cfd9eb;
    border-radius: 8px;
    color: var(--text);
    background: #f8faff;
    font-size: 13px;
    font-weight: 800;
}

.totp-result img {
    width: 112px;
    height: 112px;
    flex: 0 0 auto;
    border-radius: 8px;
}

.totp-result code {
    display: inline-block;
    margin: 0 4px;
    padding: 3px 7px;
    border-radius: 6px;
    background: #ffffff;
    color: var(--blue-deep);
    letter-spacing: 0;
}

.totp-result span {
    color: var(--muted);
    font-size: 12px;
}

.client-account-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 46px;
    padding: 0 18px;
    border-radius: 10px;
    color: #ffffff;
    background: linear-gradient(135deg, var(--blue), var(--blue-soft));
    box-shadow: 0 14px 34px rgba(77, 124, 255, 0.28);
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}

@media (max-width: 1040px) {
    .admin-shell {
        grid-template-columns: 1fr;
        grid-template-areas:
            "sidebar"
            "workspace";
    }

    .admin-brand {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .account-bar {
        grid-column: 1 / -1;
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .admin-brand .top-actions {
        grid-column: 1 / -1;
        justify-items: stretch;
    }

    .sidebar {
        min-height: auto;
    }

    .side-nav {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .rates-table {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .rates-head {
        display: none;
    }

    .rate-row {
        min-height: 122px;
        grid-template-columns: 1fr;
        align-content: start;
        gap: 10px;
        padding: 14px;
    }

    .rate-row b {
        display: grid;
        gap: 3px;
        text-align: left;
    }

    .rate-row b:first-of-type::before {
        content: "Курс\AЦБ";
        white-space: pre;
    }

    .rate-row b:nth-of-type(2)::before {
        content: "Рабочий\Aкурс";
        white-space: pre;
    }

    .rate-row b:nth-of-type(3)::before {
        content: "Изменение\A%";
        white-space: pre;
    }

    .rate-row b::before {
        color: var(--muted);
        font-size: 10px;
        font-weight: 900;
        text-transform: uppercase;
    }

    .stats-grid,
    .charts,
    .terminals-grid-group,
    .payment-settings-row,
    .user-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .top-stats-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .top-stats-grid .rates-table {
        grid-template-columns: 1fr;
    }

    .top-stats-grid .rate-row {
        min-height: 34px;
        grid-template-columns: minmax(38px, 0.62fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 0.9fr);
        align-content: center;
        gap: 8px;
        padding: 7px 9px;
    }

    .top-stats-grid .rate-row b {
        display: block;
        text-align: center;
    }

    .top-stats-grid .rate-row b::before {
        content: none;
    }

    .payment-settings-row,
    .user-form {
        grid-template-columns: 1fr;
    }

    .user-payment-access-controls {
        grid-template-columns: 150px minmax(0, 1fr) auto;
    }
}

@media (max-width: 640px) {
    .admin-shell {
        padding: 10px;
    }

    .session-card {
        grid-template-columns: 1fr;
    }

    .admin-brand {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .user-payment-access-controls,
    .user-merchant-options {
        grid-template-columns: 1fr;
    }

    .user-merchant-count {
        min-height: auto;
        justify-content: flex-start;
    }

    .account-bar {
        min-width: 0;
        width: 100%;
    }

    .admin-brand-copy h1,
    .admin-brand-copy p,
    .admin-brand-copy .eyebrow {
        margin-left: 0;
        text-align: left;
    }

    .admin-brand .rapay-logo-image {
        width: 116px;
    }

    .topline {
        flex-direction: column;
        min-height: auto;
    }

    .top-actions,
    .sync-panel {
        justify-items: stretch;
        width: 100%;
    }

    .terminal-group summary,
    .terminal-group-summary-meta {
        align-items: flex-start;
        flex-direction: column;
    }

    .live-badge,
    .sync-result {
        max-width: none;
        text-align: left;
    }

    .side-nav {
        grid-template-columns: 1fr;
    }

    .client-context-body,
    .tbank-status-grid,
    .terminals-grid-group {
        grid-template-columns: 1fr;
    }

    .top-stats-grid,
    .stats-grid,
    .charts {
        grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    }

    .rates-panel,
    .chart-stat-card {
        grid-column: 1 / -1;
    }

    .rates-table {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .tbank-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .tbank-actions .sync-result {
        text-align: left;
    }

    .success-stat-card {
        grid-column: auto;
    }

    .bar-row {
        grid-template-columns: 1fr;
    }

    .bar-row strong {
        text-align: left;
    }
}

@media (max-width: 1040px) and (orientation: landscape) {
    .login-screen {
        min-height: 100dvh;
        align-items: start;
        padding: 8px 12px;
    }

    .login-card {
        width: min(500px, 100%);
        gap: 7px;
        padding: 12px 20px;
    }

    .login-card .brand {
        justify-content: center;
    }

    .login-card .rapay-logo-image {
        width: 96px;
    }

    .login-card h1 {
        margin: 0;
        font-size: 28px;
    }

    .login-card label {
        gap: 4px;
    }

    .login-card input,
    .login-card button {
        height: 36px;
        border-radius: 10px;
        font-size: 12px;
    }

    .admin-shell {
        gap: 10px;
        padding: 8px;
    }

    .sidebar {
        gap: 10px;
        min-height: auto;
        padding: 10px 12px;
    }

    .sidebar .brand {
        justify-content: flex-start;
    }

    .admin-brand {
        grid-template-columns: auto minmax(0, 1fr) minmax(220px, auto);
        gap: 12px;
    }

    .sidebar .rapay-logo-image {
        width: 104px;
    }

    .side-nav {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 8px;
    }

    .side-nav a {
        min-height: 44px;
        display: flex;
        align-items: center;
        padding: 8px 9px;
        font-size: 13px;
        line-height: 1.12;
    }

    .session-card {
        grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr) minmax(160px, 2fr);
        align-items: center;
        gap: 10px;
        margin-top: 0;
        padding: 10px 12px;
    }

    .session-card button {
        height: 36px;
    }

    .topline,
    .panel,
    .stat-card {
        padding: 14px;
    }

    .topline {
        min-height: auto;
    }
}

/* RaMarket light banking theme */
:root {
    --page-bg: #eef3fb;
    --top-bg: rgba(255, 255, 255, 0.96);
    --panel: #ffffff;
    --panel-strong: #f7f9fe;
    --text: #111827;
    --muted: #667085;
    --line: #d7dfef;
    --line-soft: #e7ecf6;
    --field: #ffffff;
    --blue: #0757c8;
    --blue-deep: #063f98;
    --blue-soft: #1d73e8;
    --cyan: #0a65d8;
    --red: #e21d3d;
    --green: #118a49;
    --yellow: #b77900;
    --error: #d7193f;
    --shadow: rgba(28, 45, 84, 0.12);
}

body {
    color: var(--text);
    background:
        linear-gradient(180deg, #f9fbff 0%, #eef3fb 46%, #e9eff8 100%),
        var(--page-bg);
}

.login-screen {
    border-top-color: var(--red);
}

.login-card,
.sidebar,
.stat-card,
.panel,
.topline {
    border-color: var(--line);
    background: var(--panel);
    box-shadow: 0 18px 42px var(--shadow);
    backdrop-filter: none;
}

.login-card {
    border-top: 5px solid var(--blue);
}

.login-card input,
.user-form input,
.user-form select,
.payment-settings-row select {
    color: var(--text);
    background: var(--field);
}

.login-card input:focus,
.user-form input:focus,
.user-form select:focus,
.payment-settings-row select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 4px rgba(7, 87, 200, 0.12);
}

.login-card button,
.user-form button,
.client-account-link,
.sync-panel button,
.parent-terminal-link,
.terminal-meta a,
.payment-settings-row button {
    color: #ffffff;
    background: linear-gradient(135deg, var(--blue), var(--blue-soft));
    box-shadow: 0 12px 24px rgba(7, 87, 200, 0.2);
}

.user-form .secondary-action {
    color: var(--blue-deep);
    background: #eef5ff;
    border: 1px solid #cfd9eb;
    box-shadow: none;
}

.admin-brand {
    border-top: 5px solid var(--red);
}

.admin-brand-copy h1,
h1,
h2,
.stat-card strong,
.terminal-card h3,
.client-parent-card strong,
.client-shop-item span,
td,
.rate-row,
.bar-row strong {
    color: var(--text);
}

.brand > div > span,
.admin-brand-copy p,
.stat-card small,
.panel-head span,
.rates-head,
th,
td small,
.muted,
.terminal-card p,
.terminal-card small,
.terminal-group summary small,
.terminal-group summary b {
    color: var(--muted);
}

.eyebrow,
.admin-brand-copy .eyebrow,
.client-parent-card small,
.rate-row b,
.terminal-meta b {
    color: var(--blue);
}

.account-bar,
.rates-table,
.client-parent-card,
.client-shop-item,
.tbank-status-grid div,
.rate-row,
.terminal-card,
.session-card {
    border-color: var(--line-soft);
    background: #f8faff;
}

.account-bar button,
.session-card button,
.orders-panel-actions button {
    color: var(--blue-deep);
    border-color: #c9d8f5;
    background: #eef5ff;
}

.account-bar button:hover,
.session-card button:hover,
.orders-panel-actions button:hover {
    border-color: var(--blue);
    background: #e5f0ff;
}

.side-nav a {
    color: #42526e;
    background: #f7f9fe;
    border-color: transparent;
}

.side-nav a:hover,
.side-nav a.is-active {
    color: #ffffff;
    border-color: var(--blue);
    background: linear-gradient(135deg, var(--blue), var(--blue-soft));
    box-shadow: 0 10px 22px rgba(7, 87, 200, 0.18);
}

.stats-grid .stat-card:first-child,
.rates-panel,
.orders-panel {
    border-top: 4px solid var(--blue);
}

.success-stat-card {
    border-top: 4px solid var(--green);
}

.chart-stat-card,
#terminals,
#payment-settings,
.client-context-panel {
    border-top: 4px solid var(--red);
}

.success-stat-row strong {
    color: #ffffff;
    background: var(--green);
    box-shadow: none;
}

.bar-row {
    color: #344054;
}

.bar-track {
    background: #e5ebf6;
}

.bar-fill {
    background: linear-gradient(90deg, var(--blue), var(--red));
}

.bar-chart p {
    color: var(--muted);
    border-color: var(--line-soft);
    background: #f8faff;
}

.table-wrap {
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    background: #ffffff;
}

th {
    background: #f7f9fe;
}

th,
td {
    border-bottom-color: var(--line-soft);
}

tbody tr:hover td {
    background: #fbfdff;
}

.status--paid {
    color: #05603a;
    border-color: rgba(17, 138, 73, 0.32);
    background: rgba(17, 138, 73, 0.12);
    box-shadow: none;
}

.status--created {
    color: #8a5700;
    border-color: rgba(183, 121, 0, 0.32);
    background: rgba(183, 121, 0, 0.13);
    box-shadow: none;
}

.status--canceled {
    color: #b42318;
    border-color: rgba(226, 29, 61, 0.32);
    background: rgba(226, 29, 61, 0.1);
    box-shadow: none;
}

.terminal-group summary {
    border-color: #d7dfef;
    background: #f7f9fe;
}

.terminal-card span {
    color: #05603a;
    background: rgba(17, 138, 73, 0.1);
}

.live-badge {
    color: #05603a;
    border-color: rgba(17, 138, 73, 0.26);
    background: rgba(17, 138, 73, 0.08);
}

/* Light theme contrast fixes */
.terminal-group summary {
    color: var(--text);
    border-color: #cfd9eb;
    background: #ffffff;
    box-shadow: 0 6px 18px rgba(28, 45, 84, 0.06);
}

.terminal-group summary > span {
    color: var(--text);
}

.terminal-group-summary-meta b {
    color: #344054;
}

.payment-settings-group {
    border-color: #d7dfef;
    background: #ffffff;
    box-shadow: 0 8px 22px rgba(28, 45, 84, 0.06);
}

.payment-settings-group[open] {
    background: #fbfdff;
}

.payment-settings-group summary {
    color: var(--text);
    border-radius: 12px;
    background: #ffffff;
}

.payment-settings-group summary span,
.payment-settings-shops summary,
.payment-settings-shops summary span,
.payment-settings-row span {
    color: #667085;
}

.payment-settings-group.nested {
    border-color: #dbe5f7;
    background: #f8faff;
}

.payment-settings-shops {
    border-top: 1px solid var(--line-soft);
    background: #fbfdff;
}

.payment-settings-row {
    color: var(--text);
    border-color: #d7dfef;
    background: #ffffff;
}

.payment-settings-row.level-legal {
    border-left: 4px solid var(--blue);
    border-color: #d7dfef;
    background: #ffffff;
}

.payment-settings-row.level-parent {
    border-left: 4px solid #8aa8dc;
    border-color: #d7dfef;
    background: #ffffff;
}

.payment-settings-row strong {
    color: var(--text);
}

.payment-settings-row small {
    color: #667085;
}

.payment-settings-row select,
.payment-settings-row input {
    color: var(--text);
    border-color: #cfd9eb;
    background: #ffffff;
}

.payment-settings-row button {
    background: #0757c8;
    box-shadow: 0 10px 20px rgba(7, 87, 200, 0.16);
}

.qr-badge {
    color: #667085;
    border-color: #d7dfef;
    background: #ffffff;
}

.qr-badge.is-ready {
    color: #05603a;
    border-color: rgba(17, 138, 73, 0.28);
    background: rgba(17, 138, 73, 0.1);
}

.account-bar {
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.account-bar span {
    color: #475467;
}

.account-bar strong {
    display: none;
}

.account-bar button {
    color: var(--blue-deep);
    border-color: #c9d8f5;
    background: #eef5ff;
}

.admin-brand {
    border-top: 0;
}

.account-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 34px;
    align-items: center;
    gap: 4px 8px;
    min-width: 168px;
    text-align: right;
}

.account-bar span {
    width: 100%;
    font-size: 11px;
    line-height: 1.2;
    text-align: center;
    text-transform: uppercase;
}

.account-bar button {
    width: auto;
    min-width: 72px;
    height: 34px;
}

.sidebar {
    position: sticky;
    top: 10px;
    z-index: 20;
}

.collapsible-panel {
    display: block;
}

.collapsible-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 28px;
    align-items: center;
    cursor: pointer;
    gap: 14px;
    list-style: none;
    user-select: none;
}

.collapsible-head > span {
    justify-self: start;
}

.collapsible-panel[aria-busy="true"] > .collapsible-head > span:first-child::after {
    content: " · загрузка";
    color: var(--blue-deep);
    font-size: 10px;
    font-weight: 800;
}

.collapsible-head::-webkit-details-marker {
    display: none;
}

.collapsible-head::after {
    content: "+";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-left: 0;
    border: 1px solid #c9d8f5;
    border-radius: 999px;
    color: var(--blue-deep);
    background: #eef5ff;
    font-size: 18px;
    font-weight: 900;
    line-height: 1;
}

.collapsible-panel[open] > .collapsible-head::after {
    content: "−";
}

.terminal-filter,
.payment-settings-filter {
    margin: -4px 0 16px;
}

.terminal-filter input,
.payment-settings-filter input {
    width: 100%;
    height: 42px;
    border: 1px solid #cfd9eb;
    border-radius: 10px;
    padding: 0 14px;
    color: var(--text);
    background: #ffffff;
    outline: 0;
    font-size: 14px;
    font-weight: 700;
}

.terminal-filter input:focus,
.payment-settings-filter input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 4px rgba(7, 87, 200, 0.1);
}

.terminal-empty,
.payment-settings-empty {
    margin: 0;
    padding: 18px;
    color: #667085;
    border: 1px dashed var(--line-soft);
    border-radius: 10px;
    background: #fbfdff;
    font-size: 14px;
    font-weight: 800;
}

@media (max-width: 640px) {
    .sidebar {
        top: 0;
        border-radius: 0 0 14px 14px;
    }
}

@media (max-width: 1040px) {
    .admin-shell {
        padding-top: 0;
    }

    .sidebar {
        gap: 0;
        padding: 6px;
        top: 0;
        border-width: 0 0 1px;
        border-radius: 0 0 12px 12px;
        box-shadow: 0 8px 22px rgba(28, 45, 84, 0.12);
    }

    .sidebar .admin-brand {
        display: grid;
        grid-template-columns: auto minmax(360px, 1fr) minmax(150px, auto);
        gap: 8px;
        align-items: center;
    }

    .sidebar .account-bar {
        grid-column: auto;
        min-width: 150px;
    }

    .side-nav {
        display: flex;
        grid-template-columns: none;
        gap: 6px;
        overflow-x: auto;
        padding: 2px;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
    }

    .side-nav::-webkit-scrollbar {
        display: none;
    }

    .side-nav a {
        flex: 0 0 auto;
        min-width: 104px;
        min-height: 36px;
        padding: 8px 10px;
        border-radius: 9px;
        font-size: 12px;
        line-height: 1;
        white-space: nowrap;
        scroll-snap-align: start;
    }

    .side-nav.is-single a {
        flex: 1 1 auto;
    }
}

@media (max-width: 640px) {
    .admin-shell {
        gap: 10px;
        padding: 0 10px 10px;
    }

    .sidebar .admin-brand {
        grid-template-columns: auto minmax(0, 1fr);
        gap: 8px;
    }

    .sidebar .rapay-logo-image {
        width: 72px;
    }

    .sidebar .account-bar {
        grid-column: auto;
        min-width: 0;
        width: 100%;
    }

    .sidebar .side-nav {
        grid-column: 1 / -1;
    }

    .side-nav a {
        min-width: 92px;
        min-height: 34px;
        padding: 7px 9px;
        font-size: 11px;
    }

    .stats-period-toolbar {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .stats-periods {
        justify-content: flex-start;
    }

    .stats-date-range {
        width: 100%;
        flex-wrap: wrap;
    }

    .stats-date-range .orders-date-field {
        flex: 1 1 150px;
    }

    #stats-date-apply {
        flex: 1 1 100px;
    }

    .orders-date-field {
        flex: 1 1 180px;
        min-width: 0;
    }
}
