.access {
  width: min(470px, calc(100% - 24px)); margin: clamp(18px, 11dvh, 105px) auto;
  padding: 25px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--main); box-shadow: var(--shadow);
}
.access h1 { margin: 0 0 9px; font-size: 27px; line-height: 1.24; }
.access p { margin: 0; color: var(--muted); }
.access-form { padding: 0; background: transparent; gap: 12px; }
.access-form .primary { justify-self: start; min-width: 120px; }
.form-status, .field-help { margin: 0; color: var(--muted); font-size: 13px; }
.form-error, .access .form-error { color: #96342c; }
.rail .brand { background: #222; border-radius: 8px; min-height: 36px; margin: 0 2px; padding: 4px 7px; }
.rail .brand img { display: block; width: min(100%,174px); height: auto; }
.rail .compose-button { text-align: left; white-space: normal; }
.rail-user { display: grid; padding: 4px 8px 2px; font-size: 12px; color: var(--rail-muted); overflow-wrap: anywhere; }
.rail-user strong { color: var(--rail-fg); font-size: 13px; }

.pager { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 8px 17px; border-top: 1px solid var(--line); color: var(--muted); }
.rail #templates-entry { padding-inline-start: 24px; }
.rail .system-folders { padding-top: 5px; border-top: 1px solid #ffffff26; }
.system-folder { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 7px; }
.system-folder .clear-folder-link {
  border: 1px solid #c8d9f34d; border-radius: 6px; min-height: 25px;
  background: transparent; padding: 2px 5px; color: var(--rail-fg); font-size: 11px;
}
.system-folder .clear-folder-link:hover { background: var(--rail-hover); }
#clear-current-folder { min-height: 30px; padding: 4px 7px; font-size: 13px; }
#clear-current-folder [data-icon] { width: 15px; height: 15px; flex-basis: 15px; }
@media (max-height: 720px) and (hover: hover) {
  .rail { gap: 6px; padding-block: 8px; }
  .rail .folder, .rail .rail-button { min-height: 27px; padding-block: 2px; }
  .rail .compose-button { min-height: 34px; padding-block: 5px; }
  .rail-user { padding-block: 2px; }
}
.list-toolbar .filter-menu { flex-shrink: 0; margin-left: 0; }
.select-all { flex-shrink: 0; padding: 3px 0 3px 4px; gap: 6px; min-height: 34px; }
#clear-selection { width: 30px; height: 32px; flex: 0 0 30px; }
.date-section { padding: 4px 8px; margin: 6px 0 1px; }
.mail-row.real-row {
  grid-template-columns: 32px minmax(120px, 22%) 77px minmax(0,1fr) auto;
  gap: 5px; min-height: 43px; padding: 1px 6px 1px 0;
}
.mail-row.real-row.unread { background: #f1f6ff; }
.mail-row.real-row:hover { background: #edf4ff; }
.mail-row.real-row.last-viewed { background: #e8eef9; box-shadow: inset 3px 0 #5378ae; }
.mail-row.real-row.selected { background: #e1edff; }
.real-row .row-open { display: flex; min-height: 38px; padding: 3px 0; }
.real-row .row-markers { display: flex; align-items: center; gap: 0; }
.real-row .row-meta { padding-inline: 5px 1px; }
.real-row .row-from, .real-row .row-meta { cursor: pointer; }
.row-select { align-self: stretch; display: grid; place-items: center; min-height: 38px; cursor: pointer; }
.row-select input { opacity: 0; cursor: pointer; }
.real-row:hover .row-select input, .real-row:focus-within .row-select input,
.real-row.selected .row-select input { opacity: 1; }
.real-row .row-mark { width: 25px; height: 32px; flex: 0 0 25px; }
.real-row .row-mark [data-icon] { width: 15px; height: 15px; flex-basis: 15px; }
.real-row .row-dot { width: 8px; height: 8px; border-radius: 50%; border: 1px solid #8297b9; }
.real-row.unread .row-dot { background: #296bd8; border-color: #296bd8; }
.real-row .flag-button[aria-pressed="true"] { color: var(--important); }
.real-row .flag-button[aria-pressed="true"] svg { fill: currentColor; }
.real-row .flag-button[aria-pressed="false"] svg { opacity: .55; }
.real-row .flag-button:hover svg, .real-row .flag-button:focus-visible svg { opacity: 1; }
.row-spam { color: var(--muted); }
.row-spam:hover, .spam-button:hover { color: var(--important); }
[data-restore="true"] [data-icon="thumbDown"] { transform: scaleY(-1); }
.bulk-scroll { flex: 1 1 0; min-width: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.bulk-scroll::-webkit-scrollbar { display: none; }
.bulk-actions { flex-wrap: nowrap; width: max-content; min-width: 0; border: 0; margin: 0; padding: 1px 3px; }
.bulk-actions > span { margin-right: 4px; white-space: nowrap; }
.bulk-actions .tool-label { min-height: 30px; padding: 3px 6px; gap: 4px; font-size: 13px; }
.bulk-actions [data-icon] { width: 15px; height: 15px; flex-basis: 15px; }
.bulk-menu summary { cursor: pointer; list-style: none; }
.bulk-menu summary::-webkit-details-marker { display: none; }
.bulk-menu .quick-filters {
  top: calc(100% + 2px); right: auto; left: clamp(0px, var(--bulk-menu-x, 0px), calc(100% - min(225px,80vw)));
  width: min(225px,80vw); min-width: 0; max-height: 260px; overflow: auto;
}
.bulk-menu .quick-filters button { overflow-wrap: anywhere; }
.letter-important { display: flex; justify-content: center; color: var(--important); }
.letter-important svg, .message-actions [aria-pressed="true"] svg { fill: currentColor; }
@media (hover: none), (pointer: coarse) {
  .row-select input { opacity: 1; }
  .mail-row.real-row { grid-template-columns: 44px minmax(120px, 22%) 77px minmax(0,1fr) auto; min-height: 46px; }
  .row-select { min-height: 44px; }
}
@media (max-width: 740px) {
  .mail-row.real-row { grid-template-columns: 44px 77px minmax(0,1fr) auto; gap: 0 3px; min-height: 56px; padding-right: 4px; }
  .real-row .row-select { grid-row: 1 / 3; }
  .real-row .row-from { grid-column: 2 / 4; grid-row: 1; }
  .real-row .row-markers { grid-column: 2; grid-row: 2; }
  .real-row .row-open { grid-column: 3 / -1; grid-row: 2; min-height: 28px; }
  .real-row .row-meta { grid-column: 4; grid-row: 1; }
  .real-row .row-mark { height: 28px; }
  .select-all { font-size: 13px; }
  .list-toolbar { gap: 5px; }
  .bulk-actions { gap: 3px; }
  .bulk-actions > span { font-size: 12px; }
  .system-folder .clear-folder-link { min-height: 28px; padding-inline: 8px; }
}
.letter-important [data-icon] { width: 15px; height: 15px; }
.letter-unread .sender-info strong { color: var(--accent-strong); }
.message-actions { flex-wrap: wrap; min-width: 0; border: 0; margin: 0; padding: 0 16px 13px; gap: 6px; }
.message-actions .button { min-height: 34px; padding: 5px 8px; font-size: 13px; }
.message-actions [aria-pressed="true"] { color: var(--important); }
.reading-toolbar .reader-navigation { display: contents; }
.reading-toolbar .toolbar-after { display: none; }
.reading-toolbar [data-do="test-rule"] { order: 3; margin-inline-start: auto; }
.reading-toolbar .message-actions { order: 2; padding: 3px 5px; }
.thread { max-width: 1400px; }
.thread-meta { flex-wrap: wrap; }
.thread-count { overflow-wrap: anywhere; }
.thread-search {
  width: min(40%, 520px); min-width: min(250px, 100%); margin-inline-start: auto;
  padding-inline: 9px 4px; background: var(--main);
}
.thread-search > [data-icon] { color: var(--muted); margin-inline-end: 3px; }
@media (max-width: 740px) {
  .thread-search { order: 1; width: 100%; margin-inline-start: 0; }
}
.thread-card.is-active { border-color: #8daee9; }
.sender-info .sender-details { display: flex; align-items: baseline; gap: 4px; min-width: 0; overflow: visible; }
.sender-details .letter-folder { flex-shrink: 3; min-width: 0; }
.sender-address + .letter-folder::before { content: "· "; }
.sender-address {
  min-width: 0; padding: 0; border: 0; border-radius: 4px; background: transparent;
  text-align: start; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
@media (max-width: 1050px) {
  .reading-toolbar .message-actions { order: 4; flex: 0 1 100%; padding-inline: 0; }
}
.move-letter { min-width: 0; display: flex; align-items: stretch; gap: 5px; }
.move-letter select {
  min-width: 0; max-width: min(210px, 43vw); border: 1px solid #cad7eb; border-radius: 7px;
  background: white; padding: 3px 5px; font-size: 13px; color: var(--ink);
}

.message-body { white-space: pre-wrap; overflow-wrap: anywhere; padding: 4px 0 8px; margin: 0; color: var(--ink); font-size: 15px; }
.message-quote { border-inline-start: 2px solid #a3b5d1; padding-inline-start: 10px; margin-block: 8px; }
.message-quote summary { cursor: pointer; color: #26466f; font-size: 14px; padding-block: 4px; }
.message-quote .message-body { color: var(--muted); padding-block: 2px; }
.message-quote .quote-depth-2 { margin-inline-start: 10px; border-inline-start: 1px solid #c5cfdf; padding-inline-start: 8px; }
.message-quote .quote-depth-3 { margin-inline-start: 20px; border-inline-start: 1px solid #c5cfdf; padding-inline-start: 8px; }
.thread-card .message-state { padding: 8px 15px 12px; color: var(--muted); font-size: 13px; }
.message-html { display: block; width: 100%; height: 140px; border: 0; }
.incoming-attachments {
  display: grid; grid-template-columns: repeat(auto-fit,minmax(min(200px,100%),1fr));
  gap: 7px; max-width: 740px; margin: 0 0 12px;
}
.incoming-attachments .file-button {
  display: flex; align-items: center; min-width: 0; gap: 9px; text-align: left;
  border: 1px solid var(--line); border-radius: 8px; background: #f7faff; padding: 5px 8px 5px 5px;
}
.incoming-attachments .file-button:hover { border-color: var(--accent); background: var(--accent-soft); }
.file-art {
  display: grid; place-items: center; flex: 0 0 48px; width: 48px; height: 48px;
  overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: var(--main); color: var(--accent);
}
.file-art img { width: 100%; height: 100%; object-fit: contain; }
.file-details { display: grid; min-width: 0; gap: 2px; }
.file-details strong, .file-details small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-details strong { font-size: 13px; color: var(--ink); }
.file-details small { font-size: 12px; color: var(--muted); }
.rule-result { margin: 10px 0 13px; padding: 12px 14px; border-radius: 8px; background: var(--accent-soft); }
.rule, .signature { margin-bottom: 8px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; }
.rule summary, .signature h3 { font-weight: 650; margin: 0; }
.rule small, .signature small { color: var(--muted); }
.rule-heading { display: flex; align-items: flex-start; gap: 9px; }
.rule-view { flex: 1; min-width: 0; padding-block: 3px; overflow-wrap: anywhere; }
.rule-heading .text-button { flex: 0 0 auto; padding: 3px 6px; font-size: 13px; }
.rule .rule-edit-form { margin: 9px 0 0; }
.rule-edit-fields, .rule-conditions { min-width: 0; border: 0; padding: 0; margin: 0; }
.rule-edit-fields { display: grid; gap: 9px; }
.rule-edit-fields > legend, .rule-conditions > legend { margin-bottom: 5px; font-weight: 650; font-size: 13px; }
.condition-list { max-height: min(290px, 39dvh); overflow: auto; display: grid; gap: 4px; padding: 2px 4px; }
.rule-condition { display: grid; grid-template-columns: minmax(91px, 24%) minmax(0,1fr) 30px; align-items: center; gap: 5px; }
.rule-edit-form .rule-condition input, .rule-edit-form .rule-condition select { padding: 4px 6px; }
.rule-condition .icon-button { width: 30px; height: 30px; }
.rule-conditions .text-button { margin: 3px 0 0; font-size: 13px; }
.rule-flag-options { display: flex; flex-wrap: wrap; gap: 7px 14px; }
.rule-edit-form .form-actions { flex-wrap: wrap; }
.rule ul { max-height: 230px; overflow-y: auto; padding-left: 23px; overflow-wrap: anywhere; font-size: 13px; }
.rule .rule-actions { margin: 8px 0 1px; }
.signature-heading, .profile-signature-choice { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.signature-heading h3 { min-width: 0; overflow-wrap: anywhere; }
.default-preset { min-height: 32px; padding: 5px 9px; font-size: 13px; }
.default-preset[aria-pressed="true"] { color: var(--accent-strong); background: var(--accent-soft); opacity: 1; }
#profile-form .form-actions { flex-wrap: wrap; }
#profile-signature-current { font-size: 14px; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.signature iframe { border: 0; width: 100%; background: white; min-height: 220px; display: block; }
.signature-editor summary { cursor: pointer; color: var(--accent); font-size: 13px; padding-block: 5px; }
.signature-editor .settings-editor { margin-bottom: 0; }
.settings-content > p { margin: 3px 0 14px; color: var(--muted); }
.clear-folder-dialog { width: min(470px,calc(100% - 22px)); }
.clear-folder-content { padding: 15px 16px; }
.clear-folder-content p { margin: 0; }
.clear-folder-content .form-status { margin-top: 8px; }
.clear-folder-dialog .dialog-footer { justify-content: flex-end; }
.button.danger { background: #af2b42; color: white; }
.button.danger:hover { background: #932138; }
@media(max-width: 740px) {
 .pager { gap: 6px; padding: 6px; justify-content: center; }
 .pager button { padding-inline: 7px; font-size: 13px; }
 .thread-card .message-state { padding-inline: 10px; }
}
.compose-dialog {
  width: min(1120px,calc(100% - 24px)); height: min(810px,calc(100dvh - 24px));
  max-height: calc(100dvh - 24px); overflow: hidden;
}
.compose-dialog[open] { display: grid; grid-template-rows: auto minmax(0,1fr); }
#compose-form { display: flex; flex-direction: column; min-height: 0; }
.compose-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.compose-dialog .dialog-footer { position: static; flex: 0 0 auto; flex-wrap: wrap; }
.compose-fields { margin: 0; border: 0; min-width: 0; }
.compose-fields .address-row label { flex: 0 0 min(100px, 28%); }
.compose-fields .address-row { min-height: 46px; border-bottom: 0; }
.compose-fields .address-row input { padding: 6px 9px; border: 1px solid #cad7eb; }
.compose-rich-body { border: 1px solid #cad7eb; padding: 9px; }
.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,
.compose-fields .address-row input, .compose-rich-body, .move-letter select {
  border-radius: 10px;
}
:is(input:not([type="checkbox"], [type="radio"], [type="file"]), textarea, select, .compose-rich-body):focus,
.search:has(input:focus) { outline: 2px solid var(--focus); outline-offset: 1px; }
.search input:focus { outline: none; }
.compose-fields .cc-buttons { flex: 0 0 auto; align-items: center; }
.compose-fields .cc-buttons button[aria-expanded="true"] { background: var(--accent-soft); }
.compose-drop-hint {
  position: absolute; z-index: 8; top: 58px; inset-inline: 10px; margin: 0; padding: 8px 11px;
  border: 1px dashed var(--accent); border-radius: 8px; background: var(--accent-soft);
  color: var(--accent-strong); font-size: 13px; font-weight: 650; text-align: center; pointer-events: none;
}
.compose-formatting { display: flex; gap: 6px; align-items: center; margin: 5px 0 6px; }
.compose-formatting .button { min-height: 33px; padding: 5px 10px; font-size: 13px; }
.compose-formatting [aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
@media (max-width: 620px) {
  .compose-dialog { width: calc(100% - 14px); height: calc(100dvh - 14px); max-height: calc(100dvh - 14px); }
  .compose-fields .to-row { display: grid; grid-template-columns: min(70px,21%) minmax(0,1fr); gap: 0 7px; }
  .compose-fields .cc-buttons { grid-column: 2; justify-self: end; padding-bottom: 3px; }
}
.recipient-picker { position: relative; flex: 1; min-width: 0; }
.template-view .list-toolbar { display: none; }
.template-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 5px 12px; min-height: 49px;
  padding: 5px 7px; border-bottom: 1px solid var(--line);
}
.template-row:hover { background: var(--accent-soft); }
.template-description { min-width: 0; flex: 1 1 245px; display: flex; align-items: center; gap: 9px; }
.template-row .row-subject { flex: 0 1 auto; }
.template-row .row-preview { flex: 1 1 25%; }
.template-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.template-actions .button { min-height: 34px; padding: 4px 8px; font-size: 13px; }
@media (max-width: 620px) {
  .template-row .row-subject { flex-shrink: 0; }
}
.compose-template-menu { margin-inline-start: auto; position: relative; }
.compose-template-menu summary { cursor: pointer; list-style: none; }
.compose-template-menu summary::-webkit-details-marker { display: none; }
.compose-template-menu .quick-filters { right: 0; left: auto; width: min(310px, 75vw); max-height: 43vh; overflow: auto; z-index: 6; }
#compose-template-items button { display: block; width: 100%; overflow-wrap: anywhere; }
.compose-body-frame { position: relative; }
.compose-rich-body {
  position: relative; min-height: clamp(175px,35dvh,320px); overflow-wrap: anywhere; white-space: pre-wrap;
}
.compose-rich-body:empty::before {
  content: attr(aria-placeholder); position: absolute; color: var(--muted); pointer-events: none;
}
.compose-rich-body.is-inline-drop { outline: 2px dashed var(--accent); outline-offset: 1px; }
.compose-rich-body img { max-width: 100%; height: auto; }
.compose-image-resize {
  position: absolute; z-index: 2; outline: 2px solid var(--accent); pointer-events: none;
}
.compose-image-resize button {
  position: absolute; display: grid; place-items: center; width: 24px; height: 24px; padding: 0;
  border: 0; background: transparent;
  transform: translate(-50%,-50%); touch-action: none; pointer-events: auto;
}
.compose-image-resize button::before {
  content: ""; width: 10px; height: 10px;
  border: 2px solid var(--accent); border-radius: 2px; background: white;
}
.compose-image-resize [data-image-corner="nw"] { top: 0; left: 0; cursor: nwse-resize; }
.compose-image-resize [data-image-corner="ne"] { top: 0; left: 100%; cursor: nesw-resize; }
.compose-image-resize [data-image-corner="sw"] { top: 100%; left: 0; cursor: nesw-resize; }
.compose-image-resize [data-image-corner="se"] { top: 100%; left: 100%; cursor: nwse-resize; }
.recipient-picker input { width: 100%; min-width: 0; }
#recipient-suggestions {
  position: absolute; z-index: 4; inset: calc(100% + 4px) 0 auto; max-height: min(230px, 36dvh);
  overflow: auto; list-style: none; padding: 4px; margin: 0;
  border: 1px solid var(--line); border-radius: 9px; background: var(--main); box-shadow: var(--shadow);
}
#recipient-suggestions li { padding: 5px 8px; border-radius: 6px; cursor: pointer; overflow-wrap: anywhere; }
#recipient-suggestions li:hover, #recipient-suggestions [aria-selected="true"] { background: var(--accent-soft); }
#recipient-suggestions strong { display: block; font-size: 14px; font-weight: 650; }
#recipient-suggestions span { color: var(--muted); font-size: 13px; }
.compose-fields .signature-preview { margin: 3px 0 0; overflow-wrap: anywhere; }
.compose-signature-preview {
  display: block; width: 100%; height: min(172px, 26dvh);
  border: 1px solid var(--line); border-radius: 7px; background: var(--main);
}
.compose-fields .compose-attachments:not(:empty) { margin: 7px 0 5px; }
.compose-attachments .attachment { min-height: 32px; overflow-wrap: anywhere; }
.compose-attachments .icon-button { width: 27px; height: 27px; flex-basis: 27px; }
.compose-file-info { display: grid; min-width: 0; }
.compose-file-info small { color: var(--muted); font-size: 11px; }
.compose-dialog.is-forwarding .compose-rich-body { min-height: clamp(100px,21dvh,160px); }
.compose-forward {
  margin-top: 12px; padding: 11px 12px 7px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--panel); overflow-wrap: anywhere;
}
.compose-forward h3 { margin: 0 0 6px; font-size: 14px; }
.compose-forward-meta {
  display: grid; grid-template-columns: max-content minmax(0,1fr); gap: 3px 12px;
  margin: 0 0 9px; font-size: 13px;
}
.compose-forward-meta dt { color: var(--muted); }
.compose-forward-meta dd { margin: 0; }
.compose-forward .form-status { padding: 3px 0; }
.compose-forward .text-button { font-size: 13px; }
.compose-forward .message-html { background: var(--main); }
.attach-label:has(input:disabled) { opacity: .5; cursor: default; }
.compose-dialog .compose-status { margin: 0 16px 7px; flex: 0 0 auto; }
.settings-content .settings-editor { margin: 0 0 14px; }
@media (max-width: 740px) {
 .access { padding: 19px; }
 .message-actions { padding-inline: 10px; }
 .thread-card[open] summary { padding-inline: 10px; }
 .thread-card time { max-width: 29%; overflow-wrap: anywhere; text-align: right; }
}
