:root {
    color-scheme: light;
    font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
    color: #1b2133;
    background: #f5f6fc;
    --sidebar: #1b1c3a;
    --accent: #5142bb;
    --accent-dark: #3d2e9d;
    --accent-soft: #efedff;
    --muted: #525e74;
    --line: #e0e4f0;
    --surface: #fff;
    --radius: 16px;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--accent-dark); }
:focus-visible { outline: 3px solid #7161df; outline-offset: 3px; }
svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linejoin: round; stroke-linecap: round; }
.authenticated { min-height: 100vh; display: grid; grid-template-columns: 232px minmax(0, 1fr); }
.top { background: var(--sidebar); color: #fff; padding: 25px 18px; }
.authenticated .top { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 11px; color: #fff; font-weight: 760; font-size: 17px; text-decoration: none; white-space: nowrap; }
.brand-icon { width: 40px; height: 40px; display: grid; place-items: center; background: #6556d6; border-radius: 12px; flex: none; }
.wrap { width: min(1180px, 100%); padding: 38px clamp(20px, 4vw, 64px) 48px; margin: 0 auto; min-width: 0; }
.authenticated .compose-button { display: flex; justify-content: center; margin: 29px 0 24px; background: #6757d8; }
.compose-button span { font-size: 20px; line-height: .95; }
nav { display: grid; gap: 5px; }
nav a { display: flex; gap: 10px; align-items: center; padding: 11px 10px; color: #e3e1ff; border-radius: 9px; text-decoration: none; font-weight: 620; font-size: 14px; }
nav a[aria-current="page"], nav a:hover { background: #393566; color: #fff; }
nav a[aria-current="page"] { box-shadow: inset 3px 0 #a094ff; }
#unread { margin-left: auto; border-radius: 13px; background: #e3ddff; color: #30256e; padding: 0 7px; min-width: 22px; text-align: center; font-size: 12px; }
.logout { margin-top: auto; padding-top: 22px; }
.logout .quiet { color: #efedff; border-color: #625e8e; background: transparent; width: 100%; }
.guest .top { padding: 18px max(20px, calc((100vw - 960px) / 2)); }
.guest { min-height: 100vh; background: radial-gradient(ellipse at top, #e9e5ff, #f5f6fc 63%); }
h1 { margin: 0; font-size: clamp(24px, 3.5vw, 36px); line-height: 1.15; letter-spacing: -.04em; overflow-wrap: anywhere; }
h2 { margin: 0 0 15px; font-size: 19px; }
h3 { margin: 19px 0 12px; font-size: 16px; }
.page-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 14px; margin-bottom: 23px; }
.page-head p { margin: 7px 0 0; color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(18px, 3vw, 28px); min-width: 0; box-shadow: 0 8px 28px #27235808; }
.narrow { max-width: 450px; margin: min(7vh, 65px) auto; }
.narrow h1 { margin-bottom: 24px; }
.narrow button { width: 100%; }
.columns { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.message-layout { grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr); }
.stack { display: grid; gap: 15px; }
.filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) auto; align-items: end; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
label { color: #303b55; font-size: 13px; font-weight: 680; display: grid; gap: 6px; }
input, select, textarea { width: 100%; min-width: 0; min-height: 42px; color: #1b2133; padding: 9px 11px; border: 1px solid #b9c2d8; border-radius: 9px; font: 400 15px/1.45 system-ui, sans-serif; background: #fff; }
textarea { resize: vertical; }
input[type=file]::file-selector-button { background: var(--accent-soft); color: var(--accent-dark); border: 0; padding: 5px 8px; border-radius: 5px; margin-right: 9px; }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: 17px; min-height: 17px; accent-color: var(--accent); }
button, .button { display: inline-flex; justify-content: center; align-items: center; gap: 7px; min-height: 42px; background: var(--accent); color: #fff; border: 1px solid transparent; border-radius: 9px; padding: 9px 14px; font: 680 14px/1.4 system-ui, sans-serif; cursor: pointer; text-decoration: none; justify-self: start; }
button:hover, .button:hover { background: var(--accent-dark); }
button:disabled { opacity: .55; cursor: default; }
.secondary, .quiet { background: #fff; color: var(--accent-dark); border-color: #cfc8f1; }
.secondary:hover, .quiet:hover { background: var(--accent-soft); }
.logout .quiet:hover { background: #393566; }
.mailbox { padding: 0; }
.row { display: grid; grid-template-columns: 42px minmax(0, 1fr) minmax(110px, 30%); align-items: center; gap: 13px; padding: 15px 20px; color: inherit; text-decoration: none; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.row:last-child { border-bottom: 0; }
.row:hover { background: #f3f1ff; }
.row.unseen { background: #f8f7ff; box-shadow: inset 3px 0 #6f5dd6; }
.row.unseen:hover { background: #f0edff; }
.avatar { display: grid; place-items: center; width: 42px; aspect-ratio: 1; border-radius: 13px; font-weight: 750; background: #ece7ff; color: #4a319d; }
.tone-1 { background: #ddf4ef; color: #176052; }
.tone-2 { background: #e2eeff; color: #244c88; }
.tone-3 { background: #fae8d9; color: #813f27; }
.row-content strong { display: block; font-weight: 620; }
.unseen .row-content strong { font-weight: 760; }
.row-content small { margin: 0 0 2px; }
.meta { text-align: right; }
small, .muted { color: var(--muted); }
small { display: block; font-size: 12px; overflow-wrap: anywhere; }
.account-tag, .new-tag, .thread-size, .status { display: inline-block; margin-top: 4px; padding: 2px 8px; border-radius: 7px; color: #49466b; background: #eeedf7; font-size: 12px; }
.new-tag { color: #442a9a; background: #e8ddff; }
.status { margin: 0 0 16px; padding: 5px 9px; font-weight: 700; }
.connected { color: #165c40; background: #d9f5e6; }
.pending { color: #684014; background: #fff0d5; }
.notice, .error { border: 1px solid #b6dcc8; border-radius: 10px; padding: 12px 15px; margin: 0 0 17px; background: #e7f7ed; color: #205338; }
.error { border-color: #efc4ca; background: #fcebee; color: #862939; }
details { padding: 12px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
summary { cursor: pointer; color: var(--accent-dark); font-weight: 700; }
.message p, .message li { overflow-wrap: anywhere; }
.actions, .pagination { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; line-height: 1.65; border-top: 1px solid var(--line); margin: 20px 0 0; padding-top: 20px; }
.message pre + h2 { margin: 22px 0 8px; }
.thread { list-style: none; padding: 0; margin: 0; overflow-wrap: anywhere; }
.thread li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.thread li:last-child { border-bottom: 0; }
.thread a { text-decoration: none; font-weight: 650; }
.pagination { justify-content: end; padding: 13px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.pagination a { padding: 5px 7px; }
.empty { min-height: 230px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); padding: 24px 16px; text-align: center; }
.empty svg { width: 45px; height: 45px; padding: 10px; color: var(--accent-dark); background: var(--accent-soft); border-radius: 14px; }
@media (max-width: 880px) {
    .authenticated { display: block; }
    .authenticated .top { display: grid; position: static; height: auto; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "brand compose logout" "nav nav nav"; gap: 12px; padding: 15px 18px 10px; }
    .brand { grid-area: brand; }
    .authenticated .compose-button { grid-area: compose; margin: 0; }
    .logout { grid-area: logout; margin: 0; padding: 0; }
    nav { grid-area: nav; display: flex; flex-wrap: wrap; }
    nav a { gap: 6px; padding: 8px; }
    nav svg { width: 17px; height: 17px; }
    .wrap { padding-top: 25px; }
}
@media (max-width: 580px) {
    .authenticated .top { padding: 12px; gap: 8px; }
    .brand { font-size: 14px; gap: 7px; white-space: normal; }
    .brand-icon { width: 30px; height: 30px; border-radius: 8px; }
    .brand-icon svg { width: 17px; height: 17px; }
    .top button, .top .button { padding-inline: 9px; }
    nav { gap: 3px; }
    nav a { font-size: 12px; padding: 8px 6px; }
    nav svg { display: none; }
    #unread { min-width: 17px; padding-inline: 4px; font-size: 11px; }
    .wrap { padding: 22px 12px 30px; }
    .columns { grid-template-columns: minmax(0, 1fr); }
    .filters { grid-template-columns: minmax(0, 1fr) auto; padding: 13px; gap: 8px; }
    .filters label:first-of-type { grid-column: 1 / -1; }
    .row { grid-template-columns: 32px minmax(0, 1fr); gap: 5px 9px; padding: 12px 13px; }
    .avatar { width: 32px; border-radius: 9px; align-self: start; }
    .meta { grid-column: 2; text-align: left; }
    .meta small { display: inline-block; margin-right: 3px; }
}
.setup-fields { margin: 0; padding: 12px 14px 14px; border: 1px solid var(--line); border-radius: 10px; min-width: 0; }
.setup-fields legend { padding: 0 6px; color: var(--accent-dark); font-weight: 700; }

.account-status summary { margin-bottom: 8px; }
.account-title { margin-right: 6px; }
.account-status .connection { margin: 3px 0; }
.account-status summary small { margin: 4px 0 0 16px; font-weight: 400; }
.account-status .failed { background: #fcebee; color: #862939; }

.mobile-notices { margin-top: 20px; }
.mobile-notices #push-result:empty { display: none; }

.app-install { margin-bottom: 16px; padding: 10px 13px; }
.app-install p { margin: 8px 0 0; }
