:root {
    --bg: #ffffff;
    --canvas: #f6f8fb;
    --surface: #ffffff;
    --ink: #0b1b2e;
    --muted: #5b6d82;
    --faint: #8aa0b5;
    --line: #e6edf5;
    --line-strong: #d5e0ec;
    --accent: #2f7dff;
    --accent-hover: #1d6bef;
    --accent-soft: #eaf2ff;
    --sidebar: #ffffff;
    --ok-bg: #e8f7ef;
    --ok: #157347;
    --wait-bg: #eaf2ff;
    --wait: #1d5fd6;
    --bad-bg: #fdecec;
    --bad: #b42318;
    --shadow: 0 8px 24px rgba(11, 27, 46, 0.04);
    --font: Inter, ui-sans-serif, system-ui, sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
    font-family: var(--font);
    color: var(--ink);
    background: var(--canvas);
    font-size: 14px;
    line-height: 1.5;
    letter-spacing: -0.011em;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: 14px; }

.dashboard-container { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    background: var(--sidebar);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header { padding: 22px 20px 16px; }
.brand-mark {
    display: flex;
    align-items: baseline;
    gap: 8px;
    color: var(--ink);
}
.brand-mark strong {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1;
}
.brand-mark em {
    font-style: normal;
    font-size: 11px;
    color: var(--accent);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 600;
}

.sidebar-nav { display: flex; flex-direction: column; padding: 6px 10px; gap: 2px; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
}
.nav-item svg { width: 16px; height: 16px; opacity: 0.7; }
.nav-item:hover { background: #f4f7fb; }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item.active svg { opacity: 1; }

.sidebar-footer {
    margin-top: auto;
    padding: 14px 16px 16px;
    border-top: 1px solid var(--line);
}
.user-name { display: block; font-size: 13px; font-weight: 600; }
.user-role { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.logout-btn {
    margin-top: 12px;
    width: 100%;
    height: 34px;
    background: #fff;
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 7px;
    cursor: pointer;
    font-weight: 600;
}
.logout-btn:hover { background: var(--accent-soft); }

.main-content { flex: 1; min-width: 0; padding: 32px 36px 56px; background: var(--canvas); }
.top-header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 28px; }
.top-header h1 { margin: 0; font-size: 32px; font-weight: 600; letter-spacing: -0.04em; color: var(--ink); }
.welcome-text { margin: 8px 0 0; color: var(--muted); font-size: 15px; max-width: 640px; }

.hamburger-menu {
    display: none;
    width: 34px;
    height: 34px;
    border: 1px solid var(--line-strong);
    background: #fff;
    border-radius: 6px;
    padding: 7px;
    cursor: pointer;
}
.hamburger-menu span { display: block; height: 1px; background: var(--ink); margin: 5px 0; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 20px 22px 18px;
    box-shadow: var(--shadow);
}
.stat-card h3 { margin: 0; font-size: 13px; font-weight: 500; color: var(--muted); }
.stat-value { margin: 10px 0 0; font-size: 36px; font-weight: 600; letter-spacing: -0.045em; color: var(--ink); font-variant-numeric: tabular-nums; }

.panel-card, .auth-card, .pay-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
}
.panel-card { padding: 22px 22px 12px; margin-bottom: 14px; }
.panel-card h2 { margin: 0 0 4px; font-size: 18px; font-weight: 600; letter-spacing: -0.03em; color: var(--ink); }
.section-header { margin-bottom: 12px; }
.hint { color: var(--muted); margin: 0 0 12px; font-size: 13px; }
.hint a { color: var(--accent); font-weight: 500; }

.inline-form, .stack-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 8px; }
.stack-form { flex-direction: column; align-items: stretch; max-width: 460px; }
.form-group { display: flex; flex-direction: column; gap: 6px; min-width: 160px; flex: 1; }
.stack-form .form-group { min-width: 0; }
.form-group label { font-size: 13px; font-weight: 500; color: var(--ink); }
.form-control,
input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="url"], input[type="number"], select, textarea {
    width: 100%;
    height: 40px;
    border: 1px solid var(--line-strong);
    background: #fff;
    border-radius: 7px;
    padding: 0 10px;
    color: var(--ink);
}
textarea { height: auto; padding: 8px 10px; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(47, 125, 255, 0.2); border-color: var(--accent); }
input[readonly] { background: #f7f8f9; color: var(--muted); }

.btn-primary, .btn-secondary, .btn-login {
    height: 40px;
    border-radius: 7px;
    padding: 0 18px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-primary, .btn-login { background: var(--accent); color: #fff; border: 1px solid var(--accent); }
.btn-primary:hover, .btn-login:hover { background: var(--accent-hover); }
.btn-secondary { background: #fff; color: var(--accent); border: 1px solid var(--accent); }
.btn-secondary:hover { background: var(--accent-soft); }
.btn-sm { height: 28px; padding: 0 8px; font-size: 12px; }
button:disabled { opacity: 0.4; cursor: not-allowed; }

.table-wrap { overflow-x: auto; margin: 0 -6px 8px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--faint); font-weight: 550; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }
td { font-size: 13.5px; }
tr:last-child td { border-bottom: 0; }
code, .mono { font-family: var(--mono); font-size: 12px; word-break: break-all; }

.badge {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    background: #eef0f3;
    color: #3c4450;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.wait { background: var(--wait-bg); color: var(--wait); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }

.alert { border-radius: 6px; padding: 10px 12px; margin: 0 0 12px; background: var(--ok-bg); color: var(--ok); font-size: 13px; }
.alert.alert-error, .alert.error, .error-text, .error-message { background: var(--bad-bg); color: var(--bad); }
.error-text, .error-message { border-radius: 6px; padding: 8px 10px; font-size: 13px; }

.country-head, .row-actions { display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
.wallet-line {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 12px 0;
    border-top: 1px solid var(--line);
}
.row-actions form { display: inline; }

.pager { display: flex; gap: 10px; align-items: center; margin: 8px 0 12px; color: var(--muted); font-size: 13px; }
.filter-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.filter-bar a {
    height: 28px;
    display: inline-flex;
    align-items: center;
    padding: 0 10px;
    border-radius: 999px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
}
.filter-bar a.active, .filter-bar a:hover { background: var(--accent-soft); border-color: transparent; color: var(--accent); }

.api-key {
    display: block;
    background: #f7f8f9;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 12px;
    margin: 8px 0 12px;
    font-family: var(--mono);
    font-size: 12.5px;
}
pre.sample {
    background: #1b1e23;
    color: #e7eaee;
    border-radius: 8px;
    padding: 14px 16px;
    overflow-x: auto;
    font-family: var(--mono);
    font-size: 12px;
    line-height: 1.55;
}

.profile-hero {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
}
.profile-mark {
    width: 72px;
    height: 72px;
    border-radius: 12px;
    object-fit: contain;
    background: #f7f8f9;
    border: 1px solid var(--line);
    flex-shrink: 0;
}
.profile-mark-empty {
    display: grid;
    place-items: center;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 22px;
    font-weight: 600;
}
.profile-hero h2 { margin: 0; font-size: 18px; letter-spacing: -0.03em; }
.profile-hero .hint { margin: 4px 0 0; }
.profile-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.75fr);
    gap: 14px;
    align-items: start;
}
.profile-grid .panel-card { margin-bottom: 0; }
.logo-drop {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border: 1px dashed var(--line-strong);
    border-radius: 8px;
    padding: 14px;
    background: #fafbfc;
    margin-bottom: 14px;
}
.logo-drop strong { display: block; font-size: 13px; }
.logo-drop span { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.logo-file {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}
.fact-list { margin: 0; }
.fact-list div { padding: 12px 0; border-bottom: 1px solid var(--line); }
.fact-list div:last-child { border-bottom: 0; }
.fact-list dt { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); font-weight: 500; }
.fact-list dd { margin: 4px 0 0; font-size: 14px; }
.password-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
    gap: 10px;
    align-items: end;
}
.profile-actions { display: flex; justify-content: flex-end; }
.check-row { display: flex; gap: 8px; align-items: center; font-size: 13px; color: #3c4450; }

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(22, 24, 29, 0.36);
    z-index: 50;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.modal-overlay.show { display: flex; }
.modal-content { background: #fff; border-radius: 10px; width: min(400px, 100%); padding: 18px; border: 1px solid var(--line); }
.modal-header, .modal-footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.modal-header h2, .logout-modal h3 { margin: 0; font-size: 16px; }
.modal-body p { color: var(--muted); }
.logout-icon { display: none; }
.modal-close { border: 0; background: transparent; font-size: 20px; cursor: pointer; color: var(--muted); }

.sidebar-overlay { display: none; }
.sidebar-overlay.active { display: block; position: fixed; inset: 0; background: rgba(22, 24, 29, 0.28); z-index: 30; }

.auth-page, .pay-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px 16px;
    background: #ffffff;
}
.auth-card, .pay-card { width: min(420px, 100%); padding: 28px 28px 24px; }
.auth-card h1, .pay-card h1 { margin: 6px 0 4px; font-size: 24px; letter-spacing: -0.03em; font-weight: 600; }
.kicker { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.auth-card form, .pay-card form { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
.pay-logo { display: block; max-width: 120px; max-height: 48px; object-fit: contain; margin-bottom: 8px; }
.amount { font-size: 34px; font-weight: 600; letter-spacing: -0.04em; margin: 10px 0 4px; font-variant-numeric: tabular-nums; }
.wallet-box {
    margin: 12px 0;
    background: #f7f8f9;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 12px;
    font-family: var(--mono);
    font-size: 12.5px;
    line-height: 1.5;
    word-break: break-all;
}

@media (max-width: 900px) {
    .stats-grid { grid-template-columns: 1fr; }
    .stat-card + .stat-card { border-left: 0; border-top: 1px solid var(--line); }
    .hamburger-menu { display: inline-block; }
    .sidebar {
        position: fixed;
        top: 0; bottom: 0; left: 0;
        z-index: 40;
        transform: translateX(-105%);
        transition: transform 0.18s ease;
    }
    .sidebar.sidebar-open { transform: translateX(0); }
    .main-content { padding: 18px 16px 32px; }
    .wallet-line { grid-template-columns: 1fr; }
    .profile-grid, .password-grid { grid-template-columns: 1fr; }
    .logo-drop { align-items: flex-start; flex-direction: column; }
}
