/* ============================================================
   Maven ID — identity service (LIGHT theme, default)
   Silver canvas · white elevated surfaces · ink text · plum accent
   Palette: bg-canvas #DCE0E6 · surface #E6E9EE · muted #C8CDD5
            border #A4ABB6 · text #1C1F24 / #525864 / #7A828E
            accent #605158 (hover #4e4149)
   ============================================================ */

:root {
    /* Brand */
    --maven-gold: #7D6361;
    --maven-gold-light: #B59F9A;
    --maven-gold-deep: #5F4A48;
    --maven-blue: #4A90E2;

    /* Surfaces */
    --auth-bg: #DCE0E6;
    --auth-surface: rgba(255, 255, 255, 0.72);
    --auth-surface-hover: rgba(255, 255, 255, 0.95);
    --auth-border: rgba(164, 171, 182, 0.55);
    --auth-border-strong: rgba(164, 171, 182, 0.85);

    /* Type */
    --auth-text: #1C1F24;
    --auth-muted: #525864;
    --auth-faint: #7A828E;

    /* Shape */
    --auth-radius: 14px;
    --auth-radius-lg: 24px;

    /* Elevation */
    --auth-shadow: 0 24px 60px -18px rgba(28, 31, 36, 0.25);

    /* Maven distressed logo palette */
    --logo-ink-dark: #1E242B;
    --logo-slate-blue: #343E4A;
    --logo-cosmic-plum: #3B2E33;
    --logo-rose-bronze: #7D6361;
    --logo-dusty-gold: #B59F9A;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1.25rem;
    padding: 24px;
    color: var(--auth-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background:
        linear-gradient(160deg, rgba(255, 255, 255, 0.55) 0%, rgba(200, 205, 213, 0.4) 45%, rgba(220, 224, 230, 0.2) 100%),
        radial-gradient(900px 480px at 85% -10%, rgba(184, 139, 74, 0.10), transparent 60%),
        radial-gradient(700px 420px at 6% 110%, rgba(74, 144, 226, 0.08), transparent 55%),
        var(--auth-bg);
}

/* ---------- Card ---------- */

.card {
    position: relative;
    width: 100%;
    max-width: 420px;
    padding: 2.75rem 2.5rem 2.5rem;
    background: var(--auth-surface);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius-lg);
    box-shadow: var(--auth-shadow);
    backdrop-filter: blur(18px);
}

.card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.5), transparent 55%);
}

/* ---------- Brand ---------- */

.brand-area {
    text-align: center;
    margin-bottom: 0.9rem;
}

.brand-lockup {
    display: block;
    width: min(150px, 52%);
    height: auto;
    margin: 0 auto;
}

.kicker {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--maven-gold);
    text-align: center;
    margin-bottom: 0.9rem;
    white-space: nowrap;
}

.sub {
    color: var(--auth-muted);
    font-size: 0.85rem;
    line-height: 1.5;
    text-align: center;
    margin: 0 0 1.75rem;
}

/* ---------- Form ---------- */

label {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--auth-muted);
    margin-bottom: 0.4rem;
}

input {
    width: 100%;
    padding: 0.85rem 1rem;
    font-size: 0.9rem;
    color: var(--auth-text);
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius);
    margin-bottom: 1rem;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

input::placeholder { color: var(--auth-faint); }

select {
    appearance: none;
    width: 100%;
    padding: 0.85rem 2.4rem 0.85rem 1rem;
    font-size: 0.9rem;
    color: var(--auth-text);
    background-color: rgba(255, 255, 255, 0.78);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237A828E' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius);
    margin-bottom: 1rem;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

select:focus {
    outline: none;
    border-color: var(--maven-gold);
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(96, 81, 88, 0.16);
}

select option { background: #ffffff; color: var(--auth-text); }

input:focus {
    outline: none;
    border-color: var(--maven-gold);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(125, 99, 97, 0.16);
}

.input-wrap { position: relative; display: flex; align-items: center; }

.input-wrap > svg {
    position: absolute;
    left: 0.95rem;
    width: 1rem;
    height: 1rem;
    color: var(--auth-faint);
    pointer-events: none;
}

.input-wrap input { padding-left: 2.6rem; margin-bottom: 0; }

.input-wrap + label,
form > .input-wrap { margin-bottom: 1rem; }

.input-wrap + label { margin-top: 0.25rem; }

.peek {
    position: absolute;
    right: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    color: var(--auth-faint);
    background: none;
    border: 0;
    border-radius: 8px;
    padding: 0;
    cursor: pointer;
    transition: color 0.15s ease;
}

.peek:hover { color: var(--auth-text); }

.peek svg { width: 1rem; height: 1rem; }

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--auth-text);
    -webkit-box-shadow: 0 0 0 1000px #eef0f4 inset;
    transition: background-color 9999s ease-in-out 0s;
}

