:root {
  --bg: #ffffff;
  --bg-soft: #F2EDE2;
  --panel: #ffffff;
  --border: #d0d7de;
  --fg: #111824;
  --fg-muted: #57606a;
  --accent: #3E72C0;
  --accent-strong: #2f5ca0;
  --accent-soft: #e8eef8;
  --highlight: #FF4F2A;
  --highlight-soft: #ffe9e3;
  --danger: #da3633;
  --ok: #238636;
}
[data-theme="dark"] {
  --bg: #0d1117;
  --bg-soft: #161b22;
  --panel: #0d1117;
  --border: #30363d;
  --fg: #e6edf3;
  --fg-muted: #8b949e;
  --accent: #58a6ff;
  --accent-strong: #79c0ff;
  --accent-soft: #1f2a44;
  --highlight: #ff7a57;
  --highlight-soft: #3d1d18;
  --danger: #f85149;
  --ok: #3fb950;
}
[data-theme="dark"] .msg-body { background: #0d1117; }

/* Scrollbars — follow the theme via CSS vars (dark mode gets dark scrollbars automatically) */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--fg-muted); border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-corner { background: transparent; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
#app {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-muted);
  border-top: 4px solid var(--highlight);
}
#app.mail {
  display: grid;
  grid-template-rows: auto 1fr;
  justify-content: stretch;
  align-items: stretch;
  color: var(--fg);
}

#app.signin {
  background-color: var(--bg-soft);
  background-image: linear-gradient(color-mix(in srgb, var(--bg-soft) 65%, transparent), color-mix(in srgb, var(--bg-soft) 65%, transparent)), url('/assets/img/hurricane-ridge.jpg');
  background-size: cover;
  background-position: center 45%;
}
.signin-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .28);
  padding: 32px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.signin-card .logo { height: 80px; }
.page-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  padding: 10px;
  font-size: .85em;
  color: var(--fg-muted);
}
.page-footer a {
  color: #000;
  text-decoration: none;
  border-bottom: 1px dotted var(--border);
}
.page-footer a:hover { color: var(--accent); }
.signin-btn {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  padding: 8px 28px;
  border-radius: 8px;
}
.signin-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  color: var(--fg-muted);
  font-size: .75em;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.signin-divider::before, .signin-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.signin-dlink {
  font-size: .75em;
  color: var(--fg-muted);
  text-decoration: none;
  border-bottom: 1px dotted var(--border);
  margin-top: 6px;
}
.signin-dlink:hover { color: var(--accent); }
.signin-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.signin-form input[type="text"], .signin-form input[type="password"] {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--fg);
  font-size: .92em;
}
.signin-form .signin-note {
  font-size: .75em;
  color: var(--fg-muted);
  text-align: center;
}
.signin-form .signin-err {
  font-size: .82em;
  color: var(--danger);
  text-align: center;
  min-height: 1.2em;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background-color: var(--bg-soft);
  background-image: linear-gradient(color-mix(in srgb, var(--bg-soft) 65%, transparent), color-mix(in srgb, var(--bg-soft) 65%, transparent)), url('/assets/img/hurricane-ridge.jpg');
  background-size: cover;
  background-position: center 45%;
}
.topbar .logo { height: 50px; width: auto; }
.envbadge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  background: #f59e0b;
  color: #0d1117;
  font-size: .72em;
  font-weight: 700;
  letter-spacing: .08em;
  border: 1px solid rgba(13, 17, 23, .35);
  white-space: nowrap;
}
.logo-btn {
  display: flex;
  align-items: center;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  border-radius: 8px;
}
.logo-btn:hover img { opacity: .85; }
.logo { height: 34px; width: auto; }
.topmail {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 34ch;
  padding: 4px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--fg-muted);
  font-size: .82em;
}
.topmail i { color: var(--accent); }
.topmail-addr { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct { margin-left: auto; position: relative; display: flex; }
.acctbtn {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 320px;
  background: var(--panel);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: .82em;
  cursor: pointer;
}
.acctbtn:hover { border-color: var(--accent); }
.acctmail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acctbtn .caret { color: var(--fg-muted); font-size: .7em; transition: transform .15s ease; }
.acct.open .acctbtn .caret { transform: rotate(180deg); }
.acctmenu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
  padding: 6px;
  z-index: 50;
  display: none;
}
.acct.open .acctmenu { display: block; }
.acct-id { padding: 8px 10px 4px; }
.acct-email { font-weight: 600; font-size: .88em; overflow-wrap: anywhere; }
.acct-name { color: var(--fg-muted); font-size: .78em; margin-top: 2px; }
.acctsep { border-top: 1px solid var(--border); margin: 6px 2px; }
.acctitem {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  background: none;
  border: 0;
  border-radius: 8px;
  font-size: .85em;
  color: var(--fg);
  text-align: left;
  cursor: pointer;
  text-decoration: none;
}
.acctitem i.bi { color: var(--fg-muted); font-size: .95em; }
.acctitem:hover { background: var(--accent-soft); }
.acctitem.logout { color: var(--danger); }
.acctitem.logout i.bi { color: var(--danger); }
.acctitem.logout:hover { background: var(--highlight-soft); }
.options-head { padding: 10px 4px; }
.options-title { font-size: 1.15em; font-weight: 600; padding: 4px 12px; }
.options-head .note { padding: 8px 12px; }

