* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    color: #f6f8fb;
    background: #080b10;
}

a {
    color: inherit;
}

.login-page,
.app-shell {
    min-height: 100vh;
    background:
        radial-gradient(circle at 12% 10%, rgba(0, 207, 255, .18), transparent 28%),
        radial-gradient(circle at 88% 18%, rgba(255, 202, 40, .16), transparent 24%),
        linear-gradient(135deg, #07090e 0%, #101923 52%, #0b0f16 100%);
}

.login-card {
    width: min(420px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 24px;
    position: relative;
    top: 50vh;
    transform: translateY(-50%);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 18px;
    background: rgba(9, 13, 20, .84);
    box-shadow: 0 20px 70px rgba(0, 0, 0, .45);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.brand-mark {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(135deg, #00cffc, #ffd24a);
    color: #071018;
    font-weight: 800;
}

h1,
h2,
h3 {
    margin: 0;
}

h1 {
    font-size: 20px;
}

h2 {
    font-size: 18px;
}

.muted {
    color: #aab5c3;
}

label {
    display: block;
    margin: 10px 0 5px;
    color: #dbe5ef;
    font-size: 13px;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 12px;
    background: rgba(255, 255, 255, .08);
    color: #fff;
    padding: 9px 11px;
    font: inherit;
    outline: none;
}

.password-wrap {
    position: relative;
}

.password-wrap input {
    padding-right: 76px;
}

.password-toggle {
    position: absolute;
    right: 5px;
    top: 5px;
    min-height: 28px;
    border-radius: 9px;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    padding: 0 10px;
    font-size: 12px;
}

textarea {
    min-height: 140px;
    resize: vertical;
}

button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    border: 0;
    border-radius: 12px;
    background: #00cffc;
    color: #061018;
    padding: 0 12px;
    font-weight: 700;
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
}

.btn-secondary {
    background: rgba(255, 255, 255, .1);
    color: #f7fbff;
}

.btn-danger {
    background: #ff4d67;
    color: #fff;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 18px;
    background: rgba(6, 9, 14, .88);
    border-bottom: 1px solid rgba(255, 255, 255, .1);
    backdrop-filter: blur(12px);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.account-pill {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    margin-top: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(0, 207, 252, .16);
    color: #dff8ff;
    font-size: 12px;
    font-weight: 800;
}

.account-switcher {
    display: grid;
    grid-template-columns: auto minmax(260px, 1fr);
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid rgba(0, 207, 252, .38);
    border-radius: 14px;
    background: rgba(0, 207, 252, .12);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .04) inset;
}

.account-switcher label {
    margin: 0;
    color: #dff8ff;
    font-weight: 800;
}

.account-switcher select {
    min-width: 280px;
    padding: 8px 10px;
    border-color: rgba(255, 210, 74, .42);
    background: #101923;
    color: #fff;
    font-weight: 800;
}

.account-switcher select option {
    background: #101923;
    color: #fff;
}

.layout {
    display: grid;
    grid-template-columns: 230px 1fr;
    min-height: calc(100vh - 75px);
}

.sidebar {
    padding: 14px;
    border-right: 1px solid rgba(255, 255, 255, .1);
    background: rgba(255, 255, 255, .04);
}

.nav-link {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
    padding: 9px 11px;
    border-radius: 12px;
    color: #dce8f5;
    text-decoration: none;
}

.nav-link.active,
.nav-link:hover {
    background: rgba(0, 207, 252, .16);
    color: #fff;
}

.nav-link-muted {
    color: #9fb1c3;
    opacity: .78;
}

.main {
    padding: 16px;
}

.panel {
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 14px;
    background: rgba(9, 13, 20, .76);
    box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
    overflow: hidden;
}

.panel-head,
.panel-body {
    padding: 14px;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, .09);
}

.mail-list {
    display: grid;
}

.mail-tools {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    background: rgba(255, 255, 255, .035);
}

.filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.mail-filter.active {
    background: #ffd24a;
    color: #101010;
}

.mail-row {
    display: grid;
    grid-template-columns: 72px 1fr 180px;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    text-decoration: none;
}

.mail-row:hover {
    background: rgba(255, 255, 255, .05);
}

.mail-row.unread {
    background: rgba(0, 207, 252, .1);
    font-weight: 700;
}

.mail-open {
    display: grid;
    grid-template-columns: minmax(130px, 220px) 1fr 135px;
    gap: 10px;
    align-items: center;
    color: inherit;
    text-decoration: none;
}

.mail-open strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mail-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    min-height: 24px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .1);
    color: #c9d4df;
    font-size: 11px;
    font-weight: 800;
}

.mail-status.new {
    background: #ffd24a;
    color: #101010;
}

.mail-status.seen {
    background: rgba(255, 255, 255, .1);
}

.mail-forward {
    min-height: 30px;
    padding: 0 10px;
    font-size: 12px;
}

.mail-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.mail-actions form,
.actions form {
    margin: 0;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    border-radius: 999px;
    background: #ffd24a;
    color: #101010;
    padding: 0 7px;
    font-size: 12px;
    font-weight: 800;
}

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

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.file-help {
    margin-top: 6px;
    font-size: 12px;
}

