﻿/*
  Палитра:
  --paper     #F4F6FB  фон
  --surface   #FFFFFF  карточки, панели
  --ink       #0F172A  основной текст
  --slate     #64748B  вторичный текст
  --line      #E2E8F0  границы
  --stamp     #2563EB  акцент
  --stamp-dk  #1D4ED8  акцент, hover
  --amber     #F59E0B  непрочитано
  --danger    #DC2626  ошибки

  Шрифты: системный sans для текста, системный monospace для
  меток/дат/адресов — без внешних CDN, чтобы сервис разворачивался
  где угодно без зависимости от интернет-доступа к шрифтам.
*/

:root {
    --paper: #F4F6FB;
    --surface: #FFFFFF;
    --ink: #0F172A;
    --slate: #64748B;
    --line: #E2E8F0;
    --stamp: #2563EB;
    --stamp-dk: #1D4ED8;
    --stamp-soft: rgba(37, 99, 235, 0.10);
    --amber: #F59E0B;
    --danger: #DC2626;
    --danger-bg: #FEF2F2;

    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
}

button, input { font-family: inherit; }

a { color: var(--stamp-dk); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 120ms ease, border-color 120ms ease, transform 80ms ease;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--stamp); outline-offset: 2px; }
.btn-block { width: 100%; }

.btn-primary {
    background: var(--stamp);
    color: #fff;
}
.btn-primary:hover { background: var(--stamp-dk); }
.btn-primary:disabled { opacity: 0.6; cursor: default; }

.btn-ghost {
    background: transparent;
    border-color: var(--line);
    color: var(--slate);
}
.btn-ghost:hover { border-color: var(--slate); color: var(--ink); }

.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover { background: #92271D; }

.btn-icon {
    display: inline-block;
    transition: transform 400ms ease;
}
.btn.is-loading .btn-icon { animation: spin 800ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Auth screen (split) ---------- */
.auth-screen {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    background: var(--surface);
}

.auth-visual {
    position: relative;
    min-height: 100vh;
    background:
        linear-gradient(180deg, rgba(7, 11, 24, 0.05), rgba(7, 11, 24, 0.4)),
        url("/static/mountains.svg") center / cover no-repeat,
        #0B1224;
    overflow: hidden;
}

.auth-visual-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 40px 44px;
    color: #fff;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.01em;
}
.auth-brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.28);
    font-size: 17px;
}

.auth-visual-caption {
    max-width: 420px;
    padding-bottom: 8px;
    text-shadow: 0 2px 24px rgba(3, 8, 20, 0.55);
}
.auth-visual-caption h2 {
    font-size: 30px;
    line-height: 1.2;
    font-weight: 700;
    margin: 0 0 10px;
}
.auth-visual-caption p {
    font-size: 15px;
    line-height: 1.5;
    margin: 0;
    color: rgba(255, 255, 255, 0.82);
}

.auth-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    background: var(--surface);
}

.auth-panel-inner {
    width: 100%;
    max-width: 400px;
}

.auth-title {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0 0 8px;
}

.auth-subtitle {
    font-size: 14px;
    color: var(--slate);
    margin: 0 0 28px;
}

.auth-form { display: flex; flex-direction: column; gap: 16px; }

.auth-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 22px 0;
    color: var(--slate);
    font-size: 13px;
}
.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

@media (max-width: 860px) {
    .auth-screen {
        grid-template-columns: 1fr;
    }
    .auth-visual {
        min-height: 240px;
        max-height: 280px;
    }
    .auth-visual-caption { display: none; }
    .auth-visual-overlay { padding: 24px; }
    .auth-panel { padding: 36px 20px 48px; }
}

.field { display: flex; flex-direction: column; gap: 6px; }

.field-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--slate);
    font-family: var(--font-mono);
}

.field input {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 11px 12px;
    font-size: 15px;
    color: var(--ink);
    background: var(--paper);
}
.field input:focus-visible {
    outline: 2px solid var(--stamp);
    outline-offset: 1px;
    background: var(--surface);
}

.alert {
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    margin-bottom: 16px;
}
.alert-error {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(178, 58, 46, 0.25);
}

