:root {
    color-scheme: dark;
    --background: #040714;
    --surface: #0b1733;
    --surface-soft: #101f42;
    --border: #23345c;
    --text: #f9f9f9;
    --muted: #a8b3cf;
    --blue: #0063e5;
    --blue-light: #02d6e8;
    --blue-dark: #004aa8;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--background);
}

body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 72% -10%, rgba(0, 99, 229, .32), transparent 34rem),
        radial-gradient(circle at 8% 92%, rgba(2, 214, 232, .1), transparent 28rem),
        var(--background);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

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

.auth-card {
    width: min(100%, 420px);
    padding: 38px;
    border: 1px solid rgba(115, 145, 205, .24);
    border-radius: 20px;
    background: rgba(7, 18, 42, .92);
    box-shadow: 0 30px 90px rgba(0, 0, 0, .42), 0 0 70px rgba(0, 99, 229, .08);
    backdrop-filter: blur(18px);
}

.brand-mark {
    position: relative;
    display: grid;
    width: 104px;
    height: 52px;
    margin-bottom: 30px;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(135deg, #0063e5, #02a9e8);
    font-size: 18px;
    font-weight: 800;
    font-style: italic;
    letter-spacing: -.04em;
    box-shadow: 0 12px 32px rgba(0, 99, 229, .3);
}

.brand-mark::before {
    position: absolute;
    width: 74px;
    height: 24px;
    top: 4px;
    border-top: 2px solid rgba(255, 255, 255, .7);
    border-radius: 50%;
    content: "";
    transform: rotate(-6deg);
}

.brand-mark span {
    margin-left: 2px;
    color: #bdf8ff;
    font-style: normal;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--blue-light);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    font-size: clamp(28px, 4vw, 40px);
    line-height: 1.1;
    letter-spacing: -.035em;
}

.muted {
    margin: 12px 0 0;
    color: var(--muted);
    line-height: 1.6;
}

.auth-form {
    display: grid;
    gap: 18px;
    margin-top: 30px;
}

label {
    display: grid;
    gap: 8px;
}

label span {
    color: #d7d7da;
    font-size: 13px;
    font-weight: 650;
}

input {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    outline: none;
    background: #050b1c;
    color: var(--text);
    font: inherit;
    transition: border-color .2s, box-shadow .2s;
}

input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0, 99, 229, .2);
}

button,
.refresh-button {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--blue), #087ee5);
    color: #fff;
    font: inherit;
    font-weight: 750;
    cursor: pointer;
    transition: background .2s, transform .2s;
}

button:hover,
.refresh-button:hover {
    background: linear-gradient(135deg, #0874f9, var(--blue-dark));
}

button:active,
.refresh-button:active {
    transform: translateY(1px);
}

.alert {
    margin-top: 22px;
    padding: 13px 15px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.5;
}

.alert-error {
    border: 1px solid rgba(255, 95, 111, .35);
    background: rgba(255, 65, 85, .1);
    color: #ffc1c8;
}

.topbar {
    display: flex;
    min-height: 72px;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 0 max(24px, calc((100vw - 1080px) / 2));
    border-bottom: 1px solid var(--border);
    background: rgba(4, 7, 20, .82);
    backdrop-filter: blur(14px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    font-weight: 800;
}

.brand-symbol {
    position: relative;
    display: grid;
    width: 66px;
    height: 32px;
    place-items: center;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--blue), #02a9e8);
    font-size: 12px;
    font-style: italic;
    font-weight: 800;
    letter-spacing: -.03em;
}

.brand-symbol sup {
    color: #bdf8ff;
    font-size: 9px;
    font-style: normal;
}

.account {
    display: flex;
    align-items: center;
    gap: 18px;
    color: var(--muted);
    font-size: 13px;
}

.account a {
    color: #fff;
    font-weight: 700;
}

.dashboard {
    width: min(1080px, calc(100% - 48px));
    margin: 0 auto;
    padding: 64px 0 40px;
}

.page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 30px;
}

.refresh-button {
    flex: 0 0 auto;
    padding: 0 18px;
    font-size: 14px;
}

.mail-list {
    display: grid;
    gap: 12px;
}

.mail-card {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
}

.mail-card[open] {
    border-color: #3b5792;
    box-shadow: 0 14px 40px rgba(0, 0, 0, .16);
}

.mail-card summary {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    gap: 14px;
    align-items: center;
    padding: 18px 20px;
    list-style: none;
    cursor: pointer;
}

.mail-card summary::-webkit-details-marker {
    display: none;
}

.mail-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--blue-light);
    box-shadow: 0 0 0 5px rgba(2, 214, 232, .1);
}

.mail-title {
    display: grid;
    min-width: 0;
    gap: 5px;
}

.mail-title strong,
.mail-title small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mail-title strong {
    font-size: 14px;
}

.mail-title small,
.mail-card time {
    color: var(--muted);
    font-size: 12px;
}

.chevron {
    color: var(--muted);
    font-size: 20px;
    transition: transform .2s;
}

.mail-card[open] .chevron {
    transform: rotate(180deg);
}

.mail-body {
    padding: 0 14px 14px;
    border-top: 1px solid var(--border);
}

.mail-body iframe {
    width: 100%;
    min-height: 520px;
    margin-top: 14px;
    border: 0;
    border-radius: 9px;
    background: #fff;
}

.empty-state {
    padding: 70px 24px;
    border: 1px dashed var(--border);
    border-radius: 16px;
    background: var(--surface);
    text-align: center;
}

.empty-icon {
    margin-bottom: 14px;
    color: var(--blue-light);
    font-size: 38px;
}

.empty-state h2 {
    margin: 0;
    font-size: 20px;
}

.empty-state p {
    margin: 8px 0 0;
    color: var(--muted);
}

footer {
    padding: 20px 24px 30px;
    color: #68686e;
    font-size: 12px;
    text-align: center;
}

@media (max-width: 680px) {
    .auth-card {
        padding: 28px 24px;
    }

    .topbar {
        padding: 0 18px;
    }

    .account span {
        display: none;
    }

    .dashboard {
        width: min(100% - 28px, 1080px);
        padding-top: 38px;
    }

    .page-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .refresh-button {
        align-self: flex-start;
    }

    .mail-card summary {
        grid-template-columns: auto minmax(0, 1fr) auto;
    }

    .mail-card time {
        display: none;
    }

    .mail-body iframe {
        min-height: 440px;
    }
}
