:root {
    --bg: #02050a;
    --surface: rgba(8, 21, 37, 0.96);
    --surface-2: rgba(10, 28, 49, 0.9);
    --surface-3: rgba(12, 35, 61, 0.78);
    --line: rgba(115, 147, 198, 0.18);
    --line-strong: rgba(115, 147, 198, 0.34);
    --text: #f3f7ff;
    --text-soft: #aeb9cc;
    --text-muted: #6f7d92;
    --blue: #1267ff;
    --blue-2: #4f8cff;
    --green: #15d16f;
    --green-dim: rgba(21, 209, 111, 0.14);
    --yellow: #f5b820;
    --yellow-dim: rgba(245, 184, 32, 0.14);
    --red: #ff3d3d;
    --red-dim: rgba(255, 61, 61, 0.12);
    --coral: #ff7c89;
    --purple: #7c3cff;
    --purple-dim: rgba(124, 60, 255, 0.16);
    --cyan: #21d4fd;
    --shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
    --radius: 18px;
    --radius-sm: 12px;
    --sidebar: 286px;
    --right-rail: 340px;
    color-scheme: dark;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
    overflow-x: hidden;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    font-family: Inter, "Avenir Next", "Trebuchet MS", sans-serif;
    background:
        radial-gradient(circle at 44% 8%, rgba(18, 103, 255, 0.2), transparent 28rem),
        radial-gradient(circle at 80% 80%, rgba(21, 209, 111, 0.08), transparent 26rem),
        linear-gradient(180deg, #02050a 0%, #03101d 48%, #02050a 100%);
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(rgba(115, 147, 198, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(115, 147, 198, 0.03) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.72), transparent 78%);
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
    text-decoration: none;
}

.login-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(420px, 500px);
    gap: 56px;
    width: min(1040px, calc(100vw - 40px));
    min-height: 100vh;
    margin: 0 auto;
    align-items: center;
    padding: 40px 0;
}

.login-hero,
.login-card,
.panel,
.metric-card,
.rail-card,
.modal-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(10, 28, 49, 0.92), rgba(5, 15, 28, 0.94));
    box-shadow: var(--shadow);
}

.login-hero {
    min-height: auto;
    padding: 40px 16px;
    overflow: visible;
    position: relative;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.login-hero::after {
    content: none;
}

.platform-mark {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.logo-cube {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, #1267ff, #073a98);
    box-shadow: 0 14px 32px rgba(18, 103, 255, 0.32);
}

.logo-cube::before {
    content: "";
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.82);
    transform: rotate(45deg);
}

.login-title {
    max-width: 100%;
    margin: 72px 0 18px;
    font-size: 48px;
    line-height: 1.08;
    letter-spacing: 0;
    overflow-wrap: normal;
    word-break: keep-all;
}

.login-lead {
    max-width: 500px;
    margin: 0;
    color: var(--text-soft);
    font-size: 17px;
    line-height: 1.55;
}

.login-preview {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 42px;
}

.preview-chip {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(3, 14, 27, 0.62);
}

.preview-chip span {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.preview-chip strong {
    display: block;
    margin-top: 10px;
    font-size: 28px;
}

.login-card {
    width: 100%;
    max-width: 500px;
    justify-self: end;
    padding: 36px 38px;
}

.login-card h1 {
    margin: 0;
    font-size: 28px;
    line-height: 1.2;
    letter-spacing: 0;
}

.login-card .form {
    margin-top: 28px;
}

.login-card .field input {
    height: 50px;
    min-height: 50px;
}

.login-form {
    gap: 14px;
}

.login-form .field {
    gap: 7px;
}

.password-control {
    position: relative;
    display: block;
}

.password-control input {
    padding-right: 54px;
}

.password-visibility-toggle {
    position: absolute;
    top: 3px;
    right: 4px;
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border: 0;
    border-radius: 10px;
    color: var(--text-soft);
    background: transparent;
    cursor: pointer;
}

.password-visibility-toggle:hover,
.password-visibility-toggle:focus-visible {
    color: var(--text);
    background: rgba(79, 140, 255, 0.12);
    outline: none;
}

.password-visibility-toggle svg {
    width: 21px;
    height: 21px;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.password-visibility-slash {
    display: none;
}

.password-visibility-toggle.is-visible .password-visibility-slash {
    display: block;
}

.field-error {
    margin: -6px 0 0;
    color: #ff8b8b;
    font-size: 12px;
    font-weight: 700;
}

.field-error:empty {
    display: none;
}

.login-access-help {
    margin: -2px 0 4px;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.45;
}

.login-submit {
    min-height: 50px;
    margin-top: 2px;
}

.login-message {
    display: grid;
    gap: 5px;
    line-height: 1.4;
}

.login-message:empty {
    display: none;
}

.login-message strong {
    color: currentColor;
}

.login-message span {
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 600;
}

.environment-badge {
    position: fixed;
    left: 16px;
    bottom: 16px;
    z-index: 80;
    min-height: 24px;
    padding: 4px 8px;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--text-muted);
    background: rgba(2, 9, 18, 0.86);
    font-size: 10px;
    font-weight: 900;
}

.muted {
    color: var(--text-muted);
}

.soft {
    color: var(--text-soft);
}

.form {
    display: grid;
    gap: 16px;
    margin-top: 26px;
}

.field {
    display: grid;
    gap: 8px;
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 700;
}

.field input,
.field select,
.field textarea,
.control {
    width: 100%;
    min-height: 46px;
    border: 1px solid rgba(79, 105, 145, 0.62);
    border-radius: 12px;
    padding: 0 14px;
    color: var(--text);
    background: rgba(2, 9, 18, 0.86);
    outline: none;
}

.field select,
select.control {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 48px;
    background-image: url("data:image/svg+xml,%3Csvg width='14' height='9' viewBox='0 0 14 9' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1.5 1.5L7 7L12.5 1.5' stroke='%23AEB9CC' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 18px center;
    background-size: 14px 9px;
}

.field select::-ms-expand,
select.control::-ms-expand {
    display: none;
}

.field textarea {
    min-height: 88px;
    padding: 12px 14px;
    resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.control:focus {
    border-color: var(--blue-2);
    box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.18);
}

.field input:disabled,
.field select:disabled,
.field textarea:disabled,
.control:disabled {
    opacity: 0.48;
    cursor: not-allowed;
}

.btn {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 0 16px;
    color: var(--text);
    background: rgba(24, 37, 57, 0.92);
    cursor: pointer;
    font-weight: 800;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.btn:hover {
    transform: translateY(-1px);
    border-color: var(--line-strong);
}

.btn-primary {
    background: linear-gradient(135deg, var(--blue), #0a4bd0);
    box-shadow: 0 14px 28px rgba(18, 103, 255, 0.24);
}

.btn-primary:is([data-order-action="confirm-deposit"], [data-order-action="mark-withdraw-paid"], [data-order-confirmation-confirm]) {
    color: var(--bg);
    background: var(--coral);
    box-shadow: none;
}

.btn-secondary {
    border-color: rgba(79, 105, 145, 0.5);
}

.btn-danger {
    color: #ffd6d6;
    background: rgba(255, 61, 61, 0.14);
    border-color: rgba(255, 61, 61, 0.26);
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
}

.btn .ui-icon {
    width: 18px;
    height: 18px;
}

.message {
    min-height: 22px;
    margin: 16px 0 0;
    color: var(--text-soft);
    font-weight: 700;
}

.message[data-state="success"] {
    color: var(--green);
}

.message[data-state="warning"] {
    color: var(--yellow);
}

.message[data-state="error"] {
    color: #ff8b8b;
}

.source-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    color: var(--text-soft);
    background: rgba(115, 147, 198, 0.12);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.source-pill.live {
    color: var(--green);
    background: var(--green-dim);
}

.source-pill.mock {
    color: var(--yellow);
    background: var(--yellow-dim);
}

.source-pill.auth {
    color: #ff8b8b;
    background: var(--red-dim);
}

.source-pill.error {
    color: #ff8b8b;
    background: var(--red-dim);
}

/* Source labels are diagnostics. Keep failures visible without exposing API plumbing. */
.admin-dashboard-page .source-pill:not(.auth):not(.error) {
    display: none;
}

.hidden {
    display: none !important;
}

.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar) minmax(0, 1fr);
    min-height: 100vh;
    min-width: 0;
}

.sidebar-backdrop {
    display: none;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    top: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100svh;
    max-height: 100svh;
    width: var(--sidebar);
    border-right: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(2, 12, 24, 0.98), rgba(3, 17, 31, 0.96));
    padding: 26px 22px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

.sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.sidebar-close,
.mobile-menu-button {
    border: 1px solid var(--line);
    color: var(--text);
    background: rgba(7, 20, 37, 0.84);
    cursor: pointer;
}

.sidebar-close {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    font-size: 26px;
    line-height: 1;
}

.side-profile {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    margin: 28px 0 22px;
}

.avatar {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    color: #05101f;
    background: linear-gradient(135deg, #f1f5f9, #9aa7b9);
    font-size: 30px;
    font-weight: 900;
}

.side-profile h2 {
    margin: 0;
    font-size: 18px;
}

.side-profile p {
    margin: 6px 0 0;
    color: var(--text-muted);
}

.shift-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 54px;
    margin: 0 0 24px;
    padding: 0 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    color: var(--green);
    background: rgba(11, 34, 57, 0.68);
    font-size: 18px;
    font-weight: 800;
}

.shift-pill.is-on {
    color: var(--green);
    background:
        radial-gradient(circle at 88% 50%, rgba(21, 209, 111, 0.18), transparent 5rem),
        rgba(11, 34, 57, 0.68);
}

.shift-pill.is-off {
    color: var(--yellow);
    background:
        radial-gradient(circle at 88% 50%, rgba(245, 184, 32, 0.14), transparent 5rem),
        rgba(11, 34, 57, 0.68);
}

.dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 18px currentColor;
}

.rating-row {
    display: flex;
    justify-content: space-between;
    padding: 20px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    color: var(--text-soft);
}

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

.side-balance-card {
    margin-top: 16px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(5, 18, 34, 0.58);
}

.side-balance-title {
    margin-bottom: 12px;
    color: var(--text);
    font-size: 15px;
    font-weight: 900;
}

.side-balance-empty {
    margin: 0;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 700;
}

.side-balance-list {
    display: grid;
    gap: 10px;
}

.side-balance-item {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 8px 10px;
    align-items: center;
}

.side-balance-item span:not(.side-balance-icon) {
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 800;
}

.side-balance-item strong {
    grid-column: 2;
    color: var(--text);
    font-size: 15px;
    line-height: 1.15;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.side-balance-icon {
    display: inline-grid;
    grid-row: 1 / span 2;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 9px;
    color: var(--text);
    font-size: 14px;
    font-weight: 900;
    background: rgba(79, 140, 255, 0.16);
}

.side-balance-icon.is-withdraw {
    color: var(--yellow);
    background: rgba(245, 184, 32, 0.14);
}

.side-balance-icon.is-deposit {
    color: var(--green);
    background: rgba(21, 209, 111, 0.14);
}

.side-balance-icon.is-collateral {
    color: var(--blue-2);
    background: rgba(18, 103, 255, 0.18);
}

.side-balance-icon.is-commission {
    color: #c99bff;
    background: rgba(124, 60, 255, 0.18);
}

.side-balance-collateral {
    display: grid;
    gap: 8px;
}

.side-balance-meter {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(115, 147, 198, 0.16);
}

.side-balance-meter span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--blue), var(--blue-2));
}

.side-balance-note {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 800;
}

.nav-list {
    display: grid;
    gap: 8px;
    margin: 22px 0;
    padding-bottom: 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 48px;
    padding: 0 14px;
    border-radius: 12px;
    color: var(--text-soft);
    font-weight: 760;
}

.nav-item.active,
.nav-item:hover {
    color: var(--text);
    background: linear-gradient(135deg, rgba(18, 103, 255, 0.86), rgba(10, 75, 208, 0.78));
}

.nav-icon {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    color: currentColor;
}

.nav-icon .ui-icon {
    width: 20px;
    height: 20px;
}

.nav-counter {
    margin-left: auto;
    padding: 4px 9px;
    border-radius: 9px;
    background: rgba(124, 60, 255, 0.44);
}

.support-card {
    margin-top: 8px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(9, 28, 49, 0.7);
}

.workspace {
    grid-column: 2;
    min-width: 0;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 92px;
    padding: 0 28px;
    border-bottom: 1px solid var(--line);
    background: rgba(2, 12, 24, 0.64);
    backdrop-filter: blur(16px);
    min-width: 0;
}

.topbar h1 {
    margin: 0;
    font-size: 24px;
}

.topbar > div:first-child > p {
    margin: 6px 0 0;
    color: var(--text-muted);
}

.topbar-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: flex-end;
    flex: 0 0 auto;
}

.language-switcher-floating {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 80;
}

.language-selector {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 44px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(7, 20, 37, 0.74);
    color: var(--text);
    transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.language-selector:hover,
.language-selector:focus-within {
    transform: translateY(-1px);
    border-color: rgba(79, 140, 255, 0.56);
    background: rgba(21, 44, 80, 0.88);
}

.language-selector-flag {
    font-size: 17px;
    line-height: 1;
}

.language-selector select {
    min-height: 42px;
    border: 0;
    padding: 0 22px 0 0;
    appearance: none;
    color: var(--text);
    background: transparent url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23AEB9CC' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right center;
    font-weight: 900;
    cursor: pointer;
    outline: none;
}

.language-selector select option {
    color: var(--text);
    background: #071425;
}

.sound-toggle {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(7, 20, 37, 0.74);
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.sound-toggle:hover {
    transform: translateY(-1px);
    border-color: rgba(79, 140, 255, 0.56);
    background: rgba(21, 44, 80, 0.88);
}

.sound-toggle.is-active {
    border-color: rgba(28, 225, 137, 0.42);
    background: rgba(16, 104, 78, 0.28);
}

.sound-toggle span {
    font-size: 20px;
    line-height: 1;
}

.mobile-menu-button {
    display: inline-flex;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    border-radius: 14px;
}

.mobile-menu-button span {
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.notification-button {
    position: relative;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(7, 20, 37, 0.74);
}

.notification-button span {
    position: absolute;
    top: -7px;
    right: -6px;
    display: grid;
    place-items: center;
    min-width: 20px;
    height: 20px;
    border-radius: 999px;
    background: var(--red);
    font-size: 12px;
    font-weight: 900;
}

.content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--right-rail);
    gap: 20px;
    width: min(100%, 1500px);
    margin: 0 auto;
    padding: 20px 28px 48px;
}

.content-wide {
    grid-template-columns: minmax(0, 1fr);
    width: min(100%, 1320px);
}

.main-column,
.rail {
    display: grid;
    align-content: start;
    gap: 18px;
    min-width: 0;
}

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

.metric-card {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 14px;
    min-height: 126px;
    padding: 18px;
    min-width: 0;
    background:
        linear-gradient(180deg, rgba(11, 31, 55, 0.92), rgba(6, 20, 37, 0.94)),
        radial-gradient(circle at 85% 80%, rgba(18, 103, 255, 0.18), transparent 10rem);
}

.metric-icon,
.method-logo,
.account-logo {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    font-weight: 900;
}

.metric-icon.blue,
.account-logo.blue,
.method-logo.blue {
    background: rgba(18, 103, 255, 0.18);
    color: #6da1ff;
}

.metric-icon.green,
.account-logo.green,
.method-logo.green {
    background: var(--green-dim);
    color: var(--green);
}

.metric-icon.purple,
.method-logo.purple {
    background: var(--purple-dim);
    color: #a986ff;
}

.metric-icon.yellow,
.method-logo.yellow {
    background: var(--yellow-dim);
    color: var(--yellow);
}

.metric-label {
    color: var(--text-soft);
    font-size: 14px;
}

.metric-value {
    margin-top: 8px;
    font-size: 28px;
    font-weight: 900;
}

.metric-delta {
    margin-top: 8px;
    color: var(--green);
    font-size: 13px;
    font-weight: 800;
}

.panel,
.rail-card {
    padding: 20px;
    min-width: 0;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    min-width: 0;
}

.panel-header .filters {
    margin-bottom: 0;
}

.panel-subsection {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.panel-title {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.panel-title > * {
    flex-shrink: 0;
}

.panel-title > *,
.filters > *,
.topbar > *,
.table-wrap > *,
.admin-agent-summary > * {
    min-width: 0;
}

.panel h2,
.rail-card h2 {
    margin: 0;
    font-size: 22px;
}

.count-pill,
.status-badge,
.type-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 900;
}

.status-badge {
    gap: 6px;
}

.status-badge .ui-icon {
    width: 14px;
    height: 14px;
}

.count-pill {
    color: #d9d2ff;
    background: rgba(124, 60, 255, 0.36);
}

.admin-dashboard-page .count-pill {
    flex: 0 0 auto;
    min-width: 24px;
    min-height: 22px;
    padding: 2px 7px;
    border: 1px solid rgba(79, 140, 255, 0.34);
    border-radius: 999px;
    color: #b8d1ff;
    background: rgba(79, 140, 255, 0.14);
    font-size: 11px;
    line-height: 1;
    white-space: nowrap;
}

.admin-dashboard-page .panel-title {
    flex-wrap: wrap;
    column-gap: 10px;
    row-gap: 6px;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    min-width: 0;
}

.filters select,
.filters input,
.filters .source-pill {
    width: auto;
    min-width: 170px;
}

.filters .btn {
    flex: 0 0 auto;
}

.filters .currency-filter-control {
    width: 260px;
    min-width: 220px;
    max-width: min(100%, 320px);
}

.app-shell-agent .source-pill {
    display: none;
}

.merchant-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    align-items: stretch;
}

.merchant-filter-grid .control {
    width: 100%;
    min-width: 0;
}

#admin-p2p-orders .filters {
    justify-content: flex-end;
}

.order-id-search-fields {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: 12px;
    min-width: 0;
}

.order-search-limit-notice {
    margin: 0 0 14px;
    padding: 12px 14px;
    border: 1px solid rgba(232, 176, 64, 0.3);
    border-radius: 7px;
    color: var(--text-soft);
    background: rgba(232, 176, 64, 0.08);
}

.admin-test-order-bar {
    display: grid;
    grid-template-columns: minmax(180px, 280px) minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    margin: 2px 0 16px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(2, 11, 22, 0.48);
}

.admin-test-order-title {
    display: grid;
    gap: 4px;
}

.admin-test-order-title strong {
    color: var(--text);
    font-size: 16px;
}

.admin-test-order-title span {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 700;
}

.admin-test-order-controls {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(120px, 160px) auto;
    gap: 10px;
    align-items: start;
    min-width: 0;
}

.admin-test-order-method-select {
    min-width: 0;
}

.admin-test-order-amount {
    min-width: 0;
}

.admin-test-order-message {
    grid-column: 1 / -1;
    min-height: 18px;
    margin: 0;
    text-align: right;
}

.admin-test-order-message[data-state="success"] {
    color: var(--success);
}

.admin-test-order-message[data-state="error"] {
    color: var(--danger-2);
}

.table-wrap {
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid rgba(115, 147, 198, 0.12);
    border-radius: 14px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 820px;
}

.data-table th,
.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(115, 147, 198, 0.12);
    text-align: left;
    vertical-align: middle;
    overflow-wrap: break-word;
}

.data-table th {
    color: var(--text-muted);
    background: rgba(3, 14, 27, 0.62);
    font-size: 13px;
    font-weight: 800;
}

.data-table tr:last-child td {
    border-bottom: 0;
}

.data-table tbody tr:hover {
    background: rgba(18, 103, 255, 0.07);
}

.compact-orders-table {
    min-width: 720px;
}

.compact-orders-table th,
.compact-orders-table td {
    padding: 12px 14px;
}

.table-action-cell {
    min-width: 140px;
    white-space: nowrap;
}

.compact-orders-table tbody tr {
    cursor: pointer;
}

.compact-orders-table tbody tr:focus-visible {
    outline: 2px solid rgba(79, 140, 255, 0.8);
    outline-offset: -2px;
}

.compact-orders-table .status-badge {
    white-space: nowrap;
}

.table-sort-button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    width: 100%;
    padding: 0;
    border: 0;
    color: inherit;
    background: transparent;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.table-sort-button:focus-visible {
    outline: 2px solid rgba(79, 140, 255, 0.8);
    outline-offset: 4px;
}

.table-sort-button.is-active {
    color: var(--text);
}

.table-sort-indicator {
    flex: 0 0 auto;
    width: 13px;
    height: 13px;
    color: #6f8fbe;
}

.table-sort-button.is-active .table-sort-indicator {
    color: #79a8ff;
}

.advanced-order-filters {
    display: grid;
    grid-template-columns: repeat(4, minmax(130px, 1fr));
    flex: 1 1 800px;
    justify-content: end;
}

.advanced-order-filters .control,
.advanced-order-filters .btn,
.advanced-order-filters .currency-filter-control {
    width: 100%;
    min-width: 0;
    max-width: none;
}

.panel-header:has(.advanced-order-filters) {
    display: grid;
    grid-template-columns: minmax(150px, auto) minmax(0, 1fr);
    align-items: start;
}

.merchant-orders-table tbody tr {
    cursor: pointer;
    transition: background 0.16s ease, box-shadow 0.16s ease;
}

.merchant-orders-table tbody tr:focus-visible {
    outline: 2px solid rgba(79, 140, 255, 0.8);
    outline-offset: -2px;
}

.merchant-orders-table tbody tr.selected {
    background: rgba(18, 103, 255, 0.12);
    box-shadow: inset 3px 0 0 rgba(79, 140, 255, 0.9);
}

.merchant-orders-table tbody tr.selected:hover {
    background: rgba(18, 103, 255, 0.16);
}

.table-action-cell {
    min-width: 180px;
    text-align: right;
}