/* ---------- App shell ---------- */
.app-shell {
    display: grid;
    grid-template-columns: 236px 372px minmax(0, 1fr);
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    background: var(--surface);
}

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 18px 14px;
    background: var(--paper);
    border-right: 1px solid var(--line);
    min-height: 0;
    overflow-y: auto;
}

.account { position: relative; }
.account-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}
.account-trigger:hover { border-color: #CBD5E1; }
.account-trigger[aria-expanded="true"] {
    border-color: var(--stamp);
    box-shadow: 0 0 0 3px var(--stamp-soft);
}
.account-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--stamp);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}
.account-id { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.account-email {
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.account-caption { font-size: 11px; color: var(--slate); }
.account-chevron {
    color: var(--slate);
    font-size: 12px;
    line-height: 1;
    transition: transform 140ms ease;
}
.account-trigger[aria-expanded="true"] .account-chevron { transform: rotate(180deg); }

.account-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 30;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.14);
}
.account-menu[hidden] { display: none; }
.account-menu form { margin: 0; }
.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ink);
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}
.menu-item:hover { background: var(--paper); }
.menu-icon { width: 18px; text-align: center; color: var(--slate); font-size: 14px; }
.menu-item-danger { color: var(--danger); }
.menu-item-danger .menu-icon { color: var(--danger); }
.menu-sep { height: 1px; margin: 4px 2px; background: var(--line); }

.folder-nav { display: flex; flex-direction: column; gap: 2px; }
.folder-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 9px;
    color: var(--slate);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 120ms ease, color 120ms ease;
}
.folder-item:hover { background: rgba(15, 23, 42, 0.05); color: var(--ink); }
.folder-item.is-active { background: var(--stamp-soft); color: var(--stamp-dk); font-weight: 600; }
.folder-icon { display: flex; width: 18px; height: 18px; flex-shrink: 0; }
.folder-icon svg { width: 18px; height: 18px; }
.folder-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-badge {
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1;
    padding: 4px 7px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
    color: var(--slate);
}
.folder-badge.is-strong { background: var(--stamp); color: #fff; }
.folder-badge[hidden] { display: none; }

/* Message list */
.list-pane {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    border-right: 1px solid var(--line);
    background: var(--surface);
}
.list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 20px 14px;
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}
.list-title { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.list-subtitle { margin: 3px 0 0; font-family: var(--font-mono); font-size: 12px; color: var(--slate); }
.list-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #CBD5E1 transparent;
}
.list-scroll::-webkit-scrollbar { width: 10px; }
.list-scroll::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border: 3px solid var(--surface);
    border-radius: 999px;
}
.list-scroll::-webkit-scrollbar-track { background: transparent; }

/* Reading pane */
.reading-pane {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    background: var(--paper);
}
.reading-placeholder { margin: auto; text-align: center; color: var(--slate); }
.reading-placeholder-mark { display: block; font-size: 32px; margin-bottom: 10px; opacity: 0.4; }
.reading-placeholder p { font-size: 14px; margin: 0; }
.reading-header {
    padding: 24px 28px 18px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
    flex-shrink: 0;
}
.reading-subject { font-size: 19px; font-weight: 700; margin: 0 0 10px; }
.reading-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.reading-from { font-family: var(--font-mono); font-size: 13px; font-weight: 600; }
.reading-to { margin-top: 6px; font-size: 12px; color: var(--slate); }
.reading-foot { margin-top: 14px; }
.reading-date { font-family: var(--font-mono); font-size: 12px; color: var(--slate); }
.reading-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 28px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}
.attachment-chip {
    font-size: 12px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 4px 10px;
    color: var(--slate);
}
.reading-frame { flex: 1; width: 100%; border: none; background: #fff; }

/* ---------- Ledger (message list) ---------- */
.ledger {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ledger-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
    position: relative;
    cursor: pointer;
}
.ledger-row:last-child { border-bottom: none; }
.ledger-row:hover { background: var(--paper); }
.ledger-row:focus-visible { outline: 2px solid var(--stamp); outline-offset: -2px; }

.ledger-row.is-active {
    background: var(--stamp-soft);
}
.ledger-row.is-active::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--stamp);
}

.ledger-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #E2E8F0;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}
.ledger-row.is-unread .ledger-avatar {
    background: var(--stamp-soft);
    color: var(--stamp-dk);
}

