:root {
 color-scheme: light;
 font: 100%/1.45 Inter, Roboto, "Segoe UI", Arial, sans-serif;
 --ink: #172942;
 --muted: #53657d;
 --blue: #185ab7;
 --blue-dark: #124b9c;
 --line: #dce5ef;
 --surface: #fff;
 --air: #edf3fa;
 --red: #b3252e;
 color: var(--ink);
 background: #eaf0f8;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
 margin: 0;
 min-height: 100dvh;
 background: radial-gradient(ellipse at 65% 0%, #dceaff 0, transparent 65%), #eaf0f8;
}
button, input, select, textarea { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid #2869bf; outline-offset: 2px; }
button, .button {
 display: inline-flex; align-items: center; justify-content: center; gap: .44rem;
 background: transparent; border: 1px solid transparent; border-radius: 7px;
 min-height: 36px; padding: .36rem .7rem; cursor: pointer; font-size: .87rem;
 white-space: nowrap;
}
button:hover, .button:hover { background: #eaf2fc; }
button:disabled { opacity: .56; cursor: default; }
.primary { background: var(--blue); color: #fff; font-weight: 650; }
.primary:hover { background: var(--blue-dark); }
.icon { min-width: 36px; padding: .35rem; color: var(--muted); }
svg.lucide { flex: none; width: 17px; height: 17px; stroke-width: 1.75; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.25rem; font-weight: 670; letter-spacing: -.022em; }
h2 { font-size: .99rem; font-weight: 660; }
.skip { position: fixed; left: 10px; top: -4rem; z-index: 10; background: #fff; padding: .6rem; }
.skip:focus { top: 10px; }

.topbar {
 display: flex; justify-content: space-between;
 align-items: center; gap: 1rem; min-height: 65px;
 padding: .5rem clamp(14px, 2.3vw, 40px);
 border-bottom: 1px solid #cfdceb; background: #f3f7fce8;
}
.brand { display: inline-flex; align-items: center; justify-self: start; gap: .68rem; white-space: nowrap; }
.brand-mark { display: grid; gap: .22rem; text-align: center; line-height: 1; }
.brand-mark b { color: #207ac5; font-size: 2.05rem; font-weight: 850; letter-spacing: -.05em; }
.brand-mark small { color: #ba321f; font-weight: 750; font-size: .58rem; letter-spacing: .26em; }
.brand-copy { display: grid; gap: .13rem; border-left: 1px solid #c8d7e6; padding-left: .7rem; }
.brand-copy strong { color: #123954; font-size: 1rem; font-weight: 750; }
.brand-copy > span { color: #53657d; font-size: .78rem; font-weight: 500; }
.brand-icon { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: #185ab7; color: #fff; }
.brand-icon svg { width: 19px; height: 19px; }
.top-links { display: flex; align-items: center; justify-content: flex-end; gap: .85rem; }
.top-links a { display: flex; gap: .42rem; align-items: center; font-size: .87rem; white-space: nowrap; }
.top-links a:hover { color: var(--blue); }
.logout { color: var(--red); border-radius: 9px; width: 36px; padding: .4rem; }
.logout:hover { background: #fff0f2; }
.search { display: flex; align-items: center; gap: .52rem; min-width: 0; min-height: 36px; padding: 0 .7rem; border: 1px solid #d2dfed; border-radius: 7px; background: #f2f6fb; color: var(--muted); }
.search:focus-within { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.search input, .letter-head input { border: 0; background: transparent; min-width: 0; width: 100%; padding: .43rem 0; }
.search input:focus, .letter-head input:focus { outline: 0; }
.search input { font-size: .89rem; }
.search input::placeholder, .letter-head input::placeholder { color: #64758a; }

.gate {
 width: min(29rem, calc(100% - 2rem)); margin: min(16vh, 150px) auto 2rem; background: var(--surface);
 border: 1px solid #cfdaea; border-radius: 15px; padding: 1.8rem; box-shadow: 0 12px 36px #172c4418;
}
.gate h1 { margin: .85rem 0 .5rem; font-size: 1.48rem; }
.gate p { color: var(--muted); }
.gate p.error { color: #a2242c; }
.gate-actions { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: 1rem; }

.workspace {
 --folders: 205px;
 display: grid; grid-template-columns: var(--folders) minmax(0, 1fr) clamp(225px, 22vw, 325px);
 gap: 12px; padding: 13px clamp(12px, 1.5vw, 26px) 16px 12px; align-items: start;
 min-height: calc(100dvh - 65px);
}
.workspace:not([data-view=compose]) { grid-template-columns: var(--folders) minmax(0, 1fr); }
.workspace:not([data-view=compose]) .contacts { display: none; }
.folders { min-width: 0; padding: 5px 8px 0 6px; }
.new-mail { width: 100%; min-height: 42px; justify-content: start; padding-inline: .86rem; }
.folder-account { display: flex; align-items: center; min-width: 0; gap: .53rem; margin: 1.35rem .2rem .75rem; }
.folder-account > span:last-child { min-width: 0; display: grid; }
.folder-account strong { font-size: .87rem; }
.folder-account small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); font-size: .75rem; }
.avatar, .initial {
 display: grid; place-items: center; flex: none; width: 33px; height: 33px; border-radius: 50%;
 background: #dceaff; color: #134f9e; font-size: .76rem; font-weight: 650;
}
.folder-links { display: grid; gap: 3px; }
.folder-links button { min-width: 0; justify-content: start; min-height: 39px; color: #2c4360; padding-inline: .85rem; }
.folder-links button[aria-current] { background: #d5e5fb; color: #144c98; box-shadow: inset 3px 0 #2165c2; font-weight: 650; }
.surface { background: var(--surface); border: 1px solid #d0dceb; border-radius: 11px; box-shadow: 0 3px 10px #243f5b0a; }
.workpane { min-width: 0; }
.pane-head {
 display: flex; align-items: center; justify-content: space-between; gap: 10px;
 min-height: 58px; padding: 10px clamp(14px, 1.4vw, 23px); border-bottom: 1px solid var(--line);
}
#compose { min-height: calc(100dvh - 95px); }
.compose-head { align-items: center; flex-wrap: wrap; background: #f8fafd; border-radius: 11px 11px 0 0; }
.send-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 3px; }
.send-bar .primary { padding-inline: .95rem; margin-right: .23rem; }
.send-bar button:not(.primary), #reload { color: #3a526f; }
.letter-head { padding: 5px clamp(14px, 1.4vw, 23px) 0; }
.from-row, .to-row, .subject {
 display: flex; align-items: center; gap: .55rem; min-height: 47px; border-bottom: 1px solid var(--line); font-size: .91rem;
}
.from-row span, .to-row label, .subject span { white-space: nowrap; flex: 0 0 62px; color: var(--muted); font-weight: 550; }
.from-row strong { font-weight: 560; }
.to-row { padding: .28rem 0; }
.to-row:focus-within, .subject:focus-within { border-bottom-color: var(--blue); }
.address-area { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem; min-width: 0; flex: 1; }
.address-area input { flex: 1 1 9rem; }
#chips { display: contents; }
.chip { max-width: 100%; min-height: 28px; white-space: normal; overflow-wrap: anywhere; font-size: .81rem; color: #1d528c; background: #e5effc; border-color: #d7e6f8; }
.chip svg { width: 13px; height: 13px; }
.subject input { flex: 1; }
#message { margin: .75rem; width: calc(100% - 1.5rem); }
.p303-rich-editor {
 display: flex; flex-direction: column; border: 0; border-radius: 0; overflow: visible; min-width: 0;
 padding: 14px clamp(14px, 1.4vw, 23px);
 color: var(--ink);
}
.p303-rich-toolbar {
 padding: 5px 6px; gap: 2px; flex-wrap: wrap; border: 1px solid #d8e3f1; border-radius: 8px; background: #f1f5fa;
}
.p303-rich-toolbar button, .p303-rich-toolbar select, .p303-rich-color { font-size: .84rem!important; }
.p303-rich-toolbar select { border-color: #cfdbea!important; }
.p303-rich-toolbar [data-command=bold] { font-weight: 750!important; }
.p303-rich-toolbar svg { width: 16px; height: 16px; }
.font-row { display: inline-flex; align-items: center; gap: 5px; margin-left: 6px; padding-left: 8px; border-left: 1px solid #d3deee; }
.font-row label { font: .81rem/1.2 Inter, Roboto, Arial, sans-serif; color: #435875; white-space: nowrap; }
.p303-rich-surface { border: 0; padding: 19px 3px; min-height: max(230px, calc(100dvh - 425px)); max-height: none; font-size: 1rem; overflow-wrap: anywhere; }
.p303-rich-surface:focus-visible { outline: 0; }
.p303-rich-count { color: #53657d!important; }
#compose:has(.p303-rich-surface:focus-visible) { box-shadow: 0 0 0 1px #91b4e4; }

.contacts { min-width: 0; padding: 15px 13px; height: calc(100dvh - 94px); min-height: 310px; display: flex; flex-direction: column; }
.contacts-head { display: flex; align-items: center; gap: .55rem; padding: 2px 1px 12px; }
.contacts-head span { border-radius: 12px; padding: 1px 7px; background: var(--air); color: var(--muted); font-size: .76rem; }
.contacts .dismiss, #contacts-backdrop { display: none; }
.members { overflow-y: auto; margin-top: .6rem; }
.contact-line, .row, .template-option { display: flex; justify-content: start; text-align: left; width: 100%; gap: .55rem; white-space: normal; }
.contact-line { min-height: 60px; padding: .4rem .35rem; border-bottom: 1px solid #e7edf5; border-radius: 0; }
.contact-line[aria-pressed=true] { color: var(--blue); background: #eaf3ff; }
.contact-line > span:nth-child(2), .row > span, .template-option > span { display: grid; min-width: 0; flex: 1; overflow-wrap: anywhere; }
.contact-line small, .row small, .template-option small { color: var(--muted); font-size: .79rem; }
.contact-line strong { font-size: .86rem; font-weight: 650; }

#listing { min-height: calc(100dvh - 95px); overflow: hidden; }
#list-layout { display: grid; grid-template-columns: minmax(0, 1fr); }
#list-layout.reading-open { grid-template-columns: minmax(230px, .82fr) minmax(280px, 1.44fr); }
.list-column { padding: 12px; min-width: 0; }
#list-search { margin-bottom: 8px; }
#rows { margin-top: 4px; }
.row { padding: 12px 9px; border-bottom: 1px solid var(--line); border-radius: 0; }
.row[aria-current] { box-shadow: inset 3px 0 #2165c2; background: #e8f2ff; }
.row svg, .template-option svg { color: var(--blue); }
.row strong { font-weight: 650; }
#reading { min-width: 0; border-left: 1px solid var(--line); padding: 15px 20px; }
.reading-head, .dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: .7rem; }
#reading-actions { padding-top: .65rem; }
.pagination, #dialog-actions { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: .55rem; margin-top: .8rem; }
.pagination span, .empty { color: var(--muted); font-size: .87rem; }
.empty { padding: 1rem .25rem; }

#status { margin-bottom: .55rem; padding: .55rem .75rem; border-radius: 7px; background: #e7f2ff; color: #194b86; border: 1px solid #c9defa; font-size: .9rem; }
#status.error { background: #fff1ef; color: #9b222d; border-color: #efc6ca; }
dialog { width: min(36rem, calc(100% - 1.5rem)); max-height: 86dvh; overflow: auto; padding: 1.2rem; color: var(--ink); border: 1px solid #cedcee; border-radius: 12px; box-shadow: 0 16px 48px #13243e30; }
dialog::backdrop { background: #162e4c70; }
.dialog-head { border-bottom: 1px solid var(--line); padding-bottom: .55rem; }
.dialog-head h2 { font-size: 1.11rem; }
dialog p { overflow-wrap: anywhere; margin: .55rem 0; }
dialog input { display: block; margin-top: .5rem; border: 1px solid #c9d9ec; border-radius: 6px; background: #fff; padding: .55rem; max-width: 100%; }
.template-option { padding: .65rem .45rem; border-bottom: 1px solid var(--line); border-radius: 0; }
.preview-body { margin-top: .65rem; border-block: 1px solid var(--line); padding: .8rem 0; overflow-wrap: anywhere; }
.detail-list { padding-left: 1.2rem; overflow-wrap: anywhere; }
#dialog-actions button:not(.primary), .pagination button, #retry { border-color: #cad8ea; }
#dialog-actions button.danger { background: var(--red); border-color: var(--red); color: white; }

@media (max-width: 1120px) {
 .workspace, .workspace:not([data-view=compose]) { --folders: 170px; grid-template-columns: var(--folders) minmax(0, 1fr); }
 .contacts { display: none; }
 .contacts.open { display: flex; position: fixed; top: 12px; right: 12px; bottom: 12px; width: min(350px, calc(100% - 24px)); height: auto; z-index: 4; }
 .contacts.open .dismiss { display: inline-flex; margin-left: auto; }
 .workspace:has(.contacts.open) #contacts-backdrop { display: block; position: fixed; inset: 0; background: #17335266; z-index: 3; border-radius: 0; }
}
@media (max-width: 720px) {
 .topbar { display: flex; justify-content: space-between; gap: .5rem; padding-inline: 12px; min-height: 56px; }
 .top-links { gap: .45rem; }
 .top-links a, .top-links button { font-size: .8rem; }
 .top-links a svg { display: none; }
 .brand { gap: .35rem; }
 .brand-mark b { font-size: 1.43rem; }
 .brand-mark small { font-size: .46rem; }
 .brand-copy { padding-left: .36rem; }
 .brand-copy strong { font-size: .86rem; }
 .brand-copy > span { font-size: .65rem; }

 .brand-icon { width: 29px; height: 29px; }
 .brand-icon svg { width: 16px; height: 16px; }
 .workspace, .workspace:not([data-view=compose]) { display: block; padding: 0 8px 8px; }
 .folders { display: flex; gap: 4px; margin: 0 -8px 7px; padding: 7px 8px; overflow-x: auto; scrollbar-width: thin; border-bottom: 1px solid #d7e2f1; }
 .folder-account { display: none; }
 .new-mail { width: auto; min-height: 36px; }
 .folder-links { display: flex; }
 .folder-links button { padding: .35rem .5rem; min-height: 36px; }
 .folder-links svg { display: none; }
 .folder-links button[aria-current] { box-shadow: inset 0 -2px #2165c2; }
 .pane-head { padding: 9px 11px; }
 .compose-head { display: grid; gap: 8px; }
 .send-bar button { font-size: .81rem; padding: .28rem .4rem; }
 .send-bar .primary { padding-inline: .7rem; }
 .send-bar svg { width: 14px; height: 14px; }
 .from-row span, .to-row label, .subject span { flex-basis: 48px; }
 #compose, #listing { min-height: calc(100dvh - 129px); }
 .p303-rich-editor { padding-top: 10px; }
 .p303-rich-surface { min-height: 225px; }
}

@media (max-width: 550px) {
 .new-mail { min-width: 35px; padding-inline: 7px; }
 .new-mail span { display: none; }
 .folder-links { gap: 1px; }
 .folder-links button { padding-inline: .44rem; font-size: .83rem; }
}

#reload-mail { color: var(--blue-dark); }
@media (max-width: 360px) {
 .topbar { padding-inline: 8px; gap: .3rem; }
 .top-links { gap: .3rem; }
 .top-links button { padding-inline: 6px; }
}
