/* Palette via CSS custom properties (light values identical to pre-20261110 literals).
   Dark: OS preference (prefers-color-scheme: dark) unless data-theme forces light;
   the footer toggle forces light/dark via data-theme on <html>. */
:root { color-scheme: light; font-family: "Space Mono", monospace;
  --bg:#fff; --panel:#fff; --panel-2:#f3f3f3; --text:#111; --muted:#444;
  --chrome:#111; --line:#ddd; --line-strong:#bbb; --line-mid:#999; --line-hold:#777; --line-sub:#eee;
  --accent:#0000c4; --focus:#000080; --danger:#8b1717; --warn:#a51c1c; --chip:#67738a;
  --icon:#111; --press:#e4e2de; --hover:#f3f3f3; --meter-bg:#eee;
  --backdrop:rgb(0 0 0 / 18%); --card-shadow:0 6px 24px #0003;
  --activity-bg:#d4d0c8; --activity-line:#ddd; --activity-shadow:#666; --metadata-face:#eee;
  --strong:#000;
  background: var(--bg); color: var(--text); }
:root[data-theme="dark"] { color-scheme: dark;
  --bg:#17181b; --panel:#1e1f24; --panel-2:#2b2d33; --text:#e8e6e1; --muted:#a8a49c;
  --chrome:#4a4d55; --line:#35383f; --line-strong:#494c54; --line-mid:#55585f; --line-hold:#5a5d64; --line-sub:#2c2e34;
  --accent:#8ab4ff; --focus:#9db8ff; --danger:#ff9d9d; --warn:#ffb3b3; --chip:#9aa8c0;
  --icon:#ececec; --press:#2b2d33; --hover:#23252b; --meter-bg:#26272d;
  --backdrop:rgb(0 0 0 / 45%); --card-shadow:0 6px 24px #000d;
  --activity-bg:#2b2c33; --activity-line:#4a4b52; --activity-shadow:#111; --metadata-face:#2f3136;
  --strong:#e8e6e1;
  background: var(--bg); color: var(--text); }
