:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --ink: #172033;
    --muted: #677085;
    --line: #dde3ee;
    --accent: #0f766e;
    --accent-strong: #0b5f59;
    --danger: #b42318;
    --success: #147a3f;
    --warn: #a15c07;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
    color: var(--accent);
    text-decoration: none;
}

input,
select,
button {
    font: inherit;
}

input,
select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 14px;
    background: #fff;
    color: var(--ink);
}

label {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

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

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 14px;
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 13px;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px 1fr;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-height: 100vh;
    padding: 24px;
    background: #101827;
    color: #fff;
}

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

.brand small,
.brand span + div small {
    display: block;
    color: #9aa7bd;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-weight: 800;
}

.sidebar nav {
    display: grid;
    gap: 8px;
}

.sidebar nav a,
.ghost-button {
    border: 0;
    border-radius: 8px;
    padding: 11px 12px;
    background: transparent;
    color: #dbe4f0;
    text-align: left;
    cursor: pointer;
}

.sidebar nav a.active,
.sidebar nav a:hover,
.ghost-button:hover {
    background: #1d2939;
}

.main-panel {
    width: 100%;
    padding: 32px;
}

.login-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card,
.panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 16px 35px rgba(23, 32, 51, .06);
}

.login-card {
    width: min(430px, 100%);
    padding: 28px;
}

.login-card h1,
.page-header h1 {
    margin: 0;
}

.login-brand {
    margin-bottom: 26px;
}

.stack {
    display: grid;
    gap: 18px;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.check-row input {
    width: auto;
}

.primary-button,
.secondary-button {
    border: 0;
    border-radius: 8px;
    padding: 12px 16px;
    cursor: pointer;
    font-weight: 800;
}

.primary-button {
    background: var(--accent);
    color: #fff;
}

.primary-button:hover {
    background: var(--accent-strong);
}

.secondary-button {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
}

.page-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    margin-bottom: 24px;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}

.balance-card {
    min-width: 220px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    background: #fff;
}

.balance-card span,
.stat span,
.quote-box span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.balance-card strong,
.stat strong,
.quote-box strong {
    display: block;
    margin-top: 4px;
    font-size: 24px;
}

.content-grid {
    display: grid;
    grid-template-columns: minmax(320px, 460px) 1fr;
    gap: 20px;
    align-items: start;
}

.panel {
    padding: 20px;
}

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

.panel-heading h2 {
    margin: 0;
}

.quote-box {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    background: #f9fbfd;
}

.quote-box small,
.muted {
    color: var(--muted);
}

.history-list {
    display: grid;
}

.history-item {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}

.history-item:last-child {
    border-bottom: 0;
}

.history-item span,
.history-item small {
    display: block;
    color: var(--muted);
}

.status {
    display: inline-flex;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.status.success {
    background: #eaf7ef;
    color: var(--success);
}

.status.failed {
    background: #fdecec;
    color: var(--danger);
}

.alert {
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 16px;
    font-weight: 700;
}

.alert.error {
    background: #fdecec;
    color: var(--danger);
}

.alert.success {
    background: #eaf7ef;
    color: var(--success);
}

.search-row {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

.search-row button {
    width: 120px;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

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

@media (max-width: 860px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        min-height: auto;
        padding: 16px;
    }

    .sidebar nav {
        grid-template-columns: repeat(3, 1fr);
    }

    .main-panel {
        padding: 18px;
    }

    .page-header,
    .content-grid,
    .history-item,
    .search-row {
        display: grid;
        grid-template-columns: 1fr;
    }

    .balance-card,
    .search-row button {
        width: 100%;
    }

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

    table,
    thead,
    tbody,
    tr,
    th,
    td {
        display: block;
    }

    thead {
        display: none;
    }

    tr {
        border-bottom: 1px solid var(--line);
        padding: 12px 0;
    }

    td {
        display: grid;
        grid-template-columns: 120px 1fr;
        gap: 12px;
        border-bottom: 0;
        padding: 8px 0;
    }

    td::before {
        content: attr(data-label);
        color: var(--muted);
        font-weight: 800;
    }
}