input[type="file"] {
    padding: 10px;
    border-style: dashed;
    background: rgba(255, 255, 255, .06);
}

.template-form {
    display: grid;
    gap: 12px;
}

.template-editor {
    padding: 12px;
    border: 1px solid rgba(0, 207, 252, .22);
    border-radius: 14px;
    background: rgba(255, 255, 255, .05);
}

.template-editor textarea {
    min-height: 210px;
}

.flash {
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(0, 207, 252, .16);
}

.flash.error {
    background: rgba(255, 77, 103, .16);
}

.message-body {
    white-space: pre-wrap;
    line-height: 1.55;
    color: #edf4fb;
}

.message-html {
    width: 100%;
    min-height: 520px;
    border: 0;
    border-radius: 14px;
    background: #fff;
}

.message-text-fallback {
    margin-top: 14px;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 14px;
    background: rgba(255, 255, 255, .06);
    overflow: hidden;
}

.message-text-fallback summary {
    cursor: pointer;
    padding: 12px 14px;
    color: #eaf6ff;
    font-weight: 800;
}

.message-text-fallback .message-body {
    padding: 14px;
    border-top: 1px solid rgba(255, 255, 255, .08);
}

.user-card {
    margin-bottom: 10px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 14px;
    background: rgba(255, 255, 255, .05);
}

.user-card p {
    margin: 0 0 10px;
}

.mini-form {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, .08);
}

.mini-form .actions {
    margin-top: 8px;
}

.blocked-list {
    display: grid;
    gap: 8px;
}

.blocked-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 12px;
    background: rgba(255, 255, 255, .05);
}

.blocked-row form {
    margin: 0;
}

.compose-stage {
    min-height: calc(100vh - 140px);
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
}

.mail-composer {
    width: min(680px, 100%);
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 14px;
    overflow: hidden;
    background: #111820;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .48);
}

.floating-composer {
    margin-left: auto;
}

.reply-composer {
    margin-top: 18px;
}

.composer-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    background: #1c2733;
    color: #f7fbff;
}

.composer-window-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.composer-window-actions a,
.composer-window-actions button {
    width: 28px;
    min-height: 26px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .08);
    color: #fff;
    text-decoration: none;
    padding: 0;
}

.composer-field {
    display: grid;
    grid-template-columns: 46px 1fr;
    align-items: center;
    min-height: 42px;
    padding: 0 12px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.composer-field span {
    color: #aab5c3;
    font-size: 12px;
}

.composer-field input,
.composer-subject,
.template-select {
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.composer-subject,
.template-select {
    min-height: 42px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.composer-toolbar,
.composer-bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, .045);
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.composer-toolbar button,
.composer-toolbar select,
.composer-toolbar input[type="color"],
.composer-bottom button,
.icon-button,
.signature-toggle {
    width: auto;
    min-height: 30px;
    border-radius: 8px;
    padding: 0 9px;
    font-size: 12px;
}

.composer-toolbar select {
    min-width: 92px;
}

.composer-toolbar input[type="color"] {
    width: 36px;
    padding: 3px;
}

.composer-editor {
    min-height: 230px;
    padding: 14px;
    color: #fff;
    line-height: 1.55;
    outline: none;
    overflow: auto;
}

.composer-editor:empty:before {
    content: attr(data-placeholder);
    color: #758394;
}

.composer-bottom {
    border-top: 1px solid rgba(255, 255, 255, .08);
    border-bottom: 0;
}

.send-button {
    background: #1a73e8;
    color: #fff;
    border-radius: 999px;
    padding: 0 18px;
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .1);
    color: #f7fbff;
    cursor: pointer;
    font-weight: 700;
}

.icon-button input {
    display: none;
}

.signature-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #dce8f5;
}

.signature-toggle input {
    width: auto;
}

.trash-button {
    margin-left: auto;
    background: rgba(255, 77, 103, .16);
    color: #fff;
}

.attachment-list {
    display: grid;
    gap: 6px;
    padding: 0 12px 10px;
}

.attachment-item {
    width: fit-content;
    max-width: 100%;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(0, 207, 252, .12);
    color: #dff8ff;
    font-size: 12px;
}

.mail-composer.is-minimized > :not(.composer-top) {
    display: none;
}

@media (max-width: 840px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: flex;
        overflow-x: auto;
        border-right: 0;
        border-bottom: 1px solid rgba(255, 255, 255, .1);
    }

    .nav-link {
        min-width: max-content;
    }

    .mail-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .mail-open {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .mail-forward {
        width: 100%;
    }

    .mail-tools {
        grid-template-columns: 1fr;
    }

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

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar-actions,
    .account-switcher,
    .account-switcher select {
        width: 100%;
    }

    .account-switcher {
        grid-template-columns: 1fr;
    }

    .compose-stage {
        min-height: auto;
    }

    .mail-composer {
        width: 100%;
        min-height: calc(100vh - 170px);
    }

    .composer-editor {
        min-height: 260px;
    }
}
