:root {
    --bg: #0b1220;
    --bg-accent: #13233d;
    --panel: rgba(16, 24, 41, 0.82);
    --panel-strong: rgba(12, 18, 32, 0.94);
    --line: rgba(126, 153, 197, 0.24);
    --line-strong: rgba(153, 177, 214, 0.34);
    --text: #edf2ff;
    --muted: #9cacc7;
    --soft: #c3d0e9;
    --accent: #f3b44f;
    --accent-strong: #ffcc73;
    --accent-cool: #78c2ff;
    --shadow: 0 30px 80px rgba(3, 8, 19, 0.42);
}
body {
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(120, 194, 255, 0.18), transparent 28%),
        radial-gradient(circle at top right, rgba(243, 180, 79, 0.12), transparent 24%),
        linear-gradient(180deg, #101a30 0%, var(--bg) 50%, #08111e 100%);
    color: var(--text);
    margin: 0;
    min-height: 100vh;
}
* {
    box-sizing: border-box;
}
a {
    color: var(--accent-cool);
}
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 72px 72px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 85%);
    pointer-events: none;
}
.page,
.auth-wrap {
    position: relative;
    max-width: 1180px;
    margin: 0 auto;
    padding: 48px 24px 56px;
}
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    gap: 16px;
}
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}
.eyebrow {
    margin: 0 0 8px;
    color: var(--accent-strong);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}
.hero-copy {
    max-width: 760px;
}
.hero-copy h1,
.auth-card h1 {
    margin: 0;
    font-size: clamp(2rem, 3.6vw, 3.5rem);
    line-height: 0.98;
    letter-spacing: -0.04em;
}
.hero-text,
.auth-intro {
    max-width: 720px;
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 1.02rem;
    line-height: 1.6;
}
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}
.agent-card,
.auth-card {
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(20, 30, 51, 0.9), rgba(12, 18, 32, 0.96));
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 24px;
    color: var(--text);
    text-decoration: none;
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}
.agent-card::before,
.auth-card::before,
.summary-card::before,
.panel::before,
.table-shell::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.3), transparent 65%);
    pointer-events: none;
}
.auth-card {
    max-width: 480px;
    margin: 56px auto;
    display: grid;
    gap: 12px;
    padding: 32px 30px;
}
.inline-form {
    margin: 0;
}
label {
    color: var(--soft);
    font-size: 0.92rem;
    font-weight: 600;
}
input,
select,
button {
    min-height: 48px;
    border-radius: 12px;
    border: 1px solid var(--line-strong);
    padding: 0 14px;
    font: inherit;
}
input,
select {
    background: rgba(7, 14, 27, 0.78);
    color: var(--text);
    outline: none;
}
input:focus,
select:focus {
    border-color: rgba(120, 194, 255, 0.7);
    box-shadow: 0 0 0 4px rgba(120, 194, 255, 0.14);
}
button {
    background: linear-gradient(135deg, #f0ad3b, #d78918);
    color: #10141f;
    font-weight: 700;
    cursor: pointer;
    transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}
button:hover,
.ghost-button:hover,
.ghost-link:hover,
.agent-card:hover,
.table-link:hover {
    transform: translateY(-1px);
}
.ghost-button,
.ghost-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    padding: 0 14px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    cursor: pointer;
    text-decoration: none;
    backdrop-filter: blur(10px);
}
.compact-link {
    min-height: 38px;
    padding: 0 10px;
}
.table-shell {
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(16, 24, 41, 0.9), rgba(12, 18, 32, 0.95));
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: var(--shadow);
}
.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
}
.admin-table th,
.admin-table td {
    border-bottom: 1px solid rgba(126, 153, 197, 0.16);
    padding: 16px 18px;
    text-align: left;
    vertical-align: top;
}
.admin-table thead th {
    color: var(--soft);
    font-size: 0.76rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.03);
}
.admin-table tbody tr:last-child td {
    border-bottom: 0;
}
.admin-table tbody tr:hover td {
    background: rgba(120, 194, 255, 0.04);
}
.table-link {
    color: #d6e8ff;
    text-decoration: none;
    font-weight: 700;
}
.error {
    margin: 0 0 4px;
    padding: 12px 14px;
    border: 1px solid rgba(255, 132, 132, 0.35);
    border-radius: 14px;
    background: rgba(103, 24, 31, 0.28);
    color: #ffd4d4;
}
.flash-message {
    margin: 0 0 24px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--line);
}
.flash-success {
    background: rgba(28, 82, 54, 0.28);
    border-color: rgba(107, 201, 144, 0.35);
    color: #dffbe7;
}
.flash-error {
    background: rgba(103, 24, 31, 0.28);
    border-color: rgba(255, 132, 132, 0.35);
    color: #ffd4d4;
}
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 18px;
    margin: 28px 0;
}
.summary-card,
.panel {
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(20, 30, 51, 0.9), rgba(12, 18, 32, 0.96));
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 22px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}
.summary-card h2,
.panel h2 {
    margin: 0 0 10px;
    font-size: 1.12rem;
    line-height: 1.15;
}
.summary-card p {
    margin: 0;
    color: var(--muted);
}
.metric {
    display: block;
    margin-top: 10px;
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    line-height: 1;
    color: var(--text);
}
.panel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
}
.danger-panel {
    margin-bottom: 28px;
    border-color: rgba(243, 180, 79, 0.34);
}
.danger-header {
    margin-bottom: 18px;
}
.purge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}
.purge-card {
    display: grid;
    gap: 12px;
    padding: 18px;
    border: 1px solid rgba(126, 153, 197, 0.18);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(7, 14, 27, 0.82), rgba(10, 16, 30, 0.96));
}
.purge-card-wide {
    margin-bottom: 4px;
}
.purge-card h3 {
    margin: 0;
    font-size: 1.05rem;
}
.danger-button {
    background: linear-gradient(135deg, #ef8d54, #cb4a2f);
    color: #fff7f3;
}
.danger-button-small {
    min-height: 40px;
    padding: 0 12px;
}
.purge-card input[type="text"] {
    width: 100%;
}
.table-action-form {
    display: grid;
    gap: 8px;
    min-width: 150px;
}
.table-action-form + .table-action-form {
    margin-top: 8px;
}
.table-action-form input[type="text"] {
    width: 100%;
}
.stack-form {
    display: grid;
    gap: 12px;
}
.tool-fieldset {
    margin: 0;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
}
.tool-fieldset legend {
    padding: 0 6px;
    color: var(--soft);
    font-weight: 600;
}
.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.check-row input[type="checkbox"] {
    min-height: auto;
}
.credit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}
.record-list {
    display: grid;
    gap: 14px;
}
.record-card {
    border: 1px solid rgba(126, 153, 197, 0.18);
    border-radius: 16px;
    padding: 16px;
    background: linear-gradient(180deg, rgba(7, 14, 27, 0.82), rgba(10, 16, 30, 0.96));
}
.record-card dl {
    margin: 0;
    display: grid;
    grid-template-columns: minmax(120px, 160px) minmax(0, 1fr);
    gap: 10px 16px;
    align-items: start;
}
.record-card dt {
    color: var(--muted);
    font-weight: 600;
    line-height: 1.35;
    overflow-wrap: anywhere;
}
.record-card dd {
    margin: 0;
    min-width: 0;
    line-height: 1.35;
    word-break: break-word;
    overflow-wrap: anywhere;
    white-space: normal;
}
.record-card + .record-card {
    margin-top: 2px;
}
.agent-kicker {
    margin: 0 0 10px;
    color: var(--accent-strong);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}
