:root {
  color-scheme: light;
  font: 15px/1.45 Arial, "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: #f3f6fc;
  --ink: #182337;
  --muted: #3d4b61;
  --line: #dfe7f3;
  --main: #fff;
  --panel: #f3f6fc;
  --accent: #255ac3;
  --accent-strong: #19469f;
  --accent-soft: #e8f1ff;
  --focus: #3673df;
  --rail: #142744;
  --rail-fg: #f2f6ff;
  --rail-muted: #d0ddf2;
  --rail-hover: #223b63;
  --important: #c42e46;
  --shadow: 0 18px 48px #182e5524, 0 3px 9px #182e5515;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
a { color: var(--accent); }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  overflow: hidden; white-space: nowrap; clip-path: inset(50%); border: 0;
}
[data-icon] { display: inline-flex; width: 18px; height: 18px; flex: 0 0 18px; }
[data-icon] svg { width: 100%; height: 100%; }
.shell {
  display: grid; grid-template-columns: 216px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr);
  height: 100vh; height: 100dvh; overflow: hidden;
}
.rail {
  display: flex; flex-direction: column; min-height: 0; gap: 8px;
  padding: 14px 12px 10px; background: var(--rail); color: var(--rail-fg);
  overflow-x: hidden; overflow-y: auto; scrollbar-width: none; overscroll-behavior: contain;
}
.rail::-webkit-scrollbar { display: none; }
.rail > * { flex-shrink: 0; }
.brand { display: flex; gap: 11px; align-items: center; padding: 0 8px; }
.brand strong { display: block; color: #fff; font-weight: 680; font-size: 17px; letter-spacing: .005em; }
.brand div > span { display: block; color: var(--rail-muted); font-size: 13px; }
.brand-mark {
  width: 33px; height: 33px; border-radius: 9px;
  display: flex; justify-content: center; flex-direction: column; gap: 3px; padding: 7px;
  background: #d4e7ff;
}
.brand-mark i { height: 3px; border-radius: 2px; background: var(--rail); }
.brand-mark i:nth-child(2) { width: 73%; }
.brand-mark i:nth-child(3) { width: 88%; }
.button, .icon-button, .text-button {
  border: 0; border-radius: 9px; display: inline-flex; align-items: center;
  justify-content: center; gap: 8px; background: transparent;
}
.button { min-height: 39px; padding: 8px 13px; white-space: nowrap; font-weight: 600; }
.primary { background: var(--accent); color: white; }
.primary:hover { background: var(--accent-strong); }
.secondary { background: var(--panel); border: 1px solid var(--line); }
.secondary:hover, .button:not(.primary, .compose-button):hover { background: #edf3fe; }
.icon-button { width: 36px; height: 36px; flex: 0 0 36px; padding: 0; color: var(--muted); }
.icon-button:hover, .icon-button[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent); }
.text-button { color: var(--accent); padding: 5px 6px; font-weight: 600; text-align: left; }
.text-button:hover { background: var(--accent-soft); }
.compose-button {
  min-height: 38px; justify-content: flex-start; margin: 0 2px;
  padding: 7px 12px; background: #d4e7ff; color: #17376a; border-radius: 9px;
}
.compose-button:hover { background: #e4f0ff; }
.folders { display: grid; align-content: start; gap: 2px; }
.folder, .rail-button {
  background: transparent; border: 0; color: var(--rail-fg); border-radius: 8px;
  display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 4px 8px; min-height: 30px; font-size: 14px; width: 100%;
}
.folder:hover, .rail-button:hover { background: var(--rail-hover); }
.folder[aria-current="page"] { background: #2a4e84; color: white; font-weight: 650; }
.folder-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-count { margin-left: auto; font-size: 12px; font-variant-numeric: tabular-nums; color: #e1eeff; }
.new-folder { color: var(--rail-muted); }
.folder[data-folder="templates"] { padding-left: 29px; color: var(--rail-muted); }
.rail-footer { margin-top: auto; display: grid; gap: 2px; }
.rail-button { color: var(--rail-muted); font-size: 13px; }
.workspace { display: grid; grid-template-rows: auto minmax(0, 1fr); min-width: 0; }
.topbar {
  min-width: 0; display: flex; align-items: center; justify-content: flex-start;
  padding: 8px 18px; border-bottom: 1px solid var(--line); background: var(--main);
}
.search-zone { min-width: 0; position: relative; flex: 1; max-width: 680px; }
.search {
  display: flex; align-items: center; gap: 2px; min-height: 39px; padding: 1px 4px;
  border: 1px solid var(--line); border-radius: 10px; background: #f1f6ff;
}
.search:focus-within { border-color: #7399e0; background: white; }
.search input { min-width: 0; flex: 1; padding: 5px 2px; border: 0; background: transparent; outline: none; }
.search input::-webkit-search-cancel-button { display: none; }
.search-filters { border-left: 1px solid var(--line); border-radius: 0 7px 7px 0; }
.avatar {
  border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; font-weight: 650;
}
.advanced, .search-suggestions {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 5;
  padding: 16px; border-radius: 12px; background: white; border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.search-suggestions { display: flex; flex-wrap: wrap; gap: 7px; padding: 11px; }
.search-suggestions .button { font-size: 13px; min-height: 34px; }
.popover-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.popover-head h2, .dialog-header h2 { margin: 0; font-size: 18px; font-weight: 650; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.span-two { grid-column: 1 / -1; }
.fields label, .settings-editor label, .folder-field label { display: grid; gap: 4px; color: var(--muted); font-size: 13px; font-weight: 600; }
.fields input, .fields select, .settings-editor input:not([type="checkbox"]), .settings-editor select,
.settings-editor textarea, .folder-field input, .template-name input, .compose-tools select {
  min-width: 0; width: 100%; background: white; color: var(--ink);
  border: 1px solid #cad7eb; border-radius: 7px; padding: 7px 9px; font-weight: 400; font-size: 14px;
}
.check-row { padding: 0; border: 0; margin: 14px 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; }
.check-row label, .settings-editor .check-label { display: inline-flex; align-items: center; gap: 6px; }
input[type="checkbox"] { margin: 0; accent-color: var(--accent); width: 15px; height: 15px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }

.panes { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 0; min-width: 0; }
.listing { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: white; }
.list-head { padding: 8px 19px 3px; border-bottom: 1px solid var(--line); }
.list-heading { display: flex; justify-content: space-between; align-items: center; gap: 6px; min-height: 32px; }
.list-title-line { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.list-heading-actions { flex-shrink: 0; display: flex; align-items: center; gap: 4px; }
.list-heading h1 { font-size: 20px; line-height: 1.2; margin: 0; font-weight: 680; letter-spacing: -.015em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-heading p { font-size: 13px; margin: 0; color: var(--muted); flex-shrink: 0; }
.list-toolbar { position: relative; display: flex; align-items: center; gap: 8px; block-size: 38px; margin-top: 1px; }
.select-all { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); cursor: pointer; font-size: 14px; }
.filter-menu { position: relative; margin-left: auto; }
.filter-menu summary { color: var(--accent-strong); font-size: 14px; min-height: 34px; list-style: none; cursor: pointer; }
.filter-menu summary::-webkit-details-marker { display: none; }
.filter-menu summary:hover { background: var(--accent-soft); }
.filter-current { margin-left: auto; color: var(--muted); font-size: 13px; }
.filter-current:not([hidden]) + .filter-menu { margin-left: 0; }
.quick-filters {
  position: absolute; top: calc(100% + 4px); right: 0; z-index: 3;
  min-width: 172px; display: grid; gap: 2px; padding: 5px;
  border: 1px solid var(--line); border-radius: 9px; background: white; box-shadow: var(--shadow);
}
.quick-filters button, .settings-tabs button {
  background: transparent; border: 0; border-radius: 7px; padding: 6px 8px; color: var(--muted); font-size: 13px;
}
.quick-filters button { text-align: left; font-size: 14px; }
.quick-filters button:hover, .settings-tabs button:hover { background: var(--panel); }
.quick-filters button[aria-pressed="true"], .settings-tabs button[aria-pressed="true"] {
  background: var(--accent-soft); color: var(--accent-strong); font-weight: 650;
}
.bulk-actions { min-height: 35px; display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; }
.mail-list { flex: 1; min-height: 0; overflow: auto; padding: 0 15px 19px; }
.date-section {
  font-size: 13px; line-height: 1.4; font-weight: 650; color: var(--accent-strong);
  background: #f3f6fd; padding: 7px 10px; margin: 10px 0 1px; border-radius: 5px;
}
.mail-row {
  display: grid; grid-template-columns: 17px minmax(0, 1fr) 31px;
  gap: 9px; align-items: center; min-height: 54px; padding: 3px 5px 3px 8px;
  border-bottom: 1px solid #ecf0f7; border-radius: 4px;
}
.mail-row:hover, .template-row:hover { background: #f3f6fd; }
.mail-row:has(input:checked), .mail-row.selected { background: #e4edff; }
.mail-row.unread .row-subject, .mail-row.unread .row-sender { font-weight: 700; color: #152f58; }
.row-open {
  text-align: left; display: grid; grid-template-columns: minmax(132px, 23%) minmax(0, 1fr) auto;
  align-items: center; gap: 10px; width: 100%; min-width: 0;
  background: transparent; border: 0; padding: 5px 0; border-radius: 3px;
}
.row-from, .row-content, .row-meta { min-width: 0; display: flex; gap: 8px; align-items: center; }
.row-avatar { position: relative; }
.row-open .row-avatar { width: 30px; height: 30px; }
.mail-row.unread .row-avatar::after {
  content: ""; background: #2867d2; border: 2px solid white; border-radius: 50%;
  width: 10px; height: 10px; position: absolute; right: -2px; bottom: -1px;
}
.row-sender, .row-subject, .row-preview { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sender { font-size: 15px; color: var(--ink); }
.row-subject { font-weight: 500; font-size: 15px; max-width: 75%; }
.row-preview { color: var(--muted); font-size: 14px; flex: 1; }
.row-meta { gap: 7px; justify-content: flex-end; white-space: nowrap; color: var(--muted); }
.row-meta time { font-size: 13px; min-width: 45px; text-align: right; }
.row-meta [data-icon] { width: 15px; height: 15px; vertical-align: middle; }
.thread-size {
  flex: none; min-width: 21px; height: 20px; padding: 0 5px;
  color: var(--accent-strong); background: #eaf1ff; border: 1px solid #d3e2fc;
  border-radius: 5px; text-align: center; font-size: 12px; line-height: 18px;
}
.flag-button { width: 31px; height: 34px; }
.flag-button[aria-pressed="true"], .flag-button[aria-pressed="true"]:hover { color: var(--important); }
.flag-button[aria-pressed="true"] svg { fill: currentColor; }
.template-row { padding: 5px 8px; border-bottom: 1px solid var(--line); min-height: 48px; }
.reading { display: none; min-height: 0; min-width: 0; overflow: auto; background: var(--panel); }
.shell.is-reading .listing { display: none; }
.shell.is-reading .reading { display: block; }
.reading-toolbar {
  min-height: 50px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
  position: sticky; z-index: 2; top: 0; background: white; border-bottom: 1px solid var(--line); padding: 4px 14px;
}
.reading-toolbar .icon-button { height: 34px; }
.reading-toolbar .tool-label { color: var(--muted); font-weight: 550; font-size: 13px; padding: 5px 9px; min-height: 34px; }
.reading-toolbar .tool-label:hover { background: var(--accent-soft); }
.reading-toolbar .toolbar-after { margin-left: auto; }
.move-menu { position: relative; }
.move-menu summary { list-style: none; cursor: pointer; white-space: nowrap; }
.move-menu summary::-webkit-details-marker { display: none; }
.move-list {
  position: absolute; top: calc(100% + 5px); left: 0; min-width: 158px; max-height: 275px; overflow-y: auto; padding: 4px;
  display: grid; background: white; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
}
.move-list button { border: 0; border-radius: 6px; padding: 7px 10px; text-align: left; background: white; }
.move-list button:hover { background: var(--accent-soft); }
.thread { padding: 20px 21px 26px; max-width: 1020px; margin: 0 auto; }
.thread h2 { font-size: clamp(19px, 2.2vw, 27px); line-height: 1.22; letter-spacing: -.02em; margin: 0 0 4px; overflow-wrap: anywhere; }
.thread-meta { display: flex; align-items: center; justify-content: space-between; gap: 9px; margin-bottom: 12px; }
.thread-count { margin: 0; font-size: 13px; color: var(--muted); }
.expand-thread { font-size: 13px; }
.message-actions { padding: 0 12px 10px; display: flex; gap: 6px; }
.thread-card { background: white; border: 1px solid var(--line); border-radius: 11px; margin-bottom: 8px; min-width: 0; }
.thread-card summary { list-style: none; display: flex; align-items: center; gap: 9px; padding: 11px 12px; cursor: pointer; min-width: 0; }
.thread-card summary::-webkit-details-marker { display: none; }
.thread-card[open] summary { padding: 13px 14px 12px; border-bottom: 1px solid var(--line); }
.avatar { width: 34px; height: 34px; font-size: 12px; background: #e7eefb; color: #2a56a0; }
.thread-gutter { flex: 0 0 34px; height: 34px; }
.letter-attachment { display: inline-flex; flex-shrink: 0; color: var(--muted); }
.sender-info { display: grid; flex: 1; min-width: 0; }
.sender-info strong, .sender-info span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sender-info strong { font-size: 14px; }
.sender-info span, .thread-card time { font-size: 12px; color: var(--muted); }
.thread-card time { flex-shrink: 0; }
.mail-body { padding: 15px 15px 18px; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-meta { padding: 8px 15px 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.attachment-list { display: flex; flex-wrap: wrap; gap: 7px; }
.thread-card .attachment-list { padding: 0 15px 15px; }
.attachment {
  display: inline-flex; min-height: 35px; max-width: 100%; align-items: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 8px; background: #f7faff; padding: 5px 8px;
  color: var(--accent-strong); text-decoration: none; font-size: 13px; overflow-wrap: anywhere;
}
.attachment:hover { border-color: #88a8e3; }
.thread-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; }
.empty { padding: 28px 17px; text-align: center; color: var(--muted); }
.empty [data-icon] { width: 30px; height: 30px; opacity: .65; }
.empty strong { display: block; font-size: 16px; color: var(--ink); margin: 4px 0; }
.reading > .empty { display: grid; place-content: center; justify-items: center; min-height: 55%; }
.dialog {
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); color: var(--ink);
  padding: 0; width: min(700px, calc(100% - 22px)); max-height: 94dvh; overscroll-behavior: contain;
}
.dialog::backdrop { background: #10234180; }
.dialog-header, .dialog-footer { display: flex; align-items: center; gap: 8px; padding: 13px 16px; }
.dialog-header { justify-content: space-between; border-bottom: 1px solid var(--line); }
.dialog-footer { border-top: 1px solid var(--line); position: sticky; bottom: 0; background: white; }
.compose-fields { padding: 0 16px 10px; }
.address-row { display: flex; align-items: center; gap: 9px; min-height: 41px; border-bottom: 1px solid var(--line); }
.address-row label { color: var(--muted); font-weight: 600; font-size: 13px; min-width: 42px; }
.address-row input { flex: 1; width: 0; min-width: 40px; padding: 6px 1px; border: 0; }
.cc-buttons { display: flex; gap: 2px; font-size: 12px; }
.compose-tools, .template-name { display: flex; flex-wrap: wrap; gap: 5px 10px; align-items: center; padding: 9px 0; }
.compose-tools label { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 13px; }
.compose-tools select { padding: 4px 6px; width: auto; max-width: 170px; }
.save-template { font-size: 12px; }
.template-name { font-size: 13px; }
.template-name input { width: min(210px, 100%); }
.compose-fields textarea { border: 0; resize: vertical; padding: 8px 1px; display: block; width: 100%; min-height: 135px; }
.signature-preview { color: var(--muted); white-space: pre-wrap; border-top: 1px solid var(--line); padding: 7px 0; font-size: 13px; }
.compose-attachments:not(:empty) { margin: 5px 0; }
.attach-label { cursor: pointer; position: relative; overflow: hidden; }
.attach-label:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.attach-label input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.draft-button { margin-left: auto; color: var(--muted); }
.settings-tabs { display: flex; gap: 3px; padding: 9px 14px; border-bottom: 1px solid var(--line); }
.settings-tabs button { padding: 7px 11px; font-size: 14px; }
.settings-content { padding: 13px 16px 16px; }
.settings-list { display: grid; gap: 5px; margin-bottom: 8px; }
.setting-row { display: flex; gap: 4px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 3px 5px; min-width: 0; }
.setting-row .setting-name { border: 0; flex: 1; background: transparent; min-width: 0; text-align: left; border-radius: 5px; padding: 6px 7px; overflow-wrap: anywhere; }
.setting-row .setting-name:hover, .setting-row .setting-name[aria-pressed="true"] { background: var(--accent-soft); }
.setting-row small { display: block; color: var(--muted); }
.setting-row .icon-button { width: 32px; height: 32px; flex-basis: 32px; }
.appearance-options { border: 0; padding: 3px 0 4px; margin: 0; display: grid; gap: 14px; }
.appearance-options legend { font-weight: 650; margin: 0 0 11px; padding: 0; }
.appearance-options label { display: inline-flex; gap: 8px; align-items: center; }
.settings-editor { margin-top: 13px; padding: 12px; border-radius: 9px; background: var(--panel); display: grid; gap: 8px; }
.settings-editor h3 { margin: 0; font-size: 15px; font-weight: 650; }
.settings-editor textarea { width: 100%; resize: vertical; }
.settings-editor .form-actions { margin-top: 3px; }
.folder-dialog { max-width: 405px; }
.folder-field { padding: 15px 16px; }
.toast {
  margin: 0; border-radius: 9px; background: #193a72; color: #fff;
  position: fixed; z-index: 10; bottom: 16px; left: 50%; transform: translateX(-50%);
  max-width: calc(100vw - 26px); padding: 10px 14px; box-shadow: var(--shadow); font-size: 14px;
}
.nav-toggle, .list-refresh { display: none; }
@media (min-width: 920px) {
  .thread { padding: 24px 29px 30px; }
}
@media (max-width: 1050px) {
  .shell { grid-template-columns: 188px minmax(0, 1fr); }
  .rail { padding-left: 9px; padding-right: 9px; }
}
@media (max-width: 740px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail {
    position: fixed; z-index: 8; inset: 0 auto 0 0; width: min(246px, 82vw);
    transform: translateX(-102%); visibility: hidden; padding-top: 12px;
  }
  .shell.show-nav .rail { transform: none; visibility: visible; }
  .backdrop { display: block; position: fixed; inset: 0; background: #12274785; border: 0; z-index: 7; }
  .nav-toggle, .list-refresh { display: inline-flex; }
  .topbar { position: relative; padding: 6px 46px; }
  .topbar .nav-toggle { position: absolute; left: 7px; top: 50%; transform: translateY(-50%); }
  .list-head { padding: 5px 10px 3px; }
  .list-heading h1 { font-size: 18px; }
  .list-toolbar { gap: 5px; }
  .mail-list { padding-inline: 6px; }
  .mail-row { padding-left: 5px; min-height: 60px; gap: 5px; }
  .row-open { grid-template-columns: minmax(0, 1fr) auto; gap: 1px 5px; }
  .row-content { grid-column: 1 / -1; grid-row: 2; gap: 5px; }
  .row-meta { gap: 4px; }
  .row-open .row-avatar { width: 23px; height: 23px; font-size: 10px; }
  .row-subject { max-width: 86%; }
  .advanced, .search-suggestions { left: -36px; right: -36px; max-height: 82dvh; overflow: auto; }
  .reading-toolbar { padding-inline: 7px; }
  .thread { padding: 13px 9px 18px; }
  .thread-actions .button { padding-inline: 8px; font-size: 13px; }
  .dialog-footer { gap: 5px; flex-wrap: wrap; padding: 9px 10px; }
  .dialog-footer .button { padding-inline: 8px; font-size: 13px; }
  .compose-fields { padding-inline: 10px; }
  .cc-buttons { gap: 0; }
  .cc-buttons .text-button { padding-inline: 4px; }
}

.compose-status { margin: 6px 0; color: var(--muted); font-size: 13px; }