.panes {
  position: relative;
  display: grid;
  grid-template-columns: 200px minmax(280px, 1fr) 1.2fr;
  min-height: 0;
}
/*Resizable message-list <-> reader divider (mail view only — rail stays 200px).*/
.pane-grip {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 10px;
  margin-left: -5px;
  z-index: 25;
  cursor: col-resize;
  touch-action: none;
}
.pane-grip::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: transparent;
  transition: background .12s;
}
.pane-grip:hover::after,
.pane-grip.active::after { background: var(--accent); }
.stage-page {
  position: absolute;
  left: 200px;
  right: 0;
  top: 0;
  bottom: 0;
  background: var(--bg-soft);
  z-index: 40;
  overflow-y: auto;
  padding-bottom: 24px;
}
.stage-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
  position: sticky;
  top: 0;
  z-index: 1;
}
.stage-title { font-size: 1.15em; font-weight: 600; }
.sortbtn.stage-save { margin-left: auto; background: var(--accent); color: #fff; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border: 0; border-radius: 8px; font-size: .85em; cursor: pointer; }
.sortbtn.stage-save:hover { background: var(--accent-strong); color: #fff; }
.sortbtn.stage-save i.bi { color: #fff; }
.stage-back { color: var(--fg-muted); }
.opt-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 14px 16px;
  overflow: hidden;
}
.opt-sec-title {
  font-size: .82em;
  font-weight: 700;
  color: var(--accent-strong);
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 11px 16px 9px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
}
.opt-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
}
.opt-row + .opt-row { border-top: 1px solid var(--border); }
.opt-label {
  width: 200px;
  flex-shrink: 0;
  font-size: .85em;
  color: var(--fg-muted);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.opt-input {
  flex: 1;
  min-width: 0;
  padding: 6px 10px;
  font-size: .9em;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--fg);
}
.opt-static {
  flex: 1;
  min-width: 0;
  padding: 6px 10px;
  font-size: .9em;
  color: var(--fg);
  overflow-wrap: anywhere;
}
.opt-select { max-width: 220px; }
.opt-about .opt-row { align-items: flex-start; }
.opt-about .opt-static {
  user-select: text;
  word-break: break-word;
}
.opt-copy { margin: 10px 0 4px; }
.opt-about-notes { margin-bottom: 8px; scroll-margin-top: 64px; }
.opt-about-notes ul { margin: 6px 0 0; padding-left: 20px; }
.opt-about-notes li { margin: 2px 0; }
.opt-about-sub { display: block; margin-top: 12px; }
.opt-flash { animation: opt-flash 1.8s ease; border-radius: 8px; }
@keyframes opt-flash {
  0%, 30% { background: rgba(62, 114, 192, .18); }
  100% { background: transparent; }
}
.opt-rule {
  display: flex;
  align-items: center;
  gap: 6px;
}
.opt-rule .opt-input:nth-child(1) { max-width: 100px; }
.opt-rule .opt-input:nth-child(2) { max-width: 120px; }
.opt-rule .opt-input:nth-child(4) { max-width: 170px; }
.opt-rule .opt-read { flex-shrink: 0; white-space: nowrap; }
.opt-rules { display: flex; flex-direction: column; gap: 6px; padding: 10px 16px 2px; }
.opt-rulebtns { display: flex; gap: 8px; padding: 10px 16px 14px; }
.opt-textarea {
  min-height: 88px;
  resize: vertical;
  font-family: inherit;
  line-height: 1.4;
}
.opt-check {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}
.opt-radios { display: flex; gap: 18px; }
.opt-radio { display: inline-flex; align-items: center; gap: 6px; font-size: .85em; color: var(--fg); cursor: pointer; padding: 2px 0; }
.opt-radio input { accent-color: var(--accent); }
.opt-danger { color: var(--danger); border: 1px solid var(--border); }
.opt-danger:hover { background: var(--highlight-soft); }
.opt-disabled { opacity: .55; cursor: not-allowed; }
.opt-note { color: var(--fg-muted); font-size: .8em; }
.opt-note-ind { padding: 4px 16px 12px; }
.opt-row .sortbtn { flex-shrink: 0; }
.opt-calctrl { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.opt-calctrl .cal-swatch { width: 16px; height: 16px; }
.opt-mbox { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.rail, .reader { overflow: auto; }
.rail { border-right: 1px solid var(--border); background: var(--bg-soft); }
.composebtn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: calc(100% - 24px);
  margin: 10px 12px 6px;
  padding: 8px 12px;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 8px;
  font-size: .85em;
  font-weight: 600;
  cursor: pointer;
}
.composebtn:hover { background: var(--accent-strong); }
.composebtn i.bi { font-size: 1em; }
.list {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  min-height: 0;
}
.listhead {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
}
.sortrow { display: flex; align-items: center; gap: 4px; }
.searchrow { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.searchinput {
  flex: 1;
  min-width: 0;
  padding: 4px 8px;
  font-size: .8em;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--fg);
}
.search-go, .search-open { margin-left: auto; }
.adv-open { color: var(--fg-muted); }
.adv-open:hover { color: var(--accent); }
.adv-open.active { color: var(--accent); }
.advchip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: .75em;
  font-weight: 600;
}
.advchip .chip-x { cursor: pointer; color: var(--accent-strong); }
.advchip .chip-x:hover { color: var(--danger); }
.chip-clear { color: var(--fg-muted); }
.chip-clear:hover { color: var(--danger); }
.listfoot { padding: 10px; text-align: center; }
.showmore {
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: .85em;
  cursor: pointer;
}
.showmore:hover { background: var(--accent-strong); }
.showmore:disabled { opacity: .7; cursor: wait; }
.showmore .spin { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.advform {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.adv-title { font-size: 1.1em; font-weight: 600; }
.adv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
}
.adv-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: .78em;
  color: var(--fg-muted);
}
.adv-grid input, .adv-grid select {
  padding: 5px 8px;
  font-size: .88em;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--fg);
}
.adv-grid .adv-chk { flex-direction: row; align-items: center; gap: 8px; font-size: .85em; color: var(--fg); }
.adv-grid .adv-chk input { width: auto; }
.adv-grid .adv-body input { opacity: .55; }
.adv-btns { display: flex; gap: 8px; }
.search-clear { color: var(--fg-muted); }
.search-clear:hover { color: var(--danger); }
.batchwrap { padding: 4px 10px 0; }
.batchbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: .8em;
}
.batchcount { font-weight: 700; color: var(--accent-strong); }
.batch-op { color: var(--fg); }
.batch-op:hover { color: var(--accent); }
.batch-op i.bi { color: var(--fg-muted); }
.batch-op:hover i.bi { color: var(--accent); }
.batch-selall { margin-left: auto; color: var(--fg-muted); }
.batch-selall:hover { color: var(--accent); }
.batch-clear { color: var(--fg-muted); }
.batch-clear:hover { color: var(--danger); }
.ctx-markread { margin-left: auto; color: var(--fg-muted); }
.ctx-markread:hover { color: var(--accent); }
.listbody { flex: 1; overflow-y: auto; min-height: 0; }
.sortbtn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 0;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: .78em;
  color: var(--fg-muted);
  cursor: pointer;
}
.sortbtn:hover { background: var(--accent-soft); }
.sortbtn.active { color: var(--accent); font-weight: 600; }
.sortbtn i.bi { font-size: .9em; }