/* ---------- Buttons ---------- */

button {
    width: 100%;
    padding: 0.95rem 1rem;
    border: 0;
    border-radius: var(--auth-radius);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #ffffff;
    background: linear-gradient(135deg, var(--maven-gold) 0%, var(--maven-gold-deep) 100%);
    box-shadow: 0 10px 26px -8px rgba(125, 99, 97, 0.5);
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 14px 32px -8px rgba(125, 99, 97, 0.6);
    filter: brightness(1.05);
}

button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}

form > button { margin-top: 1.25rem; }

.btn-ghost {
    letter-spacing: normal;
    text-transform: none;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--auth-muted);
    background: rgba(28, 31, 36, 0.04);
    border: 1px solid var(--auth-border);
    box-shadow: none;
}

.btn-ghost:hover {
    color: var(--auth-text);
    border-color: var(--auth-border-strong);
    background: var(--auth-surface-hover);
    filter: none;
}

/* ---------- Links / footer rows ---------- */

.links {
    margin-top: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
}

.links a {
    color: var(--maven-gold);
    font-weight: 700;
    text-decoration: none;
}

.links a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.links .muted { color: var(--auth-muted); }

.links form { width: 100%; }

.foot-note {
    font-size: 0.72rem;
    color: var(--auth-faint);
    text-align: center;
    margin: 0;
}

.foot-note a { color: var(--auth-muted); text-decoration: none; }

.foot-note a:hover {
    color: var(--maven-gold);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ---------- Divider ---------- */

.divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: var(--auth-faint);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.divider::before,
.divider::after {
    content: '';
    height: 1px;
    flex-grow: 1;
    background: linear-gradient(90deg, transparent, var(--auth-border));
}

.divider::after {
    background: linear-gradient(90deg, var(--auth-border), transparent);
}

/* ---------- Social providers ---------- */

.social {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
    margin-bottom: 0.35rem;
}

.social--single { grid-template-columns: 1fr; }

.sbtn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    padding: 0.78rem 0.75rem;
    font-size: 0.86rem;
    font-weight: 500;
    color: var(--auth-text);
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius);
    text-decoration: none;
    transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease, color 0.16s ease;
}

.sbtn:hover {
    border-color: var(--auth-border-strong);
    background: #ffffff;
    color: var(--auth-text);
    transform: translateY(-1px);
}

.sbtn svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ---------- Turnstile ---------- */

.cf-turnstile {
    display: flex;
    justify-content: center;
    margin: 1rem 0;
}

/* ---------- Alerts ---------- */

.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.9rem 1rem;
    border-radius: 12px;
    color: #b91c1c;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.3);
    font-size: 0.85rem;
    line-height: 1.45;
    margin: 0 0 1.25rem;
    text-align: left;
}

.status {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.9rem 1rem;
    border-radius: 12px;
    color: #15803d;
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.3);
    font-size: 0.85rem;
    line-height: 1.45;
    margin: 0 0 1.25rem;
    text-align: left;
}

.muted { color: var(--auth-muted); font-size: 0.85rem; }

/* ---------- Consent (OAuth authorize) ---------- */

.app-line {
    font-size: 0.92rem;
    line-height: 1.5;
    color: var(--auth-text);
    text-align: center;
    margin-bottom: 1.25rem;
}

.app-line b { color: #000; }

.scopes {
    list-style: none;
    margin: 0 0 1.25rem;
    padding: 0.9rem 1rem;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius);
}

.scopes ul { list-style: none; padding: 0; margin: 0; }

.scopes li {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    margin: 0.45rem 0;
    font-size: 0.85rem;
    line-height: 1.45;
    color: var(--auth-muted);
}

.scopes li svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    margin-top: 0.15rem;
    color: var(--maven-gold);
}

.scopes li strong { color: var(--auth-text); }

.actions { display: flex; gap: 0.65rem; }

.actions button { flex: 1; }

.actions .deny {
    color: var(--auth-muted);
    background: rgba(28, 31, 36, 0.04);
    border: 1px solid var(--auth-border);
    box-shadow: none;
    letter-spacing: normal;
    text-transform: none;
    font-size: 0.85rem;
    font-weight: 600;
}

.actions .deny:hover {
    color: var(--auth-text);
    border-color: var(--auth-border-strong);
    background: var(--auth-surface-hover);
    filter: none;
    transform: none;
    box-shadow: none;
}

.actions .allow {
    color: #ffffff;
    background: linear-gradient(135deg, var(--maven-gold) 0%, var(--maven-gold-deep) 100%);
    letter-spacing: normal;
    text-transform: none;
    font-size: 0.85rem;
    font-weight: 700;
}

