/* Lana.org Mail. Builds on the site's /style.css (tokens, buttons, auth screen). */

body.is-loading { visibility: hidden; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

svg path { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Sign in ---------- */

.login-form { width: 100%; margin-top: 32px; display: grid; gap: 14px; text-align: left; }
.login-form .button { margin-top: 10px; }
.field { display: grid; gap: 7px; }
.field-label { color: var(--faint); font-size: 10px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.field-control {
  display: flex;
  align-items: center;
  min-height: 50px;
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
  transition: box-shadow .18s ease, background .18s ease;
}
.field-control:focus-within { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border-strong), 0 0 0 3px rgba(255,255,255,.05); }
.field-control input {
  flex: 1;
  min-width: 0;
  height: 50px;
  padding: 0 16px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
}
.field-suffix input { padding-right: 4px; }
.suffix { padding-right: 16px; color: var(--muted); font-size: 14px; }
.auth-switch { margin: 4px 0 0; color: var(--faint); font-size: 12.5px; text-align: center; }
.auth-switch button, .auth-switch a { padding: 0; border: 0; background: none; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(255,255,255,.3); }
.auth-switch button:hover, .auth-switch a:hover { text-decoration-color: currentColor; }
.field-hint { margin: -4px 0 0; color: var(--faint); font-size: 11.5px; }
.form-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--danger-soft);
  color: #ffc9c9;
  font-size: 12.5px;
}

/* ---------- App shell ---------- */

.mail-app {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-columns: 248px minmax(320px, 400px) 1fr;
  overflow: hidden;
}
.mobile-bar, .nav-scrim { display: none; }
.mail-sidebar { grid-column: 1; grid-row: 1; }
.mail-list-pane { grid-column: 2; grid-row: 1; }
.mail-reader-pane { grid-column: 3; grid-row: 1; }

.mail-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  padding: 20px 14px 14px;
  border-right: 1px solid var(--border);
  background: rgba(5,6,9,.35);
  overflow-y: auto;
}
.mail-brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; text-decoration: none; font-weight: 700; letter-spacing: -.01em; }
.mail-brand img { width: 34px; height: 34px; object-fit: contain; filter: drop-shadow(0 6px 14px rgba(200,200,210,.14)); }
.compose-button { min-height: 44px; border-radius: var(--r); font-size: 13.5px; }
.compose-button svg { width: 17px; height: 17px; flex: 0 0 17px; }