.frow {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.mrow {
  position: relative;
  padding: 8px 12px;
  padding-left: 84px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.frow.active, .mrow.active { background: var(--accent-soft); }
.mrow.pinned {
  background: color-mix(in srgb, var(--highlight) 9%, var(--panel));
  box-shadow: inset 3px 0 0 var(--highlight);
}
.mrow.pinned .mrow-pin { color: var(--highlight); }
/* Just-sent arrival wash (app.js flashRow) — one shot, then the row is an ordinary
   Sent row. Decoration only: the message is already server-confirmed at this point. */
.mrow.flash { animation: mrow-flash 1.6s ease-out; }
@keyframes mrow-flash {
  0%, 25% { background: color-mix(in srgb, var(--accent) 26%, transparent); }
  100% { background: transparent; }
}
.frow-ops { display: none; background: none; border: 0; color: var(--fg-muted); cursor: pointer; padding: 0 2px; font-size: 1em; line-height: 1; }
.frow:hover .frow-ops { display: inline-flex; }
.frow-ops:hover { color: var(--accent); }
.mrow.sel { box-shadow: inset 2px 0 0 var(--accent); }
.frow i.bi { color: var(--fg-muted); font-size: .95em; flex-shrink: 0; }
.frow.active i.bi { color: var(--accent); }
.frow .fname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.frow.last { border-bottom: none; }
.navsep { border-top: 1px solid var(--border); margin: 4px 4px 8px; }
.frow .fcount {
  margin-left: auto;
  min-width: 18px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--highlight);
  color: #fff;
  font-size: .72em;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}
.fchev { color: var(--fg-muted); font-size: .75em; transition: transform .15s ease; cursor: pointer; }
.fchev:hover { color: var(--accent); }
.fchev.rot { transform: rotate(90deg); }
.fchild { padding-left: 28px; }
.fchild i.bi { font-size: .8em; }
.fchild .fname { font-size: .9em; }
.etrash { color: var(--danger); }
.etrash i.bi { color: var(--danger); }
.etrash:hover { background: var(--highlight-soft); }

.mrow-dot { position: absolute; left: 30px; top: 14px; width: 8px; height: 8px; border-radius: 50%; display: none; }
.mrow-chk {
  position: absolute;
  left: 8px;
  top: 11px;
  display: flex;
  align-items: center;
  opacity: 0;
  cursor: pointer;
}
.mrow:hover .mrow-chk, .mrow.sel .mrow-chk { opacity: 1; }
.mrow-chk input { margin: 0; accent-color: var(--accent); cursor: pointer; }
.mrow-pin {
  position: absolute;
  left: 44px;
  top: 12px;
  font-size: .8em;
  color: var(--fg-muted);
  cursor: pointer;
}
.mrow-pin:hover { color: var(--accent); }
.mrow-pin.on { color: var(--accent); }
.mrow-att {
  position: absolute;
  left: 60px;
  top: 13px;
  font-size: .72em;
  color: var(--fg-muted);
}
.mrow-re { color: var(--accent); font-weight: 600; }
.mrow.unread .mrow-dot { display: block; background: var(--accent); }
.mrow.unread { font-weight: 600; }
.mrow.unread .mrow-subj { font-weight: 700; }
.mrow.unread .mrow-who { color: var(--fg); font-weight: 600; }
.mrow-who { color: var(--fg-muted); font-size: .8em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mrow-subj { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mrow-when { float: right; color: var(--fg-muted); font-size: .75em; text-align: right; margin-left: 8px; }
.mrow-actions {
  display: none;
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  gap: 4px;
  background: var(--panel);
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}
.mrow:hover .mrow-actions { display: inline-flex; }
.mrow:hover .mrow-when { display: none; }
.mrow-act {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 0;
  padding: 2px 3px;
  font-size: .95em;
  line-height: 1;
  color: var(--fg-muted);
  cursor: pointer;
  border-radius: 6px;
}
.mrow-act:hover { color: var(--accent); background: var(--highlight-soft); }
.mrow-act i.bi-trash { color: var(--danger); }
.mrow-act:disabled { opacity: .4; cursor: default; }
.mrow-when .mrow-date, .mrow-when .mrow-time { display: block; white-space: nowrap; }
.mrow-when .mrow-time { font-size: .85em; opacity: .85; }
.mrow-spam { display: inline-block; margin-top: 2px; font-size: .68em; font-weight: 600; letter-spacing: .03em; color: var(--danger); border: 1px solid var(--danger); padding: 0 5px; border-radius: 8px; opacity: .9; }

.reader { padding: 12px; }
.msg-tb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px 0 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.tb-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: none;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--fg-muted);
  cursor: pointer;
  font-size: 1em;
}
.tb-btn:hover { background: var(--accent-soft); color: var(--accent); }
.tb-btn.on { color: var(--accent); border-color: var(--accent); }
.tb-btn.tb-primary { background: var(--accent); color: #fff; }
.tb-btn.tb-primary:hover { background: var(--accent-strong); color: #fff; }
.tb-btn.tb-primary i.bi { color: #fff; }
.tb-btn i.bi { font-size: 1.05em; }
.tb-lab { display: none; }
.tb-sep { width: 1px; height: 20px; background: var(--border); margin: 0 6px; }
.msg-subject { font-size: 1.15em; font-weight: 600; line-height: 1.15; }
.spam-pill { margin-left: 10px; font-size: .62em; font-weight: 600; letter-spacing: .04em; text-transform: lowercase; color: var(--fg-muted); border: 1px solid var(--border); padding: 1px 8px; border-radius: 10px; vertical-align: middle; }
.spam-pill.on { color: var(--danger); border-color: var(--danger); }
.msg-meta { color: var(--fg-muted); font-size: .8em; margin-top: -4px; padding: 0 0 10px; display: flex; flex-direction: column; gap: 2px; }
.meta-row { display: flex; align-items: center; gap: 16px; min-width: 0; }
.meta-from { color: var(--fg); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 1; }
.meta-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-left: 2px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--fg-muted);
  font-size: .8em;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.meta-add:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
[data-theme="easy"] .meta-add { width: 30px; height: 30px; font-size: 1.1em; }
.meta-to, .meta-cc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex-shrink: 1; min-width: 0; }
.msg-att {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 10px;
}
.att-icon { color: var(--fg-muted); }
.att-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.att-count { font-size: .88em; color: var(--fg-muted); font-weight: 600; }
.att-zip { margin-left: auto; padding: 2px 12px; font-size: .88em; flex-shrink: 0; }
.att-more-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .78em;
  color: var(--fg-muted);
  padding-top: 4px;
}
.att-more-btn { padding: 2px 12px; font-size: .95em; flex-shrink: 0; }
.att-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: .8em;
  max-width: 280px;
}
.att-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 170px; }
.att-size { color: var(--fg-muted); font-size: .85em; flex-shrink: 0; }
.att-dl { color: var(--accent); cursor: pointer; flex-shrink: 0; }
.att-dl:hover { color: var(--accent-strong); }
.msg-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 0;
}
.photo-thumb {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  line-height: 0;
  flex-shrink: 0;
  position: relative;
  width: 120px;
  height: 90px;
}
.photo-thumb:hover { border-color: var(--accent); }
.photo-thumb-spin {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4em;
  color: var(--fg-muted);
  background: var(--highlight-soft);
}
.photo-thumb-img {
  width: 120px;
  height: 90px;
  object-fit: cover;
  display: block;
  background: var(--highlight-soft);
}
.photo-thumb-fail { opacity: .6; }
.photos-more-note {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .78em;
  color: var(--fg-muted);
  padding: 2px 0 0;
}
.photos-all-btn {
  padding: 2px 12px;
  font-size: .95em;
  flex-shrink: 0;
}
.lb-ovl {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, .85);
  display: flex;
  align-items: center;
  justify-content: center;
}
.lb-box {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 92vw;
  height: 92vh;
}
.lb-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  background: #000;
}
.lb-spin {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 2.2em;
  color: rgba(255, 255, 255, .75);
  pointer-events: none;
}
.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.3em;
  background: rgba(255, 255, 255, .15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .25);
}
.lb-nav i.bi { font-size: 1.3em; }
.lb-nav:hover { background: rgba(255, 255, 255, .3); color: #fff; }
.lb-prev { left: 12px; }
.lb-next { right: 12px; }
.lb-dl {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, .15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 999px;
  padding: 8px 18px;
  font-size: .95em;
}
.lb-dl i.bi { font-size: 1em; }
.lb-dl:hover { background: rgba(255, 255, 255, .3); color: #fff; }
.lb-cap {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: .85em;
  background: rgba(0, 0, 0, .55);
  padding: 4px 14px;
  border-radius: 999px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 70vw;
}
.lb-x {
  position: absolute;
  top: 8px;
  right: 12px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.1em;
  background: rgba(255, 255, 255, .15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .25);
}
.lb-x i.bi { font-size: 1.1em; }
.lb-x:hover { background: rgba(255, 255, 255, .3); color: #fff; }
.msg-body {
  width: 100%;
  height: calc(100vh - 230px);
  border: 0;
  background: #fff;
}
.note { padding: 16px; color: var(--fg-muted); }
.note i.spin { margin-right: 6px; vertical-align: -2px; }
.msg-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px 16px;
  font-size: .95em;
}
.msg-loading i.spin { font-size: 1.4em; margin-right: 0; }
.compose-att { display: flex; flex-wrap: wrap; gap: 6px; }
.compose-att .att-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border: 1px solid var(--border, #d0d7de); border-radius: 6px; font-size: .88em; }
.compose-att .att-rm { cursor: pointer; color: var(--fg-muted); }
.compose-att .att-rm:hover { color: var(--danger); }
.itip-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 12px 0;
  padding: 10px 12px;
  border: 1px solid var(--accent, #3E72C0);
  border-left: 4px solid var(--accent, #3E72C0);
  border-radius: 8px;
  background: var(--accent-soft, #eef4fd);
}
.itip-icon { font-size: 1.15em; color: var(--accent, #3E72C0); flex-shrink: 0; }
.itip-main { flex: 1; min-width: 0; }
.itip-title { font-weight: 600; }
.itip-sub { font-size: .88em; color: var(--fg-muted); }
.itip-btn { flex-shrink: 0; }
.itip-dec { color: var(--danger); }
.itip-maybe { color: var(--warn, #b58900); }
.imgblock-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 12px 0;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--warn, #b58900);
  border-radius: 8px;
  background: var(--bg-soft);
  color: var(--fg-muted);
  font-size: .85em;
}
.imgblock-bar .imgblock-show { margin-left: auto; }
.ml-note { padding: 8px 2px; color: var(--fg-muted); font-size: .92em; }
.move-folder {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  margin: 2px 0;
  border: 1px solid var(--border, #d0d7de);
  border-radius: 6px;
  background: var(--panel);
  color: var(--fg, #1f2328);
  cursor: pointer;
  text-align: left;
  font-size: .95em;
}
.move-folder:hover { border-color: var(--accent, #3E72C0); color: var(--accent, #3E72C0); }

.compose {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 2px 4px 0;
}
.compose-tb { display: flex; align-items: center; gap: 6px; }
.cf-autosave { margin-left: auto; color: var(--fg-muted); font-size: .8em; white-space: nowrap; }
.send-btn { background: var(--accent); color: #fff; font-weight: 600; }
.send-btn:hover { background: var(--accent-strong); }
.send-btn i.bi { color: #fff; }
.cf-row { display: flex; align-items: center; gap: 10px; }
.cf-label { width: 64px; flex-shrink: 0; font-size: .85em; color: var(--fg-muted); font-weight: 600; }
.cf-form .cf-row { padding: 6px 0; }
.cf-input {
  flex: 1;
  min-width: 0;
  padding: 6px 10px;
  font-size: .9em;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--fg);
}
.cf-from { max-width: 340px; }
.cc-toggle { color: var(--fg-muted); font-size: .8em; }
.cc-toggle:hover { color: var(--accent); }
.rac-box { position: relative; flex: 1; min-width: 0; display: flex; }
.rac-box > input, .rac-box > textarea { width: 100%; flex: none; }
.rac-pop {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 120;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .25);
  overflow: hidden;
}
.rac-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  background: none;
  color: var(--fg);
  font-size: .85em;
  text-align: left;
  cursor: pointer;
}
.rac-item:hover { background: var(--accent-soft); }
.rac-item i.bi { color: var(--accent); flex-shrink: 0; }
.rac-nm { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rac-em { color: var(--fg-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rac-x {
  margin-left: auto;
  flex-shrink: 0;
  padding: 0 6px;
  color: var(--fg-muted);
  font-size: .8em;
  border-radius: 6px;
}
.rac-x:hover { color: var(--danger); background: var(--highlight-soft); }
.mode-toggle { margin-left: auto; color: var(--fg-muted); font-size: .8em; }
.mode-toggle:hover { color: var(--accent); }
.cf-bodywrap { display: flex; flex-direction: column; min-height: 260px; }
.reader.composing { display: flex; flex-direction: column; }
.reader.composing .compose { flex: 1; min-height: 0; }
.reader.composing .cf-bodywrap { flex: 1; min-height: 0; }
.reader.composing .ce-editor, .reader.composing .ce-textarea { flex: 1; min-height: 120px; }
.ce-tb {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  background: var(--bg-soft);
  flex-wrap: wrap;
}
.ce-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 28px;
  background: none;
  border: 0;
  border-radius: 6px;
  color: var(--fg-muted);
  cursor: pointer;
  font-size: .95em;
}
.ce-btn:hover { background: var(--accent-soft); color: var(--accent); }
.ce-sep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }
.ce-editor {
  flex: 1;
  min-height: 220px;
  padding: 10px 12px;
  font-size: .95em;
  line-height: 1.5;
  border: 1px solid var(--border);
  border-radius: 0 0 6px 6px;
  background: var(--panel);
  color: var(--fg);
  overflow-y: auto;
  outline: none;
}
.ce-editor:empty:before { content: attr(data-ph); color: var(--fg-muted); }
.ce-editor blockquote { border-left: 3px solid var(--border); margin: 8px 0; padding-left: 10px; color: var(--fg-muted); }
.ce-textarea {
  flex: 1;
  min-height: 220px;
  padding: 10px 12px;
  font-size: .95em;
  line-height: 1.5;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--fg);
  resize: vertical;
  font-family: inherit;
}

.contacthead {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
}
.contacts-select { max-width: 260px; }
.contact-search {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}
.contact-search .bi-search { color: var(--fg-muted); }
.contacts-search { flex: 1; min-width: 0; }
.contacts-group { max-width: 150px; flex-shrink: 0; }
.contacts-import { flex-shrink: 0; }
.contacts-new { margin-left: auto; color: var(--accent); }
.contacts-new:hover { color: var(--accent-strong); }
.c-groups { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px; }
.c-group-chip {
  font-size: .78em;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  border: 1px solid var(--border);
}
.crow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.crow.active { background: var(--accent-soft); }
.crow-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8em;
  font-weight: 700;
  flex-shrink: 0;
}
.crow-main { min-width: 0; flex: 1; }
.crow-name { font-weight: 600; font-size: .9em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crow-sub { color: var(--fg-muted); font-size: .78em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crow-actions {
  display: none;
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  gap: 4px;
  background: var(--panel);
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}
.crow:hover .crow-actions { display: inline-flex; }
.crow:hover .crow-sub { display: none; }
.crow-act {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 0;
  padding: 2px 3px;
  font-size: .95em;
  line-height: 1;
  color: var(--fg-muted);
  cursor: pointer;
  border-radius: 6px;
}
.crow-act:hover { color: var(--accent); background: var(--highlight-soft); }
.crow-act i.bi-envelope { color: var(--accent); }
.crow-act:disabled { opacity: .4; cursor: default; }
.c-card { padding: 4px 4px 0; }
.c-top { display: flex; align-items: center; gap: 12px; padding: 12px 8px; }
.c-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4em;
  font-weight: 700;
  flex-shrink: 0;
}
.c-name { font-size: 1.2em; font-weight: 600; }
.c-org { font-size: .85em; color: var(--fg-muted); font-weight: 400; margin-top: 2px; }
.c-fields { margin-top: 4px; }
.c-field { display: flex; align-items: flex-start; gap: 10px; padding: 6px 8px; font-size: .9em; border-bottom: 1px solid var(--border); }
.c-field i.bi { color: var(--fg-muted); margin-top: 2px; }
.c-field-main { min-width: 0; flex: 1; }
.c-field-val { overflow-wrap: anywhere; }
.c-field-sub { color: var(--fg-muted); font-size: .75em; }
.c-sug-label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.c-mail-btn {
  display: inline-flex;
  align-items: center;
  align-self: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: .85em;
  color: var(--fg-muted);
  cursor: pointer;
}
.c-mail-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.c-mail-btn i.bi { color: inherit; margin-top: 0; }

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 340px;
}
.toast {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .15);
  padding: 12px 16px;
  font-size: 1.3em;
  color: var(--fg);
  cursor: pointer;
  animation: toast-in .2s ease-out;
  max-height: 33vh;
  overflow-y: auto;
  overflow-wrap: break-word;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.toast .tmsg { flex: 1; min-width: 0; }
.toast .tclose { color: var(--fg-muted); cursor: pointer; font-size: 1.5em; flex-shrink: 0; line-height: 1; }
.toast.sticky { border-left-color: var(--highlight); align-items: center; }
.toast.sticky .tmsg { font-size: .8em; }
.toast-act {
  flex-shrink: 0;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 8px 18px;
  font-size: .85em;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.toast-act:hover { background: var(--accent-strong); color: #fff; }
.toast-link {
  flex-shrink: 0;
  background: none;
  border: 0;
  color: var(--accent);
  font-size: .8em;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  white-space: nowrap;
  padding: 6px 2px;
}
.toast-link:hover { color: var(--accent-strong); }
.toast .tclose:hover { color: var(--fg); }
.toast.warn { border-left-color: var(--highlight); }
.toast.error { border-left-color: var(--danger); }
.toast.ok { border-left-color: var(--ok); }
.toast.out { opacity: 0; transition: opacity .3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.cal-new { margin-left: auto; background: var(--accent); color: #fff; font-weight: 400; }
.cal-new:hover { background: var(--accent-strong); color: #fff; }
.cal-new i.bi { color: #fff; }
.cal-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.cal-sel-wrap { display: flex; align-items: center; gap: 8px; }
.cal-sel { max-width: 260px; }
.cal-swatch { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.cal-legend { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-leg {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 3px 10px;
  font-size: .78em;
  font-weight: 400;
  background: color-mix(in srgb, var(--cal) 10%, var(--panel));
  color: var(--fg);
}
.cal-leg.readonly { opacity: .85; }
.cal-leg { cursor: pointer; }
.cal-leg:hover { filter: brightness(1.06); }
.cal-leg.off { opacity: .35; filter: grayscale(.6); }
.cal-leg.off:hover { opacity: .6; }
.cal-leg.readonly i.bi { color: var(--fg-muted); font-size: .8em; }
.cal-leg-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--cal); flex-shrink: 0; }
.cal-nav { display: flex; align-items: center; gap: 2px; }
.cal-today { color: var(--fg-muted); }
.cal-label { font-weight: 400; font-size: 1em; white-space: nowrap; }
.cal-labelwrap { display: flex; align-items: center; gap: 3px; color: var(--fg); font-weight: 400; }
.cal-labelwrap .cal-labelicon { color: var(--accent); font-size: .95em; }
.cal-labelwrap:hover { background: var(--accent-soft); }
.minimonth {
  position: fixed;
  z-index: 300;
  width: 660px;
  max-width: calc(100vw - 24px);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
  padding: 10px;
}
.mm-head { display: flex; align-items: center; gap: 4px; margin-bottom: 6px; }
.mm-label { flex: 1; text-align: center; font-weight: 400; font-size: .85em; white-space: nowrap; }
.mm-months { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mm-month { min-width: 0; }
.mm-name { text-align: center; font-weight: 400; font-size: .8em; margin-bottom: 4px; white-space: nowrap; }
.mm-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.mm-dow { text-align: center; font-size: .65em; font-weight: 400; color: var(--fg-muted); padding: 2px 0; }
.mm-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  text-align: center;
  font-size: .75em;
  padding: 4px 0;
  border-radius: 6px;
  color: var(--fg);
  cursor: pointer;
}
.mm-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }
.mm-cell.today .mm-dot { background: #fff; }
.mm-tip {
  position: absolute;
  z-index: 5;
  min-width: 180px;
  max-width: 280px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: none;
}
.mm-tiprow { display: flex; align-items: center; gap: 6px; font-size: .72em; }
.mm-tipdot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.mm-tiptime { color: var(--fg-muted); white-space: nowrap; flex-shrink: 0; }
.mm-tiptitle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mm-cell:hover { background: var(--accent-soft); color: var(--accent-strong); }
.mm-cell.muted { color: var(--fg-muted); opacity: .5; }
.mm-cell.today { background: var(--accent); color: #fff; font-weight: 400; }
.mm-cell.picked { outline: 2px solid var(--accent); outline-offset: -1px; }
.mm-foot { display: flex; justify-content: center; margin-top: 6px; border-top: 1px solid var(--border); padding-top: 6px; }
.mm-today { color: var(--accent); font-weight: 400; }
.cal-views { margin-left: auto; display: flex; gap: 2px; }
.cal-views .sortbtn.active { background: var(--accent-soft); }
.stage-page.cal-page {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.cal-page .stage-head, .cal-page .cal-bar { flex-shrink: 0; }
.cal-gridwrap { padding: 0 16px 12px; flex: 1; min-height: 0; overflow-y: auto; }
.cal-gridwrap.bleed { padding: 0; overflow: hidden; }
.cal-note { margin-top: 10px; color: var(--fg-muted); font-size: .78em; }
.cal-fc {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  overflow: hidden;
  min-height: 300px;
}
.cal-fc.fit { border-radius: 0; border-left: 0; border-right: 0; }
/* FullCalendar v5 adds its root classes (fc, fc-theme-standard, ...) ON the
   .cal-fc element itself — there is no .fc child wrapper. All selectors must
   be same-element (.cal-fc.fc ...), never descendant (.cal-fc .fc ...). */
.cal-fc.fc {
  color: var(--fg);
  --fc-border-color: var(--border);
  --fc-page-bg-color: var(--panel);
  --fc-neutral-bg-color: var(--bg-soft);
  --fc-neutral-text-color: var(--fg-muted);
  --fc-today-bg-color: var(--accent-soft);
  --fc-now-indicator-color: var(--highlight);
  --fc-more-link-text-color: var(--accent);
  --fc-more-link-hover-bg-color: var(--accent-soft);
  --fc-popover-bg-color: var(--panel);
}
.cal-fc.fc .fc-col-header { background: var(--bg-soft); }
.cal-fc.fc .fc-col-header-cell-cushion {
  color: var(--fg-muted);
  font-size: .74em;
  font-weight: 400;
  text-decoration: none;
  padding: 8px 6px;
}
.cal-fc.fc .fc-daygrid-day-number {
  color: var(--fg-muted);
  font-size: .74em;
  font-weight: 400;
  text-decoration: none;
  padding: 4px 6px 0 0;
}
.cal-fc.fc .fc-day-today .fc-daygrid-day-number { color: var(--accent); }
.cal-fc.fc .fc-col-header-cell.fc-day-today .fc-col-header-cell-cushion { color: var(--accent); }
.cal-fc.fc .fc-daygrid-day-frame { min-height: 84px; }
.cal-fc.fc .fc-daygrid-day.fc-day-today .fc-daygrid-day-frame {
  box-shadow: inset 0 0 0 1px var(--accent);
  border-radius: 6px;
}
.cal-fc.fc .fc-daygrid-day { cursor: pointer; }
.cal-fc.fc .fc-timegrid { cursor: pointer; }
.cal-fc.fc .fc-timegrid-slot { height: 30px; }
.cal-fc.fc .fc-timegrid-slot-label-cushion { color: var(--fg-muted); font-size: .66em; font-weight: 400; }
.cal-fc.fc .fc-timegrid-axis { background: var(--bg-soft); }
.cal-fc.fc .fc-timegrid-axis-cushion { color: var(--fg-muted); font-size: .66em; }
.cal-fc.fc .fc-timegrid-now-indicator-line { border-color: var(--highlight); border-width: 2px; }
.cal-fc.fc .fc-timegrid-now-indicator-arrow { border-color: var(--highlight); }
.cal-fc.fc .fc-event { font-size: .74em; border-radius: 5px; cursor: pointer; }
.cal-fc.fc .fc-event, .cal-fc.fc .fc-event * { cursor: pointer; user-select: none; -webkit-user-select: none; }
.cal-fc.fc .fc-event:hover { filter: brightness(1.1); }
.cal-fc.fc .fc-daygrid-event { padding: 1px 4px; }
.cal-fc.fc .fc-daygrid-event .fc-event-time { opacity: .85; }
.cal-fc.fc .fc-timegrid-event { padding: 1px 5px; border-radius: 6px; box-shadow: none; }
.cal-fc.fc .fc-timegrid-event .fc-event-time { opacity: .9; white-space: nowrap; }
/* Calendar text: uniform normal weight — FC v5 defaults bold the time on
   block events and the title on dot events; !important flattens both */
.cal-fc.fc .fc-event,
.cal-fc.fc .fc-event * { font-weight: 400 !important; }
.cal-fc.fc .fc-daygrid-more-link { color: var(--accent); font-size: .74em; font-weight: 400; }
.cal-fc.fc .fc-popover { border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); }
.cal-fc.fc .fc-popover-header { background: var(--bg-soft); color: var(--fg); font-size: .8em; border-radius: 8px 8px 0 0; }
.cal-fc.fc .fc-scroller { scrollbar-width: thin; }

/* Dark mode calendar polish: soften the time-grid borders, tint weekends with a muted dark red */
[data-theme="dark"] .cal-fc,
[data-theme="dark"] .cal-fc.fc { --fc-border-color: #20262b; }
[data-theme="dark"] .cal-fc.fc-theme-standard td,
[data-theme="dark"] .cal-fc.fc-theme-standard th { border-color: #20262b; }
[data-theme="dark"] .cal-fc .fc-daygrid-day.fc-day-sat,
[data-theme="dark"] .cal-fc .fc-daygrid-day.fc-day-sun,
[data-theme="dark"] .cal-fc .fc-timegrid-col.fc-day-sat,
[data-theme="dark"] .cal-fc .fc-timegrid-col.fc-day-sun {
  background-color: #231616;
}

.modal-ovl {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 24px;
}
.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .3);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-wide { max-width: 740px; }
.modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
}
.modal-title { font-size: 1.05em; font-weight: 600; }
.modal-x { margin-left: auto; color: var(--fg-muted); }
.modal-x:hover { color: var(--danger); }
.modal-body {
  padding: 14px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.raw-headers {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .8em;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--fg);
  max-height: 60vh;
  overflow-y: auto;
  padding: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.modal-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.modal-foot .send-btn { margin-left: auto; }
.linkguard-note { font-size: .95em; line-height: 1.45; color: var(--fg-muted); }
.linkguard-url {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .85em;
  line-height: 1.45;
  word-break: break-all;
  padding: 10px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  max-height: 132px;
  overflow-y: auto;
}
.linkguard-go { margin-left: auto; background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.linkguard-go:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
.ml-row { display: flex; align-items: center; gap: 10px; }
.ml-label { width: 92px; flex-shrink: 0; font-size: .85em; color: var(--fg-muted); font-weight: 600; }
.ml-input {
  flex: 1;
  min-width: 0;
  padding: 6px 10px;
  font-size: .9em;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--fg);
}
.ml-sel { max-width: 240px; }
.ml-time { max-width: 130px; }
.ml-textarea { min-height: 64px; resize: vertical; font-family: inherit; }
.ml-chk { display: flex; align-items: center; gap: 8px; font-size: .85em; cursor: pointer; }
.ml-chk input { accent-color: var(--accent); }
.ml-rep { display: flex; flex-direction: column; gap: 4px; }
.ml-rep .ml-row { min-height: 30px; }
.ml-rep-sub { margin-left: 102px; gap: 8px; }
.ml-rep-mon { display: flex; flex-direction: column; gap: 6px; padding: 2px 0; }
.ml-rep-mon .ml-chk { align-items: center; }
.ml-rep-n { max-width: 70px; flex: none; }
.ml-rep-unit { color: var(--fg-muted); font-size: .85em; }
.ml-rep-ord, .ml-rep-day { max-width: 110px; }
.ml-rep-warn {
  display: none;
  margin-left: 102px;
  padding: 6px 10px;
  border: 1px solid var(--warn, #b8860b);
  border-radius: 6px;
  background: var(--bg-soft);
  color: var(--fg-muted);
  font-size: .82em;
}
.ev-row { display: flex; align-items: flex-start; gap: 10px; padding: 6px 0; font-size: .9em; border-bottom: 1px solid var(--border); }
.ev-row i.bi { color: var(--fg-muted); margin-top: 2px; }
.ev-row-main { min-width: 0; }
.ev-row-label { color: var(--fg-muted); font-size: .75em; }
.ev-row-val { overflow-wrap: anywhere; }
.ev-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; }
.ev-att { display: flex; flex-wrap: wrap; gap: 6px; }
.ev-att-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  font-size: .82em;
  color: var(--fg);
  text-decoration: none;
}
.ev-att-chip:hover { background: var(--accent-soft); color: var(--accent); }
.ev-share { display: flex; gap: 8px; flex-wrap: wrap; }
.ev-note {
  margin-top: 4px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: .8em;
}
.cal-color {
  width: 90px;
  height: 28px;
  padding: 0 4px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  cursor: pointer;
}
.cal-reset { color: var(--fg-muted); font-size: .8em; }
/* ---- Accessibility: text scale + Easy theme (opt-in) ---- */
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
html[data-scale="large"] { font-size: 112.5%; }
html[data-scale="xlarge"] { font-size: 125%; }

[data-theme="easy"] {
  --bg: #ffffff;
  --bg-soft: #eef1f5;
  --panel: #ffffff;
  --border: #a4aeb8;
  --fg: #0a0e15;
  --fg-muted: #3a434e;
  --accent: #2f6fce;
  --accent-strong: #1f4f96;
  --accent-soft: #dbe7f7;
  --highlight: #d93a12;
  --highlight-soft: #fde3da;
  --danger: #c92a26;
  --ok: #1f7a2e;
}
[data-theme="easy"] .topbar { padding: 12px 16px; gap: 16px; }
[data-theme="easy"] .topbar .logo { height: 58px; }
[data-theme="easy"] .acctbtn { padding: 9px 14px; font-size: 1.05em; border-radius: 10px; }
[data-theme="easy"] .composebtn { margin: 14px 14px 10px; width: calc(100% - 28px); padding: 14px 16px; font-size: 1.1em; border-radius: 12px; gap: 10px; }
[data-theme="easy"] .composebtn i.bi { font-size: 1.2em; }
[data-theme="easy"] .frow { padding: 13px 16px; gap: 12px; font-size: 1.1em; }
[data-theme="easy"] .frow i.bi { font-size: 1.25em; }
[data-theme="easy"] .frow .fcount { min-width: 28px; padding: 0 9px; line-height: 28px; font-size: .9em; border-radius: 14px; }
[data-theme="easy"] .frow-ops { display: none !important; }
[data-theme="easy"] .fchev { font-size: .9em; }
[data-theme="easy"] .fchild .fname { font-size: 1em; }
[data-theme="easy"] .listhead { padding: 10px 14px; gap: 8px; }
[data-theme="easy"] .searchinput { padding: 10px 12px; font-size: .95em; border-radius: 10px; }
[data-theme="easy"] .sortbtn { font-size: .92em; padding: 8px 12px; border-radius: 8px; }
[data-theme="easy"] .s-sort, [data-theme="easy"] .adv-open, [data-theme="easy"] .ctx-markread { display: none !important; }
[data-theme="easy"] .s-sort[data-sort="date"], [data-theme="easy"] .s-sort[data-sort="sender"], [data-theme="easy"] .s-sort[data-sort="to"] { display: inline-flex !important; }
[data-theme="easy"] .mrow { padding: 15px 16px 15px 56px; }
[data-theme="easy"] .mrow-dot { width: 14px; height: 14px; top: 23px; left: 16px; }
[data-theme="easy"] .mrow-chk { top: 19px; }
[data-theme="easy"] .mrow-chk input { width: 20px; height: 20px; }
[data-theme="easy"] .mrow-pin, [data-theme="easy"] .mrow-chk { display: none !important; }
[data-theme="easy"] .mrow-att { left: 38px; top: 22px; font-size: .95em; }
[data-theme="easy"] .mrow-who { font-size: 1em; }
[data-theme="easy"] .mrow-subj { font-size: 1.08em; }
[data-theme="easy"] .mrow-when { font-size: .92em; }
[data-theme="easy"] .mrow-actions { right: 12px; padding: 4px 8px; }
[data-theme="easy"] .mrow-act { padding: 6px 8px; font-size: 1.15em; }
[data-theme="easy"] .crow-actions { right: 12px; padding: 4px 8px; }
[data-theme="easy"] .crow-act { padding: 6px 8px; font-size: 1.15em; }
[data-theme="easy"] .crow { padding: 13px 16px; gap: 12px; }
[data-theme="easy"] .crow-avatar { width: 40px; height: 40px; font-size: 1em; }
[data-theme="easy"] .crow-name { font-size: 1.05em; }
[data-theme="easy"] .crow-sub { font-size: .92em; }
[data-theme="easy"] .c-mail-btn { padding: 10px 18px; font-size: 1em; }
[data-theme="easy"] .mrow.unread .mrow-dot { background: var(--accent-strong); }
[data-theme="easy"] .mrow.unread .mrow-who { color: var(--accent-strong); }
[data-theme="easy"] .mrow:not(.unread) { opacity: .8; }
[data-theme="easy"] .msg-subject { font-size: 1.45em; }
[data-theme="easy"] .msg-meta { font-size: 1.02em; }
[data-theme="easy"] .msg-tb { gap: 8px; padding: 8px 0 14px; }
[data-theme="easy"] .msg-tb .tb-sep { display: none !important; }
[data-theme="easy"] .tb-btn { width: auto; min-width: 64px; height: 52px; flex-direction: column; gap: 2px; border-radius: 12px; font-size: 1.05em; }
[data-theme="easy"] .tb-btn i.bi { font-size: 1.25em; }
[data-theme="easy"] .tb-lab { display: inline-flex; font-size: .72em; font-weight: 600; }
[data-theme="easy"] .tb-adv { display: none !important; }
[data-theme="easy"] .tb-sep { height: 32px; margin: 0 10px; }
[data-theme="easy"] .msg-body { height: calc(100vh - 260px); }
[data-theme="easy"] .att-chip { padding: 7px 12px; font-size: .95em; border-radius: 10px; }
[data-theme="easy"] .photo-thumb-img { width: 150px; height: 112px; }
[data-theme="easy"] .photo-thumb { width: 150px; height: 112px; }
[data-theme="easy"] .photo-thumb-spin { font-size: 1.8em; }
[data-theme="easy"] .photos-more-note { font-size: .92em; padding: 4px 0 0; }
[data-theme="easy"] .att-more-row { font-size: .92em; padding: 4px 0 0; }
[data-theme="easy"] .lb-spin { font-size: 2.8em; }
[data-theme="easy"] .lb-nav { width: 56px; height: 56px; font-size: 1.6em; }
[data-theme="easy"] .lb-x { width: 52px; height: 52px; font-size: 1.4em; }
[data-theme="easy"] .lb-dl { padding: 12px 26px; font-size: 1.1em; }
[data-theme="easy"] .lb-cap { font-size: 1em; padding: 7px 20px; }
[data-theme="easy"] .toasts { gap: 14px; max-width: 420px; }
[data-theme="easy"] .toast { padding: 18px 22px; }
[data-theme="easy"] .toast .tclose { font-size: 1.8em; }
[data-theme="easy"] .toast.sticky .tmsg { font-size: 1em; }
[data-theme="easy"] .toast-act { padding: 12px 24px; font-size: 1em; }
[data-theme="easy"] .toast-link { font-size: 1em; padding: 12px 4px; }
[data-theme="easy"] .opt-row { padding: 13px 14px; }
[data-theme="easy"] .opt-label { font-size: 1em; }
[data-theme="easy"] .opt-radio { font-size: 1em; gap: 8px; padding: 4px 0; }
[data-theme="easy"] .opt-radio input { width: 18px; height: 18px; }
[data-theme="easy"] .opt-input, [data-theme="easy"] .opt-select, [data-theme="easy"] .opt-static { padding: 9px 12px; font-size: .95em; }
[data-theme="easy"] .note { font-size: 1.1em; }
[data-theme="easy"] .msg-loading { padding: 64px 16px; font-size: 1.15em; }
[data-theme="easy"] .msg-loading i.spin { font-size: 1.8em; }

.newmail-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: var(--accent);
  color: #fff;
  font-size: .85em;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 1px solid rgba(0, 0, 0, .12);
}
.newmail-bar:hover { background: var(--accent-strong); }
.newmail-bar .newmail-show {
  margin-left: auto;
  background: rgba(255, 255, 255, .2);
  border-radius: 6px;
  padding: 2px 10px;
}
