:root {
    --agent-ink: #17212b;
    --agent-muted: #6b7280;
    --agent-primary: #029E93;
    --agent-primary-dark: #01847b;
    --agent-surface: #ffffff;
    --agent-bg: #f5f7fa;
    --agent-border: #e7ebf0;
    --agent-success: #029E93;
}

* { box-sizing: border-box; }
body.agent-body {
    margin: 0;
    min-height: 100vh;
    color: var(--agent-ink);
    background: var(--agent-bg);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.agent-shell { display: flex; min-height: 100vh; }
.agent-sidebar {
    width: 250px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 28px 18px 20px;
    background: #fff;
    border-right: 1px solid var(--agent-border);
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 30;
}
.agent-sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px 28px;
}
.agent-brand { color: var(--agent-ink); text-decoration: none; font-size: 21px; font-weight: 800; }
.agent-brand span { color: var(--agent-primary); }
.agent-links { display: flex; flex-direction: column; gap: 7px; }
.agent-links a, .agent-link-button {
    display: flex;
    align-items: center;
    gap: 11px;
    color: #4b5563;
    background: transparent;
    border: 0;
    text-decoration: none;
    padding: 12px 14px;
    border-radius: 9px;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.agent-nav-icon { width: 19px; height: 19px; flex: 0 0 auto; fill: currentColor; }
.agent-links a.active { color: var(--agent-primary-dark); background: #e8f7f6; font-weight: 700; }
.agent-links a:hover, .agent-link-button:hover { color: var(--agent-primary-dark); background: #f2fbfa; }
.agent-logout { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--agent-border); }
.agent-logout .agent-link-button { width: 100%; }
.agent-content { width: calc(100% - 250px); min-width: 0; margin-left: 250px; }
.agent-main { width: min(1180px, calc(100% - 64px)); margin: 34px auto; }
.agent-mobile-header, .agent-sidebar-close, .agent-sidebar-backdrop { display: none; }
.agent-heading { margin: 0 0 6px; font-size: clamp(26px, 4vw, 36px); }
.agent-subheading { color: var(--agent-muted); margin: 0 0 26px; }
.agent-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.agent-card {
    background: var(--agent-surface);
    border: 1px solid var(--agent-border);
    border-radius: 14px;
    padding: 22px;
    box-shadow: 0 8px 24px rgba(23, 33, 43, .04);
}
.agent-stat-label { color: var(--agent-muted); font-size: 14px; margin-bottom: 12px; }
.agent-stat-value { font-size: 32px; font-weight: 800; letter-spacing: -.03em; }
.agent-code {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 22px;
    background: #17212b;
    color: white;
}
.agent-code code { color: #8fe1db; font-size: 22px; font-weight: 800; }
.agent-section { margin-top: 24px; }
.agent-section-title { font-size: 19px; margin: 0 0 16px; }
.agent-table-wrap { overflow-x: auto; }
.agent-table { width: 100%; border-collapse: collapse; min-width: 620px; }
.agent-table th, .agent-table td { padding: 13px 12px; text-align: left; border-bottom: 1px solid var(--agent-border); }
.agent-table th { color: var(--agent-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.agent-positive { color: var(--agent-success); font-weight: 700; }
.agent-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.agent-form-grid-single { grid-template-columns: minmax(0, 680px); }
.agent-field { margin-bottom: 16px; }
.agent-field label { display: block; margin-bottom: 7px; font-weight: 650; font-size: 14px; }
.agent-input {
    width: 100%;
    border: 1px solid #d7dde5;
    border-radius: 9px;
    padding: 12px 13px;
    font: inherit;
    outline: none;
    background: white;
}
.agent-input:focus { border-color: var(--agent-primary); box-shadow: 0 0 0 3px rgba(2, 158, 147, .14); }
.agent-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 9px;
    padding: 12px 18px;
    color: white;
    background: var(--agent-primary);
    font: inherit;
    font-weight: 750;
    cursor: pointer;
    text-decoration: none;
}
.agent-button:hover { background: var(--agent-primary-dark); color: white; }
.agent-alert { padding: 12px 14px; border-radius: 9px; margin-bottom: 18px; }
.agent-alert-success { background: #eaf8f1; color: #126944; }
.agent-alert-error { background: #fff0ee; color: #a7352b; }
.agent-auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 28px 16px; }
.agent-auth-card { width: min(480px, 100%); }
.agent-auth-logo { text-align: center; margin-bottom: 20px; }
.agent-auth-card h1 { margin: 0 0 7px; font-size: 29px; }
.agent-auth-note { color: var(--agent-muted); margin: 0 0 24px; }
.agent-auth-footer { text-align: center; margin-top: 18px; color: var(--agent-muted); }
.agent-auth-footer a { color: var(--agent-primary); font-weight: 700; }
.agent-text-button { padding: 0; border: 0; color: var(--agent-primary); background: transparent; font: inherit; font-weight: 700; cursor: pointer; }
.agent-otp-input { text-align: center; font-size: 24px; font-weight: 750; letter-spacing: .35em; }
.agent-suggestions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 9px; }
.agent-suggestion { border: 1px solid #9fddd8; background: #effaf9; color: #017b73; border-radius: 999px; padding: 5px 10px; cursor: pointer; }
.agent-errors { margin: 0; padding-left: 18px; }
.agent-meta { color: var(--agent-muted); font-size: 13px; }
.agent-button.is-loading, .agent-link-button.is-loading, .agent-text-button.is-loading {
    gap: 8px;
    cursor: wait;
    opacity: .78;
}
.agent-spinner {
    width: 24px;
    height: 24px;
    flex: 0 0 auto;
    border: 3px solid rgba(2, 158, 147, .2);
    border-top-color: var(--agent-primary);
    border-radius: 50%;
    animation: agent-spin .7s linear infinite;
}
.agent-spinner-small {
    width: 17px;
    height: 17px;
    border-width: 2px;
    border-color: rgba(255, 255, 255, .4);
    border-top-color: currentColor;
}
.agent-text-button .agent-spinner-small, .agent-link-button .agent-spinner-small {
    border-color: rgba(2, 158, 147, .2);
    border-top-color: var(--agent-primary);
}
.agent-page-loader {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(245, 247, 250, .72);
    backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .16s ease, visibility .16s ease;
}
.agent-page-loader.is-visible { opacity: 1; visibility: visible; }
.agent-page-loader-box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 19px;
    border: 1px solid var(--agent-border);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 14px 40px rgba(23, 33, 43, .14);
    font-weight: 700;
}
.agent-toast-region {
    position: fixed;
    z-index: 1100;
    right: 22px;
    bottom: 22px;
    display: flex;
    width: min(380px, calc(100% - 32px));
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.agent-toast {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 13px 15px;
    border: 1px solid var(--agent-border);
    border-radius: 11px;
    color: var(--agent-ink);
    background: #fff;
    box-shadow: 0 14px 38px rgba(23, 33, 43, .16);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity .2s ease, transform .2s ease;
}
.agent-toast.is-visible { opacity: 1; transform: translateY(0); }
.agent-toast-icon {
    display: inline-grid;
    width: 24px;
    height: 24px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: var(--agent-success);
    font-size: 14px;
    font-weight: 800;
}
.agent-toast-error .agent-toast-icon { background: #c84035; }
@keyframes agent-spin { to { transform: rotate(360deg); } }

@media (max-width: 760px) {
    body.agent-sidebar-open { overflow: hidden; }
    .agent-sidebar {
        width: min(290px, 86vw);
        transform: translateX(-100%);
        transition: transform .22s ease;
        box-shadow: 12px 0 36px rgba(23, 33, 43, .14);
    }
    .agent-sidebar-open .agent-sidebar { transform: translateX(0); }
    .agent-sidebar-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border: 0;
        border-radius: 8px;
        color: var(--agent-muted);
        background: var(--agent-bg);
        font-size: 25px;
        cursor: pointer;
    }
    .agent-sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 20;
        border: 0;
        background: rgba(23, 33, 43, .48);
    }
    .agent-sidebar-open .agent-sidebar-backdrop { display: block; }
    .agent-content { width: 100%; margin-left: 0; }
    .agent-mobile-header {
        display: flex;
        align-items: center;
        gap: 14px;
        height: 66px;
        padding: 0 16px;
        background: #fff;
        border-bottom: 1px solid var(--agent-border);
        position: sticky;
        top: 0;
        z-index: 10;
    }
    .agent-menu-button {
        display: inline-flex;
        width: 40px;
        height: 40px;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 5px;
        padding: 0;
        border: 1px solid var(--agent-border);
        border-radius: 9px;
        background: #fff;
        cursor: pointer;
    }
    .agent-menu-button span { width: 18px; height: 2px; border-radius: 2px; background: var(--agent-ink); }
    .agent-mobile-header .agent-brand { font-size: 18px; }
    .agent-main { width: calc(100% - 32px); margin-top: 24px; }
    .agent-grid, .agent-form-grid { grid-template-columns: 1fr; }
    .agent-code { align-items: flex-start; flex-direction: column; }
    .agent-toast-region { right: 16px; bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .agent-spinner { animation-duration: 1.4s; }
    .agent-page-loader, .agent-toast { transition: none; }
}

/* Explanatory content on dashboard / earnings */
.agent-explainer { margin: 0; padding-left: 20px; color: var(--agent-ink); line-height: 1.65; }
.agent-explainer li { margin-bottom: 10px; }
.agent-explainer li:last-child { margin-bottom: 0; }
.agent-explainer-sub { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--agent-muted); margin: 20px 0 10px; }
.agent-explainer a { color: var(--agent-primary-dark); font-weight: 600; }
