:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-muted: #eef3f7;
    --text: #18202c;
    --muted: #667085;
    --line: #d9e1ea;
    --primary: #0f766e;
    --primary-dark: #115e59;
    --danger: #b42318;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background: var(--bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

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

.auth-page {
    display: grid;
    place-items: center;
    padding: 32px 16px;
}

.auth-shell {
    width: min(100%, 760px);
}

.auth-brand,
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
}

.auth-brand {
    justify-content: center;
    margin-bottom: 24px;
}

.auth-brand div {
    display: grid;
    gap: 2px;
}

.auth-brand span:last-child {
    color: var(--muted);
    font-size: 13px;
}

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

.auth-card,
.panel,
.metric-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 12px 34px rgba(24, 32, 44, 0.06);
}

.auth-card {
    width: min(100%, 460px);
    margin: 0 auto;
    padding: 28px;
}

.auth-card-wide {
    width: min(100%, 720px);
}

.auth-card h1,
.page-heading h1 {
    margin: 0 0 8px;
    font-size: 28px;
    line-height: 1.2;
}

.auth-card p,
.panel p {
    margin: 0 0 22px;
    color: var(--muted);
    line-height: 1.55;
}

.form {
    display: grid;
    gap: 16px;
}

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

.form label {
    display: grid;
    gap: 7px;
    color: var(--text);
    font-size: 14px;
    font-weight: 650;
}

.form input {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text);
    background: #ffffff;
    font: inherit;
}

.form-submit {
    grid-column: 1 / -1;
}

.button {
    min-height: 40px;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 9px 14px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

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

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

.button-ghost {
    color: var(--text);
    border-color: var(--line);
    background: var(--surface);
}

.notice {
    margin-bottom: 16px;
    border: 1px solid #99d6c8;
    border-radius: 8px;
    padding: 10px 12px;
    color: #064e3b;
    background: #ecfdf3;
}

.notice-error {
    border-color: #fecdca;
    color: var(--danger);
    background: #fff1f0;
}

.switch-link {
    margin-top: 18px !important;
    margin-bottom: 0 !important;
    text-align: center;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
    border-bottom: 1px solid var(--line);
    padding: 0 24px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(12px);
}

.app-shell {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    min-height: calc(100vh - 104px);
}

.sidebar {
    border-right: 1px solid var(--line);
    padding: 24px 16px;
    background: var(--surface);
}

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

.nav a {
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text);
    font-weight: 650;
}

.nav a:hover {
    background: var(--surface-muted);
}

.app-main {
    padding: 28px;
}

.page-heading {
    margin-bottom: 20px;
}

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

.metric-card {
    display: grid;
    gap: 10px;
    min-height: 120px;
    padding: 18px;
}

.metric-card span {
    color: var(--muted);
    font-size: 14px;
}

.metric-card strong {
    font-size: 18px;
}

.panel {
    max-width: 720px;
    padding: 22px;
}

.panel h2 {
    margin: 0 0 8px;
    font-size: 20px;
}

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

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

.eyebrow {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.status-pill {
    border-radius: 999px;
    padding: 6px 10px;
    color: #064e3b;
    background: #d1fae5;
    font-size: 13px;
    font-weight: 800;
}

.detail-list {
    display: grid;
    gap: 14px;
    margin: 0;
}

.detail-list div {
    display: grid;
    gap: 4px;
}

.detail-list dt {
    color: var(--muted);
    font-size: 13px;
}

.detail-list dd {
    margin: 0;
    font-weight: 750;
}

.total-transfer-row {
    border: 1px solid #99d6c8;
    border-radius: 8px;
    padding: 12px;
    background: #ecfdf3;
}

.total-transfer-row dd {
    color: #064e3b;
    font-size: 24px;
    font-weight: 900;
}

.copy-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.copy-row code {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 10px;
    background: var(--surface-muted);
    font: inherit;
    font-weight: 800;
}

.instruction-list {
    display: grid;
    gap: 8px;
    margin: 20px 0 0;
    padding-left: 20px;
    color: var(--muted);
    line-height: 1.5;
}

.dashboard-next {
    margin-top: 18px;
}

.raw-key-panel,
.key-list-panel {
    margin-top: 18px;
}

.compact-form {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
}

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

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th,
.data-table td {
    border-bottom: 1px solid var(--line);
    padding: 12px 10px;
    text-align: left;
    vertical-align: top;
}

.data-table th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.footer {
    border-top: 1px solid var(--line);
    padding: 14px 24px;
    color: var(--muted);
    background: var(--surface);
    font-size: 13px;
}

@media (max-width: 820px) {
    .form-grid,
    .app-shell,
    .metric-grid,
    .billing-grid {
        grid-template-columns: 1fr;
    }

    .sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--line);
        padding: 12px 16px;
    }

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

    .compact-form {
        grid-template-columns: 1fr;
    }

    .app-main {
        padding: 20px 16px;
    }
}