.ledger-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.ledger-top {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ledger-from {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    color: var(--ink);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ledger-row:not(.is-unread) .ledger-from { font-weight: 500; color: #334155; }

.unread-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--stamp);
    flex-shrink: 0;
}

.ledger-subject {
    font-size: 13px;
    color: var(--slate);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ledger-row.is-unread .ledger-subject { color: var(--ink); font-weight: 600; }

.ledger-foot {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ledger-date {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--slate);
}

.ledger-attach { font-size: 11px; color: var(--slate); }

.empty-state {
    background: var(--surface);
    border: 1px dashed var(--line);
    border-radius: 12px;
    padding: 48px 24px;
    text-align: center;
}
.empty-title { font-size: 16px; font-weight: 600; margin: 0 0 4px; }
.empty-subtitle { font-size: 14px; color: var(--slate); margin: 0; }

#list-region { padding: 0; }
.empty-state { margin: 16px; }
#list-region > .alert { margin: 16px; }

.reading-back { display: none; }

@media (max-width: 1200px) {
    .app-shell { grid-template-columns: 210px 330px minmax(0, 1fr); }
}

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto minmax(0, 1fr);
        height: 100vh;
        height: 100dvh;
    }
    .sidebar {
        flex-direction: row;
        align-items: center;
        gap: 10px;
        padding: 10px 12px;
        padding-top: max(10px, env(safe-area-inset-top));
        border-right: 0;
        border-bottom: 1px solid var(--line);
        overflow: visible;
        flex-shrink: 0;
        min-width: 0;
    }
    .account { flex-shrink: 0; width: 210px; }
    .folder-nav {
        flex: 1;
        min-width: 0;
        flex-direction: row;
        gap: 4px;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
    }
    .folder-nav::-webkit-scrollbar { display: none; }
    .folder-item { white-space: nowrap; flex-shrink: 0; padding: 9px 12px; }
    .folder-label { flex: 0 1 auto; }
    .list-pane {
        border-right: 0;
        border-bottom: 0;
        grid-row: 2;
        min-height: 0;
    }
    .reading-pane {
        display: none;
        grid-row: 2;
        min-height: 0;
        overflow-y: auto;
    }
    .app-shell.is-reading .list-pane { display: none; }
    .app-shell.is-reading .reading-pane { display: flex; }
    .reading-frame { flex: 1 0 auto; min-height: 55dvh; }
    .reading-header { position: relative; padding-top: 18px; }
    .reading-subject, .reading-from, .reading-to { overflow-wrap: anywhere; }
    .reading-back {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 34px;
        height: 34px;
        margin-bottom: 10px;
        border: 1px solid var(--line);
        border-radius: 9px;
        background: var(--surface);
        color: var(--ink);
        font-size: 16px;
        line-height: 1;
        cursor: pointer;
    }
    .reading-back:hover { background: var(--paper); }
    .ledger-row { padding: 14px 16px; min-height: 64px; }
    .list-scroll { -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain; }
}

@media (max-width: 600px) {
    .account { width: 168px; }
    .account-caption { display: none; }
    .list-header { padding: 14px 16px 10px; }
    .reading-header { padding: 18px 16px 12px; padding-top: 18px; }
    .reading-attachments { padding: 10px 16px; }
    .reading-subject { font-size: 17px; }
    .reading-frame { min-height: 0; }
}

/* ---------- Settings page ---------- */
.settings-page {
    min-height: 100vh;
    padding: 40px 24px;
}

.settings-container {
    max-width: 1060px;
    margin: 0 auto;
}

.settings-topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.settings-title {
    font-size: 26px;
    font-weight: 700;
    margin: 0 0 4px;
}
.settings-subtitle {
    font-size: 14px;
    color: var(--slate);
    margin: 0;
}

.settings-tabs {
    display: flex;
    gap: 24px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 20px;
}
.settings-tab {
    font-size: 14px;
    font-weight: 600;
    color: var(--slate);
    padding: 10px 2px;
    border-bottom: 2px solid transparent;
}
.settings-tab.is-active {
    color: var(--stamp-dk);
    border-bottom-color: var(--stamp);
}

.settings-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
}

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