.agent-card h2 {
    margin: 0 0 10px;
    font-size: 1.45rem;
    line-height: 1.05;
}
.agent-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}
.agent-link {
    display: inline-flex;
    align-items: center;
    margin-top: 18px;
    color: var(--accent-strong);
    font-weight: 700;
    letter-spacing: 0.02em;
}
.muted {
    color: var(--muted);
}
@media (max-width: 700px) {
    .page,
    .auth-wrap {
        padding: 28px 16px 40px;
    }
    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }
    .topbar-actions {
        width: 100%;
        flex-wrap: wrap;
    }
    .hero-copy h1,
    .auth-card h1 {
        font-size: 2.2rem;
    }
    .agent-card,
    .auth-card,
    .summary-card,
    .panel {
        border-radius: 18px;
        padding: 18px;
    }
    .record-card dl {
        grid-template-columns: 1fr;
        gap: 4px;
    }
    .record-card dd {
        margin-bottom: 8px;
    }
    .table-shell {
        overflow-x: auto;
    }
    .admin-table {
        min-width: 620px;
    }
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: 1px solid rgba(255,255,255,0.08);
}

.status-new {
    background: rgba(120, 194, 255, 0.14);
    color: #d8ecff;
}

.status-approved {
    background: rgba(243, 180, 79, 0.16);
    color: #ffe3af;
}

.status-activated {
    background: rgba(56, 189, 120, 0.16);
    color: #d6ffe8;
}

.lead-actions {
    display: grid;
    gap: 8px;
    min-width: 120px;
}

.admin-table-leads th,
.admin-table-leads td {
    vertical-align: middle;
}

.lead-toggle-btn {
    display: grid;
    gap: 4px;
    width: 100%;
    padding: 0;
    margin: 0;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.lead-toggle-title {
    font-weight: 700;
    color: #d6e8ff;
}

.lead-toggle-meta {
    font-size: 13px;
    color: var(--muted);
}

.lead-summary-row td {
    background: transparent;
}

.lead-detail-row td {
    padding-top: 0;
    background: rgba(255,255,255,0.02);
}

.lead-detail-card {
    margin: 4px 0 10px;
    padding: 16px;
    border: 1px solid rgba(126, 153, 197, 0.18);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(7, 14, 27, 0.82), rgba(10, 16, 30, 0.96));
}

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

.lead-detail-item {
    display: grid;
    gap: 6px;
}

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

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

.lead-detail-value {
    line-height: 1.6;
    color: var(--text);
    word-break: break-word;
}

@media (max-width: 760px) {
    .lead-detail-grid {
        grid-template-columns: 1fr;
    }
}