.table-action-stack {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.table-action-cell .btn {
    min-width: 128px;
}

.order-detail-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
    padding-top: 14px;
    border-top: 1px solid rgba(115, 147, 198, 0.12);
}

.order-detail-grid div {
    min-width: 0;
}

.order-detail-grid dt {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.order-detail-grid dd {
    margin: 5px 0 0;
    overflow-wrap: anywhere;
    color: var(--text-soft);
}

.order-modal-summary {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.order-modal-summary h3 {
    margin: 2px 0 0;
    font-size: 24px;
}

.order-modal-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.order-modal-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
}

.transfer-document-field {
    display: grid;
    gap: 6px;
    min-width: min(100%, 320px);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 800;
}

.transfer-document-field input {
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: rgba(5, 14, 27, 0.72);
    color: var(--text);
}

.order-events-section {
    display: grid;
    gap: 10px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid rgba(115, 147, 198, 0.12);
}

.order-action-cell {
    min-width: 190px;
}

.order-action-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.admin-order-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.admin-action-primary,
.admin-action-secondary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.admin-action-primary {
    min-height: 36px;
}

.action-note {
    font-size: 12px;
}

.manual-status-select {
    width: auto;
    min-width: 138px;
    min-height: 36px;
    border-radius: 10px;
    padding-left: 12px;
    padding-right: 44px;
    background-position: right 16px center;
    cursor: pointer;
    font-weight: 800;
}

.btn-compact {
    min-height: 36px;
    padding: 0 12px;
    border-radius: 10px;
    white-space: nowrap;
}

.order-urgent {
    outline: 1px solid rgba(255, 61, 61, 0.58);
    background: linear-gradient(90deg, rgba(255, 61, 61, 0.12), rgba(255, 61, 61, 0.04));
}

.status-badge.new,
.status-badge.pending,
.status-badge.pending_review,
.status-badge.draft,
.status-badge.not_synced {
    color: #8fbdff;
    background: rgba(18, 103, 255, 0.14);
}

.status-badge.active,
.status-badge.approved,
.status-badge.completed,
.status-badge.verified {
    color: var(--green);
    background: var(--green-dim);
}

.status-badge.in_progress {
    color: #8fbdff;
    background: rgba(18, 103, 255, 0.14);
}

.status-badge.archived {
    color: var(--muted);
    background: rgba(142, 160, 190, 0.14);
}

.status-badge.warning,
.status-badge.reassigned,
.status-badge.manual_review,
.status-badge.not_started,
.status-badge.not_checked {
    color: var(--yellow);
    background: var(--yellow-dim);
}

.status-badge.rejected,
.status-badge.blocked,
.status-badge.disabled,
.status-badge.failed,
.status-badge.cancelled,
.status-badge.not_assigned,
.status-badge.matched {
    color: #ff8b8b;
    background: var(--red-dim);
}

.data-table .status-badge .ui-icon {
    display: none;
}

.type-badge.deposit {
    color: var(--green);
    background: var(--green-dim);
}

.type-badge.withdraw {
    color: var(--yellow);
    background: var(--yellow-dim);
}

.mono {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.timer {
    color: var(--red);
    font-weight: 900;
}

.order-overdue-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 6px;
    color: #ff8b8b;
    font-size: 12px;
    font-weight: 800;
}

.order-overdue-label .ui-icon {
    width: 14px;
    height: 14px;
}

.modal-open {
    overflow: hidden;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(1, 8, 16, 0.78);
    backdrop-filter: blur(12px);
}

.order-history-modal {
    width: min(920px, 100%);
    max-height: min(760px, calc(100vh - 48px));
    overflow: auto;
    padding: 20px;
}

body.agent-kyc-locked {
    overflow: hidden;
}

.agent-kyc-gate {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(1, 8, 16, 0.85);
    backdrop-filter: blur(12px);
}

.agent-kyc-gate-card {
    width: min(460px, 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(10, 28, 49, 0.94), rgba(5, 15, 28, 0.96));
    box-shadow: var(--shadow);
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    text-align: center;
}

.agent-kyc-gate-card h2 {
    margin: 0;
}

.agent-kyc-gate-card .action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.agent-kyc-gate-message[data-state="error"] {
    color: #ff6b6b;
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.modal-header h3 {
    margin: 4px 0 0;
    font-size: 22px;
}

.order-event-row {
    overflow: hidden;
}

.event-status-flow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
}

.event-payload-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
    margin: 4px 0 0;
}

.event-payload-item {
    min-width: 0;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(115, 147, 198, 0.08);
}

.event-payload-item dt {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.event-payload-item dd {
    margin: 3px 0 0;
    overflow-wrap: anywhere;
    color: var(--text-main);
    font-size: 13px;
}

.rail-card {
    background: linear-gradient(180deg, rgba(8, 21, 37, 0.94), rgba(5, 15, 28, 0.94));
}

.balance-list,
.mini-list,
.method-list {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.balance-row,
.mini-row,
.registration-card {
    display: grid;
    gap: 8px;
    padding: 14px;
    border: 1px solid rgba(115, 147, 198, 0.12);
    border-radius: 14px;
    background: rgba(6, 19, 35, 0.72);
    min-width: 0;
}

.hierarchy-header {
    align-items: flex-start;
    margin-bottom: 14px;
}

.hierarchy-header .btn {
    min-height: 36px;
    padding: 0 12px;
}

.hierarchy-section {
    display: grid;
    gap: 8px;
    align-content: start;
    min-width: 0;
}

.hierarchy-section + .hierarchy-section {
    margin-top: 16px;
}

.hierarchy-grid > .hierarchy-section + .hierarchy-section {
    margin-top: 0;
}

.admin-agent-controls {
    grid-template-columns: minmax(320px, 1fr) minmax(130px, auto) minmax(130px, auto);
    width: min(100%, 900px);
    margin-bottom: 14px;
}

.admin-agent-overview {
    display: grid;
    gap: 16px;
    margin: 14px 0 18px;
    padding: 16px;
    border: 1px solid rgba(115, 147, 198, 0.14);
    border-radius: 12px;
    background: rgba(6, 19, 35, 0.58);
}

.admin-agent-list {
    display: grid;
    gap: 14px;
    margin: 14px 0 18px;
}

.admin-agent-list-header {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
}

.admin-agent-list-header h3 {
    margin: 4px 0 0;
}

.admin-agent-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 12px;
}

.admin-agent-list-card {
    display: grid;
    gap: 14px;
    min-width: 0;
    padding: 16px;
    border: 1px solid rgba(115, 147, 198, 0.14);
    border-radius: 12px;
    background: rgba(6, 19, 35, 0.58);
    cursor: pointer;
    transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.admin-agent-list-card:hover {
    border-color: rgba(75, 128, 255, 0.46);
    background: rgba(19, 42, 78, 0.58);
    transform: translateY(-1px);
}

.admin-agent-list-card:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.admin-agent-list-card .admin-agent-summary {
    grid-template-columns: 52px minmax(0, 1fr);
}

.admin-agent-list-card .admin-agent-summary h3 {
    font-size: 18px;
    overflow-wrap: anywhere;
}

.admin-agent-list-card .mini-caption,
.admin-agent-list-card .muted {
    overflow-wrap: anywhere;
}

.admin-agent-list-card .admin-agent-statuses {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-agent-summary {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
}

.admin-agent-summary h3 {
    margin: 4px 0 0;
    font-size: 22px;
}

.admin-agent-statuses {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(132px, max-content));
    gap: 10px;
    align-items: start;
}

.status-fact {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.status-fact > span {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.status-fact .status-badge {
    width: fit-content;
}

.rating-fact-value {
    display: inline-flex;
    width: fit-content;
    min-height: 30px;
    align-items: center;
    padding: 0 10px;
    border-radius: 10px;
    color: var(--green);
    background: var(--green-dim);
    white-space: nowrap;
}

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

.admin-agent-details-form {
    display: grid;
    grid-template-columns: minmax(180px, 220px) minmax(280px, 1fr) minmax(190px, 220px);
    gap: 12px;
    align-items: end;
    padding-top: 14px;
    border-top: 1px solid rgba(115, 147, 198, 0.12);
}

.admin-agent-details-submit {
    grid-column: 3;
    grid-row: 1;
    width: 100%;
    min-height: 46px;
    align-self: end;
}

.admin-agent-topup-currencies {
    grid-column: 1 / -1;
    display: grid;
    gap: 10px;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.admin-agent-topup-currencies legend {
    margin-bottom: 10px;
    padding: 0;
    font-weight: 800;
}

.admin-agent-currency-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    grid-auto-rows: max-content;
    align-content: start;
    gap: 4px 16px;
    max-height: 180px;
    overflow-y: auto;
}

.admin-agent-currency-option {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    min-height: 36px;
    cursor: pointer;
}

.admin-agent-currency-option[hidden] {
    display: none;
}

.admin-agent-currency-option input {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
}

.admin-agent-currency-option span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.admin-agent-details-message {
    grid-column: 1 / -1;
    min-height: 18px;
    margin: 0;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.admin-balance-adjustment {
    min-width: 0;
    border-top: 1px solid rgba(115, 147, 198, 0.12);
    padding-top: 16px;
}

.admin-balance-adjustment h3,
.admin-balance-preview h4 {
    margin: 0 0 10px;
}

.admin-balance-adjustment-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.admin-balance-reason,
.admin-balance-preview,
.admin-balance-message,
.admin-balance-actions {
    grid-column: 1 / -1;
    min-width: 0;
}

.admin-balance-preview {
    padding: 16px;
    border: 1px solid rgba(75, 128, 255, 0.4);
    border-radius: 12px;
    background: rgba(19, 42, 78, 0.4);
}

.admin-balance-preview[hidden] {
    display: none;
}

.admin-balance-preview .detail-table {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-balance-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.admin-balance-message {
    margin: 0;
    overflow-wrap: anywhere;
}

.admin-balance-history-link {
    display: block;
    margin-top: 8px;
}

.admin-agent-financial-history {
    display: grid;
    gap: 20px;
    min-width: 0;
    padding-top: 16px;
    border-top: 1px solid rgba(115, 147, 198, 0.12);
}

.admin-agent-financial-history > h3,
.admin-agent-financial-history > p {
    margin: 0;
}

.admin-agent-history-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(160px, 1fr)) auto auto;
    gap: 12px;
    align-items: end;
    min-width: 0;
}

.admin-agent-history-filters > * {
    min-width: 0;
}

.admin-agent-history-section,
.admin-agent-history-list {
    display: grid;
    gap: 12px;
    min-width: 0;
}

.admin-agent-history-section + .admin-agent-history-section {
    padding-top: 20px;
    border-top: 1px solid rgba(115, 147, 198, 0.12);
}

.admin-agent-history-heading,
.admin-agent-history-record > header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    min-width: 0;
}

.admin-agent-history-heading h3 {
    margin: 0;
    font-size: 18px;
}

.admin-agent-history-record {
    display: grid;
    gap: 14px;
    min-width: 0;
    padding: 16px;
    border: 1px solid rgba(115, 147, 198, 0.14);
    border-radius: 12px;
    background: rgba(6, 19, 35, 0.58);
}

.admin-agent-history-record > header > strong {
    min-width: 0;
    overflow-wrap: anywhere;
}

.admin-agent-history-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
    gap: 14px;
    min-width: 0;
    margin: 0;
}

.admin-agent-history-facts > div {
    display: grid;
    gap: 6px;
    min-width: 0;
    align-content: start;
}

.admin-agent-history-facts dt,
.admin-agent-history-facts dd {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
}

.admin-agent-history-facts dt {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 800;
}

.admin-agent-history-facts dd {
    color: var(--text-soft);
}

.admin-agent-history-reason,
.admin-agent-history-limit {
    margin: 0;
    overflow-wrap: anywhere;
}

.admin-agent-history-reason {
    white-space: pre-wrap;
}

.admin-agent-history-limit {
    color: var(--yellow);
}

.admin-agent-history-record details {
    min-width: 0;
}

.admin-agent-history-record summary {
    cursor: pointer;
    color: var(--text-soft);
    font-weight: 800;
}

.admin-agent-history-record details[open] summary {
    margin-bottom: 14px;
}

.agent-direction-settings {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(150px, 180px) repeat(2, minmax(190px, max-content));
    gap: 12px;
    align-items: center;
    min-height: 46px;
}

.agent-direction-settings > div,
.toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 0 14px;
    border: 1px solid rgba(115, 147, 198, 0.18);
    border-radius: 10px;
    background: rgba(5, 14, 27, 0.58);
}

.agent-direction-settings span {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 800;
}

.agent-direction-settings strong {
    color: var(--text);
    font-size: 14px;
}

.toggle-row {
    cursor: pointer;
}

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

.mini-caption {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hierarchy-row {
    position: relative;
    overflow: hidden;
    padding: 12px;
}

.hierarchy-node {
    padding-left: calc(14px + min(var(--depth, 1), 4) * 4px);
}

.hierarchy-node::before {
    content: "";
    position: absolute;
    left: calc(9px + min(var(--depth, 1), 4) * 3px);
    top: 14px;
    bottom: 14px;
    width: 2px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(18, 103, 255, 0.8), rgba(21, 209, 111, 0.42));
}

.hierarchy-ref {
    display: grid;
    gap: 4px;
    min-width: 0;
    overflow: hidden;
}

.hierarchy-ref strong {
    font-size: 15px;
    line-height: 1.2;
}

.hierarchy-ref .mono {
    font-size: 12px;
    line-height: 1.35;
}

.hierarchy-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    color: var(--text-muted);
    font-size: 12px;
}

.hierarchy-meta span {
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(115, 147, 198, 0.08);
    white-space: nowrap;
}

.hierarchy-empty {
    min-height: 92px;
    border: 1px dashed rgba(115, 147, 198, 0.18);
    border-radius: 14px;
    background: rgba(6, 19, 35, 0.38);
}

#agent-hierarchy .hierarchy-grid {
    grid-template-columns: repeat(2, minmax(320px, 1fr));
}

#agent-hierarchy .hierarchy-section > .mini-caption {
    min-height: 18px;
}

#agent-hierarchy .hierarchy-row,
#agent-hierarchy .hierarchy-empty {
    min-height: 136px;
}

.balance-row {
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
}

.balance-value {
    font-size: 20px;
    font-weight: 900;
}

.progress {
    width: 100%;
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(115, 147, 198, 0.16);
}

.progress > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--green), #53e08f);
}

.split {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.hierarchy-row .split {
    align-items: flex-start;
}

.hierarchy-row .status-badge,
.hierarchy-row .count-pill {
    flex: 0 0 auto;
    overflow-wrap: normal;
    white-space: nowrap;
    word-break: keep-all;
}

.registration-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr));
    gap: 12px;
}

.registration-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 336px;
}

.method-row {
    grid-template-columns: 48px minmax(0, 1fr) auto;
    align-items: center;
}

.profile-page {
    display: grid;
    gap: 16px;
    min-width: 0;
}

.profile-page-header h1 {
    margin: 0;
    font-size: 30px;
    line-height: 1.15;
}

.profile-page-header p {
    margin: 6px 0 0;
    color: var(--text-muted);
}

.profile-summary {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) auto;
    gap: 16px;
    align-items: center;
    min-width: 0;
    padding: 18px 20px;
    border: 1px solid rgba(115, 147, 198, 0.16);
    border-radius: 16px;
    background: rgba(6, 19, 35, 0.62);
}

.profile-summary-avatar {
    display: grid;
    width: 64px;
    height: 64px;
    place-items: center;
    border-radius: 50%;
    color: #061326;
    background: #d9e4f4;
    font-size: 24px;
    font-weight: 900;
}

.profile-summary-identity {
    min-width: 0;
}

.profile-summary-identity h2 {
    margin: 0;
    font-size: 24px;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.profile-summary-identity > span {
    display: block;
    margin-top: 5px;
    color: var(--text-muted);
    font-size: 14px;
}

.profile-summary-rating {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: var(--text-soft);
}

.profile-summary-rating span {
    color: var(--text-muted);
    font-size: 13px;
}

.profile-summary-rating strong {
    color: var(--green);
    font-size: 20px;
    line-height: 1;
    white-space: nowrap;
}

.profile-overview {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-width: 0;
    overflow: hidden;
    border: 1px solid rgba(115, 147, 198, 0.14);
    border-radius: 16px;
    background: rgba(6, 19, 35, 0.5);
}

.profile-section {
    min-width: 0;
}

.profile-overview .profile-section {
    padding: 20px;
}

.profile-overview .profile-section + .profile-section {
    border-left: 1px solid rgba(115, 147, 198, 0.14);
}

.profile-section > h2 {
    margin: 0 0 14px;
    font-size: 18px;
    line-height: 1.25;
}

.profile-data-list,
.profile-fact-list {
    display: grid;
}

.profile-data-row {
    display: grid;
    grid-template-columns: 116px minmax(0, 1fr) 38px;
    gap: 12px;
    align-items: center;
    min-height: 54px;
    border-top: 1px solid rgba(115, 147, 198, 0.1);
}

.profile-data-row:first-child,
.profile-fact-row:first-child {
    border-top: 0;
}

.profile-data-label,
.profile-fact-row > span {
    color: var(--text-muted);
    font-size: 13px;
}

.profile-data-value {
    min-width: 0;
    color: var(--text-soft);
    overflow-wrap: anywhere;
}

.profile-copy-cell {
    position: relative;
    display: grid;
    width: 38px;
    justify-items: end;
}

.profile-copy-button {
    display: inline-grid;
    width: 36px;
    height: 36px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 9px;
    color: var(--text-muted);
    background: transparent;
    cursor: pointer;
}

.profile-copy-button:hover,
.profile-copy-button:focus-visible {
    color: var(--text);
    background: rgba(115, 147, 198, 0.12);
}

.profile-copy-button:disabled {
    opacity: 0.35;
    cursor: default;
}

.profile-copy-button .ui-icon {
    width: 18px;
    height: 18px;
}

.profile-copy-feedback {
    position: absolute;
    right: 0;
    bottom: calc(100% + 4px);
    z-index: 2;
    padding: 4px 7px;
    border-radius: 7px;
    color: var(--text);
    background: #15253d;
    font-size: 11px;
    line-height: 1;
    white-space: nowrap;
}

.profile-copy-feedback:empty {
    display: none;
}

.profile-fact-row {
    display: grid;
    grid-template-columns: minmax(132px, 0.9fr) minmax(0, 1.1fr);
    gap: 14px;
    align-items: center;
    min-height: 54px;
    border-top: 1px solid rgba(115, 147, 198, 0.1);
}

.profile-fact-row > div {
    min-width: 0;
    color: var(--text-soft);
}

.profile-operation-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.profile-operation-tags > span {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    padding: 0 10px;
    border-radius: 9px;
    color: #b9d2ff;
    background: rgba(18, 103, 255, 0.14);
    font-size: 12px;
    font-weight: 800;
}

.profile-money-value {
    color: var(--text);
    font-weight: 700;
}

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

.profile-grid .detail-row {
    padding: 12px;
    border: 1px solid rgba(115, 147, 198, 0.1);
    border-radius: 14px;
    background: rgba(6, 19, 35, 0.56);
}

.profile-grid .detail-row > div {
    align-content: center;
    min-height: 28px;
}

.profile-working-conditions,
.profile-system-information {
    padding: 20px;
    border: 1px solid rgba(115, 147, 198, 0.14);
    border-radius: 16px;
    background: rgba(6, 19, 35, 0.5);
}

.profile-condition-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    min-width: 0;
}

.profile-condition-grid > div {
    min-width: 0;
    padding: 2px 20px;
}

.profile-condition-grid > div:first-child {
    padding-left: 0;
}

.profile-condition-grid > div:last-child {
    padding-right: 0;
}

.profile-condition-grid > div + div {
    border-left: 1px solid rgba(115, 147, 198, 0.14);
}

.profile-condition-grid h3 {
    margin: 0 0 7px;
    color: var(--text);
    font-size: 15px;
}

.profile-condition-grid p {
    margin: 0;
    color: var(--text-soft);
    font-size: 13px;
    line-height: 1.5;
}

.profile-system-information {
    background: rgba(2, 12, 24, 0.3);
}

.profile-system-information .profile-data-list {
    max-width: 820px;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 4px;
}

.registration-actions {
    display: grid;
    grid-template-columns: minmax(104px, 0.85fr) minmax(96px, 0.75fr) minmax(184px, 1.4fr);
    align-self: end;
    align-items: end;
    width: 100%;
    margin-top: auto;
}

.registration-actions .btn,
.blacklist-actions .btn {
    width: 100%;
    min-width: 0;
    padding: 0 10px;
    font-size: 14px;
    white-space: nowrap;
}

.timeline {
    display: grid;
    gap: 14px;
}

.timeline div {
    display: grid;
    grid-template-columns: 16px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    color: var(--text-soft);
}

.timeline span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 18px rgba(21, 209, 111, 0.62);
}

.timeline .current {
    color: var(--text);
    font-weight: 900;
}

.timeline .current span {
    background: var(--yellow);
    box-shadow: 0 0 18px rgba(245, 184, 32, 0.62);
}

.card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--text-muted);
    font-size: 13px;
}

.registration-card-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: start;
}

.registration-card-title {
    display: grid;
    gap: 7px;
    min-width: 0;
}

.registration-card-title strong {
    font-size: 17px;
    line-height: 1.2;
}

.registration-card-title > span {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.registration-card-contacts {
    display: grid;
    gap: 2px;
    min-width: 0;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.35;
}

.contact-chip {
    display: block;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.registration-card-header .status-badge {
    min-width: 116px;
    white-space: nowrap;
}

.registration-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 22px;
    row-gap: 13px;
    min-height: 188px;
    align-content: start;
}

.blacklist-card {
    min-height: 310px;
}

.blacklist-card .registration-details {
    min-height: 148px;
}

.registration-detail {
    display: grid;
    gap: 10px;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid rgba(115, 147, 198, 0.08);
    border-radius: 12px;
    background: rgba(2, 12, 24, 0.24);
}

.registration-detail.wide {
    grid-column: 1 / -1;
}

.registration-detail-label {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 800;
}

.registration-detail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
}