.settings-card-title {
    font-size: 17px;
    font-weight: 700;
    margin: 0 0 4px;
}
.settings-card-subtitle {
    font-size: 13px;
    color: var(--slate);
    margin: 0 0 16px;
}
.settings-card-header .settings-card-subtitle { margin-bottom: 0; }

.settings-count {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--slate);
    flex-shrink: 0;
    padding-top: 2px;
}

.account-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
}

.account-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--stamp);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
}

.account-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}
.account-name { font-size: 14px; font-weight: 700; }
.account-email {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--slate);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.account-meta { font-size: 12px; color: var(--slate); }

.account-badge {
    font-size: 12px;
    font-weight: 600;
    color: var(--stamp-dk);
    background: rgba(37, 99, 235, 0.10);
    border: 1px solid rgba(37, 99, 235, 0.25);
    border-radius: 999px;
    padding: 4px 12px;
    flex-shrink: 0;
}

.settings-password-form { max-width: 420px; }
.settings-submit { margin-top: 4px; align-self: flex-start; }

/* ---------- Admin ---------- */
.admin-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    align-items: end;
}

.admin-input {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    color: var(--ink);
    background: var(--paper);
    width: 100%;
}
.admin-input:focus-visible {
    outline: 2px solid var(--stamp);
    outline-offset: 1px;
    background: var(--surface);
}
.admin-field { display: flex; gap: 6px; align-items: center; }
.admin-field .admin-input { flex: 1; min-width: 0; }
.admin-gen { flex-shrink: 0; padding: 8px 12px; line-height: 1; }

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.admin-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 10px;
}
.admin-table th {
    text-align: left;
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--slate);
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
}
.admin-table td {
    padding: 10px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}
.admin-table td:last-child { width: 1%; white-space: nowrap; }
.admin-mail { font-weight: 600; }
.admin-mail a { color: var(--stamp); text-decoration: none; }
.admin-mail a:hover { text-decoration: underline; }
.admin-mono { font-family: var(--font-mono); font-size: 12px; color: var(--slate); }
.admin-dim { color: var(--slate); white-space: nowrap; }

.admin-provider {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    background: rgba(22, 35, 46, 0.08);
    color: var(--ink, #0F172A);
}
.admin-provider-firstmail { background: #E7F0FB; color: #1B4F8A; }
.admin-provider-notletters { background: #EAF6EE; color: #1C6B3A; }
.admin-dim { color: var(--slate); white-space: nowrap; }

.admin-pass { font-family: var(--font-mono); font-size: 12px; }
.admin-pass-btn { padding: 4px 10px; font-size: 12px; margin-left: 6px; }

.admin-edit summary {
    cursor: pointer;
    font-size: 12px;
    padding: 6px 12px;
    display: inline-block;
    border-radius: 8px;
}
.admin-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}
.btn-sm { padding: 6px 12px; font-size: 12px; }

.edit-form {
    display: grid;
    gap: 14px;
}
.edit-field { display: flex; flex-direction: column; gap: 6px; }
.edit-label {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--slate);
}
.edit-hint { margin: 0; font-size: 12px; color: var(--slate); }
.edit-actions { display: flex; gap: 10px; margin-top: 4px; }

.modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal[hidden] { display: none; }
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(22, 35, 46, 0.45);
}
.modal-card {
    position: relative;
    width: 100%;
    max-width: 440px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 12px 32px rgba(22, 35, 46, 0.18);
}
.modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}
.modal-title { font-size: 17px; font-weight: 700; margin: 0 0 4px; }
.modal-email {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--slate);
    margin: 0;
    overflow-wrap: anywhere;
}
.modal-close { padding: 4px 10px; font-size: 14px; line-height: 1; flex-shrink: 0; }

@media (max-width: 640px) {
    .admin-table { display: block; overflow-x: auto; }
}

.alert-success {
    background: rgba(37, 99, 235, 0.07);
    color: var(--stamp-dk);
    border: 1px solid rgba(37, 99, 235, 0.25);
}

@media (max-width: 480px) {
    .settings-page { padding: 24px 16px; }
    .settings-topbar { flex-direction: column; }
    .account-item { flex-wrap: wrap; }
    .account-badge { margin-left: 54px; }
}