/* ---------- Responsive / motion ---------- */

@media (max-width: 480px) {
    .card { padding: 2rem 1.5rem; }
    .social { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    button, .sbtn { transition: none; }
    button:hover, .sbtn:hover { transform: none; }
}

/* ============================================================
   DARK MODE — canonical black-and-gold identity
   (html[data-mode="dark"], saved via the toggle / user preference)
   ============================================================ */

html[data-mode="dark"] {
    --auth-bg: #060a13;
    --auth-surface: rgba(13, 18, 30, 0.88);
    --auth-surface-hover: rgba(255, 255, 255, 0.06);
    --auth-border: rgba(255, 255, 255, 0.09);
    --auth-border-strong: rgba(255, 255, 255, 0.16);
    --auth-text: #eef1f7;
    --auth-muted: #8b93a7;
    --auth-faint: #5d6478;
    --maven-gold: #BF953F;
    --maven-gold-light: #f3e5ab;
    --maven-gold-deep: #aa771c;
    --auth-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.75);
}

html[data-mode="dark"] body {
    background:
        radial-gradient(1100px 560px at 82% -12%, rgba(191, 149, 63, 0.13), transparent 62%),
        radial-gradient(900px 480px at 8% 112%, rgba(74, 144, 226, 0.10), transparent 58%),
        var(--auth-bg);
}

html[data-mode="dark"] .card {
    background: linear-gradient(180deg, rgba(17, 23, 38, 0.92), rgba(11, 16, 28, 0.88));
    border-top-color: rgba(191, 149, 63, 0.32);
}

html[data-mode="dark"] .card::before {
    background: radial-gradient(420px 200px at 50% -8%, rgba(191, 149, 63, 0.10), transparent 70%);
}

html[data-mode="dark"] input,
html[data-mode="dark"] select {
    background: var(--auth-surface);
    color: var(--auth-text);
}

html[data-mode="dark"] select option { background: #0d1526; color: var(--auth-text); }

html[data-mode="dark"] input:focus,
html[data-mode="dark"] select:focus {
    border-color: rgba(191, 149, 63, 0.65);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 0 3px rgba(191, 149, 63, 0.16);
}

html[data-mode="dark"] input:-webkit-autofill,
html[data-mode="dark"] input:-webkit-autofill:hover,
html[data-mode="dark"] input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--auth-text);
    -webkit-box-shadow: 0 0 0 1000px #101828 inset;
}

html[data-mode="dark"] button {
    color: #100c02;
    background: linear-gradient(135deg, var(--maven-gold) 0%, var(--maven-gold-light) 52%, var(--maven-gold-deep) 100%);
    box-shadow: 0 10px 26px -8px rgba(191, 149, 63, 0.45);
}

html[data-mode="dark"] .btn-ghost {
    color: var(--auth-muted);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--auth-border);
}

html[data-mode="dark"] .btn-ghost:hover {
    color: var(--auth-text);
    background: var(--auth-surface-hover);
}

html[data-mode="dark"] .sbtn {
    color: #d7dce8;
    background: var(--auth-surface);
}

html[data-mode="dark"] .sbtn:hover {
    background: var(--auth-surface-hover);
    color: #fff;
}

html[data-mode="dark"] .scopes {
    background: var(--auth-surface);
}

html[data-mode="dark"] .scopes li { color: #c6ccd8; }
html[data-mode="dark"] .scopes li strong { color: var(--auth-text); }

html[data-mode="dark"] .app-line b { color: #fff; }

html[data-mode="dark"] .alert {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.28);
}

html[data-mode="dark"] .status {
    color: #86efac;
    background: rgba(34, 197, 94, 0.08);
    border-color: rgba(34, 197, 94, 0.28);
}

html[data-mode="dark"] .actions .deny {
    color: var(--auth-muted);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--auth-border);
}

html[data-mode="dark"] .actions .allow {
    color: #100c02;
    background: linear-gradient(135deg, var(--maven-gold) 0%, var(--maven-gold-light) 52%, var(--maven-gold-deep) 100%);
}

/* ---------- Mode toggle ---------- */

.mode-toggle {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    border: 1px solid var(--auth-border);
    background: var(--auth-surface);
    color: var(--auth-muted);
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.mode-toggle:hover {
    color: var(--maven-gold);
    border-color: var(--maven-gold);
    transform: scale(1.06);
}

.mode-toggle svg { width: 1.1rem; height: 1.1rem; }

.mode-toggle .icon-sun { display: none; }
.mode-toggle .icon-moon { display: block; }

html[data-mode="dark"] .mode-toggle .icon-sun { display: block; }
html[data-mode="dark"] .mode-toggle .icon-moon { display: none; }