.registration-detail-value {
    min-width: 0;
    color: var(--text-soft);
    font-size: 13px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.registration-detail .status-badge {
    width: fit-content;
    min-width: 0;
    min-height: 26px;
    padding: 0 11px;
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
}

.inline-status {
    display: inline-flex;
    width: fit-content;
    min-height: 24px;
    flex: 0 0 auto;
    align-items: center;
    border-radius: 9px;
    padding: 0 11px;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
}

.inline-status.clear,
.inline-status.ready,
.inline-status.delivered,
.inline-status.verified,
.inline-status.approved,
.inline-status.active {
    color: var(--green);
    background: var(--green-dim);
}

.inline-status.not_started,
.inline-status.not_checked,
.inline-status.not_created,
.inline-status.pending {
    color: var(--yellow);
    background: var(--yellow-dim);
}

.inline-status.matched,
.inline-status.rejected,
.inline-status.failed,
.inline-status.blocked {
    color: #ffb1b1;
    background: var(--red-dim);
}

.detail-table {
    display: grid;
    width: 100%;
    gap: 6px;
    margin: 0;
}

.detail-table div {
    display: grid;
    grid-template-columns: 90px minmax(0, 1fr);
    gap: 12px;
    align-items: baseline;
}

.detail-table dt,
.detail-table dd {
    min-width: 0;
    margin: 0;
}

.detail-table dt {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 800;
}

.detail-table dd {
    color: var(--text-soft);
    overflow-wrap: anywhere;
}

.kyc-detail .detail-table div {
    grid-template-columns: 102px minmax(0, 1fr);
}

.detail-row {
    display: grid;
    grid-template-columns: 126px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    color: var(--text-muted);
    font-size: 13px;
}

.detail-row > span {
    color: var(--text-muted);
}

.detail-row > div {
    display: block;
    align-items: start;
    min-width: 0;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.detail-row.with-badge > div {
    display: block;
}

.detail-row .status-badge {
    width: fit-content;
    min-width: 0;
    min-height: 26px;
    padding: 0 11px;
    justify-content: flex-start;
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
}

.detail-row > div > span:not(.status-badge) {
    display: inline;
    min-width: 0;
    padding-top: 3px;
    line-height: 1.35;
}

.detail-row.with-badge > div > span:not(.status-badge) {
    display: block;
    margin-top: 7px;
    padding-top: 0;
}

.merchant-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px 18px;
    padding: 16px;
    border: 1px solid rgba(115, 147, 198, 0.12);
    border-radius: 14px;
    background: rgba(6, 19, 35, 0.46);
}

.merchant-detail-grid .detail-row {
    grid-template-columns: 1fr;
    gap: 5px;
    min-width: 0;
}

.merchant-detail-grid .detail-row > span {
    font-size: 12px;
}

.merchant-detail-grid .detail-row > div {
    color: var(--text-soft);
    font-size: 14px;
}

.card-meta span,
.split > *,
.mini-row strong,
.registration-card strong,
.registration-action-message,
.blacklist-action-message,
.secret-box strong {
    min-width: 0;
    overflow-wrap: anywhere;
}

.card-note {
    margin: 0;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 800;
}

.rejected-note {
    color: #ffb1b1;
    background: var(--red-dim);
}

.secret-box {
    display: grid;
    gap: 6px;
    padding: 12px;
    border: 1px solid rgba(21, 209, 111, 0.28);
    border-radius: 14px;
    background:
        linear-gradient(135deg, rgba(21, 209, 111, 0.14), rgba(18, 103, 255, 0.09)),
        rgba(6, 19, 35, 0.78);
}

.secret-box span {
    color: var(--green);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.secret-box strong {
    font-size: 20px;
}

.secret-box p,
.registration-action-message,
.blacklist-action-message {
    margin: 0;
}

.registration-action-message,
.blacklist-action-message {
    min-height: 18px;
}

.registration-action-message[data-state="error"] {
    color: #ff8b8b;
}

.admin-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 18px;
}

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

.quick-card {
    display: grid;
    gap: 8px;
    min-height: 118px;
    padding: 18px;
    border: 1px solid rgba(115, 147, 198, 0.14);
    border-radius: 16px;
    background:
        linear-gradient(135deg, rgba(18, 103, 255, 0.12), rgba(21, 209, 111, 0.04)),
        rgba(6, 19, 35, 0.72);
}

.quick-card span {
    color: var(--green);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.quick-card strong {
    align-self: end;
    font-size: 18px;
    line-height: 1.35;
}

.blacklist-form {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: start;
    margin-bottom: 18px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.blacklist-form .field {
    min-width: 0;
}

.blacklist-form textarea {
    min-height: 118px;
}

.blacklist-form .metadata-field {
    grid-column: span 3;
}

.payment-method-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    align-items: start;
    margin-bottom: 18px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.payment-method-form .field {
    min-width: 0;
}

.payment-method-form .json-field {
    grid-column: span 2;
}

.payment-method-form .agent-picker-field {
    grid-column: span 2;
}

.payment-method-form .agent-requisite-method-field {
    grid-column: span 2;
}

.requisite-schema-fields {
    grid-column: 1 / -1;
    display: grid;
    gap: 12px;
    min-width: 0;
    padding: 14px;
    border: 1px solid rgba(115, 147, 198, 0.14);
    border-radius: 14px;
    background: rgba(2, 12, 24, 0.30);
}

.requisite-schema-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.requisite-schema-field small {
    color: var(--text-muted);
    font-weight: 600;
    line-height: 1.35;
}

.requisite-schema-empty {
    padding: 12px;
    border: 1px dashed rgba(115, 147, 198, 0.20);
    border-radius: 12px;
    color: var(--text-muted);
    font-weight: 700;
}

.requisite-field-values {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.requisite-field-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 5px 8px;
    border: 1px solid rgba(115, 147, 198, 0.16);
    border-radius: 8px;
    background: rgba(2, 12, 24, 0.45);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 800;
}

.requisite-field-chip strong {
    overflow: hidden;
    color: var(--text-soft);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.payment-method-form .metadata-field,
.rating-config-form .metadata-field {
    grid-column: span 4;
}

.payment-method-form small[data-state="success"] {
    color: var(--green);
}

.payment-method-form small[data-state="warning"] {
    color: var(--yellow);
}

.payment-method-form textarea {
    min-height: 116px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    line-height: 1.45;
}

.rating-config-form textarea {
    min-height: 300px;
}

.rating-summary-grid {
    margin-bottom: 18px;
}

.rating-config-form .payment-method-submit {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.rating-form-section {
    display: grid;
    gap: 12px;
    min-width: 0;
    padding: 14px 0;
    border-top: 1px solid rgba(115, 147, 198, 0.12);
    border-bottom: 1px solid rgba(115, 147, 198, 0.12);
}

.rating-metrics-editor {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.rating-metrics-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    min-width: 0;
}

.rating-metrics-head h3 {
    margin: 0 0 4px;
    font-size: 18px;
}

.rating-metrics-head p {
    margin: 0;
}

.rating-weight-total {
    display: inline-flex;
    min-height: 32px;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(115, 147, 198, 0.12);
    white-space: nowrap;
}

.rating-weight-total[data-state="success"] {
    color: var(--green);
    background: var(--green-dim);
}

.rating-weight-total[data-state="warning"] {
    color: var(--yellow);
    background: var(--yellow-dim);
}

.rating-metric-row {
    display: grid;
    grid-template-columns: minmax(210px, 1fr) minmax(96px, 0.45fr) minmax(120px, 0.5fr) minmax(120px, 0.5fr);
    gap: 12px;
    align-items: end;
    min-width: 0;
    padding: 12px 0;
    border-top: 1px solid rgba(115, 147, 198, 0.1);
}

.rating-metrics-head + .rating-metric-row {
    border-top: 0;
}

.rating-metric-toggle {
    align-self: stretch;
    min-width: 0;
}

.rating-metric-toggle span {
    overflow-wrap: anywhere;
}

.rating-metric-row .field {
    gap: 6px;
}

.rating-metric-row .field input {
    min-height: 40px;
}

.rating-metric-rule {
    grid-column: 1 / -1;
    display: grid;
    gap: 4px;
    min-width: 0;
}

.rating-metric-rule span {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.rating-metric-rule strong {
    color: var(--text-soft);
    font-size: 13px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.rating-star-editor {
    display: grid;
    grid-template-columns: repeat(5, minmax(110px, 1fr));
    gap: 10px;
    min-width: 0;
}

.rating-advanced {
    min-width: 0;
}

.rating-advanced summary {
    margin-bottom: 12px;
}

.agent-rating-hero {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 16px;
    align-items: stretch;
    min-width: 0;
    margin-bottom: 16px;
}

.agent-rating-score {
    display: grid;
    align-content: center;
    gap: 8px;
    min-height: 176px;
    padding: 18px;
    border: 1px solid rgba(115, 147, 198, 0.16);
    border-radius: 14px;
    background: rgba(2, 12, 24, 0.34);
}

.agent-rating-score span,
.agent-rating-score small {
    color: var(--text-soft);
    font-weight: 800;
}

.agent-rating-score strong {
    font-size: 34px;
    line-height: 1;
    white-space: nowrap;
}

.agent-rating-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    min-width: 0;
}

.agent-rating-breakdown {
    display: grid;
    gap: 10px;
    min-width: 0;
    margin-bottom: 14px;
}

.agent-rating-metric {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 120px;
    gap: 12px;
    align-items: center;
    min-height: 58px;
    padding: 12px 14px;
    border: 1px solid rgba(115, 147, 198, 0.14);
    border-radius: 12px;
    background: rgba(2, 12, 24, 0.26);
}

.agent-rating-metric > div {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.agent-rating-metric > div:last-child {
    text-align: right;
}

.fields-schema-builder {
    grid-column: span 4;
    display: grid;
    gap: 12px;
    min-width: 0;
    padding: 14px;
    border: 1px solid rgba(115, 147, 198, 0.16);
    border-radius: 14px;
    background: rgba(2, 12, 24, 0.34);
}

.schema-builder-head,
.schema-preview-head,
.schema-field-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.schema-builder-head strong,
.schema-preview-head strong,
.schema-field-header strong {
    color: var(--text);
}

.schema-fields {
    display: grid;
    gap: 12px;
}

.schema-field-card {
    display: grid;
    gap: 12px;
    padding: 12px;
    border: 1px solid rgba(115, 147, 198, 0.14);
    border-radius: 12px;
    background: rgba(2, 9, 18, 0.54);
}

.schema-field-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.schema-required-field .schema-checkbox {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    border: 1px solid rgba(79, 105, 145, 0.62);
    border-radius: 12px;
    color: var(--text);
    background: rgba(2, 9, 18, 0.86);
}

.schema-checkbox input {
    width: 18px;
    min-height: 18px;
    margin: 0;
}

.schema-builder-error {
    min-height: 20px;
    margin: 0;
    color: #ff8b8b;
    font-size: 13px;
    line-height: 1.45;
}

.schema-builder-warning {
    padding: 12px;
    border: 1px solid rgba(245, 184, 32, 0.28);
    border-radius: 12px;
    color: var(--yellow);
    background: var(--yellow-dim);
}

.schema-builder-warning details {
    margin-top: 8px;
    color: var(--text-soft);
}

.schema-preview-box,
.fields-schema-readonly {
    display: grid;
    gap: 12px;
    padding: 12px;
    border: 1px solid rgba(115, 147, 198, 0.12);
    border-radius: 12px;
    background: rgba(2, 9, 18, 0.42);
}

.schema-preview-form {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.schema-preview-field input,
.schema-preview-field select {
    opacity: 0.88;
}

.schema-preview-field small {
    color: var(--text-muted);
    font-weight: 600;
    line-height: 1.35;
}

.schema-required-mark {
    color: var(--yellow);
    margin-left: 4px;
}

.schema-preview-empty {
    padding: 12px;
    border: 1px dashed rgba(115, 147, 198, 0.22);
    border-radius: 12px;
    color: var(--text-muted);
}

.schema-json-details summary {
    cursor: pointer;
    color: var(--text-soft);
    font-weight: 800;
}

.payment-method-submit {
    align-self: end;
}

.choice-field {
    align-self: stretch;
}

.choice-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr));
    gap: 8px;
    min-height: 46px;
}

.choice-option {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    min-height: 46px;
    padding: 0 14px;
    border: 1px solid rgba(79, 105, 145, 0.62);
    border-radius: 12px;
    color: var(--text);
    font-weight: 800;
    background: rgba(2, 9, 18, 0.86);
}

.choice-option input {
    width: 18px;
    min-height: 18px;
    margin: 0;
    accent-color: var(--blue);
}

.choice-option span {
    min-width: 0;
    white-space: nowrap;
}

.payment-method-submit .btn {
    align-self: end;
    min-height: 46px;
}

.payment-method-submit .muted,
.payment-method-action-message {
    margin: 8px 0 0;
    line-height: 1.45;
}

.payment-method-submit .muted[data-state="success"],
.payment-method-action-message[data-state="success"] {
    color: var(--green);
}

.payment-method-submit .muted[data-state="error"],
.payment-method-action-message[data-state="error"] {
    color: #ff8b8b;
}

.payment-method-table {
    min-width: 1180px;
}

.commission-rate-header {
    align-items: flex-start;
}

.commission-rate-header .btn {
    flex: 0 0 auto;
}

.commission-rate-list-section,
.commission-rate-create-section {
    display: grid;
    gap: 14px;
    min-width: 0;
}

.commission-rate-list-section > *,
.commission-rate-create-section > *,
#admin-commission-rates-table {
    min-width: 0;
}

.commission-rate-create-section {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid rgba(115, 147, 198, 0.18);
}

.commission-rate-section-head {
    display: flex;
    gap: 12px;
    align-items: end;
    justify-content: space-between;
}

.commission-rate-section-head h3 {
    margin: 0;
}

.commission-rate-section-head p {
    margin: 4px 0 0;
}

.commission-rate-filters {
    display: grid;
    grid-template-columns:
        minmax(160px, 0.85fr)
        minmax(210px, 1.15fr)
        minmax(160px, 0.85fr)
        minmax(140px, 0.7fr)
        minmax(160px, 0.75fr)
        minmax(150px, 0.75fr);
    align-items: end;
    margin-bottom: 0;
}

.commission-rate-filters .control {
    width: 100%;
    min-width: 0;
}

.commission-rate-form {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: end;
}

.commission-rate-form .commission-rate-target-kind {
    grid-column: 1;
}

.commission-rate-form .commission-target-value {
    grid-column: span 2;
}

.commission-rate-form .commission-rate-operation,
.commission-rate-form .commission-rate-project,
.commission-rate-form .commission-rate-currency,
.commission-rate-form .commission-rate-status-field {
    grid-column: auto;
}

.commission-rate-form .commission-rate-agent,
.commission-rate-form .commission-rate-platform {
    grid-column: span 2;
}

.commission-rate-submit {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: 1fr;
    align-items: center;
    gap: 10px 14px;
    min-width: 0;
}

.commission-rate-submit .btn {
    width: 100%;
    min-width: 0;
}

.commission-rate-submit .muted {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
}

.commission-rate-table {
    min-width: 1160px;
}

.scope-badge {
    display: inline-flex;
    width: max-content;
    max-width: 180px;
    padding: 5px 9px;
    border: 1px solid rgba(70, 133, 255, 0.42);
    border-radius: 6px;
    color: #a9c5ff;
    background: rgba(44, 105, 226, 0.14);
    font-size: 12px;
    font-weight: 800;
    overflow-wrap: normal;
    white-space: nowrap;
}

.admin-ledger-header-actions {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.commission-rate-target,
.commission-rate-values {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.commission-rate-target strong,
.commission-rate-target span,
.commission-rate-target small {
    min-width: 0;
    overflow-wrap: anywhere;
}

.commission-rate-values {
    grid-template-columns: repeat(2, minmax(92px, 1fr));
}

.commission-rate-values > div {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.commission-rate-values span {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.commission-rate-values strong {
    font-size: 18px;
}

.payment-method-action-cell {
    min-width: 230px;
}

.payment-method-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.payment-method-actions .btn {
    min-width: 104px;
}

.agent-resource-meta {
    display: grid;
    justify-items: end;
    gap: 6px;
    text-align: right;
}

.payment-method-detail-modal {
    width: min(1040px, calc(100vw - 32px));
    max-height: min(760px, calc(100vh - 48px));
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
    padding: 20px;
}

.resource-edit-modal {
    width: min(1040px, calc(100vw - 32px));
    max-height: min(780px, calc(100vh - 32px));
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
    padding: 0;
}

.resource-edit-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px 18px;
    border-bottom: 1px solid rgba(115, 147, 198, 0.16);
}

.resource-edit-header h3 {
    margin: 0;
    font-size: 22px;
    line-height: 1.25;
}

.resource-edit-close {
    display: grid;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    padding: 0;
    place-items: center;
    border: 1px solid transparent;
    border-radius: 7px;
    color: var(--text-muted);
    background: transparent;
    cursor: pointer;
}

.resource-edit-close:hover,
.resource-edit-close:focus-visible {
    border-color: rgba(115, 147, 198, 0.28);
    color: var(--text);
    background: rgba(115, 147, 198, 0.08);
}

.resource-edit-close .ui-icon {
    width: 20px;
    height: 20px;
}

.resource-edit-form {
    display: block;
    min-height: 0;
    overflow: auto;
    margin: 0;
    padding: 22px 24px 0;
    border: 0;
}

.resource-edit-section {
    display: block;
}

.resource-edit-section.hidden {
    display: none;
}

.resource-edit-section[data-resource-edit-section="requisite"]:not(.hidden) {
    display: block;
}

[data-resource-shared-agent-picker] {
    margin-bottom: 16px;
}

.resource-edit-primary-grid,
.resource-edit-limits-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.resource-edit-data,
.resource-edit-limits {
    min-width: 0;
}

.resource-edit-admin-method-fields {
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid rgba(115, 147, 198, 0.14);
}

.resource-edit-admin-method-fields.hidden {
    display: none;
}

.resource-edit-admin-method-fields h4 {
    margin: 0 0 14px;
    color: var(--text);
    font-size: 15px;
    line-height: 1.3;
}

.resource-edit-method-schema {
    margin-top: 18px;
}

.resource-edit-method-schema .schema-field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.resource-edit-data h4,
.resource-edit-limits h4 {
    margin: 0 0 14px;
    color: var(--text);
    font-size: 15px;
    line-height: 1.3;
}

.resource-edit-limits {
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid rgba(115, 147, 198, 0.14);
}

.resource-edit-requisite-name,
.resource-edit-active-orders-field {
    width: min(100%, calc(50% - 8px));
}

.resource-edit-active-orders-field {
    margin-bottom: 16px;
}

.resource-edit-schema-fields {
    display: block;
    margin-top: 16px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.resource-edit-schema-fields .requisite-schema-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.resource-edit-schema-fields .requisite-schema-field.is-wide {
    grid-column: 1 / -1;
}

.resource-edit-schema-fields .requisite-schema-field-with-code {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    grid-column: 1 / -1;
    align-items: start;
    gap: 16px;
    min-width: 0;
}

.resource-edit-schema-fields .requisite-schema-empty {
    padding: 0;
    border: 0;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
}

.resource-edit-schema-field.has-field-error .requisite-schema-field-hint {
    display: none;
}

.resource-edit-form .field {
    min-width: 0;
}

.resource-edit-form .field > small {
    line-height: 1.35;
}

.resource-edit-field-error {
    display: none;
    color: #ff7c89;
    font-size: 12px;
    font-weight: 700;
}

.resource-edit-field-error:not(:empty) {
    display: block;
}

.resource-edit-form input.has-error,
.resource-edit-form [data-requisite-field-key][aria-invalid="true"],
.resource-edit-form [data-requisite-field-code][aria-invalid="true"] {
    border-color: rgba(255, 91, 107, 0.72);
    box-shadow: 0 0 0 3px rgba(255, 91, 107, 0.1);
}

.resource-edit-info {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-top: 20px;
    padding: 11px 13px;
    border: 1px solid rgba(79, 140, 255, 0.18);
    border-radius: 7px;
    color: var(--text-soft);
    background: rgba(79, 140, 255, 0.07);
    font-size: 12px;
    line-height: 1.45;
}

.resource-edit-info .ui-icon {
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    margin-top: 1px;
    color: #79a8ff;
}

.resource-edit-message {
    min-height: 18px;
    margin: 10px 0 0;
    font-size: 12px;
}

.resource-edit-message:empty {
    min-height: 0;
    margin: 0;
}

.resource-edit-actions {
    position: sticky;
    z-index: 2;
    bottom: 0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin: 20px -24px 0;
    padding: 16px 24px;
    border-top: 1px solid rgba(115, 147, 198, 0.16);
    background: rgba(8, 24, 43, 0.98);
}

.resource-edit-actions .btn {
    width: auto;
    min-width: 138px;
    min-height: 44px;
}

#admin-payment-method-detail-content {
    min-height: 0;
    overflow: auto;
    padding-right: 4px;
}

.agent-ref {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.agent-ref strong {
    min-width: 0;
    overflow-wrap: anywhere;
}

.agent-ref .muted {
    overflow-wrap: anywhere;
}

.agent-rating-inline {
    display: inline-flex;
    width: fit-content;
    margin-top: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    color: var(--green);
    background: var(--green-dim);
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

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

.method-detail-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    align-items: start;
    margin-bottom: 12px;
    padding: 14px;
    border: 1px solid rgba(115, 147, 198, 0.12);
    border-radius: 14px;
    background: rgba(2, 12, 24, 0.34);
}

.method-detail-summary span {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.method-detail-summary strong {
    display: block;
    margin-top: 6px;
    font-size: 22px;
    overflow-wrap: anywhere;
}

.method-detail-summary p {
    margin: 6px 0 0;
}

.method-detail-statuses {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.json-preview {
    max-height: 280px;
    margin: 0;
    padding: 12px;
    overflow: auto;
    border: 1px solid rgba(115, 147, 198, 0.12);
    border-radius: 12px;
    color: var(--text-soft);
    background: rgba(2, 9, 18, 0.72);
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    line-height: 1.45;
    white-space: pre-wrap;
}

.ledger-layout {
    display: grid;
    gap: 22px;
}

.ledger-scope {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 0.8fr);
    gap: 16px;
    align-items: end;
    margin-bottom: 22px;
    padding: 16px;
    border: 1px solid rgba(79, 105, 145, 0.32);
    border-radius: 14px;
    background: rgba(5, 17, 31, 0.48);
}

.ledger-scope-copy {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.ledger-scope-copy strong {
    font-size: 18px;
}

.ledger-scope-copy small {
    color: var(--text-soft);
    line-height: 1.35;
}

.ledger-scope-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 10px;
    min-width: 0;
}

.ledger-scope-field {
    display: grid;
    gap: 6px;
    min-width: 0;
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 800;
}

.ledger-scope-field .control {
    width: 100%;
}

.agent-topup-sections {
    display: grid;
    gap: 18px;
}

.agent-topup-section-heading {
    margin-bottom: 18px;
}

.agent-topup-section-heading h2,
.agent-topup-section-heading p {
    margin: 0;
}

.agent-topup-section-heading p {
    margin-top: 6px;
    color: var(--text-soft);
}

.agent-topup-form {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(220px, 0.72fr) auto;
    gap: 12px;
    align-items: end;
    max-width: 980px;
}

.agent-topup-submit {
    min-height: 46px;
    white-space: nowrap;
}

.agent-topup-form[data-currencies-ready="true"] select[name="currency"]:disabled {
    opacity: 1;
    cursor: default;
}

.agent-topup-form-message {
    min-height: 0;
    margin: 12px 0 0;
}

.agent-topup-history-head {
    display: grid;
    grid-template-columns: minmax(180px, 0.55fr) minmax(0, 1.45fr);
    gap: 18px;
    align-items: end;
}

.agent-topup-history-copy {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.agent-topup-history-copy h2,
.agent-topup-history-copy p {
    margin: 0;
}

.agent-topup-period-controls {
    display: grid;
    grid-template-columns: minmax(360px, 1fr) auto auto;
    gap: 10px;
    align-items: end;
    min-width: 0;
}

.agent-topup-period-controls .btn {
    min-height: 46px;
}

.agent-topup-period-controls .btn-ghost {
    border: 0;
    background: transparent;
    color: var(--text-soft);
    box-shadow: none;
}

.agent-topup-period-controls .btn-ghost:hover:not(:disabled) {
    color: var(--text-main);
    background: rgba(133, 162, 205, 0.08);
}

.agent-topup-period-controls .btn-ghost:disabled {
    opacity: 0.42;
}

.agent-topup-date-range {
    display: grid;
    grid-template-columns: auto repeat(2, minmax(150px, 1fr));
    gap: 10px;
    align-items: end;
    min-width: 0;
    min-height: 46px;
    padding: 7px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: rgba(2, 12, 24, 0.72);
}

.agent-topup-date-range > .ui-icon {
    align-self: center;
    color: var(--text-soft);
}

.agent-topup-date-range label {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.agent-topup-date-range label + label {
    padding-left: 10px;
    border-left: 1px solid var(--line);
}

.agent-topup-date-range label span {
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 800;
}

.agent-topup-date-range input {
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text-main);
    font: inherit;
}

.agent-topups-period-message {
    min-height: 0;
    margin: 10px 0 0;
}

.agent-topup-table-wrap {
    margin-top: 14px;
}

.agent-topup-table {
    table-layout: fixed;
}

.agent-topup-col-amount {
    width: 22%;
}

.agent-topup-col-status {
    width: 20%;
}

.agent-topup-col-operation {
    width: 34%;
}

.agent-topup-col-created {
    width: 24%;
}

.agent-topup-table-row td {
    vertical-align: middle;
}

.agent-topup-amount {
    white-space: nowrap;
}

.agent-topup-status,
.agent-topup-created-at {
    display: grid;
    gap: 4px;
}

.agent-topup-status small,
.agent-topup-created-at small {
    color: var(--text-soft);
}

.agent-topup-operation-id {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 40px;
    gap: 8px;
    align-items: center;
    min-width: 0;
}

.agent-topup-operation-id > .mono {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agent-topup-id-copy-zone {
    display: grid;
    place-items: center;
    width: 40px;
    min-height: 40px;
}

.agent-topup-copy {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--text-soft);
    cursor: pointer;
}

.agent-topup-copy:hover:not(:disabled),
.agent-topup-copy:focus-visible {
    border-color: var(--line-strong);
    color: var(--text-main);
    background: rgba(133, 162, 205, 0.08);
}

.agent-topup-copy[data-state="success"] {
    color: var(--success);
}

.ledger-summary {
    display: grid;
    gap: 14px;
    margin-bottom: 22px;
}

.ledger-summary-currency {
    display: grid;
    gap: 14px;
}

.ledger-summary-currency + .ledger-summary-currency {
    margin-top: 10px;
    padding-top: 24px;
    border-top: 1px solid var(--line);
}

.ledger-summary-scope-head {
    margin-top: 6px;
    padding-top: 18px;
    border-top: 1px solid rgba(115, 147, 198, 0.14);
}

.ledger-summary-head h3 {
    margin: 0;
    font-size: 18px;
}

.ledger-summary-head p {
    margin: 6px 0 0;
}

.ledger-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.ledger-summary-card {
    display: grid;
    gap: 8px;
    min-width: 0;
    min-height: 132px;
    padding: 16px;
    border: 1px solid rgba(115, 147, 198, 0.14);
    border-radius: 14px;
    background:
        linear-gradient(180deg, rgba(6, 19, 35, 0.86), rgba(4, 14, 26, 0.92));
}

.ledger-summary-card span {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ledger-summary-card strong {
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 24px;
    line-height: 1.1;
}

.ledger-summary-card small {
    color: var(--text-soft);
    line-height: 1.35;
}

.ledger-explainer {
    display: grid;
    gap: 8px;
    padding: 14px;
    border: 1px solid rgba(33, 212, 253, 0.16);
    border-radius: 14px;
    color: var(--text-soft);
    background: rgba(33, 212, 253, 0.06);
    line-height: 1.42;
}

.ledger-explainer strong {
    color: var(--text);
}

.ledger-section {
    display: grid;
    gap: 14px;
    min-width: 0;
}

#admin-agent-topups-table,
#admin-ledger-accounts-table,
#admin-ledger-transactions-table,
#admin-merchant-settlements-table,
#admin-merchant-settlement-preview {
    min-width: 0;
    max-width: 100%;
}

.ledger-section + .ledger-section {
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.ledger-section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.ledger-section-head h3 {
    margin: 0;
    font-size: 18px;
}

.ledger-section-head p {
    margin: 6px 0 0;
}

.ledger-filters {
    margin-bottom: 0;
}

.ledger-filters .control {
    min-width: 180px;
}

.settlement-filters {
    display: grid;
    grid-template-columns:
        minmax(180px, 1fr)
        minmax(160px, 0.85fr)
        minmax(96px, 0.45fr)
        minmax(190px, 0.75fr)
        minmax(190px, 0.75fr)
        minmax(116px, auto)
        minmax(116px, auto);
}

.settlement-filters .control,
.settlement-filters .btn {
    width: 100%;
    min-width: 0;
}

.settlement-message {
    min-height: 18px;
    margin: -4px 0 0;
}

.settlement-message.error {
    color: var(--red);
}

.settlement-preview {
    display: grid;
    gap: 14px;
    min-width: 0;
}

.settlement-preview-head {
    padding-top: 2px;
}

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

.settlement-summary-card {
    min-height: 112px;
}

.settlement-meta-chips {
    padding: 2px 0;
}

.settlement-orders-wrap {
    max-height: 440px;
    overflow: auto;
}

.settlement-orders-table,
.merchant-settlement-table {
    min-width: 860px;
}

.settlement-overflow-note {
    margin: 10px 12px 12px;
}

.ledger-record-list {
    display: grid;
    gap: 10px;
}

.ledger-table-wrap {
    border-radius: 14px;
    background: rgba(5, 17, 31, 0.52);
}

.ledger-table {
    min-width: 920px;
    table-layout: fixed;
}

.ledger-table th,
.ledger-table td {
    padding: 12px 14px;
    vertical-align: top;
}

.ledger-table th {
    white-space: nowrap;
}

.ledger-table-cell {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.ledger-table-cell strong,
.ledger-table-cell small,
.ledger-table-cell span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.ledger-table .agent-ref {
    min-width: 0;
}

.ledger-table .status-badge {
    width: fit-content;
    max-width: 100%;
    white-space: normal;
    line-height: 1.15;
    text-align: center;
}

.ledger-status-cell {
    vertical-align: top;
}

.ledger-status-text {
    display: block;
    padding-top: 1px;
    color: var(--text);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.25;
}

.ledger-service-cell {
    min-width: 0;
}

.ledger-service-list {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.ledger-service-list span {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 6px;
    max-width: 100%;
    min-width: 0;
    min-height: 24px;
    align-items: center;
    padding: 0 7px;
    border-radius: 9px;
    color: var(--text-soft);
    background: rgba(115, 147, 198, 0.09);
    font-size: 12px;
}

.ledger-service-list strong {
    color: var(--text-muted);
    white-space: nowrap;
}

.ledger-service-list em {
    min-width: 0;
    overflow-wrap: anywhere;
    font-style: normal;
}

.ledger-service-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 7px;
}

.ledger-copy-action {
    width: auto;
    min-width: 42px;
    min-height: 30px;
    padding: 0 10px;
    border-radius: 9px;
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
}

.ledger-cell-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.ledger-copy-cell {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    min-width: 0;
}

.ledger-copy-cell .ledger-copy-action {
    flex: 0 0 auto;
}

.compact-agent-meta {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topup-col-agent {
    width: 22%;
}

.topup-table-with-agent .topup-col-amount {
    width: 27%;
}

.topup-table-with-agent .topup-col-status {
    width: 13%;
}

.topup-table-with-agent .topup-col-guru {
    width: 20%;
}

.topup-table-with-agent .topup-col-dates {
    width: 18%;
}

.topup-table-compact .topup-col-amount {
    width: 26%;
}

.topup-table-compact .topup-col-status {
    width: 14%;
}

.topup-table-compact .topup-col-guru {
    width: 32%;
}

.topup-table-compact .topup-col-dates {
    width: 28%;
}

.ledger-account-col-owner {
    width: 21%;
}

.ledger-account-col-account {
    width: 20%;
}

.ledger-account-col-amount {
    width: 15%;
}

.ledger-account-col-status {
    width: 12%;
}

.ledger-account-col-dates {
    width: 15%;
}

.ledger-account-col-service {
    width: 17%;
}

.ledger-transaction-col-event {
    width: 17%;
}

.ledger-transaction-col-agent {
    width: 19%;
}

.ledger-transaction-col-amount {
    width: 16%;
}

.ledger-transaction-col-status {
    width: 12%;
}

.ledger-transaction-col-source {
    width: 13%;
}

.ledger-transaction-col-date {
    width: 12%;
}

.ledger-transaction-col-action {
    width: 11%;
}

.ledger-table-actions {
    text-align: right;
}

.ledger-table-actions .btn {
    width: 100%;
    min-width: 0;
    min-height: 36px;
    padding: 0 12px;
    font-size: 14px;
}

.ledger-record {
    display: grid;
    grid-template-columns:
        minmax(220px, 1.15fr)
        minmax(170px, 0.9fr)
        minmax(104px, 0.5fr)
        minmax(120px, 0.5fr)
        minmax(220px, 1fr);
    gap: 14px;
    align-items: center;
    min-width: 0;
    padding: 16px 18px;
    border: 1px solid rgba(115, 147, 198, 0.14);
    border-radius: 14px;
    background: rgba(5, 17, 31, 0.72);
}

.topup-record {
    grid-template-columns:
        minmax(220px, 1.1fr)
        minmax(130px, 0.58fr)
        minmax(180px, 0.78fr)
        minmax(170px, 0.72fr)
        minmax(240px, 1.02fr)
        minmax(150px, auto);
    align-items: start;
}

.topup-record .status-badge {
    width: fit-content;
}

.topup-record .ledger-record-actions {
    justify-content: flex-start;
}

.topup-record-with-agent {
    grid-template-columns:
        minmax(220px, 1.1fr)
        minmax(170px, 0.75fr)
        minmax(116px, 0.5fr)
        minmax(170px, 0.7fr)
        minmax(160px, 0.66fr)
        minmax(210px, 0.9fr)
        minmax(130px, auto);
}

.ledger-account-record {
    grid-template-columns:
        minmax(210px, 1.16fr)
        minmax(180px, 1fr)
        minmax(130px, 0.68fr)
        minmax(108px, 0.44fr)
        minmax(150px, 0.7fr)
        minmax(180px, 0.84fr);
}

.ledger-transaction-record {
    grid-template-columns: 1fr;
    align-items: stretch;
}

.ledger-transaction-head {
    display: grid;
    grid-template-columns:
        minmax(190px, 1.15fr)
        minmax(150px, 0.78fr)
        minmax(90px, 0.4fr)
        minmax(220px, 1.18fr)
        minmax(105px, 0.5fr)
        minmax(96px, auto);
    gap: 14px;
    align-items: center;
    min-width: 0;
}

.ledger-entry-record {
    grid-template-columns:
        minmax(220px, 1fr)
        minmax(128px, 0.45fr)
        minmax(140px, 0.55fr)
        minmax(220px, 1fr)
        minmax(120px, 0.5fr);
}

.ledger-record-main,
.ledger-record-field,
.ledger-record-actions {
    min-width: 0;
}

.ledger-record-main,
.ledger-record-field {
    display: grid;
    gap: 5px;
}

.ledger-record-field > span,
.ledger-record-label {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ledger-record-main > strong,
.ledger-record-field > strong {
    min-width: 0;
    overflow-wrap: anywhere;
}

.ledger-record-field small,
.ledger-record-main small {
    min-width: 0;
    overflow-wrap: anywhere;
}

.ledger-record-actions {
    display: flex;
    justify-content: flex-end;
}

.ledger-record-actions .btn {
    width: 100%;
    max-width: 176px;
}

.ledger-record-meta {
    align-content: start;
}

.ledger-transaction-meta {
    padding-top: 12px;
    border-top: 1px solid rgba(115, 147, 198, 0.12);
}

.ledger-transaction-record .ledger-record-main > strong {
    overflow-wrap: normal;
    word-break: normal;
}

.ledger-purpose {
    display: block;
    max-width: 42ch;
    color: var(--text-soft);
    line-height: 1.35;
}

.ledger-account-amount strong {
    font-size: 18px;
}

.ledger-money-line {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
    padding-top: 12px;
}

.ledger-money-chip {
    display: grid;
    gap: 3px;
    min-width: 148px;
    padding: 10px 12px;
    border: 1px solid rgba(115, 147, 198, 0.14);
    border-radius: 12px;
    background: rgba(115, 147, 198, 0.08);
}

.ledger-money-chip.required_amount,
.ledger-money-chip.amount_with_commission {
    border-color: rgba(245, 184, 32, 0.24);
    background: rgba(245, 184, 32, 0.1);
}

.ledger-money-chip.agent_commission,
.ledger-money-chip.platform_commission,
.ledger-money-chip.master_commission {
    border-color: rgba(21, 209, 111, 0.2);
    background: rgba(21, 209, 111, 0.08);
}

.ledger-money-chip small {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ledger-money-chip strong {
    min-width: 0;
    overflow-wrap: anywhere;
}

.ledger-idempotency-field strong {
    font-size: 14px;
    line-height: 1.35;
}

.ledger-meta-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ledger-meta-chips span {
    display: inline-grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 5px;
    max-width: 100%;
    min-width: 0;
    min-height: 26px;
    align-items: center;
    padding: 0 9px;
    border-radius: 9px;
    color: var(--text-soft);
    background: rgba(115, 147, 198, 0.1);
    font-size: 12px;
    overflow-wrap: anywhere;
    word-break: normal;
}

.ledger-meta-chips strong {
    color: var(--text-muted);
    white-space: nowrap;
}

.ledger-detail-modal {
    width: min(1120px, calc(100vw - 32px));
    max-height: min(820px, calc(100vh - 48px));
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
    padding: 20px;
}

.ledger-detail-modal .ledger-money-line {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.ledger-detail-modal .ledger-money-chip {
    min-width: 0;
}

.ledger-detail-modal .ledger-meta-chips span {
    width: 100%;
}

#admin-ledger-detail-content {
    min-height: 0;
    overflow: auto;
    padding-right: 4px;
}

.ledger-detail-grid {
    display: grid;
    gap: 12px;
}

.blacklist-submit {
    align-self: end;
}

.blacklist-submit .btn {
    align-self: end;
    min-height: 46px;
}

.blacklist-submit .muted {
    margin: 8px 0 0;
    line-height: 1.45;
}

.hierarchy-grid {
    display: grid;
    grid-template-columns: minmax(320px, 0.9fr) minmax(320px, 1.1fr);
    gap: 16px;
    align-items: start;
}

.agent-hierarchy-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    margin-bottom: 18px;
}

.agent-hierarchy-head h2,
.agent-hierarchy-head p {
    margin: 0;
}

.agent-hierarchy-head p {
    margin-top: 6px;
    color: var(--text-soft);
}

.agent-hierarchy-surface {
    width: min(100%, 980px);
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(3, 14, 27, 0.44);
    overflow: hidden;
}

.agent-child-invitations {
    display: grid;
    gap: 12px;
    margin-top: 24px;
    min-width: 0;
}

.agent-child-invitations > h3,
.agent-child-invitations > p,
.child-invitation-card > p {
    margin: 0;
}

.agent-child-invitation-form,
.child-invitation-card {
    display: grid;
    gap: 12px;
    padding: 16px;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(3, 14, 27, 0.44);
}

.agent-child-invitation-form[hidden] {
    display: none;
}

.agent-child-invitation-form label,
.child-invitation-link {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.agent-child-invitation-form input,
.child-invitation-link input {
    width: 100%;
    min-width: 0;
}

#agent-child-invitations-list {
    display: grid;
    gap: 12px;
    min-width: 0;
}

.child-invitation-card > strong,
.child-invitation-error,
.child-invitation-stages dd {
    overflow-wrap: anywhere;
}

.child-invitation-error,
.child-invitation-stages [data-state="error"],
#agent-child-invitation-message[data-state="error"] {
    color: var(--red);
}

.agent-hierarchy-context,
.agent-hierarchy-tree,
.agent-hierarchy-lower {
    display: grid;
    gap: 8px;
}

.agent-hierarchy-tree {
    margin-top: 8px;
}

.agent-hierarchy-lower {
    margin-top: 12px;
}

.agent-hierarchy-label {
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.agent-hierarchy-root-group,
.agent-hierarchy-group {
    display: grid;
    gap: 2px;
    min-width: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.agent-hierarchy-group[hidden] {
    display: none;
}

.agent-hierarchy-treeitem {
    position: relative;
    min-width: 0;
}

.agent-hierarchy-row {
    position: relative;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    align-items: center;
    min-width: 0;
    min-height: 54px;
    padding: 5px 10px 5px calc(10px + var(--tree-level, 0) * 22px);
    border-radius: 6px;
}

.agent-hierarchy-treeitem > .agent-hierarchy-row::before {
    content: '';
    position: absolute;
    top: 50%;
    left: calc(4px + var(--tree-level, 0) * 22px);
    width: 14px;
    border-top: 1px solid rgba(128, 153, 188, 0.24);
}

.agent-hierarchy-row:hover {
    background: rgba(130, 161, 204, 0.06);
}

.agent-hierarchy-current {
    --tree-level: 0;
    border-top: 1px solid rgba(128, 153, 188, 0.14);
    border-bottom: 1px solid rgba(128, 153, 188, 0.14);
}

.agent-hierarchy-superior {
    --tree-level: 0;
}

.agent-hierarchy-toggle,
.agent-hierarchy-toggle-spacer {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
}

.agent-hierarchy-toggle {
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-soft);
    cursor: pointer;
}

.agent-hierarchy-toggle:hover,
.agent-hierarchy-toggle:focus-visible {
    color: var(--text-main);
    background: rgba(130, 161, 204, 0.1);
}

.agent-hierarchy-identity {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.agent-hierarchy-name {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    align-items: center;
    min-width: 0;
    color: var(--text-main);
    font-weight: 800;
    line-height: 1.3;
}

.agent-hierarchy-current-badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 0 8px;
    border: 1px solid rgba(76, 137, 255, 0.28);
    border-radius: 999px;
    color: #8fb7ff;
    background: rgba(49, 105, 207, 0.13);
    font-size: 11px;
    font-weight: 800;
}

.agent-hierarchy-id {
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--text-soft);
    font-family: var(--mono);
    font-size: 12px;
}

.agent-hierarchy-empty {
    margin: 6px 0 0 54px;
    color: var(--text-soft);
}

.hierarchy-controls {
    display: grid;
    grid-template-columns: minmax(260px, 480px) 150px 140px;
    width: min(100%, 820px);
    margin-bottom: 16px;
}

.hierarchy-controls.admin-agent-controls {
    grid-template-columns: minmax(320px, 1fr) minmax(130px, auto) minmax(130px, auto);
    width: min(100%, 900px);
}

.hierarchy-modal {
    width: min(980px, calc(100vw - 32px));
    max-height: min(720px, calc(100vh - 32px));
    overflow: auto;
    padding: 22px;
}

.admin-agent-create-modal {
    width: min(820px, calc(100vw - 32px));
    max-height: min(760px, calc(100vh - 32px));
    overflow: auto;
    padding: 22px;
}

.admin-agent-header-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.admin-agent-header-actions .btn {
    min-width: 190px;
}

.admin-agent-password-reset-modal {
    width: min(640px, calc(100vw - 32px));
    max-height: min(620px, calc(100vh - 32px));
    overflow: auto;
    padding: 22px;
}

.admin-agent-password-reset-form {
    display: grid;
    gap: 14px;
}

.admin-agent-password-reset-help {
    margin: -2px 0 0;
}

.admin-agent-password-reset-submit {
    display: flex;
    align-items: center;
    gap: 14px;
}

.admin-agent-password-reset-submit .btn {
    min-width: 190px;
}

#admin-agent-password-reset-message[data-state="error"] {
    color: #ff8b8b;
}

#admin-agent-password-reset-message[data-state="success"] {
    color: var(--green);
}

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

.admin-agent-create-projects,
.admin-agent-create-submit {
    grid-column: 1 / -1;
}

.admin-agent-create-submit {
    display: flex;
    align-items: center;
    gap: 14px;
}

.admin-agent-create-submit .btn {
    min-width: 220px;
}

.admin-agent-created-password {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.admin-agent-created-password strong {
    flex: 1;
}

#admin-agent-create-message[data-state="error"] {
    color: #ff8b8b;
}

#admin-agent-create-message[data-state="success"] {
    color: var(--green);
}

.hierarchy-modal-header {
    align-items: center;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(115, 147, 198, 0.14);
    margin-bottom: 16px;
}

.hierarchy-modal-header h3 {
    margin-top: 2px;
}

.hierarchy-modal-controls {
    width: 100%;
    margin-bottom: 14px;
    padding: 12px;
    border: 1px solid rgba(115, 147, 198, 0.12);
    border-radius: 14px;
    background: rgba(6, 19, 35, 0.38);
}

.hierarchy-modal-controls .control {
    min-width: 160px;
}

.hierarchy-modal-grid {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 14px;
    margin-top: 0;
}

.hierarchy-modal .hierarchy-section {
    padding: 14px;
    border: 1px solid rgba(115, 147, 198, 0.12);
    border-radius: 14px;
    background: rgba(3, 14, 27, 0.42);
}

.hierarchy-modal .mini-list {
    min-height: 172px;
    max-height: 360px;
    overflow: auto;
    margin-top: 10px;
}

.hierarchy-modal .hierarchy-empty {
    min-height: 156px;
    padding: 18px;
    border-radius: 12px;
}

.method-builder {
    display: grid;
    gap: 12px;
}

.fake-field {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 10px;
}

.empty-state {
    display: grid;
    place-items: center;
    min-height: 180px;
    color: var(--text-muted);
    text-align: center;
}

.hierarchy-empty {
    min-height: 120px;
    padding: 18px;
}

.mobile-only {
    display: none;
}

@media (max-width: 1280px) {
    :root {
        --right-rail: 300px;
        --sidebar: 250px;
    }

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

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

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

    .ledger-scope {
        grid-template-columns: 1fr;
    }

    .agent-topup-history-head {
        grid-template-columns: 1fr;
    }

    .advanced-order-filters {
        grid-template-columns: repeat(3, minmax(130px, 1fr));
    }

    .ledger-account-record,
    .ledger-entry-record,
    .topup-record,
    .topup-record-with-agent {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .ledger-transaction-head {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .ledger-record-main,
    .ledger-record-meta {
        grid-column: span 2;
    }

    .ledger-record-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 1040px) {
    .mobile-only {
        display: inline-flex;
    }

    .content,
    .login-shell,
    .admin-grid,
    .hierarchy-grid,
    .registration-grid {
        grid-template-columns: 1fr;
    }

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

    .app-shell {
        display: block;
    }

    .workspace {
        grid-column: auto;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 120;
        width: min(86vw, 340px);
        height: 100vh;
        height: 100svh;
        max-height: 100svh;
        border-right: 1px solid var(--line);
        border-bottom: 0;
        padding-bottom: max(18px, env(safe-area-inset-bottom));
        overflow-y: auto;
        overscroll-behavior: contain;
        transform: translateX(-105%);
        transition: transform 0.22s ease;
        box-shadow: 24px 0 70px rgba(0, 0, 0, 0.48);
    }

    .sidebar.is-open {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 110;
        display: block;
        border: 0;
        background: rgba(0, 0, 0, 0.52);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.22s ease;
    }

    .sidebar-backdrop.is-open {
        opacity: 1;
        pointer-events: auto;
    }

    body.sidebar-open {
        overflow: hidden;
    }

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

    .support-card {
        display: none;
    }

    .blacklist-form .metadata-field {
        grid-column: auto;
    }

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

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

    .rating-metric-toggle,
    .rating-metric-rule {
        grid-column: span 2;
    }

    .rating-star-editor {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .payment-method-form .agent-picker-field,
    .payment-method-form .json-field,
    .fields-schema-builder {
        grid-column: span 2;
    }

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

    .commission-rate-form .commission-rate-target-kind,
    .commission-rate-form .commission-target-value,
    .commission-rate-form .commission-rate-agent,
    .commission-rate-form .commission-rate-platform,
    .commission-rate-submit {
        grid-column: span 2;
    }

    .commission-rate-form .commission-rate-operation,
    .commission-rate-form .commission-rate-project,
    .commission-rate-form .commission-rate-currency,
    .commission-rate-form .commission-rate-status-field {
        grid-column: span 1;
    }

    .admin-test-order-bar {
        grid-template-columns: 1fr;
    }

    .admin-test-order-controls {
        grid-template-columns: minmax(260px, 1fr) minmax(120px, 160px) auto;
    }

    .order-detail-grid,
    .admin-agent-controls,
    .hierarchy-controls.admin-agent-controls,
    .admin-agent-statuses,
    .admin-agent-list-card .admin-agent-statuses,
    .admin-agent-facts,
    .admin-agent-details-form,
    .admin-balance-adjustment-form,
    .admin-balance-preview .detail-table,
    .agent-direction-settings {
        grid-template-columns: 1fr;
    }

    .admin-agent-details-submit,
    .admin-agent-details-message {
        grid-column: auto;
        grid-row: auto;
    }

    .choice-group,
    .schema-field-grid,
    .schema-preview-form,
    .requisite-schema-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 851px) and (max-width: 1040px) {
    .login-shell {
        grid-template-columns: minmax(0, 1fr) minmax(400px, 480px);
        width: min(960px, calc(100vw - 40px));
        gap: 32px;
        padding: 32px 0;
    }

    .login-hero {
        padding: 32px 10px;
    }

    .login-title {
        margin-top: 52px;
        font-size: 40px;
    }

    .login-card {
        max-width: 480px;
        justify-self: end;
    }
}

@media (min-width: 851px) and (max-width: 950px) {
    .login-shell {
        grid-template-columns: minmax(0, 1fr) minmax(400px, 420px);
    }

    .login-title {
        font-size: 36px;
    }
}

@media (max-width: 850px) {
    .login-shell {
        grid-template-columns: 1fr;
    }

    .login-hero {
        min-height: auto;
        padding: 24px 18px 10px;
    }

    .login-title {
        margin-top: 36px;
        font-size: 36px;
    }

    .login-card {
        max-width: 620px;
        justify-self: center;
    }
}

@media (max-width: 900px) {
    .content {
        padding-left: 20px;
        padding-right: 20px;
    }

    .panel-header {
        display: grid;
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .admin-ledger-header-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-ledger-header-actions .btn {
        width: 100%;
        min-width: 0;
    }

    .panel-header .filters,
    .filters {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }

    .panel-header:has(.advanced-order-filters) {
        grid-template-columns: 1fr;
    }

    .panel-header .advanced-order-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #admin-p2p-orders .filters {
        justify-content: stretch;
    }

    .admin-test-order-controls {
        grid-template-columns: minmax(0, 1fr) minmax(120px, 160px);
    }

    .admin-test-order-controls .btn {
        grid-column: 1 / -1;
        width: 100%;
    }

    .filters select,
    .filters input,
    .filters .btn,
    .filters .source-pill,
    .filters .currency-filter-control {
        width: 100%;
        min-width: 0;
        max-width: none;
    }

    .hierarchy-controls,
    .hierarchy-controls.admin-agent-controls {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }

    .admin-agent-create-form {
        grid-template-columns: 1fr;
    }

    .admin-agent-create-projects,
    .admin-agent-create-submit {
        grid-column: auto;
    }

    .admin-agent-create-submit,
    .admin-agent-created-password {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-agent-create-submit .btn {
        min-width: 0;
        width: 100%;
    }

    .admin-agent-header-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        justify-content: stretch;
    }

    .admin-agent-header-actions .btn {
        width: 100%;
        min-width: 0;
    }

    .admin-agent-password-reset-submit {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-agent-password-reset-submit .btn {
        width: 100%;
        min-width: 0;
    }

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

    .commission-rate-header {
        display: grid;
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .login-title {
        font-size: 36px;
    }

    .profile-overview {
        grid-template-columns: 1fr;
    }

    .profile-overview .profile-section + .profile-section {
        border-top: 1px solid rgba(115, 147, 198, 0.14);
        border-left: 0;
    }

    .profile-condition-grid {
        grid-template-columns: 1fr;
    }

    .profile-condition-grid > div,
    .profile-condition-grid > div:first-child,
    .profile-condition-grid > div:last-child {
        padding: 14px 0;
    }

    .profile-condition-grid > div:first-child {
        padding-top: 0;
    }

    .profile-condition-grid > div:last-child {
        padding-bottom: 0;
    }

    .profile-condition-grid > div + div {
        border-top: 1px solid rgba(115, 147, 198, 0.14);
        border-left: 0;
    }
}

@media (max-width: 680px) {
    .admin-ledger-header-actions {
        grid-template-columns: 1fr;
    }

    .app-shell {
        width: 100%;
    }

    .hierarchy-modal {
        width: 100%;
        max-height: calc(100vh - 28px);
        padding: 16px;
    }

    .admin-agent-password-reset-modal {
        width: 100%;
        max-height: calc(100vh - 28px);
        padding: 16px;
    }

    .admin-agent-header-actions {
        grid-template-columns: 1fr;
    }

    .panel-header .advanced-order-filters {
        grid-template-columns: 1fr;
    }

    .hierarchy-modal-header {
        display: grid;
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .hierarchy-modal-header .btn,
    .hierarchy-modal-controls .control,
    .hierarchy-modal-controls .btn {
        width: 100%;
    }

    .hierarchy-modal-controls {
        display: grid;
        grid-template-columns: 1fr;
    }

    .merchant-detail-grid {
        grid-template-columns: 1fr;
    }

    .login-shell,
    .content {
        width: 100%;
        padding: 14px;
        gap: 14px;
    }

    .login-hero {
        min-height: auto;
        padding: 24px 18px 10px;
    }

    .login-title {
        margin-top: 36px;
        font-size: 36px;
    }

    .login-card {
        max-width: 620px;
        justify-self: center;
    }

    .login-preview,
    .metric-grid,
    .nav-list {
        grid-template-columns: 1fr;
    }

    .sidebar {
        padding: 18px;
    }

    .platform-mark {
        font-size: 14px;
    }

    .admin-test-order-controls {
        grid-template-columns: 1fr;
    }

    .admin-test-order-message {
        text-align: left;
    }

    .side-profile {
        grid-template-columns: 56px minmax(0, 1fr);
        margin: 22px 0 18px;
    }

    .avatar {
        width: 56px;
        height: 56px;
        font-size: 24px;
    }

    .shift-pill {
        margin-bottom: 18px;
        font-size: 16px;
    }

    .topbar {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 14px;
        padding: 18px;
        min-height: auto;
        align-items: start;
    }

    .topbar > div:first-child {
        min-width: 0;
    }

    .panel,
    .rail-card,
    .metric-card {
        padding: 16px;
        border-radius: 16px;
    }

    .panel-header {
        display: grid;
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .panel-title {
        flex-wrap: wrap;
    }

    .panel h2,
    .rail-card h2 {
        font-size: 20px;
    }

    .profile-page-header h1 {
        font-size: 26px;
    }

    .profile-summary {
        grid-template-columns: 56px minmax(0, 1fr);
        padding: 16px;
    }

    .profile-summary-avatar {
        grid-row: 1 / span 2;
        width: 56px;
        height: 56px;
        font-size: 21px;
    }

    .profile-summary-identity h2 {
        font-size: 20px;
    }

    .profile-summary-rating {
        grid-column: 2;
        flex-wrap: wrap;
        gap: 7px;
    }

    .profile-summary-rating strong {
        font-size: 18px;
    }

    .profile-overview .profile-section,
    .profile-working-conditions,
    .profile-system-information {
        padding: 16px;
    }

    .profile-data-row {
        grid-template-columns: 96px minmax(0, 1fr) 38px;
        gap: 9px;
    }

    .profile-fact-row {
        grid-template-columns: minmax(116px, 0.9fr) minmax(0, 1.1fr);
        gap: 10px;
    }

    .filters {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr;
    }

    .topbar-actions {
        width: auto;
        gap: 8px;
        justify-self: end;
        justify-content: flex-end;
    }

    .filters select,
    .filters input,
    .filters .source-pill,
    .btn {
        width: 100%;
    }

    .topbar-actions .btn,
    .topbar-actions .notification-button,
    .topbar-actions .mobile-menu-button,
    .topbar-actions .language-selector {
        width: auto;
        flex: 0 0 auto;
    }

    .topbar-actions .sound-toggle,
    .topbar-actions .language-selector {
        flex: 0 0 auto;
    }

    .hierarchy-controls,
    .hierarchy-controls.admin-agent-controls,
    .admin-agent-list-grid {
        grid-template-columns: 1fr;
    }

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

    .registration-actions,
    .profile-grid,
    .quick-grid,
    .blacklist-form,
    .payment-method-form,
    .method-detail-grid,
    .registration-card .split,
    .mini-row .split {
        display: grid;
        grid-template-columns: 1fr;
    }

    .payment-method-form .json-field {
        grid-column: auto;
    }

    .payment-method-form .agent-picker-field {
        grid-column: auto;
    }

    .payment-method-form .agent-requisite-method-field {
        grid-column: auto;
    }

    .payment-method-form .metadata-field,
    .rating-config-form .metadata-field {
        grid-column: auto;
    }

    .agent-rating-hero,
    .agent-rating-facts {
        grid-template-columns: 1fr;
    }

    .rating-metrics-head {
        display: grid;
        align-items: start;
    }

    .rating-metric-row,
    .rating-star-editor {
        grid-template-columns: 1fr;
    }

    .rating-metric-toggle,
    .rating-metric-rule {
        grid-column: auto;
    }

    .agent-rating-metric {
        grid-template-columns: 1fr;
    }

    .agent-rating-metric > div:last-child {
        text-align: left;
    }

    .commission-rate-filters,
    .commission-rate-form,
    .commission-rate-submit {
        grid-template-columns: 1fr;
    }

    .commission-rate-form .commission-rate-target-kind,
    .commission-rate-form .commission-target-value,
    .commission-rate-form .commission-rate-operation,
    .commission-rate-form .commission-rate-project,
    .commission-rate-form .commission-rate-currency,
    .commission-rate-form .commission-rate-agent,
    .commission-rate-form .commission-rate-platform,
    .commission-rate-form .commission-rate-status-field,
    .commission-rate-submit {
        grid-column: auto;
    }

    .commission-rate-header .btn,
    .commission-rate-submit .btn {
        width: 100%;
    }

    .compact-orders-table,
    .compact-orders-table thead,
    .compact-orders-table tbody,
    .compact-orders-table tr,
    .compact-orders-table td,
    .commission-rate-table,
    .commission-rate-table thead,
    .commission-rate-table tbody,
    .commission-rate-table tr,
    .commission-rate-table td {
        display: block;
        width: 100%;
        min-width: 0;
    }

    .compact-orders-table thead,
    .commission-rate-table thead {
        display: none;
    }

    .compact-orders-table tr,
    .commission-rate-table tr {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px 12px;
        padding: 14px;
        border-bottom: 1px solid rgba(115, 147, 198, 0.14);
    }

    .compact-orders-table tr:last-child,
    .commission-rate-table tr:last-child {
        border-bottom: 0;
    }

    .compact-orders-table td,
    .commission-rate-table td {
        padding: 0;
        border-bottom: 0;
    }

    .compact-orders-table td:nth-child(4),
    .compact-orders-table td:nth-child(5),
    .compact-orders-table td:nth-child(6),
    .commission-rate-table td:nth-child(1),
    .commission-rate-table td:nth-child(5),
    .commission-rate-table td:nth-child(7),
    .commission-rate-table td:nth-child(8) {
        grid-column: 1 / -1;
    }

    .compact-orders-table .table-action-cell,
    .commission-rate-table .payment-method-action-cell {
        min-width: 0;
        white-space: normal;
    }

    .compact-orders-table .table-action-cell .btn,
    .commission-rate-table .payment-method-action-cell .btn {
        width: 100%;
    }

    .fields-schema-builder {
        grid-column: auto;
    }

    .choice-group,
    .schema-field-grid,
    .schema-preview-form,
    .requisite-schema-grid {
        grid-template-columns: 1fr;
    }

    .schema-builder-head,
    .schema-preview-head,
    .schema-field-header {
        display: grid;
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .payment-method-detail-modal {
        width: 100%;
        max-height: calc(100vh - 28px);
        padding: 16px;
    }

    .ledger-section-head {
        display: grid;
        grid-template-columns: 1fr;
    }

    .admin-agent-history-filters,
    .admin-agent-history-facts {
        grid-template-columns: 1fr;
    }

    .admin-agent-history-filters .btn {
        width: 100%;
    }

    .admin-agent-history-record {
        padding: 14px;
    }

    .ledger-summary-grid,
    .settlement-filters,
    .settlement-summary-grid,
    .ledger-scope-controls,
    .agent-topup-period-controls {
        grid-template-columns: 1fr;
    }

    .ledger-detail-modal {
        width: 100%;
        max-height: calc(100vh - 28px);
        padding: 16px;
    }

    .ledger-account-record,
    .ledger-entry-record,
    .ledger-transaction-head {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .ledger-record-main,
    .ledger-record-meta {
        grid-column: auto;
    }

    .ledger-record {
        padding: 14px;
    }

    .ledger-record-actions .btn {
        max-width: none;
    }

    .method-detail-summary {
        grid-template-columns: 1fr;
    }

    .agent-resource-meta {
        justify-items: start;
        text-align: left;
    }

    .method-detail-statuses {
        justify-content: flex-start;
    }

    .detail-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .detail-row > div {
        grid-template-columns: 1fr;
    }

    .detail-row.with-badge > div {
        grid-template-columns: 1fr;
    }

    .registration-details {
        grid-template-columns: 1fr;
    }

    .detail-row .status-badge {
        width: auto;
        justify-content: flex-start;
    }

    .registration-details {
        min-height: 0;
    }

    .registration-grid {
        gap: 10px;
    }
}

@media (max-width: 680px) {
    .table-wrap .compact-orders-table {
        display: table;
        width: 100%;
        min-width: 760px;
    }

    .table-wrap .compact-orders-table thead {
        display: table-header-group;
    }

    .table-wrap .compact-orders-table tbody {
        display: table-row-group;
    }

    .table-wrap .compact-orders-table tr {
        display: table-row;
        padding: 0;
        border-bottom: 0;
    }

    .table-wrap .compact-orders-table th,
    .table-wrap .compact-orders-table td {
        display: table-cell;
        width: auto;
        padding: 12px 14px;
        border-bottom: 1px solid rgba(115, 147, 198, 0.12);
    }

    .table-wrap .compact-orders-table td:nth-child(4),
    .table-wrap .compact-orders-table td:nth-child(5),
    .table-wrap .compact-orders-table td:nth-child(6) {
        grid-column: auto;
    }
}

@media (max-width: 480px) {
    .login-shell {
        width: 100%;
        min-height: auto;
        padding: 12px;
    }

    .login-card,
    .login-hero {
        padding: 22px;
    }

    .login-title {
        font-size: 32px;
        letter-spacing: 0;
    }

    .login-lead {
        font-size: 15px;
    }

    .login-card {
        padding: 26px 22px;
    }

    .language-switcher-floating {
        top: 12px;
        right: 12px;
    }

    .environment-badge {
        left: 12px;
        bottom: 12px;
    }

    .content,
    .topbar,
    .sidebar {
        padding-left: 12px;
        padding-right: 12px;
    }

    .metric-card {
        grid-template-columns: 48px minmax(0, 1fr);
    }

    .metric-value {
        font-size: 24px;
    }
}

@media (max-width: 360px) {
    .login-title {
        font-size: 24px;
    }
}

/* Agent workspace */
.ui-icon {
    display: block;
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
}

.app-shell-agent .sidebar {
    background: #03111f;
}

.app-shell-agent .platform-mark {
    gap: 11px;
    font-size: 15px;
}

.app-shell-agent .agent-side-profile {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 12px;
    margin: 24px 0 16px;
}

.app-shell-agent .agent-side-profile .avatar {
    width: 48px;
    height: 48px;
    font-size: 20px;
}

.app-shell-agent .agent-side-profile h2 {
    overflow: hidden;
    font-size: 16px;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-shell-agent .agent-side-profile p {
    margin-top: 3px;
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agent-rating-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
    align-items: center;
    padding: 13px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    color: var(--text-soft);
    font-size: 13px;
}

.agent-rating-summary strong {
    color: var(--text);
    font-size: 14px;
}

.agent-level-badge {
    padding: 3px 7px;
    border: 1px solid rgba(21, 209, 111, 0.24);
    border-radius: 6px;
    color: var(--green);
    background: rgba(21, 209, 111, 0.09);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.agent-shift-control {
    margin-top: 14px;
}

.agent-shift-toggle {
    display: flex;
    width: 100%;
    min-height: 64px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text-soft);
    background: #071727;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.16s ease, background 0.16s ease;
}

.agent-shift-toggle:hover:not(:disabled),
.agent-shift-toggle:focus-visible {
    border-color: rgba(79, 140, 255, 0.58);
    outline: none;
}

.agent-shift-toggle.is-on {
    border-color: rgba(21, 209, 111, 0.34);
    background: rgba(8, 43, 41, 0.72);
}

.agent-shift-toggle:disabled {
    cursor: not-allowed;
    opacity: 0.62;
}

.agent-shift-copy {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.agent-shift-copy strong {
    color: var(--text);
    font-size: 14px;
}

.agent-shift-toggle.is-on .agent-shift-copy strong {
    color: var(--green);
}

.agent-shift-copy small {
    color: var(--text-muted);
    font-size: 10px;
    line-height: 1.3;
}

.agent-switch-track {
    position: relative;
    width: 38px;
    height: 22px;
    flex: 0 0 38px;
    border-radius: 999px;
    background: #495568;
    transition: background 0.16s ease;
}

.agent-switch-track span {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #f3f6fb;
    transition: transform 0.16s ease;
}

.agent-shift-toggle.is-on .agent-switch-track {
    background: #13a95d;
}

.agent-shift-toggle.is-on .agent-switch-track span {
    transform: translateX(16px);
}

.agent-shift-message {
    display: grid;
    gap: 2px;
    min-height: 14px;
    margin: 6px 2px 0;
    color: var(--text-muted);
    font-size: 10px;
}

.agent-shift-message[data-state="error"] {
    color: #ff9aa6;
}

.app-shell-agent .nav-list {
    gap: 4px;
    margin-top: 12px;
}

.app-shell-agent .nav-item {
    min-height: 44px;
    border-radius: 7px;
    font-size: 14px;
}

.app-shell-agent .nav-item.active,
.app-shell-agent .nav-item:hover {
    background: rgba(18, 103, 255, 0.78);
}

.app-shell-agent .topbar {
    min-height: 82px;
    background: #03111f;
    backdrop-filter: none;
}

.app-shell-agent .topbar h1 {
    font-size: 22px;
}

.app-shell-agent .topbar > div:first-child > p {
    font-size: 13px;
}

.app-shell-agent .content-wide {
    width: min(100%, 1540px);
    padding-top: 22px;
}

.app-shell-agent .main-column {
    gap: 16px;
}

.app-shell-agent .panel {
    border-radius: 8px;
    background: #091b2f;
}

.app-shell-agent .language-selector,
.app-shell-agent .notification-button,
.agent-user-trigger {
    min-height: 42px;
    border-radius: 8px;
    background: #071727;
}

.app-shell-agent .notification-button.sound-toggle {
    position: relative;
    display: grid;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    padding: 0;
    place-items: center;
}

.app-shell-agent .notification-button .notification-icon {
    position: static;
    display: block;
    width: auto;
    min-width: 0;
    height: auto;
    border-radius: 0;
    color: var(--text-soft);
    background: transparent;
    font-size: inherit;
}

.app-shell-agent .notification-button.is-active .notification-icon {
    color: var(--green);
}

.app-shell-agent .notification-button .notification-count {
    position: absolute;
    top: -5px;
    right: -5px;
    display: grid;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    place-items: center;
    border: 2px solid #03111f;
    border-radius: 999px;
    color: #fff;
    background: var(--red);
    font-size: 9px;
    font-weight: 900;
}

.agent-user-menu {
    position: relative;
    min-width: 0;
}

.agent-user-trigger {
    display: inline-flex;
    width: 100%;
    min-height: 44px;
    max-width: 250px;
    align-items: center;
    gap: 9px;
    padding: 0 12px;
    border: 1px solid var(--line);
    color: var(--text);
    font-weight: 750;
    text-align: left;
    cursor: pointer;
}

.agent-account-identity {
    display: grid;
    min-width: 0;
    gap: 2px;
    line-height: 1.2;
}

.agent-account-identity > :is(strong, small) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agent-account-identity small {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
}

.agent-user-trigger[aria-expanded="true"] .agent-user-chevron {
    transform: rotate(180deg);
}

.agent-user-chevron {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    transition: transform 0.16s ease;
}

.agent-user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 150;
    width: min(278px, calc(100vw - 24px));
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #071727;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.38);
}

.agent-user-dropdown[hidden] {
    display: none;
}

.agent-user-dropdown a,
.agent-user-dropdown button {
    display: flex;
    width: 100%;
    min-height: 44px;
    align-items: center;
    gap: 10px;
    padding: 0 10px;
    border: 0;
    border-radius: 6px;
    color: var(--text-soft);
    background: transparent;
    font: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}

.agent-user-dropdown a:hover,
.agent-user-dropdown button:not(:disabled):hover,
.agent-user-dropdown a:focus-visible,
.agent-user-dropdown button:focus-visible {
    color: var(--text);
    background: rgba(79, 140, 255, 0.13);
    outline: none;
}

.agent-user-divider {
    height: 1px;
    margin: 5px 4px;
    background: var(--line);
}

.agent-user-dropdown .agent-user-logout {
    color: #ff9aa6;
}

.agent-user-menu-error {
    margin: 4px 10px;
    color: #ff9aa6;
    font-size: 13px;
}

.agent-user-accounts {
    display: grid;
    max-height: 190px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.agent-user-accounts p {
    margin: 0;
    padding: 10px;
}

.agent-account-choice .ui-icon,
.agent-user-trigger > .ui-icon {
    flex-shrink: 0;
}

.agent-user-accounts .agent-account-choice[aria-current="true"] {
    color: var(--text);
    background: rgba(79, 140, 255, 0.1);
    cursor: default;
}

.agent-account-current {
    flex-shrink: 0;
    margin-left: auto;
    color: var(--text-muted);
    font-size: 11px;
}

.agent-entry-shell {
    grid-template-columns: minmax(0, 1fr);
    width: min(500px, calc(100vw - 24px));
    min-height: 100svh;
    padding: 64px 0 24px;
}

.agent-entry-card {
    min-width: 0;
}

.agent-order-link-accounts,
.agent-entry-actions {
    display: grid;
    gap: 8px;
    margin-top: 18px;
}

.agent-order-link-accounts .agent-account-choice {
    display: flex;
    width: 100%;
    min-height: 48px;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    background: #091b2f;
    text-align: left;
    cursor: pointer;
}

.agent-order-link-accounts .agent-account-choice:is(:hover, :focus-visible) {
    border-color: var(--blue-2);
    background: rgba(79, 140, 255, 0.13);
}

.agent-entry-actions .btn {
    min-height: 44px;
}

.agent-kpi-strip {
    display: grid;
    grid-auto-columns: calc((100% - 78px) / 3);
    grid-auto-flow: column;
    gap: 14px;
    overflow-x: auto;
    padding: 0 0 8px;
    scroll-snap-type: x proximity;
    scrollbar-color: rgba(115, 147, 198, 0.34) transparent;
    scrollbar-width: thin;
    cursor: grab;
    overscroll-behavior-inline: contain;
}

.agent-kpi-strip.is-dragging {
    cursor: grabbing;
    scroll-snap-type: none;
    user-select: none;
}

.agent-kpi-card {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 14px;
    min-height: 112px;
    align-items: center;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #091b2f;
    scroll-snap-align: start;
}

.agent-kpi-icon {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 8px;
    color: var(--blue-2);
    background: rgba(79, 140, 255, 0.12);
}

.agent-kpi-card.is-red .agent-kpi-icon {
    color: #ff8492;
    background: rgba(255, 91, 107, 0.12);
}

.agent-kpi-card.is-green .agent-kpi-icon {
    color: var(--green);
    background: rgba(21, 209, 111, 0.1);
}

.agent-kpi-card.is-cyan .agent-kpi-icon {
    color: #59d4dd;
    background: rgba(89, 212, 221, 0.1);
}

.agent-kpi-card.is-violet .agent-kpi-icon {
    color: #b79bff;
    background: rgba(183, 155, 255, 0.1);
}

.agent-kpi-label {
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 750;
}

.agent-kpi-value {
    margin-top: 6px;
    color: var(--text);
    font-size: 27px;
    font-weight: 900;
    line-height: 1;
}

.agent-kpi-detail {
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 12px;
}

.agent-finance-panel {
    padding: 16px 20px 18px;
}

.agent-finance-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.agent-finance-heading h2 {
    margin: 0;
    font-size: 19px;
}

.agent-finance-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(170px, 0.9fr);
    align-items: stretch;
    min-width: 0;
}

.agent-finance-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 4px 12px;
    border-left: 1px solid var(--line);
}

.agent-finance-item:first-child {
    border-left: 0;
    padding-left: 0;
}

.agent-finance-icon {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 8px;
}

.agent-finance-icon .ui-icon {
    width: 21px;
    height: 21px;
}

.agent-finance-icon.is-withdraw {
    color: #f2c230;
    background: rgba(242, 194, 48, 0.12);
}

.agent-finance-icon.is-deposit {
    color: var(--green);
    background: rgba(21, 209, 111, 0.1);
}

.agent-finance-icon.is-collateral {
    color: #2f96ff;
    background: rgba(47, 150, 255, 0.12);
}

.agent-finance-icon.is-commission {
    color: #b563ff;
    background: rgba(181, 99, 255, 0.12);
}

.agent-finance-value {
    display: grid;
    gap: 7px;
    min-width: 0;
}

.agent-finance-value > span,
.agent-finance-usage > span {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
}

.agent-finance-value > strong {
    max-width: 100%;
    color: var(--text);
    font-size: 16px;
    line-height: 1.2;
    white-space: nowrap;
}

.agent-finance-usage {
    display: grid;
    align-content: center;
    gap: 8px;
    min-width: 0;
    padding: 4px 0 4px 20px;
    border-left: 1px solid var(--line);
}

.agent-finance-usage > strong {
    color: var(--text);
    font-size: 17px;
}

.agent-finance-progress {
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(115, 147, 198, 0.16);
}

.agent-finance-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--blue-2);
}

.agent-finance-empty {
    margin: 0;
    color: var(--text-muted);
}

.agent-resource-page {
    display: grid;
    gap: 14px;
    width: 100%;
    max-width: 1320px;
    min-width: 0;
}

.agent-resource-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-width: 0;
}

.agent-resource-list-header h2 {
    margin: 0;
    font-size: 22px;
    line-height: 1.2;
}

.agent-resource-list-header .btn {
    flex: 0 0 auto;
}

.agent-payment-method-filters {
    align-items: flex-end;
    margin-bottom: 0;
}

.agent-payment-method-filters .field {
    flex: 1 1 220px;
    max-width: 320px;
}

.agent-resource-list {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.agent-resource-card {
    display: grid;
    grid-template-columns: minmax(300px, 1.45fr) minmax(210px, 0.8fr) minmax(132px, 0.52fr) minmax(134px, auto);
    grid-template-areas:
        "identity limits state actions"
        "message message message message";
    gap: 16px;
    align-items: center;
    min-width: 0;
    padding: 16px 18px;
    border: 1px solid rgba(115, 147, 198, 0.16);
    border-radius: 8px;
    background: rgba(6, 19, 35, 0.64);
}

.agent-requisite-card {
    grid-template-columns: minmax(360px, 1.5fr) minmax(220px, 0.75fr) minmax(150px, auto);
    grid-template-areas:
        "identity limits actions"
        "message message message";
}

.agent-resource-identity {
    grid-area: identity;
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    min-width: 0;
}

.agent-resource-icon {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border-radius: 8px;
}

.agent-resource-icon .ui-icon {
    width: 21px;
    height: 21px;
}

.agent-resource-icon.is-method {
    color: #67a1ff;
    background: rgba(79, 140, 255, 0.13);
}

.agent-resource-icon.is-requisite {
    color: #4dd99a;
    background: rgba(21, 209, 111, 0.1);
}

.agent-resource-identity-content,
.agent-resource-limits,
.agent-resource-state,
.agent-resource-actions {
    min-width: 0;
}

.agent-resource-identity-content {
    display: grid;
    gap: 7px;
}

.agent-resource-title-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.agent-resource-title {
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--text);
    font-size: 16px;
    line-height: 1.3;
}

.agent-resource-direction,
.agent-resource-technical {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-width: 0;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
}

.agent-resource-direction .type-badge {
    padding: 4px 7px;
    border: 1px solid rgba(115, 147, 198, 0.18);
    background: rgba(115, 147, 198, 0.08);
    color: var(--text-soft);
}

.agent-resource-direction .type-badge.deposit {
    border-color: rgba(89, 212, 221, 0.22);
    background: rgba(89, 212, 221, 0.09);
    color: #7bdce4;
}

.agent-resource-direction .type-badge.withdraw {
    border-color: rgba(183, 155, 255, 0.22);
    background: rgba(183, 155, 255, 0.09);
    color: #c7b5ff;
}

.agent-resource-technical > span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agent-resource-copy {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
}

.agent-resource-copy-button {
    display: grid;
    width: 32px;
    height: 32px;
    padding: 0;
    place-items: center;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}

.agent-resource-copy-button:hover,
.agent-resource-copy-button:focus-visible,
.agent-resource-copy-button[data-state="success"] {
    border-color: rgba(79, 140, 255, 0.28);
    background: rgba(79, 140, 255, 0.1);
    color: var(--text);
}

.agent-resource-copy-button .ui-icon {
    width: 16px;
    height: 16px;
}

.agent-resource-copy [data-agent-resource-copy-feedback] {
    position: absolute;
    z-index: 2;
    right: 0;
    bottom: calc(100% + 6px);
    width: max-content;
    max-width: 190px;
    padding: 5px 7px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #071729;
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 700;
    box-shadow: var(--shadow);
}

.agent-resource-copy [data-agent-resource-copy-feedback]:empty {
    display: none;
}

.agent-resource-limits {
    grid-area: limits;
    display: grid;
    gap: 5px;
    align-content: center;
}

.agent-resource-section-label,
.agent-requisite-fact dt {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 800;
}

.agent-resource-limits strong {
    overflow-wrap: anywhere;
    color: var(--text);
    font-size: 14px;
    line-height: 1.35;
}

.agent-resource-limits > span:last-child {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.4;
}

.agent-resource-state {
    grid-area: state;
    display: grid;
    justify-items: start;
    gap: 9px;
}

.agent-resource-state > strong {
    color: var(--text-soft);
    font-size: 13px;
}

.agent-resource-status {
    max-width: 100%;
}

.agent-resource-actions {
    grid-area: actions;
    display: grid;
    gap: 7px;
    align-content: center;
}

.agent-resource-actions:empty {
    display: none;
}

.agent-resource-actions .btn {
    width: 100%;
    min-width: 126px;
    min-height: 40px;
    gap: 7px;
    white-space: nowrap;
}

.agent-resource-actions .ui-icon {
    width: 16px;
    height: 16px;
}

.agent-resource-action-note {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.35;
    text-align: center;
}

.agent-resource-archive-action {
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
}

.agent-resource-archive-action:hover,
.agent-resource-archive-action:focus-visible {
    border-color: rgba(255, 91, 107, 0.22);
    background: rgba(255, 91, 107, 0.06);
    color: #ff929d;
}

.agent-resource-card .payment-method-action-message {
    grid-area: message;
    min-height: 0;
    margin: 0;
}

.agent-resource-card .payment-method-action-message:empty {
    display: none;
}

.agent-requisite-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 14px;
    min-width: 0;
    margin: 3px 0 0;
}

.agent-requisite-fact {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.agent-requisite-fact dd {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    margin: 0;
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 750;
}

.agent-requisite-fact dd > span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agent-requisite-empty {
    color: var(--text-muted);
    font-size: 12px;
}

.agent-resource-page > .payment-method-form {
    margin: 0;
    padding: 16px;
    border: 1px solid rgba(115, 147, 198, 0.16);
    border-radius: 8px;
    background: rgba(6, 19, 35, 0.64);
}

.agent-orders-page {
    min-width: 0;
    padding: 0;
    overflow: hidden;
}

.agent-orders-tabs {
    display: flex;
    align-items: end;
    gap: 28px;
    min-width: 0;
    padding: 0 24px;
    border-bottom: 1px solid rgba(115, 147, 198, 0.16);
}

.agent-orders-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 58px;
    padding: 0;
    border: 0;
    color: var(--text-muted);
    background: transparent;
    font: inherit;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
}

.agent-orders-tab::after {
    position: absolute;
    right: 0;
    bottom: -1px;
    left: 0;
    height: 2px;
    background: transparent;
    content: "";
}

.agent-orders-tab:hover,
.agent-orders-tab.is-active {
    color: var(--text);
}

.agent-orders-tab.is-active::after {
    background: #4f8cff;
}

.agent-orders-tab:focus-visible {
    border-radius: 4px;
    outline: 2px solid rgba(79, 140, 255, 0.8);
    outline-offset: 4px;
}

.agent-orders-tab-count {
    display: inline-grid;
    min-width: 24px;
    min-height: 22px;
    padding: 2px 7px;
    place-items: center;
    border: 1px solid rgba(115, 147, 198, 0.2);
    border-radius: 999px;
    color: var(--text-soft);
    background: rgba(115, 147, 198, 0.1);
    font-size: 11px;
    line-height: 1;
}

.agent-orders-tab.is-active .agent-orders-tab-count {
    border-color: rgba(79, 140, 255, 0.34);
    color: #b8d1ff;
    background: rgba(79, 140, 255, 0.14);
}

.agent-orders-tab-panel {
    min-width: 0;
    padding: 20px 24px 24px;
}

.agent-orders-tab-panel[hidden] {
    display: none;
}

.agent-order-filters {
    display: grid;
    grid-template-columns: minmax(132px, 0.75fr) minmax(150px, 0.8fr) minmax(132px, 0.72fr) minmax(330px, 1.6fr) auto;
    gap: 12px;
    align-items: end;
    margin: 0 0 18px;
    padding: 16px;
    border: 1px solid rgba(115, 147, 198, 0.14);
    border-radius: 7px;
    background: rgba(6, 19, 35, 0.46);
}

.agent-order-filter-field,
.agent-order-period-filter {
    display: grid;
    min-width: 0;
    gap: 7px;
}

.agent-order-filter-field > span,
.agent-order-period-filter legend {
    padding: 0;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 800;
}

.agent-order-period-filter {
    margin: 0;
    padding: 0;
    border: 0;
}

.agent-order-filters .control {
    width: 100%;
    min-width: 0;
    max-width: none;
    min-height: 42px;
}

.agent-order-date-range {
    display: grid;
    grid-template-columns: 18px minmax(120px, 1fr) auto minmax(120px, 1fr);
    gap: 8px;
    align-items: center;
    min-height: 42px;
    padding: 0 11px;
    border: 1px solid var(--control-line, rgba(115, 147, 198, 0.3));
    border-radius: 7px;
    background: rgba(3, 12, 24, 0.76);
}

.agent-order-date-range:focus-within {
    border-color: #4f8cff;
    box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.12);
}

.agent-order-date-range > .ui-icon {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.agent-order-date-range label {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 5px;
}

.agent-order-date-range label > span,
.agent-order-date-separator {
    color: var(--text-muted);
    font-size: 11px;
}

.agent-order-date-range input {
    width: 100%;
    min-width: 0;
    padding: 0;
    border: 0;
    color: var(--text-soft);
    background: transparent;
    font: inherit;
    font-size: 12px;
    outline: 0;
}

.agent-order-filter-actions {
    display: flex;
    gap: 8px;
}

.agent-order-filter-actions .btn {
    width: auto;
    min-width: 104px;
    min-height: 42px;
    padding-inline: 15px;
}

.agent-order-filter-actions .btn-ghost {
    border: 1px solid transparent;
    color: var(--text-soft);
    background: transparent;
}

.agent-order-filter-actions .btn-ghost:hover:not(:disabled) {
    border-color: rgba(115, 147, 198, 0.24);
    background: rgba(115, 147, 198, 0.08);
}

.agent-order-filter-actions .btn-ghost:disabled {
    color: var(--text-muted);
    opacity: 0.42;
    cursor: default;
}

.agent-orders-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 18px;
}

.agent-orders-pagination .btn {
    width: auto;
    min-height: 40px;
    padding-inline: 14px;
}

.agent-orders-page-number {
    color: var(--text-soft);
    font-size: 13px;
    white-space: nowrap;
}

.agent-orders-page-error {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    flex-basis: 100%;
    gap: 10px;
    color: var(--red);
    font-size: 13px;
}

.agent-order-advanced-filters {
    grid-column: 1 / -1;
    min-width: 0;
    border-top: 1px solid rgba(115, 147, 198, 0.12);
}

.agent-order-advanced-filters summary {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding-top: 13px;
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    list-style: none;
}

.agent-order-advanced-filters summary::-webkit-details-marker {
    display: none;
}

.agent-order-advanced-filters summary .ui-icon {
    width: 16px;
    height: 16px;
    color: #79a8ff;
}

.agent-order-amount-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(160px, 230px));
    gap: 12px;
    padding-top: 12px;
}

.agent-orders-page .table-wrap {
    max-width: 100%;
    overflow: auto;
    border: 1px solid rgba(115, 147, 198, 0.14);
    border-radius: 7px;
}

.agent-orders-page .compact-orders-table {
    min-width: 1040px;
}

.agent-orders-page .data-table th,
.agent-orders-page .data-table td {
    padding: 10px 12px;
}

.agent-orders-page .data-table th {
    height: 46px;
}

.agent-orders-page .data-table td {
    height: 62px;
    border-bottom-color: rgba(115, 147, 198, 0.11);
}

.agent-orders-page .data-table tr.order-urgent,
.agent-orders-page .data-table tr.order-urgent td {
    background: rgba(255, 91, 107, 0.018);
    outline: 0;
}

.agent-orders-page .type-badge {
    min-height: 25px;
    padding: 3px 9px;
    font-size: 11px;
}

.agent-orders-page .type-badge.deposit {
    color: #6fd4be;
    background: rgba(76, 181, 158, 0.12);
}

.agent-orders-page .type-badge.withdraw {
    color: #d5bc7b;
    background: rgba(197, 160, 75, 0.12);
}

.agent-order-amount-cell {
    color: var(--text);
    font-size: 14px;
    font-weight: 900;
    white-space: nowrap;
}

.agent-order-agent,
.agent-order-created {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.agent-order-agent strong {
    max-width: 180px;
    overflow: hidden;
    color: var(--text-soft);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agent-order-agent span,
.agent-order-agent-empty,
.agent-order-created small,
.agent-order-created-empty,
.agent-order-sla-empty {
    color: var(--text-muted);
    font-size: 11px;
}

.agent-order-table-sla {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.agent-order-table-sla .ui-icon {
    width: 15px;
    height: 15px;
}

.agent-order-table-sla.timer {
    color: var(--coral);
}

.agent-order-sla-overdue-icon {
    display: none;
}

.agent-order-table-sla.timer .agent-order-sla-overdue-icon {
    display: inline-flex;
}

.agent-order-created {
    color: var(--text-soft);
    font-size: 12px;
    font-style: normal;
    white-space: nowrap;
}

.agent-orders-page .table-action-cell {
    min-width: 300px;
}

.agent-orders-page .table-action-stack {
    flex-wrap: nowrap;
    align-items: center;
}

.agent-orders-page .table-action-cell .btn {
    width: auto;
    min-width: 106px;
    min-height: 36px;
    padding: 7px 12px;
    white-space: nowrap;
}

.agent-orders-empty {
    min-height: 220px;
    align-content: center;
    gap: 9px;
    padding: 24px;
}

.agent-orders-empty-icon {
    width: 34px;
    height: 34px;
    color: var(--text-muted);
}

.agent-orders-empty strong {
    color: var(--text);
    font-size: 15px;
}

.agent-orders-empty p {
    max-width: 300px;
    margin: 0;
    font-size: 12px;
}

@media (max-width: 1440px) {
    .agent-finance-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        row-gap: 14px;
    }

    .agent-order-filters {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .agent-order-period-filter {
        grid-column: span 2;
    }

    .agent-finance-item:nth-child(odd) {
        border-left: 0;
        padding-left: 0;
    }

    .agent-finance-usage {
        grid-column: 1 / -1;
        padding: 14px 0 0;
        border-top: 1px solid var(--line);
        border-left: 0;
    }
}

@media (max-width: 1280px) {
    .agent-kpi-strip {
        grid-auto-columns: calc((100% - 64px) / 3);
    }

    .agent-resource-card,
    .agent-requisite-card {
        grid-template-columns: minmax(0, 1fr) minmax(190px, 0.58fr);
        grid-template-areas:
            "identity state"
            "limits actions"
            "message message";
        align-items: start;
    }

    .agent-requisite-card {
        grid-template-areas:
            "identity identity"
            "limits actions"
            "message message";
    }
}

@media (max-width: 900px) {
    .agent-kpi-strip {
        grid-auto-columns: minmax(260px, 44vw);
    }

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

    .agent-order-period-filter,
    .agent-order-filter-actions {
        grid-column: 1 / -1;
    }

}

@media (max-width: 680px) {
    .app-shell-agent .topbar {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .app-shell-agent .topbar > div:first-child > p {
        display: none;
    }

    .app-shell-agent .topbar-actions {
        width: 100%;
        gap: 6px;
        justify-content: flex-end;
    }

    .agent-user-trigger {
        gap: 6px;
        padding: 0 8px;
    }

    .agent-user-trigger > .ui-icon:not(.agent-user-chevron) {
        display: none;
    }

    .agent-kpi-strip {
        grid-auto-columns: min(82vw, 294px);
    }

    .agent-kpi-card {
        min-height: 104px;
        padding: 15px;
    }

    .agent-finance-panel {
        padding: 16px;
    }

    .agent-finance-grid {
        grid-template-columns: 1fr;
        row-gap: 0;
    }

    .agent-finance-item,
    .agent-finance-item:first-child,
    .agent-finance-item:nth-child(odd) {
        margin: 0;
        padding: 14px 0;
        border-top: 1px solid var(--line);
        border-left: 0;
    }

    .agent-finance-usage {
        grid-column: auto;
    }

    .agent-order-filters {
        grid-template-columns: 1fr;
        padding: 14px;
    }

    .agent-order-period-filter,
    .agent-order-filter-actions {
        grid-column: auto;
    }

    .agent-order-date-range {
        grid-template-columns: 18px minmax(0, 1fr);
        gap: 8px 10px;
        padding-block: 9px;
    }

    .agent-order-date-range > .ui-icon {
        align-self: start;
        margin-top: 4px;
    }

    .agent-order-date-range label {
        grid-column: 2;
    }

    .agent-order-date-separator {
        display: none;
    }

    .agent-order-filter-actions .btn {
        flex: 1 1 0;
        width: 100%;
        min-width: 0;
    }

    .agent-order-amount-filters {
        grid-template-columns: 1fr;
    }

    .agent-resource-list-header {
        align-items: stretch;
        flex-direction: column;
    }

    .agent-resource-list-header .btn {
        width: 100%;
    }

    .agent-resource-card,
    .agent-requisite-card {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "identity"
            "limits"
            "state"
            "actions"
            "message";
        gap: 14px;
        padding: 15px;
    }

    .agent-requisite-card {
        grid-template-areas:
            "identity"
            "limits"
            "actions"
            "message";
    }

    .agent-resource-limits,
    .agent-resource-state,
    .agent-resource-actions {
        padding-top: 12px;
        border-top: 1px solid rgba(115, 147, 198, 0.13);
    }

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

    .agent-resource-actions .agent-resource-archive-action:last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }

    .agent-resource-actions .btn {
        min-width: 0;
        min-height: 44px;
    }

    .agent-resource-page > .payment-method-form {
        padding: 14px;
    }

    .agent-orders-tabs {
        gap: 20px;
        padding-inline: 16px;
    }

    .agent-orders-tab-panel {
        padding: 16px;
    }

    .agent-orders-page .table-wrap {
        overflow: visible;
        border: 0;
    }

    .agent-orders-page .table-wrap .compact-orders-table,
    .agent-orders-page .table-wrap .compact-orders-table tbody,
    .agent-orders-page .table-wrap .compact-orders-table tr,
    .agent-orders-page .table-wrap .compact-orders-table td {
        display: block;
        width: 100%;
        min-width: 0;
    }

    .agent-orders-page .table-wrap .compact-orders-table thead {
        display: none;
    }

    .agent-orders-page .table-wrap .compact-orders-table tr {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px 12px;
        margin-bottom: 10px;
        padding: 14px;
        border: 1px solid rgba(115, 147, 198, 0.14);
        border-radius: 7px;
        background: rgba(6, 19, 35, 0.42);
    }

    .agent-orders-page .table-wrap .compact-orders-table tr:last-child {
        margin-bottom: 0;
    }

    .agent-orders-page .table-wrap .compact-orders-table tr.order-urgent {
        background: rgba(255, 91, 107, 0.025);
    }

    .agent-orders-page .table-wrap .compact-orders-table td {
        display: grid;
        height: auto;
        gap: 5px;
        padding: 0;
        border-bottom: 0;
    }

    .agent-orders-page .table-wrap .compact-orders-table td::before {
        color: var(--text-muted);
        content: attr(data-label);
        font-size: 10px;
        font-weight: 800;
    }

    .agent-orders-page .table-wrap .compact-orders-table td:nth-child(4),
    .agent-orders-page .table-wrap .compact-orders-table .table-action-cell {
        grid-column: 1 / -1;
    }

    .agent-orders-page .agent-order-agent strong {
        max-width: none;
    }

    .agent-orders-page .compact-orders-table .table-action-cell {
        min-width: 0;
        white-space: normal;
    }

    .agent-orders-page .compact-orders-table .table-action-stack {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .agent-orders-page .compact-orders-table .table-action-cell .btn {
        width: 100%;
        min-width: 0;
        min-height: 42px;
        white-space: normal;
    }

    .agent-orders-page .compact-orders-table .table-action-cell .btn:only-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 480px) {
    .agent-orders-tab {
        min-height: 52px;
        font-size: 14px;
    }

    .agent-orders-tab-panel {
        padding: 12px;
    }

    .agent-order-filter-actions,
    .agent-orders-page .compact-orders-table .table-action-stack {
        display: grid;
        grid-template-columns: 1fr;
    }

    .agent-orders-page .compact-orders-table .table-action-cell .btn {
        grid-column: auto;
    }

    .agent-resource-identity {
        grid-template-columns: 36px minmax(0, 1fr);
        gap: 10px;
    }

    .agent-resource-icon {
        width: 36px;
        height: 36px;
    }

    .agent-requisite-facts,
    .agent-resource-actions {
        grid-template-columns: 1fr;
    }
}

/* Agent order modal */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.agent-order-modal {
    position: relative;
    width: min(1060px, 100%);
    max-height: min(820px, calc(100vh - 48px));
    overflow: auto;
    padding: 0;
    border-radius: 16px;
}

.agent-order-modal-content {
    min-width: 0;
    padding: 26px 30px 0;
}

.agent-client-history-link {
    max-width: 100%;
    padding: 0;
    border: 0;
    color: var(--blue-2);
    background: transparent;
    font: inherit;
    font-weight: 800;
    text-align: left;
    text-decoration: underline;
    text-underline-offset: 3px;
    overflow-wrap: anywhere;
    cursor: pointer;
}

.agent-client-history-layer {
    position: fixed;
    inset: 0;
    z-index: 3;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(1, 8, 16, 0.82);
}

.agent-client-history-card {
    display: flex;
    flex-direction: column;
    width: min(920px, 100%);
    max-height: calc(100vh - 48px);
    overflow: hidden;
    padding: 24px;
    background: #08192b;
}

.agent-client-history-body {
    min-height: 0;
    overflow: auto;
}

.agent-client-history-card h3 {
    margin: 0;
}

.agent-client-history-id {
    display: block;
    margin: 10px 0 20px;
    color: var(--text-soft);
    overflow-wrap: anywhere;
}

.agent-client-history-table {
    table-layout: fixed;
}

.agent-client-history-table td {
    overflow-wrap: anywhere;
}

.agent-client-history-table th:first-child {
    width: 27%;
}

.agent-client-history-table .mono {
    white-space: nowrap;
}

@media (max-width: 640px) {
    .agent-client-history-layer {
        padding: 12px;
    }

    .agent-client-history-card {
        max-height: calc(100vh - 24px);
        padding: 16px;
    }

    .agent-client-history-table {
        min-width: 0;
    }

    .agent-client-history-table,
    .agent-client-history-table tbody,
    .agent-client-history-table tr,
    .agent-client-history-table td {
        display: block;
        width: 100%;
    }

    .agent-client-history-table thead {
        display: none;
    }

    .agent-client-history-table tr {
        margin-bottom: 12px;
        padding: 10px;
        border: 1px solid var(--line);
        border-radius: 8px;
    }

    .agent-client-history-table td {
        padding: 8px 0;
        border: 0;
    }

    .agent-client-history-table td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 5px;
        color: var(--text-soft);
        font-size: 12px;
    }
}

.agent-order-modal-header,
.agent-order-title-line,
.agent-order-metadata,
.order-value-with-action,
.agent-order-assignee,
.agent-order-sla-state > div,
.agent-order-extension-actions,
.agent-order-upload-action,
.agent-order-upload-file,
.agent-order-footer,
.agent-order-safety,
.agent-order-footer-actions,
.agent-order-confirmation-actions {
    display: flex;
    align-items: center;
}

.agent-order-modal-header {
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.agent-order-title-line {
    flex-wrap: wrap;
    gap: 10px;
}

.agent-order-title-line h3 {
    margin: 0;
    font-size: 25px;
    line-height: 1.2;
}

.agent-order-status-badge {
    min-height: 28px;
}

.status-badge.assigned {
    color: #8fbdff;
    background: rgba(18, 103, 255, 0.14);
}

.agent-order-metadata {
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 12px;
}

.agent-order-close,
.order-copy-button {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    border: 0;
    color: var(--text-soft);
    background: transparent;
    cursor: pointer;
}

.agent-order-close {
    width: 40px;
    height: 40px;
    border: 1px solid transparent;
    border-radius: 8px;
}

.agent-order-close:hover,
.agent-order-close:focus-visible,
.order-copy-button:hover,
.order-copy-button:focus-visible {
    color: var(--text);
    border-color: var(--line-strong);
    background: rgba(115, 147, 198, 0.1);
    outline: none;
}

.agent-order-amount {
    margin-top: 24px;
    font-size: 42px;
    font-weight: 900;
    line-height: 1;
}

.agent-order-stage {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 16px;
    color: var(--text-soft);
}

.agent-order-stage > .ui-icon {
    margin-top: 1px;
    color: var(--blue-2);
}

.agent-order-stage div {
    display: grid;
    gap: 3px;
}

.agent-order-stage strong {
    color: var(--text);
    font-size: 14px;
}

.agent-order-stage span {
    font-size: 13px;
}

.agent-order-client-cancelled {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 16px;
    padding: 12px 14px;
    border-left: 3px solid var(--yellow);
    border-radius: 6px;
    color: var(--text-soft);
    background: rgba(255, 193, 7, 0.08);
}

.agent-order-client-cancelled > .ui-icon {
    flex: 0 0 auto;
    margin-top: 1px;
    color: var(--yellow);
}

.agent-order-client-cancelled > div {
    display: grid;
    gap: 3px;
}

.agent-order-client-cancelled strong {
    color: var(--text);
    font-size: 14px;
}

.agent-order-client-cancelled time {
    font-size: 13px;
}

.agent-order-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    margin-top: 28px;
    border-top: 1px solid var(--line);
}

.agent-order-section {
    min-width: 0;
    padding: 24px 30px 26px 0;
}

.agent-order-section h4 {
    margin: 0 0 22px;
    font-size: 16px;
}

.agent-order-processing {
    padding-right: 0;
    padding-left: 30px;
    border-left: 1px solid var(--line);
}

.agent-order-field {
    display: grid;
    gap: 7px;
    min-width: 0;
}

.agent-order-field + .agent-order-field {
    margin-top: 20px;
}

.agent-order-field-label,
.order-requisite-field > span {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 850;
    text-transform: uppercase;
}

.agent-order-field strong,
.order-requisite-field strong,
.order-value-with-action {
    overflow-wrap: anywhere;
}

.order-requisite-fields {
    display: grid;
    gap: 14px;
}

.order-requisite-field {
    display: grid;
    gap: 5px;
}

.order-value-with-action {
    min-width: 0;
    gap: 7px;
}

.order-copy-control {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.order-copy-button {
    width: 30px;
    height: 30px;
    border: 1px solid transparent;
    border-radius: 6px;
}

.order-copy-button .ui-icon {
    width: 16px;
    height: 16px;
}

.order-copy-feedback {
    color: var(--green);
    font-size: 11px;
    white-space: nowrap;
}

.agent-order-assignee {
    align-items: flex-start;
    gap: 11px;
}

.agent-order-assignee > div {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.agent-order-avatar {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 50%;
    color: #07111e;
    background: #c7d1df;
    font-size: 13px;
    font-weight: 900;
}

.agent-order-sla-state {
    display: grid;
    gap: 5px;
    padding: 12px 14px;
    border-left: 3px solid var(--blue-2);
    border-radius: 6px;
    background: rgba(79, 140, 255, 0.07);
}

.agent-order-sla-state > div {
    gap: 7px;
}

.agent-order-sla-state .ui-icon {
    width: 17px;
    height: 17px;
}

.agent-order-sla-state > span {
    color: var(--text-muted);
    font-size: 12px;
}

.agent-order-sla-state.is-overdue {
    border-left-color: var(--red);
    background: rgba(255, 61, 61, 0.08);
}

.agent-order-sla-state.is-overdue > div {
    color: #ff8b8b;
}

.agent-order-extension-actions {
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.agent-order-upload {
    display: grid;
    gap: 9px;
    margin-top: 20px;
}

.agent-order-upload-action {
    width: fit-content;
    min-height: 42px;
    gap: 8px;
    padding: 0 14px;
    border: 1px dashed var(--line-strong);
    border-radius: 8px;
    color: var(--text-soft);
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
}

.agent-order-upload-action:hover,
.agent-order-upload-action:focus-within {
    color: var(--text);
    border-color: var(--blue-2);
    background: rgba(79, 140, 255, 0.07);
}

.agent-order-upload-file {
    width: fit-content;
    max-width: 100%;
    gap: 8px;
    color: var(--text-soft);
    font-size: 12px;
}

.agent-order-upload-file > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agent-order-upload-file > .ui-icon {
    color: var(--green);
}

.agent-order-upload small {
    color: var(--text-muted);
    font-size: 11px;
}

.agent-order-footer {
    justify-content: space-between;
    gap: 24px;
    margin: 0 -30px;
    padding: 20px 30px;
    border-top: 1px solid var(--line);
    background: rgba(2, 11, 22, 0.42);
}

.agent-order-footer.is-claim {
    justify-content: flex-end;
}

.agent-order-safety {
    align-items: flex-start;
    gap: 10px;
    max-width: 590px;
}

.agent-order-safety > .ui-icon {
    margin-top: 2px;
    color: var(--yellow);
}

.agent-order-safety > div {
    display: grid;
    gap: 3px;
}

.agent-order-safety strong {
    font-size: 13px;
}

.agent-order-safety span {
    color: var(--text-muted);
    font-size: 12px;
}

.agent-order-action-message,
.agent-order-confirmation-message {
    min-height: 16px;
    margin: 0;
    font-size: 12px;
    font-weight: 800;
}

.agent-order-action-message:empty,
.agent-order-confirmation-message:empty {
    display: none;
}

.agent-order-action-message[data-state="error"],
.agent-order-confirmation-message[data-state="error"] {
    color: #ff8b8b;
}

.agent-order-primary-action {
    min-width: 250px;
    min-height: 48px;
}

.agent-order-footer-actions {
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.agent-order-confirmation-layer {
    position: fixed;
    inset: 0;
    z-index: 2;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(1, 8, 16, 0.82);
}

.agent-order-confirmation {
    width: min(500px, 100%);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    padding: 26px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: #08192b;
    box-shadow: var(--shadow);
}

.agent-order-confirmation h3 {
    margin: 0;
    font-size: 22px;
}

.agent-order-confirmation-amount {
    display: block;
    margin-top: 18px;
    font-size: 32px;
}

.agent-order-confirmation p {
    color: var(--text-soft);
    line-height: 1.5;
}

.agent-order-partial-fields {
    display: grid;
    gap: 9px;
    margin-top: 20px;
}

.agent-order-partial-fields label {
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 800;
}

.agent-order-partial-input {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
}

.agent-order-partial-input .control {
    min-width: 0;
}

.agent-order-partial-input span {
    min-width: 36px;
    color: var(--text);
    font-weight: 900;
}

.agent-order-partial-fields small {
    color: var(--text-muted);
}

.agent-order-partial-fields small strong {
    color: var(--text-soft);
}

.agent-order-confirmation-note {
    font-size: 13px;
}

.agent-order-confirmation-actions {
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
}

@media (max-width: 800px) {
    .agent-order-columns {
        grid-template-columns: 1fr;
    }

    .agent-order-section {
        padding-right: 0;
    }

    .agent-order-processing {
        padding-top: 24px;
        padding-left: 0;
        border-top: 1px solid var(--line);
        border-left: 0;
    }

    .agent-order-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .agent-order-primary-action,
    .agent-order-footer-actions,
    .agent-order-footer-actions .btn,
    .agent-order-footer.is-claim .btn {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 520px) {
    #agent-order-detail-modal {
        padding: 8px;
    }

    .agent-order-modal {
        max-height: calc(100vh - 16px);
        max-height: calc(100svh - 16px);
        border-radius: 10px;
    }

    .agent-order-modal-content {
        padding: 18px 16px 0;
    }

    .agent-order-title-line {
        align-items: flex-start;
        flex-direction: column;
    }

    .agent-order-title-line h3 {
        font-size: 21px;
    }

    .agent-order-amount {
        margin-top: 20px;
        font-size: 34px;
    }

    .agent-order-columns {
        margin-top: 22px;
    }

    .agent-order-section {
        padding-top: 20px;
        padding-bottom: 22px;
    }

    .agent-order-extension-actions,
    .agent-order-confirmation-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .agent-order-extension .btn,
    .agent-order-confirmation-actions .btn {
        width: 100%;
    }

    .agent-order-footer {
        margin: 0 -16px;
        padding: 18px 16px;
    }

    .agent-order-confirmation-layer {
        padding: 12px;
    }

    .agent-order-confirmation {
        padding: 20px;
    }
}

@media (max-width: 900px) {
    .agent-topup-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .agent-topup-submit {
        grid-column: 1 / -1;
        width: 100%;
    }

    .agent-hierarchy-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .agent-hierarchy-head .action-row {
        width: 100%;
    }
}

@media (max-width: 680px) {
    .agent-topup-form,
    .agent-topup-period-controls {
        grid-template-columns: 1fr;
    }

    .agent-topup-date-range {
        grid-template-columns: auto minmax(0, 1fr);
        align-items: center;
    }

    .agent-topup-date-range label + label {
        grid-column: 2;
        padding-top: 7px;
        padding-left: 0;
        border-top: 1px solid var(--line);
        border-left: 0;
    }

    .agent-topup-period-controls .btn {
        width: 100%;
    }

    .agent-topup-table-wrap {
        overflow: visible;
        border: 0;
    }

    .agent-topup-table,
    .agent-topup-table tbody,
    .agent-topup-table tr,
    .agent-topup-table td {
        display: block;
        width: 100%;
    }

    .agent-topup-table {
        min-width: 0;
    }

    .agent-topup-table colgroup,
    .agent-topup-table thead {
        display: none;
    }

    .agent-topup-table tbody {
        display: grid;
        gap: 10px;
    }

    .agent-topup-table-row {
        padding: 14px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: rgba(3, 14, 27, 0.56);
    }

    .agent-topup-table-row td {
        display: grid;
        grid-template-columns: minmax(92px, 0.42fr) minmax(0, 1fr);
        gap: 12px;
        align-items: center;
        min-width: 0;
        padding: 9px 0;
        border: 0;
    }

    .agent-topup-table-row td > * {
        min-width: 0;
    }

    .agent-topup-table-row td + td {
        border-top: 1px solid rgba(112, 145, 192, 0.12);
    }

    .agent-topup-table-row td::before {
        content: attr(data-label);
        color: var(--text-soft);
        font-size: 12px;
        font-weight: 800;
    }

    .agent-topup-operation-id {
        width: 100%;
    }

    .agent-topup-created-at strong,
    .agent-topup-created-at small {
        overflow-wrap: anywhere;
    }

    .agent-hierarchy-surface {
        padding: 12px;
    }

    .agent-hierarchy-head .action-row {
        display: grid;
        grid-template-columns: 1fr;
    }

    .agent-hierarchy-head .btn {
        width: 100%;
    }

    .agent-hierarchy-row {
        grid-template-columns: 44px minmax(0, 1fr);
        padding-right: 4px;
        padding-left: calc(2px + var(--tree-level, 0) * 14px);
    }

    .agent-hierarchy-treeitem > .agent-hierarchy-row::before {
        left: calc(-4px + var(--tree-level, 0) * 14px);
        width: 10px;
    }

    .agent-hierarchy-empty {
        margin-left: 46px;
    }
}

/* Admin resources share the same visual language as the agent resource cards. */
.admin-resource-list {
    margin-top: 18px;
}

.admin-payment-method-limit-requests {
    margin-top: 24px;
    padding-top: 22px;
    border-top: 1px solid rgba(115, 147, 198, 0.16);
}

.admin-payment-method-limit-requests .agent-resource-list-header h3 {
    margin: 0;
    font-size: 18px;
    line-height: 1.3;
}

.admin-resource-card,
.admin-requisite-card {
    grid-template-columns: minmax(290px, 1.25fr) minmax(230px, 0.82fr) minmax(190px, 0.66fr) minmax(150px, auto);
    grid-template-areas:
        "identity owner limits actions"
        "message message message message";
    align-items: start;
}

.admin-resource-owner {
    grid-area: owner;
    display: grid;
    min-width: 0;
    gap: 6px;
    align-content: start;
}

.admin-resource-owner > strong,
.admin-resource-owner > span:last-child {
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--text-soft);
    font-size: 12px;
}

.admin-resource-owner .agent-ref {
    gap: 3px;
}

.admin-resource-card > .payment-method-actions {
    grid-area: actions;
    display: grid;
    min-width: 0;
    gap: 7px;
    align-content: start;
}

.admin-resource-card > .payment-method-actions .btn {
    width: 100%;
    min-width: 138px;
    min-height: 40px;
    gap: 7px;
    white-space: nowrap;
}

.admin-resource-card > .payment-method-actions .ui-icon {
    width: 16px;
    height: 16px;
}

.admin-resource-card > .payment-method-action-message {
    grid-area: message;
    min-height: 0;
    margin: 0;
}

.admin-resource-card > .payment-method-action-message:empty {
    display: none;
}

@media (max-width: 1280px) {
    .admin-resource-card,
    .admin-requisite-card {
        grid-template-columns: minmax(0, 1fr) minmax(220px, 0.58fr);
        grid-template-areas:
            "identity owner"
            "limits actions"
            "message message";
    }
}

@media (max-width: 680px) {
    .resource-edit-modal {
        width: 100%;
        max-width: 100%;
        max-height: calc(100vh - 48px);
    }

    .resource-edit-header {
        padding: 16px;
    }

    .resource-edit-header h3 {
        font-size: 19px;
    }

    .resource-edit-form {
        padding: 18px 16px 0;
    }

    .resource-edit-primary-grid,
    .resource-edit-limits-grid,
    .resource-edit-schema-fields .requisite-schema-grid,
    .resource-edit-schema-fields .requisite-schema-field-with-code {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
    }

    .resource-edit-requisite-name,
    .resource-edit-active-orders-field {
        width: 100%;
    }

    .resource-edit-actions {
        margin-right: -16px;
        margin-left: -16px;
        padding: 14px 16px;
    }

    .resource-edit-actions .btn {
        flex: 1 1 0;
        min-width: 0;
    }

    .resource-edit-actions .btn-primary {
        flex-grow: 1.35;
    }

    .admin-resource-card,
    .admin-requisite-card {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "identity"
            "owner"
            "limits"
            "actions"
            "message";
        gap: 14px;
        padding: 15px;
    }

    .admin-resource-owner,
    .admin-resource-card .agent-resource-limits,
    .admin-resource-card > .payment-method-actions {
        padding-top: 12px;
        border-top: 1px solid rgba(115, 147, 198, 0.13);
    }

    .admin-resource-card > .payment-method-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-resource-card > .payment-method-actions .btn {
        min-width: 0;
        min-height: 44px;
    }

    .admin-resource-card > .payment-method-actions .agent-resource-archive-action:last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }
}

@media (max-width: 420px) {
    .resource-edit-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .resource-edit-actions .btn {
        width: 100%;
    }
}

.master-rewards,
.master-reward-settings {
    min-width: 0;
    display: grid;
    gap: 12px;
    padding-top: 18px;
    border-top: 1px solid rgba(115, 147, 198, 0.15);
}

.master-rewards h3,
.master-rewards h4,
.master-rewards p,
.master-reward-settings h3,
.master-reward-settings p {
    margin: 0;
}

.master-reward-settings-form,
.master-reward-transfer-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    min-width: 0;
}

.master-reward-full-row {
    grid-column: 1 / -1;
    min-width: 0;
}

.master-reward-balances {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
    gap: 12px;
}

.master-reward-balance,
.master-reward-quote {
    min-width: 0;
    padding: 16px;
    border: 1px solid rgba(75, 128, 255, 0.3);
    border-radius: 12px;
    background: rgba(19, 42, 78, 0.25);
}

.master-reward-balance .detail-table,
.master-reward-quote .detail-table {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin: 12px 0;
}

.master-reward-balance dd,
.master-reward-quote dd,
.master-reward-child-modal dd {
    overflow-wrap: anywhere;
}

.master-reward-quote[hidden] {
    display: none;
}

.master-reward-child-button {
    margin-left: auto;
}

.master-reward-child-modal {
    width: min(700px, calc(100vw - 24px));
    padding: 24px;
    max-height: calc(100dvh - 40px);
    overflow: auto;
}

.master-reward-child-methods {
    display: grid;
    gap: 12px;
}

.master-reward-child-methods article {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(115, 147, 198, 0.15);
}

.master-reward-child-methods article strong,
.master-reward-child-methods article span {
    overflow-wrap: anywhere;
}

.agent-order-reward {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    align-items: center;
    padding: 10px 0;
}

@media (max-width: 700px) {
    .master-reward-settings-form,
    .master-reward-transfer-form {
        grid-template-columns: 1fr;
    }

    .master-reward-settings-form .action-row,
    .master-reward-transfer-form .action-row {
        flex-wrap: wrap;
    }

    .master-reward-child-modal {
        padding: 16px;
    }

    .master-reward-child-button {
        margin-left: 0;
        max-width: 100%;
    }

    .agent-hierarchy-row:has(.master-reward-child-button) {
        flex-wrap: wrap;
    }
}

.agent-analytics-page {
    display: grid;
    min-width: 0;
    gap: 20px;
}

.agent-analytics-page > [data-analytics-content] {
    min-width: 0;
}

.agent-analytics-filters {
    display: grid;
    gap: 14px;
}

.agent-analytics-filter-row,
.agent-analytics-presets,
.agent-analytics-filter-notes,
.agent-analytics-custom {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.agent-analytics-period-label {
    color: var(--text-soft);
    font-weight: 800;
}

.agent-analytics-presets {
    gap: 3px;
    padding: 4px;
    border: 1px solid rgba(115, 147, 198, 0.22);
    border-radius: 30px;
    background: rgba(3, 14, 27, 0.5);
}

.agent-analytics-presets button {
    min-height: 38px;
    padding: 8px 16px;
    border: 0;
    border-radius: 24px;
    color: var(--text-soft);
    background: transparent;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.agent-analytics-presets button[aria-pressed="true"] {
    color: #fff;
    background: linear-gradient(135deg, #7160d7, #5142bb);
    box-shadow: 0 0 18px rgba(116, 89, 235, 0.2);
}

.agent-analytics-presets button:focus-visible {
    outline: 2px solid #a99aff;
    outline-offset: 2px;
}

.agent-analytics-currency {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    color: var(--text-muted);
    font-size: 13px;
}

.agent-analytics-currency .control {
    width: 110px;
    min-height: 42px;
}

.agent-analytics-filter-notes {
    gap: 8px 20px;
    color: var(--text-muted);
    font-size: 12px;
}

.agent-analytics-custom {
    align-items: end;
}

.agent-analytics-custom[hidden] {
    display: none;
}

.agent-analytics-custom label {
    display: grid;
    min-width: 0;
    gap: 6px;
    color: var(--text-muted);
    font-size: 12px;
}

.agent-analytics-custom .control {
    min-height: 42px;
}

.agent-analytics-range {
    margin: 0 0 14px;
    color: var(--text-muted);
    font-size: 12px;
}

.agent-analytics-range strong {
    color: var(--text-soft);
    font-weight: 500;
}

.agent-analytics-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.agent-analytics-summary-card {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    min-width: 0;
    gap: 16px;
    padding: 26px;
}

.agent-analytics-summary-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    color: #a28bff;
}

.agent-analytics-summary-icon .ui-icon {
    width: 32px;
    height: 32px;
}

.agent-analytics-summary-card > div {
    display: grid;
    min-width: 0;
    gap: 7px;
}

.agent-analytics-summary-card > div > span {
    color: var(--text-soft);
    font-size: 14px;
}

.agent-analytics-summary-card [data-analytics-value] {
    font-size: clamp(22px, 2vw, 32px);
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.agent-analytics-change {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    padding: 8px 10px;
    border-radius: 20px;
    color: var(--text-muted);
    background: rgba(115, 147, 198, 0.08);
    font-size: 11px;
}

.agent-analytics-change.is-positive {
    color: var(--success);
    background: rgba(22, 187, 125, 0.09);
}

.agent-analytics-change.is-negative {
    color: var(--danger-2);
    background: rgba(255, 91, 107, 0.08);
}

.agent-analytics-daily {
    min-width: 0;
    padding: 20px;
}

.agent-analytics-table {
    min-width: 1040px;
    font-variant-numeric: tabular-nums;
}

.agent-analytics-table caption {
    padding: 0 4px 10px;
    color: var(--text-muted);
    font-size: 12px;
    text-align: right;
}

.agent-analytics-table th,
.agent-analytics-table td {
    padding: 14px 10px;
    text-align: right;
    white-space: nowrap;
    font-size: 13px;
}

.agent-analytics-table th:first-child {
    text-align: left;
}

.agent-analytics-table thead th {
    text-align: center;
    white-space: normal;
    font-size: 12px;
}

.agent-analytics-table thead tr:first-child th[colspan] {
    font-size: 14px;
}

.agent-analytics-table tbody th {
    color: var(--text-soft);
    font-weight: 500;
}

.agent-analytics-table tfoot th,
.agent-analytics-table tfoot td {
    border-bottom: 0;
    background: rgba(116, 89, 235, 0.14);
    color: var(--text);
    font-weight: 800;
}

.agent-analytics-turnover {
    background: rgba(116, 89, 235, 0.07);
    color: var(--text);
    font-weight: 800;
}

.agent-analytics-note,
.agent-analytics-no-currency {
    margin: 16px 0 0;
    font-size: 12px;
}

@media (max-width: 960px) {
    .agent-analytics-summary {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .agent-analytics-filters,
    .agent-analytics-daily {
        padding: 14px;
    }

    .agent-analytics-filter-row {
        align-items: start;
    }

    .agent-analytics-presets {
        width: 100%;
        justify-content: space-between;
        border-radius: 18px;
    }

    .agent-analytics-presets button {
        flex: 1 1 calc(50% - 6px);
        padding: 8px;
    }

    .agent-analytics-currency {
        margin-left: 0;
        margin-right: auto;
    }

    .agent-analytics-custom label {
        flex: 1 1 100%;
    }

    .agent-analytics-custom .control {
        width: 100%;
    }

    .agent-analytics-summary-card {
        padding: 18px;
        gap: 12px;
    }
}

.admin-reporting-page,
.admin-reporting-page > [data-report-content] {
    display: grid;
    min-width: 0;
    gap: 20px;
}

.admin-reporting-heading h2,
.admin-reporting-page h3,
.admin-reporting-page h4 {
    margin: 0;
}

.admin-reporting-heading p {
    margin: 8px 0 0;
}

.admin-reporting-filters {
    display: grid;
    gap: 16px;
}

.admin-reporting-filter-row,
.admin-reporting-notes,
.admin-reporting-chart-key,
.admin-reporting-section-heading {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 24px;
}

.admin-reporting-filter-row label {
    display: grid;
    min-width: 0;
    gap: 8px;
    color: var(--text-soft);
    font-size: 13px;
}

.admin-reporting-filter-row label:first-child {
    flex: 1 1 240px;
    max-width: 420px;
}

.admin-reporting-filter-row .control {
    min-width: 120px;
    width: 100%;
}

.admin-reporting-filter-row > button {
    align-self: end;
    margin-left: auto;
}

.admin-reporting-notes,
.admin-reporting-section-heading > span {
    color: var(--text-muted);
    font-size: 12px;
}

.admin-reporting-notes > span:last-child {
    margin-left: auto;
}

.admin-reporting-filters > .agent-analytics-presets {
    justify-self: start;
}

.admin-reporting-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.admin-reporting-metric {
    display: grid;
    min-width: 0;
    align-content: space-between;
    gap: 18px;
    padding: 22px;
}

.admin-reporting-metric > span {
    color: var(--text-soft);
    font-size: 13px;
}

.admin-reporting-metric > strong,
.admin-reporting-extra > strong,
.admin-reporting-requisites > strong {
    font-size: clamp(24px, 2.5vw, 34px);
    line-height: 1.25;
    overflow-wrap: anywhere;
    font-variant-numeric: tabular-nums;
}

.admin-reporting-metric.is-success > strong {
    color: var(--green);
}

.admin-reporting-metric.is-danger > strong {
    color: var(--red);
}

.admin-reporting-metric.is-accent > strong {
    color: #ac99ff;
}

.admin-reporting-pair,
.admin-reporting-activity {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    min-width: 0;
}

.admin-reporting-activity {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
}

.admin-reporting-page .panel {
    min-width: 0;
}

.admin-reporting-page h3 {
    font-size: 17px;
    line-height: 1.4;
}

.admin-reporting-page .panel > .muted,
.admin-reporting-chart-note,
.admin-reporting-footnote {
    font-size: 12px;
    line-height: 1.6;
}

.admin-reporting-liquidity .panel-header {
    margin-bottom: 0;
}

.admin-reporting-balance {
    min-width: 0;
    padding: 20px;
    border: 1px solid rgba(115, 147, 198, 0.18);
    border-radius: 18px;
    background: rgba(3, 14, 27, 0.24);
}

.admin-reporting-balance h4 {
    color: var(--text-soft);
}

.admin-reporting-balance dl {
    display: grid;
    gap: 16px;
    margin: 22px 0 0;
}

.admin-reporting-balance dl > div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr);
    gap: 12px;
    align-items: baseline;
}

.admin-reporting-balance dt {
    color: var(--text-muted);
    font-size: 13px;
}

.admin-reporting-balance dd {
    margin: 0;
    text-align: right;
    font-weight: 700;
    overflow-wrap: anywhere;
    font-variant-numeric: tabular-nums;
}

.admin-reporting-balance dl > div:last-child {
    padding-top: 16px;
    border-top: 1px solid rgba(115, 147, 198, 0.18);
}

.admin-reporting-active {
    display: grid;
    min-width: 0;
    gap: 8px;
    padding-top: 12px;
}

.admin-reporting-active > span:first-child {
    color: var(--text-muted);
    font-size: 13px;
}

.admin-reporting-active strong {
    font-size: 32px;
}

.admin-reporting-active > span:last-child {
    overflow-wrap: anywhere;
}

.admin-reporting-requisites,
.admin-reporting-extra {
    display: grid;
    align-content: start;
    gap: 16px;
}

.admin-reporting-requisites p,
.admin-reporting-extra p {
    margin: 0;
}

.admin-reporting-conversions {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 32px;
    color: var(--text-soft);
    font-size: 13px;
}

.admin-reporting-conversions > div {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.admin-reporting-conversions strong {
    color: var(--text);
    font-size: 22px;
}

.admin-reporting-directions h3 {
    margin-bottom: 16px;
}

.admin-reporting-table {
    min-width: 960px;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.admin-reporting-table th,
.admin-reporting-table td {
    text-align: right;
}

.admin-reporting-table th:first-child {
    text-align: left;
}

.admin-reporting-table thead th {
    white-space: normal;
    font-size: 12px;
    line-height: 1.5;
}

.admin-reporting-table tbody td {
    white-space: nowrap;
}

.admin-reporting-chart .panel-header {
    flex-wrap: wrap;
}

.admin-reporting-chart-key {
    font-size: 12px;
}

.admin-reporting-chart-key > .is-deposit,
.admin-reporting-chart-key > .is-withdraw {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.admin-reporting-chart-key > .is-deposit::before,
.admin-reporting-chart-key > .is-withdraw::before {
    content: '';
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #a58bff;
}

.admin-reporting-chart-key > .is-withdraw::before {
    background: #44cdb5;
}

.admin-reporting-chart-max {
    margin-left: auto;
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--text-muted);
}

.admin-reporting-svg {
    display: block;
    width: 100%;
    height: clamp(150px, 24vw, 248px);
    margin-top: 8px;
    overflow: visible;
}

.admin-reporting-grid {
    stroke: rgba(115, 147, 198, 0.2);
    stroke-dasharray: 4 5;
}

.admin-reporting-svg .is-deposit {
    stroke: #a58bff;
    fill: #a58bff;
}

.admin-reporting-svg .is-withdraw {
    stroke: #44cdb5;
    fill: #44cdb5;
}

.admin-reporting-svg polyline {
    fill: none;
    stroke-width: 2.5;
    stroke-linejoin: round;
}

.admin-reporting-svg .is-withdraw polyline {
    stroke-dasharray: 6 3;
}

.admin-reporting-axis {
    position: relative;
    height: 20px;
    color: var(--text-muted);
    font-size: 11px;
}

.admin-reporting-axis > span {
    position: absolute;
    transform: translateX(-50%);
    white-space: nowrap;
}

.admin-reporting-daily summary {
    cursor: pointer;
    color: var(--text-soft);
    font-size: 13px;
}

.admin-reporting-daily .table-wrap {
    margin-top: 16px;
}

.admin-reporting-daily .admin-reporting-table {
    min-width: 420px;
}

.admin-reporting-empty,
.admin-reporting-footnote,
.admin-reporting-page .agent-analytics-range {
    margin: 0;
}

@media (max-width: 960px) {
    .admin-reporting-activity {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .admin-reporting-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

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

    .admin-reporting-activity .admin-reporting-pair {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-reporting-page .panel {
        padding: 16px;
    }

    .admin-reporting-filter-row label:first-child {
        flex-basis: 100%;
        max-width: none;
    }

    .admin-reporting-filter-row {
        gap: 14px;
    }

    .admin-reporting-notes > span:last-child,
    .admin-reporting-chart-max {
        margin-left: 0;
        flex-basis: 100%;
    }

    .admin-reporting-filters > .agent-analytics-presets {
        justify-self: stretch;
    }

    .admin-reporting-chart .agent-analytics-presets {
        width: 100%;
    }

    .admin-reporting-chart .agent-analytics-presets button {
        flex-basis: auto;
    }

    .admin-reporting-metric > strong {
        font-size: 24px;
    }

    .admin-reporting-balance {
        padding: 16px;
    }
}


/* Physical account liquidity freeze follows the resource edit modal. */
.requisite-freeze-modal[hidden] { display: none; }
.requisite-freeze-dialog { width: min(860px, calc(100vw - 32px)); }
.requisite-freeze-body { overflow-y: auto; min-height: 0; min-width: 0; padding: 20px 24px; display: grid; grid-auto-rows: max-content; gap: 16px; }
.requisite-freeze-body > * { min-width: 0; }
.requisite-freeze-body h3, .requisite-freeze-body p { margin: 0; overflow-wrap: anywhere; }
.requisite-freeze-body li { overflow-wrap: anywhere; }
.requisite-freeze-body .table-scroll { width: 100%; overflow-x: auto; }
.requisite-freeze-body table { min-width: 440px; width: 100%; }
.requisite-freeze-dialog [data-freeze-close] { flex: 0 0 40px; width: 40px; min-width: 40px; padding: 8px; }
.requisite-freeze-body form { display: grid; gap: 12px; border-top: 1px solid var(--border-color, #243852); padding-top: 16px; }
.requisite-freeze-body [data-freeze-amounts] { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.requisite-freeze-body [data-freeze-amounts][hidden], .requisite-freeze-body [data-freeze-unfreeze-note][hidden] { display: none; }
.requisite-freeze-history { display: grid; gap: 5px; padding: 12px 0; border-bottom: 1px solid var(--border-color, #243852); overflow-wrap: anywhere; }
.requisite-freeze-control { display: grid; gap: 8px; }
.requisite-frozen-amount, .status-badge.is-frozen { color: #a7d9ff; }
@media (max-width: 600px) { .requisite-freeze-body { padding: 16px; } .requisite-freeze-dialog .resource-edit-header { padding: 16px; } .requisite-freeze-dialog h2 { font-size: 20px; } }
