:root { --bg: #0f1419; --panel: #161c24; --line: #263040; --text: #e6edf3; --muted: #8b98a8; --acc: #4fb3a9; --bad: #e5534b; --ok: #3fb950; }
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
.top { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel); }
.brand { font-weight: 600; font-size: 16px; display: flex; gap: 8px; align-items: center; }
.logo { background: var(--acc); color: #001; border-radius: 6px; padding: 2px 6px; font-size: 12px; }
.tag { font-size: 11px; color: var(--acc); border: 1px solid var(--acc); border-radius: 10px; padding: 1px 8px; font-weight: 500; }
.who { display: flex; gap: 12px; align-items: center; }
.pad { padding: 16px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .err { color: var(--bad); min-height: 1em; }
button { background: #222b38; color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 7px 12px; cursor: pointer; font: inherit; }
button:hover { border-color: var(--acc); }
button.primary { background: var(--acc); color: #00110f; border-color: var(--acc); font-weight: 600; }
button.link { background: none; border: none; color: var(--acc); padding: 4px; }
button.wide { width: 100%; }
input, textarea { width: 100%; background: #0b1016; color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 8px; font: inherit; margin-top: 4px; }
label { display: block; margin: 10px 0; color: var(--muted); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 24px; }
.narrow { max-width: 420px; margin: 60px auto; }
.layout { display: grid; grid-template-columns: 220px 360px 1fr; height: calc(100vh - 49px); }
.side { border-right: 1px solid var(--line); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.folders { list-style: none; padding: 0; margin: 0; }
.folder { width: 100%; text-align: left; background: none; border: none; display: flex; justify-content: space-between; }
.folder.active { background: #1d2733; }
.badge { background: var(--acc); color: #001; border-radius: 10px; padding: 0 7px; font-size: 12px; }
.keys { margin-top: auto; font-size: 11px; } .fp code { font-size: 10px; color: var(--acc); }
.list { border-right: 1px solid var(--line); overflow-y: auto; }
.item { display: block; width: 100%; text-align: left; border: none; border-bottom: 1px solid var(--line); border-radius: 0; background: none; padding: 10px 12px; }
.item.unseen .subj { font-weight: 700; } .item.bad { background: #2a1416; }
.row-between { display: flex; justify-content: space-between; gap: 8px; }
.subj { margin: 2px 0; } .lock { margin-right: 4px; }
.read { padding: 16px 22px; overflow-y: auto; }
.meta { margin: 8px 0 12px; display: grid; gap: 2px; }
.banner { border-radius: 8px; padding: 10px 12px; margin: 10px 0; display: grid; gap: 4px; }
.banner.ok { background: #0f2a1d; border: 1px solid #1f6f43; } .banner.bad { background: #2a1416; border: 1px solid var(--bad); }
.banner code { color: var(--acc); }
pre.body { white-space: pre-wrap; font: inherit; background: #0b1016; border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.row { display: flex; gap: 8px; }
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 10px; width: min(640px, 94vw); }
dialog::backdrop { background: rgba(0, 0, 0, .6); }
table.sec { border-collapse: collapse; } table.sec th { text-align: left; vertical-align: top; padding: 6px 12px 6px 0; color: var(--muted); white-space: nowrap; } table.sec td { padding: 6px 0; }
.toast { position: fixed; bottom: 18px; right: 18px; background: #0f2a1d; border: 1px solid #1f6f43; border-radius: 8px; padding: 10px 14px; }
.tenant { font-size: 12px; font-weight: 500; color: var(--text); background: #222b38; border: 1px solid var(--line); border-radius: 10px; padding: 1px 8px; overflow-wrap: anywhere; }

/* webmail-sig-1: the real mailbox (folders | list | reading pane), like Outlook / Gmail. mail.js draws it. */
.mx { display: grid; grid-template-columns: 230px minmax(300px, 400px) 1fr; height: calc(100vh - 49px); }
.mx-rail { border-right: 1px solid var(--line); padding: 12px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; background: var(--panel); }
.mx-compose-btn { padding: 11px 14px; font-size: 15px; border-radius: 10px; }
.mx-box { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; padding: 0 4px; }
.mx-picker select { width: 100%; margin-top: 4px; background: #0b1016; color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 7px; font: inherit; }
.mx-folders { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.mx-folder { width: 100%; display: flex; justify-content: space-between; align-items: center; text-align: left; background: none; border: 0; border-radius: 8px; padding: 9px 10px; }
.mx-folder:hover { background: #1b2430; }
.mx-folder.on { background: #1d2f3a; color: #fff; font-weight: 600; box-shadow: inset 3px 0 var(--acc); }
.mx-count { background: var(--acc); color: #001; border-radius: 10px; padding: 0 7px; font-size: 12px; font-weight: 700; }
.mx-listpane { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; }
.mx-search { display: flex; gap: 6px; padding: 10px; border-bottom: 1px solid var(--line); }
.mx-search input { margin: 0; }
.mx-list-title { font-size: 15px; margin: 0; padding: 10px 14px 6px; }
.mx-list { overflow-y: auto; flex: 1; }
.mx-item { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; column-gap: 10px; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line);
  border-radius: 0; background: none; padding: 10px 12px; min-height: 64px; }
.mx-item:hover { background: #1a222d; }
.mx-item.on { background: #1d2f3a; box-shadow: inset 3px 0 var(--acc); }
.mx-item.unread .mx-from, .mx-item.unread .mx-subj { font-weight: 700; color: #fff; }
.mx-item.unread { box-shadow: inset 3px 0 rgba(79, 179, 169, .5); }
.mx-av { grid-row: 1 / span 2; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px; }
.mx-av.big { width: 42px; height: 42px; font-size: 15px; }
.mx-from { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mx-date { font-size: 12px; color: var(--muted); white-space: nowrap; }
.mx-subj { grid-column: 2 / span 2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.mx-reader { overflow-y: auto; min-width: 0; }
.mx-empty { height: 100%; display: grid; place-content: center; text-align: center; color: var(--muted); gap: 6px; }
.mx-empty-ico { font-size: 44px; opacity: .5; }
.mx-read { padding: 16px 22px 24px; display: grid; gap: 12px; }
.mx-read-subject { margin: 0; font-size: 21px; line-height: 1.3; }
.mx-meta { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 12px; align-items: start; overflow-wrap: anywhere; }
.mx-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.mx-actions button { padding: 6px 10px; border-radius: 8px; }
button.danger { border-color: #5c2a2a; } button.danger:hover { border-color: var(--bad); color: #ffb4ae; }
.mx-atts { display: flex; flex-wrap: wrap; gap: 6px; } .mx-att { border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; font-size: 12px; }
.mx-pics { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 9px 12px; border-radius: 8px; background: rgba(255, 182, 72, .1);
  border: 1px solid rgba(255, 182, 72, .4); font-size: 13px; }
.mx-pics span { flex: 1 1 240px; }
.mx-frame { width: 100%; min-height: calc(100vh - 290px); border: 0; border-radius: 6px; background: #fff; }
.mx-text { white-space: pre-wrap; background: #0b1016; border: 1px solid var(--line); border-radius: 8px; padding: 14px; overflow-wrap: anywhere; }
.mx-compose { padding: 14px 22px; display: flex; flex-direction: column; gap: 8px; height: 100%; box-sizing: border-box; }
.mx-compose-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.mx-compose-head h2 { margin: 0; font-size: 18px; }
.mx-field { display: grid; grid-template-columns: 70px 1fr; align-items: center; margin: 0; gap: 8px; }
.mx-field input { margin: 0; }
.mx-bar { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; border: 1px solid var(--line); border-bottom: 0; border-radius: 8px 8px 0 0; background: #1a222d; }
.mx-bar button { padding: 5px 9px; min-width: 34px; font-size: 13px; border-radius: 6px; }
.mx-bar button[data-cmd=bold] { font-weight: 800; } .mx-bar button[data-cmd=italic] { font-style: italic; } .mx-bar button[data-cmd=underline] { text-decoration: underline; }
.mx-bar button[data-cmd=strikeThrough] { text-decoration: line-through; }
.mx-editor { flex: 1 1 auto; min-height: 220px; overflow-y: auto; background: #fff; color: #111; border: 1px solid var(--line); border-radius: 0 0 8px 8px;
  padding: 14px 16px; font: 15px/1.5 system-ui, sans-serif; outline: none; overflow-wrap: anywhere; }
.mx-editor:focus { box-shadow: 0 0 0 2px var(--acc); }
.mx-editor img { max-width: 100%; height: auto; }
.mx-editor blockquote { border-left: 3px solid #ccc; margin: 6px 0 6px 4px; padding-left: 10px; color: #444; }
.mx-sig { margin-top: 14px; }
.mx-compose-foot { display: flex; gap: 8px; flex-wrap: wrap; flex: none; }
.mx-compose .err:empty { display: none; }
.mx-dialog .mx-sig-paper { min-height: 140px; background: #fff; color: #111; border-radius: 8px; padding: 12px; margin: 8px 0; overflow: auto; }
.mx-dialog .mx-sig-paper img { max-width: 100%; height: auto; }
.mx-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.mx-seg button { border: 0; border-radius: 0; } .mx-seg button.on { background: var(--acc); color: #00110f; font-weight: 600; }
.mx-toast { position: fixed; bottom: 18px; right: 18px; border-radius: 8px; padding: 10px 14px; max-width: min(420px, 90vw); z-index: 9; background: #0f2a1d; border: 1px solid #1f6f43; }
.mx-toast.bad { background: #2a1416; border-color: var(--bad); } .mx-toast.warn { background: #2a2210; border-color: #a8821f; }
.pad { padding: 16px; }
@media (max-width: 1000px) { .mx { grid-template-columns: 190px minmax(0, 1fr); } .mx-reader { grid-column: 1 / -1; border-top: 1px solid var(--line); } }
@media (max-width: 640px) { .mx { grid-template-columns: 1fr; height: auto; } .mx-rail { border-right: 0; } .mx-frame { min-height: 60vh; } .mx-compose { height: auto; } .mx-editor { min-height: 50vh; } }