:root[data-theme="light"] { color-scheme: light; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark;
    --bg:#17181b; --panel:#1e1f24; --panel-2:#2b2d33; --text:#e8e6e1; --muted:#a8a49c;
    --chrome:#4a4d55; --line:#35383f; --line-strong:#494c54; --line-mid:#55585f; --line-hold:#5a5d64; --line-sub:#2c2e34;
    --accent:#8ab4ff; --focus:#9db8ff; --danger:#ff9d9d; --warn:#ffb3b3; --chip:#9aa8c0;
    --icon:#ececec; --press:#2b2d33; --hover:#23252b; --meter-bg:#26272d;
    --backdrop:rgb(0 0 0 / 45%); --card-shadow:0 6px 24px #000d;
    --activity-bg:#2b2c33; --activity-line:#4a4b52; --activity-shadow:#111; --metadata-face:#2f3136;
    --strong:#e8e6e1;
    background: var(--bg); color: var(--text); }
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 13px; line-height: 1.55; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 560px; }
.maillayout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 16px; align-items: start; }
.sidebar { min-width: 0; }
.sidebar .sidebox { min-width: 0; margin-bottom: 12px; overflow-wrap: anywhere; word-break: normal; }
.sidebar .sidebox > .mono { display: block; max-width: 100%; }
.storage-box { border-top: 1px solid var(--line); padding-top: 10px; }
.storage-title { display: flex; align-items: center; gap: 6px; }
.storage-title .icon { color: var(--icon); }
.storage-meter { display: block; width: 100%; height: 10px; margin: 8px 0 5px; appearance: none; -webkit-appearance: none; border: 1px solid var(--line-hold); border-radius: 0; background: var(--meter-bg); }
.storage-meter::-webkit-meter-bar { border: 0; border-radius: 0; background: var(--meter-bg); }
.storage-meter::-webkit-meter-optimum-value { border-radius: 0; background: var(--accent); }
.storage-meter::-moz-meter-bar { background: var(--accent); }
.storage-warning::-webkit-meter-optimum-value { background: var(--warn); }
.storage-warning::-moz-meter-bar { background: var(--warn); }
.storage-label, .storage-alert { display: block; overflow-wrap: anywhere; }
.storage-alert { color: var(--warn); }
.folderlist { list-style: none; margin: 8px 0 0; padding: 0; }
.folderlist li { padding: 4px 0; border-bottom: 1px solid var(--line-sub); }
.folderlist li:last-child { border-bottom: 0; }
.mailmain { min-width: 0; }
@media (max-width: 760px) { .maillayout { grid-template-columns: minmax(0, 1fr); } }
.center { text-align: center; }
.muted { color: var(--muted); } .small { font-size: 12px; } .mono { font-family: monospace; }
h1 { font-size: 22px; }
.topbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 0; border-bottom: 2px solid var(--chrome); margin-bottom: 12px; }
.topbar a { color: var(--strong); }
.inline-form { display: inline; margin: 0; }
.linklike { border: 0; background: none; color: var(--accent); padding: 0; cursor: pointer; text-decoration: underline; font-size: inherit; }
.card { border: 1px solid var(--line-strong); padding: 14px; margin: 0 0 14px; background: var(--panel); }
.card > :first-child { margin-top: 0; } .card > :last-child { margin-bottom: 0; }
.rowline { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.rowline:last-child { border: 0; }
.btn { display: inline-block; border: 1px solid var(--line-mid); background: var(--panel); color: var(--accent); padding: 7px 12px; cursor: pointer; text-decoration: underline; text-align: center; }
.btn:hover { border-color: var(--accent); } .btn-primary { font-weight: bold; }
.btn-danger, .btn-danger:visited { color: var(--danger); border-color: var(--danger); }
.btn-block { display: block; width: 100%; } .btn-sm { padding: 6px 10px; } .btn-lg { padding: 8px 14px; }
.field { margin-bottom: 16px; } .label { display: block; margin-bottom: 5px; font-weight: bold; }
.input, .textarea { display: block; width: 100%; border: 1px solid var(--line-mid); background: var(--panel); padding: 8px; color: inherit; }
.tablewrap { overflow-x: auto; }
.maillist-scroll { max-height: min(62vh, 640px); overflow: auto; }
.maillist thead th { position: sticky; top: 0; background: var(--panel); z-index: 1; }
.maillist input[type="checkbox"] { width: 20px; height: 20px; }
.c-select { width: 44px; }
.c-from { max-width: 220px; overflow-wrap: anywhere; }
.c-more { color: var(--chip); font-size: 0.9em; margin-left: 6px; white-space: nowrap; }
.c-date { white-space: nowrap; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.subject-text { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; overflow-wrap: anywhere; }
.bulkactions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bulkmove { margin-top: 12px; }
.bulkmove-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bulkmove-row .input { width: auto; min-width: 160px; flex: 1 1 160px; }
.movepopup { display: inline-block; position: relative; margin-left: 8px; vertical-align: middle; }
.movepopup > summary { list-style: none; cursor: pointer; }
.movepopup > summary::-webkit-details-marker { display: none; }
.movepopup > summary::marker { content: ""; }
.movepanel { position: absolute; z-index: 5; left: 0; top: calc(100% + 6px); width: min(300px, 70vw); border: 1px solid var(--chrome); background: var(--panel); padding: 12px; }
.inline-popup { margin: 0 0 0 8px; }
@media (max-width: 760px) {
  .movepanel { position: static; width: 100%; margin-top: 8px; }
  .movepopup { display: block; margin: 8px 0 0; }
  .movepopup > summary { display: block; text-align: center; }
}
@media (max-width: 760px) {
  .maillayout { grid-template-columns: minmax(0, 1fr); }
  .maillist-scroll { max-height: 70vh; }
  .maillist thead { display: none; }
  .maillist, .maillist tbody, .maillist tr, .maillist td { display: block; width: 100%; }
  .maillist tr { border-bottom: 2px solid var(--chrome); padding: 6px 0; }
  .maillist td { border-bottom: 0; padding: 4px 8px; }
  .maillist .c-select { padding-top: 8px; }
  .maillist .c-from { font-weight: bold; }
  .maillist .c-date { color: var(--muted); font-size: 12px; }
  .subject-text { white-space: normal; }
}
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 8px; text-align: left; border-bottom: 1px solid var(--line); }
tr.unread td { font-weight: bold; }
.note { border: 1px solid var(--chrome); padding: 10px; margin: 0 0 14px; }
.note.err { border-color: var(--danger); color: var(--danger); }
.message-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.login-shell { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, 1fr); align-items: center; gap: clamp(24px, 5vw, 72px); min-height: calc(100svh - 90px); padding: 48px 0; }
.login-art { min-width: 0; }
.login-beaver { display: block; width: 100%; max-width: 620px; height: auto; margin: 0 auto; }
.login-panel { width: 100%; max-width: 440px; min-width: 0; }
.login-panel h1 { margin-top: 0; }
.login-panel form { margin-top: 28px; }
.login-panel .btn { color: var(--text); text-decoration: none; }
.site-footer { padding: 12px 0; }
.theme-toggle { border: 0; background: none; padding: 0; font: inherit; font-size: 12px; color: var(--accent); cursor: pointer; text-decoration: underline; }
.theme-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
svg.icon { display: inline-block; width: 16px; height: 16px; vertical-align: middle; color: var(--icon); }
.icon-button svg.icon, .action-button svg.icon { flex: 0 0 16px; }
.subject-link, .subject-link:visited { display: block; color: inherit; text-decoration: none; overflow-wrap: anywhere; }
.subject-link:hover { background: var(--hover); }
.subject-link:focus-visible { outline: 2px solid var(--chrome); outline-offset: 3px; }
.message-subject { overflow-wrap: anywhere; }
.rowline { display: grid; grid-template-columns: 6em minmax(0, 1fr); justify-content: normal; align-items: start; }
.rowline > span { min-width: 0; overflow-wrap: anywhere; word-break: normal; }
.mailmain .card { min-width: 0; overflow-wrap: anywhere; }
.maillist td.c-select { padding: 0; vertical-align: top; }
.selection-hit { display: inline-flex; min-width: 44px; min-height: 44px; align-items: center; justify-content: center; cursor: pointer; }
.message-content { min-width: 0; overflow-x: auto; }
.message-body { min-width: 0; overflow-wrap: anywhere; }
.message-plain { white-space: pre-wrap; }
.message-html { white-space: normal; }
.message-html pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.message-html blockquote { margin-inline: 12px 0; padding-left: 12px; border-left: 2px solid var(--line-strong); }
.message-html table { max-width: 100%; }
.maillist { table-layout: fixed; }
.maillist .c-from { width: 26%; max-width: none; }
.maillist .c-date { width: 150px; white-space: normal; overflow-wrap: anywhere; }
.maillist td.c-from, .maillist td.c-subject, .maillist td.c-date { padding: 0; vertical-align: top; }
.row-open, .subject-link { display: block; min-height: 44px; padding: 12px 8px; color: inherit; text-decoration: none; overflow-wrap: anywhere; }
.row-open:visited { color: inherit; }
.maillist tr:hover, .maillist tr:focus-within { background: var(--hover); }
.row-open:focus-visible, .subject-link:focus-visible { outline: 2px solid var(--chrome); outline-offset: -2px; }
.subject-text { white-space: normal; overflow: visible; text-overflow: clip; }
@media (max-width: 760px) {
  .maillist .c-from, .maillist .c-date { width: 100%; max-width: none; }
  .row-open, .subject-link { padding: 10px 8px; }
  .rowline { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}
@media (max-width: 760px) { .login-shell { grid-template-columns: minmax(0, 1fr); min-height: auto; gap: 28px; padding: 32px 0; } .login-beaver { max-width: 360px; } .login-panel { margin: 0 auto; } }
.folder-search { display: flex; align-items: center; gap: 6px; }
.folder-search .input { min-width: 0; flex: 1 1 0; }
.folder-search .btn { flex: 0 0 auto; min-height: 36px; }
.icon-button, .action-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 36px; min-height: 36px; padding: 7px; border: 1px solid var(--line-mid); border-radius: 0; background: var(--panel); color: var(--accent); text-decoration: underline; line-height: 1; }
.icon-button:focus-visible, .action-button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.icon-button svg.icon, .action-button svg.icon { color: var(--icon); }
.metadata-info svg.icon, .metadata-close svg.icon { color: var(--icon); }
.message-actions, .bulkactions { display: flex; align-items: center; flex-wrap: nowrap; gap: 4px; }
.message-actions > *, .bulkactions > * { flex: 0 0 auto; }
.message-actions .inline-form { display: inline-flex; align-items: center; gap: 2px; }
.message-actions .movepopup, .bulkactions .movepopup { display: inline-block; margin: 0; }
.message-actions .movepopup > summary, .bulkactions .movepopup > summary { display: inline-flex; }
.message-actions .movepanel, .bulkactions .movepanel { position: absolute; left: auto; right: 0; width: min(300px, 75vw); margin-top: 0; }
.confirm-delete { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; min-height: 36px; }
.confirm-delete input { width: 18px; height: 18px; margin: 2px; }
.activity-status { position: fixed; z-index: 20; right: 12px; bottom: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; max-width: calc(100vw - 24px); padding: 10px 12px; border: 2px outset var(--activity-line); background: var(--activity-bg); color: var(--text); box-shadow: 2px 2px var(--activity-shadow); }
.activity-status[hidden] { display: none; }
.activity-track { width: 96px; height: 14px; overflow: hidden; border: 2px inset var(--activity-line); background: var(--panel); }
.activity-track > span { display: block; width: 28px; height: 10px; background: repeating-linear-gradient(90deg, var(--focus) 0 6px, transparent 6px 8px); animation: activity-blocks 1.2s steps(8, end) infinite; }
.is-refreshing img, .is-refreshing svg.icon { animation: refresh-turn 1s steps(8, end) infinite; }
@keyframes activity-blocks { from { transform: translateX(-28px); } to { transform: translateX(96px); } }
@keyframes refresh-turn { to { transform: rotate(360deg); } }
@media (max-width: 1100px) { .action-label { display: none; } }
.btn:active, .icon-button:active, .action-button:active { border-style: inset; background: var(--press); }
.row-open:active, .subject-link:active { background: var(--press); }
@media (prefers-reduced-motion: reduce) { .activity-track > span, .is-refreshing img, .is-refreshing svg.icon { animation: none; } .activity-track > span { transform: translateX(24px); } }
.move-backdrop { display: none; }
.movepopup.is-enhanced[open] .move-backdrop { display: block; position: fixed; z-index: 30; inset: 0; border: 0; border-radius: 0; background: var(--backdrop); width: 100%; height: 100%; cursor: default; }
.movepopup.is-enhanced[open] .movepanel { position: fixed; z-index: 31; left: 50%; right: auto; top: 50%; transform: translate(-50%, -50%); width: min(340px, calc(100vw - 32px)); max-height: 80vh; overflow: auto; background: var(--panel); border: 1px solid var(--line-hold); padding: 18px; box-shadow: 3px 3px var(--line-hold); }
.move-close { float: right; min-width: 32px; min-height: 32px; padding: 2px 8px; margin: -8px -8px 8px 8px; font-size: 20px; line-height: 1; }
.move-close[hidden] { display: none; }
.movepanel .bulkmove-row { clear: both; }
.attachment-list { list-style: none; padding: 0; margin: 8px 0; }
.attachment-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line); padding: 4px 0; }
.attachment-list li > span { min-width: 0; overflow-wrap: anywhere; }
.attachment-remove { flex: 0 0 auto; min-width: 32px; min-height: 32px; padding: 2px 8px; }
.attachment-preparing { display: flex; align-items: center; gap: 8px; }
.attachment-preparing[hidden], .attachment-list[hidden] { display: none; }
.discard-saved { display: block; margin: 0 0 12px; }
.action-button.btn-danger { color: var(--danger); border-color: var(--danger); }
@media (max-width: 480px) { .message-actions { gap: 2px; } .message-actions .action-button { min-width: 32px; padding: 6px; } }
