/* eunoia.kz portal (login / register / mail) — same tokens as the hold page */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg: #0a0a0c;
    --surface: #111114;
    --surface-2: #16161a;
    --border: rgba(255, 255, 255, 0.06);
    --border-strong: rgba(255, 255, 255, 0.12);
    --text-primary: #e8e6e3;
    --text-secondary: #6b6a6f;
    --accent: #c8ff2e;
    --accent-dim: rgba(200, 255, 46, 0.08);
    --accent-glow: rgba(200, 255, 46, 0.15);
    --danger: #ff5d5d;
    --danger-dim: rgba(255, 93, 93, 0.1);
}

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
    background: var(--bg);
    color: var(--text-primary);
    font-family: 'DM Sans', sans-serif;
    min-height: 100vh;
}

.wordmark {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    letter-spacing: 0.35em;
    color: var(--text-primary);
    text-decoration: none;
}
.wordmark span { color: var(--accent); }

/* ── Auth pages ── */

.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px 36px;
}

.auth-card .wordmark { display: block; text-align: center; font-size: 1.4rem; margin-bottom: 6px; }

.auth-card h1 {
    font-family: 'Syne', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 28px;
}

.field { margin-bottom: 16px; }

.field label {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.field input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    color: var(--text-primary);
    font: inherit;
    padding: 11px 12px;
    outline: none;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }

.field .suffix-wrap { display: flex; align-items: stretch; }
.field .suffix-wrap input { border-radius: 8px 0 0 8px; min-width: 0; }
.field .suffix-wrap .suffix {
    display: flex; align-items: center;
    padding: 0 12px;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-left: none;
    border-radius: 0 8px 8px 0;
    color: var(--text-secondary);
    white-space: nowrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    background: var(--accent);
    color: #0a0a0c;
    border: none;
    border-radius: 8px;
    font: inherit;
    font-weight: 600;
    padding: 12px;
    cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.5; cursor: default; }

.btn--ghost {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-strong);
    width: auto;
    padding: 8px 14px;
}

.auth-error {
    display: none;
    background: var(--danger-dim);
    border: 1px solid var(--danger);
    color: var(--danger);
    border-radius: 8px;
    font-size: 0.85rem;
    padding: 10px 12px;
    margin-bottom: 16px;
}
.auth-error.show { display: block; }

.auth-note {
    display: none;
    background: var(--accent-dim);
    border: 1px solid var(--accent);
    color: var(--accent);
    border-radius: 8px;
    font-size: 0.85rem;
    padding: 10px 12px;
    margin-bottom: 16px;
}
.auth-note.show { display: block; }

.auth-alt {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 20px;
}
.auth-alt a { color: var(--accent); text-decoration: none; }

/* ── Mail app ── */

.mail-body { display: flex; flex-direction: column; height: 100vh; }

.mail-top {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.mail-top .wordmark { font-size: 1rem; }
.mail-top .who { margin-left: auto; color: var(--text-secondary); font-size: 0.85rem; }

.mail-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-bottom: 1px solid var(--border);
}

.tab {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-secondary);
    font: inherit;
    font-size: 0.9rem;
    padding: 7px 14px;
    cursor: pointer;
}
.tab:hover { color: var(--text-primary); }
.tab.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

.mail-main { display: flex; flex: 1; min-height: 0; }

.msg-list {
    width: 380px;
    min-width: 260px;
    overflow-y: auto;
    border-right: 1px solid var(--border);
}

.msg-row {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    font: inherit;
    padding: 12px 16px;
    cursor: pointer;
}
.msg-row:hover { background: var(--surface); }
.msg-row.active { background: var(--accent-dim); }
.msg-row .line1 { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 3px; }
.msg-row .who { font-weight: 600; font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-row .date { color: var(--text-secondary); font-size: 0.72rem; white-space: nowrap; }
.msg-row .subj { color: var(--text-secondary); font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-row.unseen .who, .msg-row.unseen .subj { color: var(--text-primary); }
.msg-row.unseen .who::before {
    content: '';
    display: inline-block;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--accent);
    margin-right: 7px;
    vertical-align: 1px;
}

.msg-view { flex: 1; overflow-y: auto; padding: 24px 28px; }

.msg-view .placeholder { color: var(--text-secondary); margin-top: 40px; text-align: center; }

.msg-view h2 { font-family: 'Syne', sans-serif; font-size: 1.15rem; margin-bottom: 12px; }

.msg-meta {
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.6;
    border-bottom: 1px solid var(--border);
    padding-bottom: 14px;
    margin-bottom: 18px;
}

.msg-text { white-space: pre-wrap; line-height: 1.65; font-size: 0.95rem; overflow-wrap: anywhere; }
.msg-text a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.msg-text a:hover { filter: brightness(1.15); }

.msg-img {
    display: block;
    max-width: 100%;
    max-height: 420px;
    margin: 8px 0;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--surface);
}
.msg-atts {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
.msg-att { color: var(--accent); text-decoration: none; font-size: 0.9rem; }
.msg-att span { color: var(--text-secondary); }
.msg-att:hover { text-decoration: underline; }

.empty-list { color: var(--text-secondary); text-align: center; padding: 40px 16px; font-size: 0.9rem; }

/* ── Compose modal ── */

.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 10;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-backdrop.show { display: flex; }

.modal {
    width: 100%;
    max-width: 560px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    padding: 26px;
}
.modal h2 { font-family: 'Syne', sans-serif; font-size: 1rem; margin-bottom: 18px; }
.modal textarea {
    width: 100%;
    min-height: 180px;
    background: var(--bg);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    color: var(--text-primary);
    font: inherit;
    padding: 11px 12px;
    resize: vertical;
    outline: none;
}
.modal textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.modal .actions .btn { width: auto; padding: 10px 22px; }

@media (max-width: 720px) {
    .msg-list { width: 100%; }
    .mail-main.viewing .msg-list { display: none; }
    .msg-view { display: none; padding: 18px; }
    .mail-main.viewing .msg-view { display: block; }
    .back-btn { display: inline-flex !important; }
}
.back-btn { display: none; }

.msg-actions { display: flex; gap: 10px; margin-bottom: 14px; }
.msg-actions:empty { display: none; }
.msg-actions .btn { width: auto; }
.msg-actions #move-btn { margin-left: auto; }
.btn--spam { color: var(--danger); border-color: var(--danger); }
.btn--spam:hover { background: var(--danger-dim); }