.folder-nav { display: grid; gap: 1px; }
.folder {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 36px;
  padding: 0 10px 0 12px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.folder svg { width: 17px; height: 17px; flex: 0 0 17px; }
.folder-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder:hover { background: var(--surface); color: var(--text); }
.folder[aria-current="true"] { background: var(--surface-2); color: var(--text); }
.folder-count { padding: 1px 7px; border-radius: 999px; background: var(--surface-3); color: var(--text); font-size: 11px; font-weight: 700; }
.folder-count.muted { background: none; color: var(--faint); font-weight: 600; }
.folder-more { display: none; width: 22px; height: 22px; margin-right: -4px; border-radius: 6px; place-items: center; color: var(--faint); font-size: 15px; line-height: 1; }
.folder:hover .folder-more { display: grid; }
.folder:hover .folder-more + .folder-count, .folder:hover .folder-count:has(+ .folder-more) { display: none; }
.folder-more:hover { background: var(--surface-3); color: var(--text); }
.mail-app.dragging .folder[data-role] { box-shadow: inset 0 0 0 1px transparent; }
.folder.drop-target { background: rgba(255,255,255,.12); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }

.folder-group { display: grid; gap: 4px; }
.folder-group-header { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 0 12px; color: var(--faint); font-size: 10px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.folder-empty { margin: 0; padding: 4px 12px; color: var(--faint); font-size: 11.5px; line-height: 1.45; }
.sidebar-bottom { margin-top: auto; }

.account {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--r);
  background: var(--surface);
}
.account-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #4a4c54 0%, #2e3036 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}
.account-text { min-width: 0; flex: 1; }
.account-name, .account-address { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-name { font-size: 12.5px; font-weight: 700; }
.account-address { color: var(--faint); font-size: 11px; }

.icon-button {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 0;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.icon-button svg { width: 18px; height: 18px; }
.icon-button:hover { background: var(--surface-2); color: var(--text); }
.icon-button.small { width: 26px; height: 26px; flex-basis: 26px; }
.icon-button.small svg { width: 15px; height: 15px; }
.icon-button.danger:hover { background: var(--danger-soft); color: var(--danger); }
.icon-button.on { color: #f5c542; }
.icon-button.on svg path { fill: currentColor; }
.icon-button:focus-visible, .folder:focus-visible, .chip-button:focus-visible, .message:focus-visible, .menu-item:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 5px;
  background: var(--surface-2);
  box-shadow: inset 0 -1px 0 rgba(255,255,255,.08), 0 0 0 1px var(--border);
  color: var(--muted);
  font: 600 11px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------- Message list ---------- */

.mail-list-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-right: 1px solid var(--border); }
.pane-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 20px 16px 12px 18px; }
.pane-title { margin: 0; font-size: 19px; letter-spacing: -.02em; }
.pane-sub { margin: 2px 0 0; color: var(--faint); font-size: 11.5px; min-height: 16px; }
.pane-actions { display: flex; align-items: center; gap: 6px; }
.pane-actions .chip-button { min-height: 30px; padding: 0 12px; font-size: 12px; }
.search {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 14px 8px;
  padding: 0 8px 0 12px;
  min-height: 40px;
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
  color: var(--faint);
}
.search:focus-within { box-shadow: inset 0 0 0 1px var(--border-strong); }
.search:focus-within .kbd-hint { display: none; }
.search svg { width: 16px; height: 16px; flex: 0 0 16px; }
.search input { flex: 1; min-width: 0; height: 38px; border: 0; background: none; color: var(--text); font: inherit; font-size: 13px; outline: none; }
.search input::-webkit-search-cancel-button { filter: invert(1) opacity(.5); }

.select-bar { display: flex; align-items: center; gap: 8px; min-height: 38px; margin: 0 14px 4px; padding: 0 4px 0 12px; }
.select-count { color: var(--faint); font-size: 12px; font-weight: 600; }
.select-actions { display: flex; align-items: center; gap: 1px; margin-left: auto; }
.select-actions .icon-button { width: 32px; height: 32px; flex-basis: 32px; }
.select-actions .icon-button svg { width: 17px; height: 17px; }
.checkbox { position: relative; display: inline-grid; place-items: center; width: 18px; height: 18px; cursor: pointer; }
.checkbox input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.checkbox span { width: 16px; height: 16px; border-radius: 5px; box-shadow: inset 0 0 0 1.5px var(--border-strong); transition: background .15s ease; }
.checkbox input:checked + span { background: #d8dce0 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m5 10.5 3.2 3.2L15 7' fill='none' stroke='%23050609' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/12px no-repeat; box-shadow: none; }
.checkbox input:indeterminate + span { background: #d8dce0 linear-gradient(#050609, #050609) center/8px 2px no-repeat; box-shadow: none; }
.checkbox input:focus-visible + span { outline: 2px solid #fff; outline-offset: 2px; }

.message-list { flex: 1; min-height: 0; margin: 0; padding: 0 8px 8px; list-style: none; overflow-y: auto; }
.message-row { border-radius: var(--r-sm); }
.message {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 10px 10px 8px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--muted);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .12s ease;
}
.message:hover { background: var(--surface); }
.message[aria-current="true"] { background: var(--surface-2); }
.message-row.selected .message { background: rgba(255,255,255,.085); }
.message.unread::before { content: ""; position: absolute; left: 0; top: 50%; width: 3px; height: 22px; margin-top: -11px; border-radius: 0 3px 3px 0; background: #d8dce0; }

.message-avatar {
  position: relative;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  transition: background .12s ease;
}
.message.unread .message-avatar { background: linear-gradient(180deg, #4a4c54 0%, #2e3036 100%); color: #fff; }
.avatar-check { position: absolute; inset: 0; display: none; place-items: center; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--border-strong); background: var(--bg); }
.avatar-check svg { width: 16px; height: 16px; opacity: 0; }
.avatar-check svg path { stroke-width: 2.4; }
.message:hover .avatar-check, .selecting .avatar-check { display: grid; }
.message-row.selected .avatar-check { display: grid; background: #d8dce0; box-shadow: none; color: #050609; }
.message-row.selected .avatar-check svg { opacity: 1; }

.message-body { flex: 1; min-width: 0; display: grid; gap: 3px; }
.message-top, .message-bottom { display: flex; align-items: center; gap: 8px; min-width: 0; }
.message-from, .message-subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-from { flex: 1; min-width: 0; display: flex; align-items: center; gap: 5px; font-size: 13.5px; font-weight: 600; }
.from-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-subject { flex: 1; min-width: 0; font-size: 12.5px; }
.message-date { color: var(--faint); font-size: 11.5px; white-space: nowrap; }
.message.unread .message-from, .message.unread .message-subject { color: var(--text); font-weight: 700; }
.message.unread .message-date { color: var(--text); }
.message-clip { width: 13px; height: 13px; flex: 0 0 13px; color: var(--faint); }
.message-star { display: grid; place-items: center; width: 22px; height: 22px; flex: 0 0 22px; margin: -4px -4px -4px 0; border-radius: 6px; color: var(--faint); opacity: 0; transition: opacity .12s ease, color .12s ease; }
.message-star svg { width: 15px; height: 15px; }
.message:hover .message-star, .message-star.on { opacity: 1; }
.message-star:hover { color: var(--text); background: var(--surface-3); }
.message-star.on { color: #f5c542; }
.message-star.on svg path { fill: currentColor; }
.draft-tag { margin-right: 6px; color: var(--danger); font-weight: 700; }
.folder-tag { flex: 0 0 auto; padding: 0 7px; border-radius: 999px; background: var(--surface-2); color: var(--faint); font-size: 10.5px; font-weight: 600; line-height: 18px; }

.list-empty { padding: 56px 24px; color: var(--faint); font-size: 13px; text-align: center; }
.load-more {
  margin: 0 14px 14px;
  min-height: 38px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.load-more:hover { background: var(--surface-2); color: var(--text); }
.drag-ghost { position: fixed; top: -100px; left: 0; max-width: 260px; padding: 8px 14px; border-radius: 999px; background: #d8dce0; color: #050609; font: 700 12.5px/1.2 var(--font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Reader ---------- */

.mail-reader-pane { min-width: 0; min-height: 0; overflow-y: auto; }
.reader-empty { height: 100%; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--faint); font-size: 13px; }
.reader-empty img { opacity: .3; filter: grayscale(1); margin-bottom: 4px; }
.reader-empty p { margin: 0; }
.reader-empty-hint { font-size: 12px; }

.reader { max-width: 900px; margin: 0 auto; padding: 14px 32px 48px; }
.reader-toolbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 -8px 16px;
  padding: 6px 8px;
  border-radius: var(--r);
  background: rgba(10,11,14,.82);
  backdrop-filter: blur(12px);
}
.toolbar-group { display: flex; align-items: center; gap: 1px; }
.toolbar-sep { width: 1px; height: 20px; margin: 0 6px; background: var(--border-strong); }
.back-button { display: none; }
.chip-button {
  min-height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.chip-button:hover { background: var(--surface-2); color: var(--text); }
.chip-button.danger:hover { background: var(--danger-soft); color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger-border); }

.reader-subject { margin: 0 0 18px; font-size: 22px; line-height: 1.25; letter-spacing: -.02em; overflow-wrap: anywhere; }
.reader-meta { display: flex; align-items: center; gap: 12px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.reader-meta-text { flex: 1; min-width: 0; }
.reader-from, .reader-to { margin: 0; overflow-wrap: anywhere; }
.reader-from { font-size: 13.5px; font-weight: 700; }
.reader-from .reader-addr { color: var(--faint); font-weight: 500; }
.reader-from .verified { display: inline-grid; place-items: center; vertical-align: -3px; margin-left: 2px; color: var(--muted); }
.reader-from .verified svg { width: 16px; height: 16px; }
.reader-to { color: var(--faint); font-size: 12px; }
.reader-date { color: var(--faint); font-size: 12px; white-space: nowrap; align-self: flex-start; }

.auth-banner, .images-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 10px 12px 10px 14px;
  border-radius: var(--r-sm);
  font-size: 12.5px;
  line-height: 1.45;
}
.auth-banner svg, .images-banner svg { width: 18px; height: 18px; flex: 0 0 18px; }
.auth-banner { background: var(--warning-soft); box-shadow: inset 0 0 0 1px var(--warning-border); color: #fde4a5; }
.images-banner { background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); color: var(--muted); }
.images-banner span { flex: 1; }
.images-banner .chip-button { min-height: 30px; padding: 0 12px; font-size: 12px; white-space: nowrap; }

.attachment-list { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 16px; }
.attachment {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  max-width: 100%;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
  font-size: 12.5px;
  text-decoration: none;
  transition: background .15s ease;
}
.attachment:hover { background: var(--surface-2); }
.attachment svg { width: 16px; height: 16px; flex: 0 0 16px; color: var(--muted); }
.attachment-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-size { color: var(--faint); font-size: 11px; white-space: nowrap; }

.reader-body { padding-top: 20px; }
.reader-text { margin: 0; color: rgba(255,255,255,.86); font: inherit; font-size: 14px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.reader-text a { color: #fff; }
/* HTML mail is shown in dark mode: the frame is colour-inverted (and hue-rotated so colours
   keep their hue), and the frame's own stylesheet flips images back to their real colours. */
.reader-html { width: 100%; min-height: 120px; border: 0; display: block; background: transparent; color-scheme: light; filter: invert(1) hue-rotate(180deg); }

/* ---------- Composer ---------- */

.composer {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  width: min(600px, calc(100vw - 48px));
  max-height: calc(100dvh - 48px);
  display: flex;
  flex-direction: column;
  border-radius: var(--r-lg);
  background: #101116;
  box-shadow: 0 0 0 1px var(--border-strong), 0 30px 80px rgba(0,0,0,.6);
  animation: pageIn .32s var(--ease-out) both;
}
.composer-header { display: flex; align-items: center; gap: 10px; padding: 12px 12px 8px 18px; }
.composer-header h2 { margin: 0; font-size: 14px; }
.composer-status { flex: 1; color: var(--faint); font-size: 11.5px; text-align: right; }
.composer-row { display: flex; align-items: center; gap: 8px; margin: 0 18px; border-bottom: 1px solid var(--border); }
.composer-row span { flex: 0 0 auto; color: var(--faint); font-size: 12.5px; }
.composer-row input { flex: 1; min-width: 0; height: 42px; border: 0; background: none; color: var(--text); font: inherit; font-size: 13.5px; outline: none; }
.composer-toggle { padding: 4px 6px; border: 0; border-radius: 6px; background: none; color: var(--faint); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.composer-toggle:hover { background: var(--surface-2); color: var(--text); }
.composer-body {
  flex: 1;
  min-height: 260px;
  margin: 0;
  padding: 14px 18px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  line-height: 1.6;
  resize: none;
  outline: none;
}
.composer-files { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0 18px; list-style: none; }
.composer-files:empty { display: none; }
.composer-files li { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 4px 4px 10px; border-radius: 999px; background: var(--surface-2); font-size: 12px; }
.composer-files li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer-files button { width: 22px; height: 22px; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.composer-files button:hover { background: var(--surface-3); color: var(--text); }
.composer-files button svg { width: 12px; height: 12px; }
.composer .form-error { margin: 10px 18px 0; }
.composer-footer { display: flex; align-items: center; gap: 8px; padding: 14px 14px 14px 18px; }
.composer-spacer { flex: 1; }
.send-button { width: auto; min-height: 42px; padding: 0 28px; border-radius: var(--r); }
.send-button:disabled { opacity: .6; cursor: progress; transform: none; }
.attach-button { cursor: pointer; }

/* ---------- Menus and toasts ---------- */

.menu {
  position: fixed;
  z-index: 40;
  min-width: 210px;
  max-width: 280px;
  max-height: min(420px, calc(100dvh - 16px));
  overflow-y: auto;
  padding: 6px;
  border-radius: var(--r);
  background: #15161b;
  box-shadow: 0 0 0 1px var(--border-strong), 0 18px 48px rgba(0,0,0,.55);
  animation: menuIn .14s var(--ease-out) both;
}
@keyframes menuIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.menu-label { margin: 4px 10px 6px; color: var(--faint); font-size: 10px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.menu-text { margin: -2px 10px 8px; color: var(--muted); font-size: 12px; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.menu-item svg { width: 16px; height: 16px; flex: 0 0 16px; }
.menu-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); color: var(--text); outline: none; }
.menu-item.danger { color: var(--danger); }
.menu-item.danger:hover { background: var(--danger-soft); }
.menu-sep { height: 1px; margin: 6px 4px; background: var(--border); }
.schedule-item { justify-content: space-between; }
.schedule-item small { flex: 0 0 auto; color: var(--faint); font-size: 11.5px; }
.menu-form input[type="datetime-local"] { color-scheme: dark; }
:root[data-theme="light"] .menu-form input[type="datetime-local"] { color-scheme: light; }
.menu-error { margin: 0 6px; color: var(--danger); }
.failed-tag { background: var(--danger-soft); color: var(--danger); }
.menu-form { display: grid; gap: 8px; padding: 2px 4px 4px; }
.menu-form .menu-label { margin: 4px 6px 0; }
.menu-form input {
  height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: rgba(0,0,0,.3);
  box-shadow: inset 0 0 0 1px var(--border-strong);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  outline: none;
}
.menu-form-actions { display: flex; justify-content: flex-end; gap: 6px; }
.menu-form-actions .chip-button { min-height: 30px; padding: 0 12px; font-size: 12px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateX(-50%);
  padding: 10px 12px 10px 18px;
  border-radius: 999px;
  background: #1b1c22;
  box-shadow: 0 0 0 1px var(--border-strong), 0 14px 36px rgba(0,0,0,.5);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  animation: pageIn .3s var(--ease-out) both;
}
.toast:not(:has(.toast-action)) { padding-right: 18px; }
.toast-action { padding: 4px 10px; border: 0; border-radius: 999px; background: var(--surface-3); color: var(--text); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.toast-action:hover { background: rgba(255,255,255,.18); }

/* ---------- Settings ---------- */

.mail-app[data-view="settings"] .mail-list-pane,
.mail-app[data-view="settings"] .mail-reader-pane { display: none; }
.settings-inner { max-width: 760px; }
.settings-card { display: grid; gap: 14px; }
.settings-card .admin-card-header { margin-bottom: 0; }
.settings-card .admin-help { margin: 0; }
.settings-card .field-control { min-height: 44px; background: rgba(0,0,0,.2); }
.settings-card .field-control input { height: 44px; font-size: 13.5px; }
.settings-card .admin-form-actions .button { width: auto; min-height: 40px; padding: 0 20px; border-radius: var(--r-sm); font-size: 13px; }
.settings-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.field-textarea {
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-radius: var(--r);
  background: rgba(0,0,0,.2);
  box-shadow: inset 0 0 0 1px var(--border);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  line-height: 1.55;
  resize: vertical;
  outline: none;
}
.field-textarea:focus { box-shadow: inset 0 0 0 1px var(--border-strong); }
.check.toggle { align-items: flex-start; }
.check.toggle input { margin-top: 1px; }
.check em { display: block; margin-top: 2px; color: var(--faint); font-style: normal; font-size: 12px; }
.shortcuts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 24px; margin: 0; }
.shortcuts div { display: flex; align-items: center; gap: 12px; }
.shortcuts dt { min-width: 64px; }
.shortcuts dd { margin: 0; color: var(--muted); font-size: 12.5px; }

/* ---------- Admin ---------- */

.mail-app[data-view="admin"] .mail-list-pane,
.mail-app[data-view="admin"] .mail-reader-pane { display: none; }
.admin-pane { grid-column: 2 / -1; grid-row: 1; min-width: 0; overflow-y: auto; }
.admin-inner { max-width: 1040px; margin: 0 auto; padding: 26px 32px 56px; }
.admin-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; }
.admin-title { margin: 0; font-size: 24px; letter-spacing: -.025em; }
.admin-sub { margin: 4px 0 0; color: var(--faint); font-size: 12.5px; }

.admin-tabs { display: flex; gap: 4px; margin-bottom: 20px; padding: 4px; border-radius: var(--r); background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); overflow-x: auto; }
.admin-tabs button {
  flex: 1 0 auto;
  min-height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .18s ease, color .18s ease;
}
.admin-tabs button:hover { color: var(--text); }
.admin-tabs button[aria-selected="true"] { background: linear-gradient(180deg, #4a4c54 0%, #2e3036 100%); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.14); }
.tab-count { margin-left: 4px; color: var(--faint); font-size: 11.5px; }
.admin-tabs button[aria-selected="true"] .tab-count { color: rgba(255,255,255,.65); }

.admin-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
.stat-card, .admin-card { padding: 16px 18px; border-radius: var(--r); background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); }
.stat-card .panel-label { margin: 0 0 8px; }
.stat-value { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.admin-card { margin-bottom: 12px; }
.admin-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.admin-card-header h3 { margin: 0; font-size: 14px; }
.admin-card .admin-help { margin: 12px 0 0; }
.dns-checks { display: flex; flex-wrap: wrap; gap: 6px; }
.dns-check { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; background: rgba(255,255,255,.05); color: var(--muted); font-size: 12px; font-weight: 600; }
.dns-check::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.dns-check.pass { color: #bdf5cf; background: var(--success-soft); }
.dns-check.pass::before { background: var(--success); }
.dns-check.fail { color: #ffc9c9; background: var(--danger-soft); }
.dns-check.fail::before { background: var(--danger); }

.notice {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px 12px 12px 16px;
  border-radius: var(--r);
  background: var(--success-soft);
  box-shadow: inset 0 0 0 1px var(--success-border);
  font-size: 13px;
}
.notice.error { background: var(--danger-soft); box-shadow: inset 0 0 0 1px var(--danger-border); }
.notice-text { flex: 1; min-width: 0; overflow-wrap: anywhere; line-height: 1.7; }
.notice-text code, .code { padding: 2px 7px; border-radius: 6px; background: rgba(0,0,0,.35); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; letter-spacing: .02em; }

.admin-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.admin-search { flex: 1 1 220px; margin: 0; }
.toolbar-help { flex: 1 1 260px; margin: 0; }
.toolbar-button { width: auto; min-height: 40px; padding: 0 18px; border-radius: var(--r-sm); font-size: 13px; }
.segmented { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r-sm); background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); }
.segmented button { min-height: 32px; padding: 0 12px; border: 0; border-radius: 7px; background: none; color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }
.list-filter { margin-bottom: 10px; }
.admin-help { margin: 0; color: var(--faint); font-size: 12.5px; line-height: 1.5; }

.admin-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
  padding: 16px;
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
}
.admin-form-4 { grid-template-columns: repeat(4, 1fr); }
.admin-form .field-control { min-height: 44px; background: rgba(0,0,0,.2); }
.admin-form .field-control input, .admin-form .field-control select { height: 44px; font-size: 13.5px; }
.field-control select {
  flex: 1;
  min-width: 0;
  padding: 0 12px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  outline: none;
  cursor: pointer;
}
.field-control select option { background: #15161b; }
.admin-form .check, .admin-form-actions { grid-column: 1 / -1; }
.admin-form-actions { display: flex; align-items: center; gap: 8px; }
.admin-form-actions .button { width: auto; min-height: 40px; padding: 0 20px; border-radius: var(--r-sm); font-size: 13px; }
.inline-button {
  margin-right: 6px;
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.inline-button:hover { background: var(--surface-3); color: var(--text); }
.check { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12.5px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: #c9ccd2; }

.admin-list, .activity-list { margin: 0; padding: 0; list-style: none; }
.admin-list { border-radius: var(--r); background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); }
.admin-row-wrap, .admin-list > .admin-row { border-top: 1px solid var(--border); }
.admin-row-wrap:first-child, .admin-list > .admin-row:first-child { border-top: 0; }
.admin-row-wrap.open { background: rgba(255,255,255,.02); }
.admin-row { display: flex; align-items: center; gap: 12px; padding: 13px 16px; }
.admin-row-main { flex: 1; min-width: 0; }
.admin-row-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.admin-row-sub { margin: 3px 0 0; color: var(--faint); font-size: 12px; overflow-wrap: anywhere; }
.request-reason { margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.admin-row-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
.admin-row .chip-button, .user-panel .chip-button { min-height: 30px; padding: 0 12px; font-size: 12px; }
.account-avatar.muted { opacity: .4; }

.badge { padding: 1px 8px; border-radius: 999px; background: var(--surface-3); color: var(--muted); font-size: 10.5px; font-weight: 700; letter-spacing: .02em; }
.badge-strong { background: rgba(255,255,255,.14); color: var(--text); }
.badge-ok { background: var(--success-soft); color: #bdf5cf; }
.badge-danger { background: var(--danger-soft); color: #ffc9c9; }

.user-panel { padding: 0 16px 14px 62px; }
.user-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.user-action-form { margin-top: 10px; }
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.inline-form input, .admin-row-actions input {
  width: 220px;
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: rgba(0,0,0,.3);
  box-shadow: inset 0 0 0 1px var(--border-strong);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  outline: none;
}
.inline-text { color: var(--muted); font-size: 12.5px; }
.chip-button.strong { background: var(--surface-3); color: var(--text); }
.chip-button.danger-solid { background: var(--danger-soft); color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger-border); }
.chip-button:disabled { opacity: .55; cursor: progress; }
.admin-empty { padding: 20px 16px; color: var(--faint); font-size: 12.5px; }

.activity { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); font-size: 13px; }
.activity:first-child { border-top: 0; padding-top: 0; }
.activity-main { flex: 1; min-width: 0; }
.activity-main p { margin: 0; color: var(--muted); overflow-wrap: anywhere; }
.activity-main strong { color: var(--text); font-weight: 600; }
.activity-detail { margin-top: 2px !important; color: var(--faint) !important; font-size: 12px; }
.activity time { color: var(--faint); font-size: 12px; white-space: nowrap; }
.activity-list .admin-empty { padding: 4px 0; }

/* ---------- Smaller screens ---------- */

@media (max-width: 1180px) {
  .mail-app { grid-template-columns: 220px minmax(290px, 340px) 1fr; }
  .admin-form-4 { grid-template-columns: 1fr 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}

/* Phones: the sidebar becomes a drawer behind a menu button. */
@media (max-width: 760px) {
  .mail-app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .mobile-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    grid-row: 1;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    background: rgba(5,6,9,.6);
  }
  .mobile-bar .mail-brand { flex: 1; padding: 0; }
  .mobile-bar .mail-brand img { width: 28px; height: 28px; }
  .mail-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 25;
    width: min(290px, 84vw);
    background: #0b0c10;
    box-shadow: 20px 0 60px rgba(0,0,0,.5);
    transform: translateX(-102%);
    transition: transform .26s var(--ease-out);
  }
  .mail-app.nav-open .mail-sidebar { transform: none; }
  .nav-scrim { display: block; position: fixed; inset: 0; z-index: 24; background: rgba(0,0,0,.5); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
  .mail-app.nav-open .nav-scrim { opacity: 1; pointer-events: auto; }
  .mail-list-pane, .mail-reader-pane { grid-row: 2; grid-column: 1; border-right: 0; min-height: 0; }
  .mail-app[data-pane="list"] .mail-reader-pane { display: none; }
  .mail-app[data-pane="reader"] .mail-list-pane { display: none; }
  .back-button { display: grid; }
  .reader { padding: 8px 14px 32px; }
  .reader-toolbar { margin: 0 -6px 12px; overflow-x: auto; }
  .toolbar-sep { display: none; }
  .reader-subject { font-size: 19px; }
  .pane-header { padding: 14px 14px 10px 16px; }
  .kbd-hint, .reader-empty-hint { display: none; }
  .message-star { opacity: 1; }
  .composer { inset: 0; width: 100%; max-height: none; border-radius: 0; }
  .admin-pane { grid-column: 1; grid-row: 2; }
  .admin-inner { padding: 16px 16px 40px; }
  .admin-stats { grid-template-columns: 1fr 1fr; }
  .admin-form, .admin-form-4 { grid-template-columns: 1fr; }
  .admin-row { flex-wrap: wrap; }
  .admin-row-actions { justify-content: flex-start; }
  .user-panel { padding-left: 16px; }
  .inline-form input { width: 100%; }
  .toolbar-button { flex: 1 1 100%; }
  .shortcuts { grid-template-columns: 1fr; }
  .toast { max-width: calc(100vw - 32px); white-space: normal; }
}

/* Placeholder rows while a folder loads for the first time. */
.skeleton-row { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 8px; }
.sk { display: block; border-radius: 6px; background: linear-gradient(90deg, rgba(255,255,255,.04) 0%, rgba(255,255,255,.09) 50%, rgba(255,255,255,.04) 100%) 0 0 / 200% 100%; animation: shimmer 1.2s ease-in-out var(--d, 0ms) infinite; }
.sk-avatar { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%; }
.sk-lines { flex: 1; display: grid; gap: 7px; }
.sk-line { height: 10px; width: 78%; }
.sk-line.short { width: 52%; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }

/* Quoted original under a reply or forward, and folded history when reading. */
.composer-body { min-height: 180px; }
.composer-quote { margin: 0 18px 4px; border-radius: var(--r-sm); background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); overflow: hidden; }
.quote-toggle { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; padding: 0 12px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 12.5px; text-align: left; cursor: pointer; }
.quote-toggle:hover { background: var(--surface-2); color: var(--text); }
.quote-toggle svg { width: 16px; height: 16px; flex: 0 0 16px; margin-left: auto; transition: transform .18s ease; }
.quote-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.quote-dots { padding: 0 6px; border-radius: 6px; background: var(--surface-3); color: var(--text); font-size: 9px; letter-spacing: 1px; line-height: 16px; }
.quote-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quote-body { max-height: 260px; overflow-y: auto; padding: 4px 14px 14px; border-left: 2px solid var(--border-strong); margin: 0 12px 12px; }
.quote-body .reader-text { font-size: 13px; color: var(--muted); }
.quote-head { margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border); font-size: 12px; }
.quote-head p { margin: 0 0 2px; color: var(--muted); overflow-wrap: anywhere; }
.quote-head span { display: inline-block; min-width: 58px; color: var(--faint); }
.quote-missing { margin: 4px 0 0; color: var(--faint); font-size: 12.5px; }
.quote-fold { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; padding: 5px 12px 5px 6px; border: 0; border-radius: 999px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); color: var(--muted); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.quote-fold span { padding: 0 6px; border-radius: 6px; background: var(--surface-3); color: var(--text); font-size: 9px; letter-spacing: 1px; line-height: 16px; }
.quote-fold:hover { background: var(--surface-2); color: var(--text); }
.reader-quoted { margin-top: 12px; padding-left: 14px; border-left: 2px solid var(--border-strong); color: var(--muted); }

/* Lana.org member shield: other members, verified. */
.member-shield { display: inline-grid; place-items: center; flex: 0 0 auto; color: #4ade80; filter: drop-shadow(0 0 6px rgba(74,222,128,.25)); }
.member-shield svg { width: 14px; height: 14px; }
.member-shield svg path:first-child { fill: rgba(74,222,128,.16); }
.member-shield svg path:last-child { stroke-width: 2; }
.reader-from .member-shield { vertical-align: -2px; margin-left: 2px; }

/* ---------- Settings rows ---------- */

.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.settings-card .admin-card-header + .setting-row { padding-top: 0; border-top: 0; }
.setting-text { min-width: 0; }
.setting-title { margin: 0; font-size: 13.5px; font-weight: 600; }
.setting-help { margin: 2px 0 0; color: var(--faint); font-size: 12px; }
.setting-row .segmented { flex: 0 0 auto; }
.settings-card .setting-row + .check { padding-top: 14px; border-top: 1px solid var(--border); }
@media (max-width: 760px) {
  .setting-row { flex-direction: column; align-items: stretch; gap: 10px; }
  .setting-row .segmented { display: flex; }
  .setting-row .segmented button { flex: 1; }
}

/* ---------- Text size ---------- */

:root { --read-size: 14px; --from-size: 13.5px; --subject-size: 12.5px; }
:root[data-text="small"] { --read-size: 13px; --from-size: 12.5px; --subject-size: 11.5px; }
:root[data-text="large"] { --read-size: 16px; --from-size: 15px; --subject-size: 14px; }
.reader-text, .composer-body { font-size: var(--read-size); }
.message-from { font-size: var(--from-size); }
.message-subject { font-size: var(--subject-size); }

/* ---------- Compact density ---------- */

:root[data-density="compact"] .message { gap: 10px; padding: 6px 10px 6px 8px; }
:root[data-density="compact"] .message-body { gap: 1px; }
:root[data-density="compact"] .message-avatar { width: 28px; height: 28px; flex-basis: 28px; font-size: 11.5px; }
:root[data-density="compact"] .message.unread::before { height: 18px; margin-top: -9px; }
:root[data-density="compact"] .skeleton-row { padding: 6px 10px 6px 8px; }
:root[data-density="compact"] .sk-avatar { width: 28px; height: 28px; flex-basis: 28px; }
:root[data-density="compact"] .folder { min-height: 32px; }
:root[data-density="compact"] .mail-sidebar { gap: 10px; }

/* ---------- Light theme ---------- */

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f5f7;
  --surface: rgba(16,18,26,.035);
  --surface-2: rgba(16,18,26,.06);
  --surface-3: rgba(16,18,26,.09);
  --border: rgba(16,18,26,.09);
  --border-strong: rgba(16,18,26,.17);
  --text: #121318;
  --muted: #555863;
  --faint: #767983;
  --success: #15803d;
  --success-soft: rgba(22,163,74,.09);
  --success-border: rgba(22,163,74,.28);
  --danger: #c62828;
  --danger-soft: rgba(220,38,38,.08);
  --danger-border: rgba(220,38,38,.26);
  --warning: #b45309;
  --warning-soft: rgba(217,119,6,.09);
  --warning-border: rgba(217,119,6,.28);
}
:root[data-theme="light"] body::before { background: radial-gradient(ellipse 78% 50% at 50% 0%, #ffffff 0%, rgba(255,255,255,.6) 45%, transparent 100%), var(--bg); }
:root[data-theme="light"] body::after { display: none; }
:root[data-theme="light"] strong { color: var(--text); }
:root[data-theme="light"] .button:focus-visible,
:root[data-theme="light"] .icon-button:focus-visible, :root[data-theme="light"] .folder:focus-visible, :root[data-theme="light"] .chip-button:focus-visible,
:root[data-theme="light"] .message:focus-visible, :root[data-theme="light"] .menu-item:focus-visible,
:root[data-theme="light"] .checkbox input:focus-visible + span { outline-color: #121318; }
:root[data-theme="light"] .button-discord { box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 0 0 1px rgba(0,0,0,.06), 0 10px 24px rgba(16,18,26,.16); }
:root[data-theme="light"] .button-discord:hover { box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 0 0 1px rgba(0,0,0,.08), 0 12px 28px rgba(16,18,26,.2); }

:root[data-theme="light"] .field-control:focus-within { box-shadow: inset 0 0 0 1px var(--border-strong), 0 0 0 3px rgba(16,18,26,.05); }
:root[data-theme="light"] .auth-switch button, :root[data-theme="light"] .auth-switch a { text-decoration-color: rgba(16,18,26,.3); }
:root[data-theme="light"] .form-error,
:root[data-theme="light"] .dns-check.fail, :root[data-theme="light"] .badge-danger { color: #b91c1c; }
:root[data-theme="light"] .dns-check.pass, :root[data-theme="light"] .badge-ok { color: #15803d; }
:root[data-theme="light"] .auth-banner { color: #92400e; }

:root[data-theme="light"] .mail-sidebar { background: rgba(255,255,255,.55); }
:root[data-theme="light"] .folder.drop-target { background: rgba(16,18,26,.08); }
:root[data-theme="light"] .icon-button.on, :root[data-theme="light"] .message-star.on { color: #d18f00; }
:root[data-theme="light"] kbd { background: #fff; box-shadow: inset 0 -1px 0 rgba(16,18,26,.08), 0 0 0 1px var(--border); }
:root[data-theme="light"] .search { background: #fff; }
:root[data-theme="light"] .search input::-webkit-search-cancel-button { filter: opacity(.5); }

:root[data-theme="light"] .checkbox input:checked + span { background: #26282e url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m5 10.5 3.2 3.2L15 7' fill='none' stroke='%23ffffff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/12px no-repeat; }
:root[data-theme="light"] .checkbox input:indeterminate + span { background: #26282e linear-gradient(#fff, #fff) center/8px 2px no-repeat; }
:root[data-theme="light"] .message-row.selected .message { background: rgba(16,18,26,.07); }
:root[data-theme="light"] .message.unread::before { background: #26282e; }
:root[data-theme="light"] .message-row.selected .avatar-check, :root[data-theme="light"] .drag-ghost { background: #26282e; color: #fff; }
:root[data-theme="light"] .avatar-check { background: #fff; }
:root[data-theme="light"] .sk { background-image: linear-gradient(90deg, rgba(16,18,26,.05) 0%, rgba(16,18,26,.1) 50%, rgba(16,18,26,.05) 100%); }

:root[data-theme="light"] .reader-toolbar { background: rgba(255,255,255,.85); box-shadow: 0 0 0 1px var(--border); }
:root[data-theme="light"] .reader-text { color: #24262d; }
:root[data-theme="light"] .reader-text a { color: #1a56c4; }
:root[data-theme="light"] .reader-html { filter: none; }
:root[data-theme="light"] .images-banner, :root[data-theme="light"] .attachment, :root[data-theme="light"] .chip-button,
:root[data-theme="light"] .composer-quote, :root[data-theme="light"] .quote-fold { background-color: #fff; }
:root[data-theme="light"] .chip-button:hover, :root[data-theme="light"] .attachment:hover, :root[data-theme="light"] .quote-fold:hover { background-color: #eceef1; }
:root[data-theme="light"] .chip-button.danger:hover { background-color: #fdecec; }

:root[data-theme="light"] .composer { background: #fff; box-shadow: 0 0 0 1px var(--border-strong), 0 30px 80px rgba(16,18,26,.18); }
:root[data-theme="light"] .menu { background: #fff; box-shadow: 0 0 0 1px var(--border-strong), 0 18px 48px rgba(16,18,26,.16); }
:root[data-theme="light"] .toast { background: #fff; box-shadow: 0 0 0 1px var(--border-strong), 0 14px 36px rgba(16,18,26,.16); }
:root[data-theme="light"] .toast-action:hover { background: rgba(16,18,26,.14); }
:root[data-theme="light"] .menu-form input, :root[data-theme="light"] .inline-form input, :root[data-theme="light"] .admin-row-actions input,
:root[data-theme="light"] .settings-card .field-control, :root[data-theme="light"] .admin-form .field-control,
:root[data-theme="light"] .field-textarea { background: #fff; }
:root[data-theme="light"] .field-control select option { background: #fff; }
:root[data-theme="light"] .notice-text code, :root[data-theme="light"] .code { background: rgba(16,18,26,.07); }

:root[data-theme="light"] .stat-card, :root[data-theme="light"] .admin-card, :root[data-theme="light"] .admin-list,
:root[data-theme="light"] .admin-form, :root[data-theme="light"] .admin-tabs, :root[data-theme="light"] .account { background: rgba(255,255,255,.7); }
:root[data-theme="light"] .segmented { background: rgba(16,18,26,.04); }
:root[data-theme="light"] .segmented button[aria-pressed="true"] { background: #fff; box-shadow: 0 1px 2px rgba(16,18,26,.12), 0 0 0 1px var(--border); }
:root[data-theme="light"] .admin-row-wrap.open { background: rgba(16,18,26,.02); }
:root[data-theme="light"] .badge-strong { background: rgba(16,18,26,.1); }
:root[data-theme="light"] .dns-check { background: rgba(16,18,26,.05); }
:root[data-theme="light"] .check input { accent-color: #26282e; }

:root[data-theme="light"] .member-shield { color: #16a34a; filter: none; }
:root[data-theme="light"] .member-shield svg path:first-child { fill: rgba(22,163,74,.14); }

@media (max-width: 760px) {
  :root[data-theme="light"] .mobile-bar { background: rgba(255,255,255,.75); }
  :root[data-theme="light"] .mail-sidebar { background: #f7f8fa; box-shadow: 20px 0 60px rgba(16,18,26,.18); }
  :root[data-theme="light"] .nav-scrim { background: rgba(16,18,26,.3); }
}

/* ---------- Tracker protection ---------- */

.tracker-note { display: inline-flex; align-items: center; gap: 7px; margin: 14px 0 0; padding: 5px 12px 5px 9px; border-radius: 999px; background: var(--success-soft); color: var(--success); font-size: 12px; font-weight: 600; }
.tracker-note svg { width: 15px; height: 15px; flex: 0 0 15px; }
.tracker-note svg path:last-child { stroke-width: 2; }

.link-dialog {
  width: min(440px, calc(100vw - 32px));
  padding: 22px;
  border: 0;
  border-radius: var(--r-lg);
  background: #15161b;
  box-shadow: 0 0 0 1px var(--border-strong), 0 30px 80px rgba(0,0,0,.6);
  color: var(--text);
  font: inherit;
}
.link-dialog::backdrop { background: rgba(0,0,0,.55); }
.link-dialog h2 { margin: 0 0 8px; font-size: 16px; letter-spacing: -.01em; }
.link-dialog p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.link-dialog strong { color: var(--text); }
.link-dialog-url { margin-top: 12px !important; padding: 9px 11px; border-radius: var(--r-sm); background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important; overflow-wrap: anywhere; max-height: 96px; overflow-y: auto; }
.link-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ---------- Composer From ---------- */

.composer-from { flex: 1; min-width: 0; height: 42px; border: 0; background: none; color: var(--text); font: inherit; font-size: 13.5px; outline: none; cursor: pointer; }
.composer-from option { background: #15161b; }

/* ---------- Sessions ---------- */

.session-list, .alias-list { margin: 0; padding: 0; list-style: none; border-radius: var(--r-sm); box-shadow: inset 0 0 0 1px var(--border); }
.session-row, .alias-row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-top: 1px solid var(--border); }
.session-row:first-child, .alias-row:first-child { border-top: 0; }
.session-main, .alias-main { flex: 1; min-width: 0; }
.session-device, .alias-address { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 13.5px; font-weight: 600; min-width: 0; }
.session-meta, .alias-meta { margin: 2px 0 0; color: var(--faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-row .chip-button { min-height: 30px; padding: 0 12px; font-size: 12px; }
.session-list .admin-empty, .alias-list .admin-empty { padding: 14px; }

/* ---------- Aliases ---------- */

.alias-create { display: flex; gap: 8px; }
.alias-create .field-control { flex: 1; }
.alias-create .button { width: auto; min-height: 44px; padding: 0 20px; border-radius: var(--r-sm); font-size: 13px; white-space: nowrap; }
.alias-copy, .alias-label { min-width: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alias-copy:hover, .alias-label:hover { text-decoration: underline; text-underline-offset: 3px; }
.alias-row.off .alias-copy { color: var(--faint); }
.alias-actions { display: flex; align-items: center; gap: 6px; }

.switch { position: relative; display: inline-block; width: 34px; height: 20px; flex: 0 0 34px; cursor: pointer; }
.switch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--border-strong); transition: background .15s ease; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: transform .18s var(--ease-out), background .15s ease; }
.switch input:checked + span { background: var(--success-soft); box-shadow: inset 0 0 0 1px var(--success-border); }
.switch input:checked + span::after { transform: translateX(14px); background: var(--success); }
.switch input:focus-visible + span { outline: 2px solid #fff; outline-offset: 2px; }

@media (max-width: 760px) {
  .alias-create { flex-direction: column; }
}

:root[data-theme="light"] .link-dialog { background: #fff; box-shadow: 0 0 0 1px var(--border-strong), 0 30px 80px rgba(16,18,26,.2); }
:root[data-theme="light"] .link-dialog::backdrop { background: rgba(16,18,26,.3); }
:root[data-theme="light"] .composer-from option { background: #fff; }
:root[data-theme="light"] .session-list, :root[data-theme="light"] .alias-list { background: #fff; }
:root[data-theme="light"] .switch input:focus-visible + span { outline-color: #121318; }

.session-icon { display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 36px; border-radius: 10px; background: var(--surface-2); color: var(--muted); }
.session-icon svg { width: 18px; height: 18px; }
.session-meta { white-space: normal; }
:root[data-theme="light"] .session-icon { background: rgba(16,18,26,.05); }

.alias-new { display: grid; gap: 8px; }
.alias-suggestion { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 6px 6px 14px; border-radius: var(--r-sm); background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); }
.alias-suggestion-address { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 14px/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .01em; }
.alias-suggestion .chip-button { display: inline-flex; align-items: center; gap: 7px; flex: 0 0 auto; }
.alias-suggestion .chip-button svg { width: 15px; height: 15px; }
:root[data-theme="light"] .alias-suggestion { background: #fff; }
.alias-new.full .alias-suggestion, .alias-new.full .alias-create { opacity: .5; }
.alias-new #alias-full { margin: 2px 0 0; }

/* ---------- Two-factor authentication ---------- */

.code-input { font: 600 20px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important; letter-spacing: .32em; text-align: center; }
.code-input::placeholder { color: var(--faint); opacity: .45; }
.code-input.recovery { font-size: 16px !important; letter-spacing: .12em; }
.settings-card .code-input { text-align: left; font-size: 17px !important; letter-spacing: .24em; }
.auth-sep { margin: 0 6px; color: var(--faint); }

.tfa-setup { display: grid; grid-template-columns: 172px 1fr; gap: 22px; align-items: start; }
.tfa-qr { padding: 10px; border-radius: var(--r); background: #fff; box-shadow: 0 0 0 1px var(--border); line-height: 0; }
.tfa-qr svg { width: 100%; height: auto; }
.tfa-steps { display: grid; gap: 18px; min-width: 0; }
.tfa-steps .setting-title { margin-bottom: 4px; }
.tfa-key { display: flex; align-items: center; gap: 10px; margin: 10px 0 0; flex-wrap: wrap; }
.tfa-key code { padding: 7px 10px; border-radius: 8px; background: var(--surface-2); font: 600 13px/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .06em; overflow-wrap: anywhere; }
.tfa-key .chip-button, .tfa-form .chip-button, .tfa-codes-wrap .chip-button { min-height: 34px; }
.tfa-form { display: grid; gap: 12px; }
.tfa-form .field-control { max-width: 260px; }
.tfa-grid { grid-template-columns: 1fr 1fr; }
.tfa-grid .field-control { max-width: none; }
.tfa-codes-wrap { display: grid; gap: 6px; }
.tfa-codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 10px 0 8px; padding: 14px; list-style: none; border-radius: var(--r-sm); background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); }
.tfa-codes code { font: 600 14px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .08em; }
#twofactor-body .admin-help { margin: 0 0 14px; }
#twofactor-body .admin-form-actions { flex-wrap: wrap; }

@media (max-width: 760px) {
  .tfa-setup { grid-template-columns: 1fr; }
  .tfa-qr { width: 200px; justify-self: center; }
  .tfa-grid, .tfa-codes { grid-template-columns: 1fr; }
  .tfa-form .field-control { max-width: none; }
}

:root[data-theme="light"] .tfa-codes { background: #fff; }
/* The app draws icon paths as outlines; QR modules must be solid. */
.tfa-qr svg path { fill: #000 !important; stroke: none !important; }
.tfa-qr svg rect { fill: #fff !important; stroke: none !important; }

/* Setup rows span the full width beside the QR code. */
.tfa-setup { grid-template-columns: 188px 1fr; align-items: stretch; }
.tfa-steps { align-content: space-between; gap: 16px; }
.tfa-key code { flex: 1; min-width: 0; display: flex; align-items: center; min-height: 40px; padding: 0 14px; }
.tfa-key .chip-button { min-height: 40px; padding: 0 16px; }
.tfa-form[data-tfa-form="enable"] { gap: 10px; }
.tfa-inline { display: flex; align-items: stretch; gap: 8px; }
.tfa-inline .field-control { flex: 1; max-width: none; min-height: 44px; }
.tfa-inline .code-input { height: 44px; }
.tfa-inline .button { width: auto; min-height: 44px; padding: 0 22px; border-radius: var(--r-sm); font-size: 13px; }
.tfa-inline .chip-button { min-height: 44px; border-radius: var(--r-sm); padding: 0 16px; }
@media (max-width: 760px) {
  .tfa-setup { grid-template-columns: 1fr; }
  .tfa-inline { flex-wrap: wrap; }
  .tfa-inline .field-control { flex-basis: 100%; }
  .tfa-inline .button { flex: 1; }
}

/* Square white tile with even padding; the steps column stretches to match. */
.tfa-qr { align-self: start; aspect-ratio: 1; display: grid; place-items: center; padding: 12px; }
.tfa-qr svg { display: block; width: 100%; height: 100%; }

/* Desktop: the tile takes the height of the steps column (set in app.js) and stays square. */
@media (min-width: 761px) {
  .tfa-setup { grid-template-columns: auto 1fr; align-items: start; }
  .tfa-qr { width: 172px; }
  .tfa-steps { align-self: start; }
}

/* Two-factor overview: one row per method. */
.tfa-method { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--border); }
#twofactor-body > .admin-help + .tfa-method { border-top: 0; padding-top: 2px; }
.tfa-method .setting-title { display: flex; align-items: center; gap: 8px; }
.tfa-method .chip-button { flex: 0 0 auto; }
.tfa-keys { margin: -4px 0 12px; }
.tfa-key-row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-top: 1px solid var(--border); }
.tfa-key-row:first-child { border-top: 0; }
.tfa-key-row .chip-button { min-height: 30px; padding: 0 12px; font-size: 12px; }
.tfa-narrow { max-width: 320px; }
#twofactor-key { margin-top: -4px; }
@media (max-width: 760px) { .tfa-method { flex-direction: column; align-items: stretch; } .tfa-narrow { max-width: none; } }

/* End-to-end encryption settings and unlock dialog. */
.enc-fingerprint { margin-top: 4px !important; color: var(--text) !important; font: 600 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important; letter-spacing: .04em; overflow-wrap: anywhere; }
.enc-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.unlock-dialog form { display: grid; gap: 12px; }
.unlock-dialog h2 { margin: 0; }
.unlock-dialog .field-control { min-height: 46px; background: rgba(0,0,0,.25); }
.unlock-dialog .field-control input { height: 46px; }
.unlock-dialog .link-dialog-actions { margin-top: 4px; }
:root[data-theme="light"] .unlock-dialog .field-control { background: #fff; }

/* End-to-end encrypted mail. */
.e2e-pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px 3px 7px; border-radius: 999px; background: var(--success-soft); color: var(--success); font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.e2e-pill svg { width: 13px; height: 13px; }
.e2e-note { display: inline-flex; align-items: center; gap: 7px; margin: 14px 0 0; padding: 5px 12px 5px 9px; border-radius: 999px; background: var(--success-soft); color: var(--success); font-size: 12px; font-weight: 600; }
.e2e-note svg { width: 14px; height: 14px; flex: 0 0 14px; }
.e2e-note.warn { background: var(--warning-soft); color: var(--warning); }
.e2e-note + .tracker-note { margin-left: 6px; }
.e2e-locked { display: grid; justify-items: start; gap: 12px; padding: 22px; border-radius: var(--r); background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); color: var(--muted); font-size: 13.5px; }
.e2e-locked p { margin: 0; }
.message-lock { width: 12px; height: 12px; flex: 0 0 12px; color: var(--success); }
#encryption-body > .admin-help { margin: 0 0 14px; }
#encryption-body > .admin-help + .tfa-method { border-top: 0; padding-top: 2px; }

.e2e-trust { margin-left: 4px; padding: 2px 9px; border: 0; border-radius: 999px; background: rgba(0,0,0,.25); color: inherit; font: inherit; font-size: 11.5px; font-weight: 700; cursor: pointer; }
.e2e-trust:hover { background: rgba(0,0,0,.4); }
:root[data-theme="light"] .e2e-trust { background: rgba(16,18,26,.08); }
.e2e-trust-inline { margin: 6px 0 0; }
