:root {
    color-scheme: light;
    --app-bg: #edf2f7;
    --app-card: rgba(255, 255, 255, 0.88);
    --app-border: rgba(148, 163, 184, 0.24);
    --app-shadow: 0 24px 55px rgba(15, 23, 42, 0.08);
    --app-text: #0f172a;
    --app-muted: #475569;
    --app-primary: #2563eb;
    --app-primary-strong: #1d4ed8;
    --app-success: #0f766e;
    --app-warning: #b45309;
    --app-danger: #b91c1c;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: Aptos, "Segoe UI Variable Text", "Segoe UI", sans-serif;
    color: var(--app-text);
    background: var(--app-bg);
}

a {
    color: inherit;
}

h1,
h2,
h3 {
    font-family: "Segoe UI Variable Display", Aptos Display, Aptos, "Segoe UI", sans-serif;
    letter-spacing: -0.02em;
}

button,
.primary,
.auth-primary-button,
.auth-link-button {
    border: 0;
    border-radius: 14px;
    padding: 12px 16px;
    font: inherit;
    font-weight: 650;
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

button:hover,
.primary:hover,
.auth-primary-button:hover,
.auth-link-button:hover {
    transform: translateY(-1px);
}

button,
.primary,
.auth-primary-button {
    background: linear-gradient(135deg, var(--app-primary), var(--app-primary-strong));
    color: #eff6ff;
    box-shadow: 0 16px 28px rgba(37, 99, 235, 0.18);
}

button.secondary,
.secondary {
    background: rgba(255, 255, 255, 0.86);
    color: var(--app-text);
    border: 1px solid var(--app-border);
    box-shadow: none;
}

input,
select,
textarea,
.form-control {
    width: 100%;
    box-sizing: border-box;
    min-height: 44px;
    padding: 11px 13px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.32);
    background: rgba(255, 255, 255, 0.96);
    color: var(--app-text);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

input:focus,
select:focus,
textarea:focus,
.form-control:focus {
    outline: 2px solid rgba(37, 99, 235, 0.18);
    border-color: rgba(37, 99, 235, 0.45);
}

label {
    color: var(--app-muted);
    font-size: 0.95rem;
}

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

th,
td {
    padding: 13px 12px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.95);
    vertical-align: top;
}

th {
    text-align: left;
    font-size: 0.84rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
}

.surface-card {
    background: var(--app-card);
    border: 1px solid var(--app-border);
    border-radius: 24px;
    box-shadow: var(--app-shadow);
    backdrop-filter: blur(16px);
}

.status-banner {
    margin-bottom: 16px;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid rgba(37, 99, 235, 0.16);
    background: rgba(239, 246, 255, 0.96);
    color: #1d4ed8;
}

.danger-text {
    color: var(--app-danger);
}

.muted-text {
    color: var(--app-muted);
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.14);
    color: #334155;
    font-size: 0.82rem;
    font-weight: 600;
}

.pill-success {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}

.pill-warning {
    background: rgba(245, 158, 11, 0.14);
    color: #b45309;
}

.pill-danger {
    background: rgba(239, 68, 68, 0.14);
    color: #b91c1c;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(15, 23, 42, 0.48);
    backdrop-filter: blur(8px);
}

.modal-shell {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 24px;
}

.modal-card {
    width: min(920px, 100%);
    max-height: calc(100vh - 48px);
    overflow: auto;
    padding: 24px;
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(148, 163, 184, 0.22);
    box-shadow: 0 34px 80px rgba(15, 23, 42, 0.22);
}

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

.modal-head h2 {
    margin: 0;
}

.modal-head p {
    margin: 6px 0 0;
    color: var(--app-muted);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
}

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

.field-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

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

.auth-panel {
    min-height: 72vh;
    display: grid;
    place-items: center;
}

.auth-card {
    width: min(720px, 100%);
    padding: 32px;
    border-radius: 28px;
    background:
        radial-gradient(circle at top right, rgba(37, 99, 235, 0.12), transparent 34%),
        rgba(255, 255, 255, 0.97);
    border: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow: 0 30px 80px rgba(15, 23, 42, 0.12);
}

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

.auth-kicker {
    display: inline-block;
    margin-bottom: 10px;
    color: #1d4ed8;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.76rem;
    font-weight: 700;
}

.auth-copy {
    color: var(--app-muted);
    max-width: 62ch;
    margin-bottom: 20px;
}

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

.auth-block {
    padding: 20px;
    border-radius: 22px;
    background: rgba(248, 250, 252, 0.92);
    border: 1px solid rgba(226, 232, 240, 0.96);
}

.auth-block-muted {
    background: linear-gradient(180deg, rgba(239, 246, 255, 0.9), rgba(240, 253, 250, 0.92));
}

.auth-field {
    display: grid;
    gap: 8px;
    margin-bottom: 14px;
}

.auth-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 4px 0 16px;
}

.auth-link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.9);
    color: var(--app-text);
    border: 1px solid rgba(148, 163, 184, 0.24);
    box-shadow: none;
}

.auth-hint,
.auth-empty-provider {
    color: var(--app-muted);
}

.auth-external-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 0;
}

.crud-page {
    display: grid;
    gap: 14px;
}

.crud-form,
.crud-list {
    padding: 20px;
}

.crud-form h1 {
    margin: 0 0 12px;
}

.crud-list h2 {
    margin: 14px 0 8px;
}

.track-kicker {
    display: inline-block;
    font-size: 0.74rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #4d7c0f;
    font-weight: 700;
}

.selector-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

@media (max-width: 820px) {
    .field-grid,
    .field-grid-3,
    .auth-grid {
        grid-template-columns: 1fr;
    }

    .modal-shell {
        padding: 14px;
    }

    .auth-card,
    .modal-card {
        padding: 20px;
    }
}
