/* Inbox as a three pane mail client (v2.39.0). Full height and full width: the page padding is not used, the panes fill the area under the header.
   Uses the app colour variables only, so light and dark both follow the theme. Folders left, messages middle, reading pane right; below 1100px the folders slide over, on a phone it is list then message. */
.mx { --mx-bd: var(--border); position: relative; display: grid; grid-template-columns: var(--mx-f, 250px) 6px minmax(300px, var(--mx-l, 420px)) 6px minmax(0, 1fr); height: calc(100dvh - 72px); min-height: 360px; background: var(--card); color: var(--text); border-top: 1px solid var(--mx-bd); overflow: hidden; }
.mx.fold-off { grid-template-columns: 0 0 minmax(300px, var(--mx-l, 420px)) 6px minmax(0, 1fr); }
.mx.fold-off .mx-fp, .mx.fold-off .mx-div[data-div=f] { display: none; }
.mx button { font-family: inherit; }
.mx .icon { width: 18px; height: 18px; flex: none; }

/* folder pane */
.mx-fp { min-width: 0; overflow-y: auto; background: var(--card-2); border-right: 1px solid var(--mx-bd); }
.mx-fp-in { padding: var(--space-10) var(--space-xs) var(--space-m); display: flex; flex-direction: column; gap: 2px; }
.mx-fh { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px var(--space-xs) var(--space-xs); font-size: var(--step-0); }
.mx-grp { margin: var(--space-14) var(--space-xs) 4px; font-size: var(--step--2); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.mx-fi, .mx-bxh { display: flex; align-items: center; gap: var(--space-xs); width: 100%; min-height: var(--tap); padding: 5px var(--space-10); border: 0; border-radius: var(--radius-s); background: transparent; color: var(--text); text-align: left; cursor: pointer; font-size: var(--step--1); text-decoration: none; }
.mx-fi:hover, .mx-bxh:hover { background: color-mix(in srgb, var(--text) 7%, transparent); }
.mx-fi.on, .mx-bxh.on { background: var(--accent-soft); font-weight: 600; }
.mx-fi:focus-visible, .mx-bxh:focus-visible, .mx-main:focus-visible, .mx-chip:focus-visible, .mx-star:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.mx-fn, .mx-bn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mx-bxh { font-weight: 600; }
.mx-chev .icon { width: 14px; height: 14px; transition: transform .15s; } .mx-bx.open > .mx-bxh .mx-chev .icon { transform: rotate(90deg); }
.mx-fl { display: flex; flex-direction: column; gap: 1px; padding: 1px 0 6px 22px; }
.mx-fl .mx-fi { min-height: var(--tap); font-size: var(--step--1); }
.mx-n { flex: none; min-width: 20px; padding: 1px 7px; border-radius: 999px; background: var(--accent); color: var(--accent-ink, #fff); font-size: var(--step--2); font-weight: 600; text-align: center; }
.mx-set { margin-top: var(--space-s); color: var(--muted); }

/* dividers */
.mx-div { position: relative; cursor: col-resize; background: transparent; touch-action: none; }
.mx-div::before { content: ''; position: absolute; inset: 0 2px; background: var(--mx-bd); transition: background .12s; }
.mx-div:hover::before, .mx-div.drag::before, .mx-div:focus-visible::before { background: var(--accent); inset: 0 1px; }
.mx-div:focus-visible { outline: none; }

/* message list */
.mx-list { min-width: 0; display: flex; flex-direction: column; min-height: 0; background: var(--card); }
.mx-lh { position: sticky; top: 0; z-index: 2; background: var(--card); border-bottom: 1px solid var(--mx-bd); padding: var(--space-10) var(--space-10) var(--space-xs); display: flex; flex-direction: column; gap: var(--space-xs); }
.mx-ltop { display: flex; align-items: center; gap: var(--space-xs); }
.mx-search { position: relative; flex: 1; min-width: 0; }
.mx-search input { width: 100%; box-sizing: border-box; min-height: var(--tap); height: auto; padding: 0 var(--space-s) 0 36px; border: 1px solid var(--mx-bd); border-radius: var(--radius-m); background: var(--input); color: var(--text); font: inherit; font-size: var(--step--1); }
.mx-search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.mx-sic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); display: flex; pointer-events: none; }
.mx-new { min-height: var(--tap); height: auto; flex: none; }
.mx-foldbtn { flex: none; }
.mx-filters, .mx-bulk { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: var(--tap); }
.mx-filters[hidden], .mx-bulk[hidden] { display: none; }
.mx-chip { display: inline-flex; align-items: center; gap: 5px; min-height: var(--tap); height: auto; padding: 0 11px; border: 1px solid var(--mx-bd); border-radius: 999px; background: var(--card); color: var(--text); font-size: var(--step--1); cursor: pointer; }
.mx-chip .icon { width: 14px; height: 14px; }
.mx-chip:hover { background: var(--card-2); }
.mx-chip.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 50%, transparent); font-weight: 600; }
.mx-sel select { min-height: var(--tap); height: auto; padding: 0 24px 0 var(--space-10); border: 1px solid var(--mx-bd); border-radius: 999px; background-color: var(--card); color: var(--text); font-size: var(--step--1); }
.mx-bulk .btn { min-height: var(--tap); height: auto; padding: 0 var(--space-10); font-size: var(--step--1); gap: 5px; }
.mx-bulk .btn .icon { width: 15px; height: 15px; }
.mx-all { display: inline-flex; align-items: center; gap: var(--space-xs); font-size: var(--step--1); font-weight: 600; margin-right: 4px; }
.mx-rows { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.mx-lf { display: flex; align-items: center; gap: var(--space-10); padding: 6px var(--space-s); border-top: 1px solid var(--mx-bd); background: var(--card); min-height: var(--tap); box-sizing: border-box; }
.mx-lf .btn { min-height: var(--tap); height: auto; padding: 0 var(--space-s); font-size: var(--step--1); }
.mx-keys { margin-left: auto; white-space: nowrap; }

.mx-row { position: relative; display: grid; grid-template-columns: 30px minmax(0, 1fr) 34px; align-items: start; border-bottom: 1px solid var(--mx-bd); padding: 0 4px 0 2px; }
.mx-row:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
.mx-row.picked { background: var(--accent-soft); }
.mx-row.on { background: color-mix(in srgb, var(--accent) 13%, var(--card)); box-shadow: inset 3px 0 0 var(--accent); }
.mx-row.unseen::after { content: ''; position: absolute; left: 3px; top: 15px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.mx-chk { display: flex; justify-content: center; align-items: center; padding-top: 0; min-width: var(--tap); min-height: var(--tap); cursor: pointer; }
.mx-chk input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.mx-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; padding: var(--space-xs) 4px var(--space-xs) 2px; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; font-size: var(--step--1); line-height: 1.35; }
.mx-l1, .mx-l2, .mx-l3 { display: flex; align-items: center; gap: 6px; min-width: 0; }
.mx-from { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--step--1); }
.mx-ics { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.mx-ic .icon { width: 14px; height: 14px; }
.mx-when { flex: none; color: var(--muted); font-size: var(--step--2); }
.mx-l2 { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mx-subj { color: var(--text); }
.mx-snip { color: var(--muted); font-weight: 400; }
.mx-l3 { gap: 4px; flex-wrap: wrap; margin-top: 2px; }
.mx-row.unseen .mx-from, .mx-row.unseen .mx-subj { font-weight: 700; }
.mx-row.unseen .mx-when { color: var(--accent-text, var(--accent)); font-weight: 600; }
.mx-tag { display: inline-block; padding: 0 var(--space-xs); border-radius: 999px; background: var(--card-2); color: var(--muted); font-size: var(--step--2); line-height: 18px; white-space: nowrap; }
.mx-tag.bad { background: color-mix(in srgb, #d93025 15%, transparent); color: #b3261e; font-weight: 600; }
html.theme-dark .mx-tag.bad { color: #ff8a80; }
.mx-star { margin-top: 6px; width: var(--tap); height: var(--tap); min-width: var(--tap); min-height: var(--tap); display: flex; align-items: center; justify-content: center; border: 0; border-radius: var(--radius-s); background: transparent; color: var(--muted); cursor: pointer; opacity: .55; }
.mx-row:hover .mx-star, .mx-star.on, .mx-star:focus-visible { opacity: 1; }
.mx-star.on, .mx-star.on .icon { color: var(--accent); }
.mx-empty, .mx-none { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-xs); text-align: center; padding: 56px var(--space-l); color: var(--muted); }
.mx-empty .icon, .mx-none .icon { width: 34px; height: 34px; }
.mx-none { height: 100%; box-sizing: border-box; }
.mx-empty b, .mx-none b { color: var(--text); font-weight: 600; font-size: var(--step-0); }
.mx-skel { display: flex; flex-direction: column; gap: 1px; }
.mx-skel i { display: block; height: 62px; background: linear-gradient(90deg, var(--card-2), color-mix(in srgb, var(--card-2) 55%, var(--card)), var(--card-2)); background-size: 200% 100%; animation: mxsh 1.2s linear infinite; border-bottom: 2px solid var(--card); }
.mx-skel-r i { height: 46px; margin: var(--space-xs) var(--space-18); border-radius: var(--radius-s); }
@keyframes mxsh { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .mx-skel i { animation: none; } .mx-chev .icon { transition: none; } }

/* reading pane */
.mx-read { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--card); border-left: 0; }
.mx-rbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: var(--space-xs) var(--space-14); border-bottom: 1px solid var(--mx-bd); min-height: 52px; box-sizing: border-box; }
.mx-rbar .btn { min-height: var(--tap); height: auto; padding: 0 var(--space-s); gap: 6px; font-size: var(--step--1); }
.mx-rbar .btn .icon { width: 16px; height: 16px; }
.mx-rbar .iconbtn.on, .mx-rbar .iconbtn.on .icon { color: var(--accent); }
.mx-sp { flex: 1; }
.mx-backbtn { display: none; }
.mx-rscroll { flex: 1; min-height: 0; overflow-y: auto; padding: var(--space-18) var(--space-l) var(--space-28); display: flex; flex-direction: column; gap: var(--space-14); }
.mx-rh { display: flex; flex-direction: column; gap: var(--space-xs); }
.mx-subject { margin: 0; font-size: var(--step-2); line-height: 1.3; font-weight: 600; overflow-wrap: anywhere; }
.mx-from-line { display: flex; align-items: center; gap: var(--space-10); }
.mx-fl-main { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.3; }
.mx-fl-main b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mx-to { overflow-wrap: anywhere; }
.mx-links { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mx-link { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); height: auto; padding: 0 11px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text, var(--accent)); font-size: var(--step--1); font-weight: 600; text-decoration: none; }
.mx-link .icon { width: 14px; height: 14px; }
.mx-body { max-width: 860px; }
.mx-read .mail-html { font-size: var(--step-0); line-height: 1.6; overflow-wrap: anywhere; }
.mx-read .mail-html img { max-width: 100%; height: auto; }
.mx-read .mail-html table { max-width: 100%; }
.mx-read .mail-html a { color: var(--accent-text, var(--accent)); }
.mx-read .mail-atts { padding: 0; }
.mx-thread { display: flex; flex-direction: column; border: 1px solid var(--mx-bd); border-radius: var(--radius-m); overflow: hidden; }
.mx-th-h { padding: 7px var(--space-s); font-size: var(--step--2); font-weight: 600; color: var(--muted); background: var(--card-2); }
.mx-th { border-top: 1px solid var(--mx-bd); }
.mx-th-b { display: flex; align-items: center; gap: var(--space-10); width: 100%; padding: var(--space-xs) var(--space-s); border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; font-size: var(--step--1); }
.mx-th-b:hover { background: var(--card-2); }
.mx-th-f { flex: none; width: 130px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mx-th-s { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.mx-th-b time { flex: none; color: var(--muted); font-size: var(--step--2); }
.mx-th-body { padding: 4px var(--space-14) var(--space-14) var(--space-14); max-height: 360px; overflow: auto; }
.mx-team { border: 1px solid var(--mx-bd); border-radius: var(--radius-m); padding: 0 var(--space-s); }
.mx-team summary { cursor: pointer; padding: var(--space-10) 0; font-size: var(--step--1); font-weight: 600; }
.mx-team[open] { padding-bottom: var(--space-s); }
.mx-team-f { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-10); margin-bottom: var(--space-xs); }

/* compose: docked at the bottom of the reading pane, or popped out as a floating window */
.mx-compose { display: flex; flex-direction: column; flex: none; max-height: 62%; border-top: 1px solid var(--mx-bd); background: var(--card); box-shadow: 0 -6px 18px rgba(0, 0, 0, .06); min-height: 0; }
.mx-compose.pop { position: fixed; right: 24px; bottom: 16px; width: min(600px, calc(100vw - 32px)); max-height: min(640px, calc(100dvh - 120px)); z-index: var(--z-fab, 40); border: 1px solid var(--mx-bd); border-radius: var(--radius-m); box-shadow: 0 18px 50px rgba(0, 0, 0, .28); overflow: hidden; }
.mx-ch { display: flex; align-items: center; gap: 6px; padding: 6px var(--space-xs) 6px var(--space-m); background: var(--card-2); border-bottom: 1px solid var(--mx-bd); min-height: var(--tap); box-sizing: border-box; }
.mx-cf { display: flex; flex-direction: column; overflow-y: auto; min-height: 0; padding: 4px var(--space-m) var(--space-s); }
.mx-cr { display: flex; align-items: center; gap: var(--space-10); border-bottom: 1px solid var(--mx-bd); min-height: var(--tap); }
.mx-cr > span:first-child { flex: none; width: 54px; color: var(--muted); font-size: var(--step--1); }
.mx-cr input, .mx-cr select { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font: inherit; font-size: var(--step--1); min-height: var(--tap); height: auto; padding: 0; box-shadow: none; }
.mx-cr input:focus, .mx-cr select:focus { outline: none; }
.mx-cr:focus-within { border-bottom-color: var(--accent); }
.mx-cc-t { display: flex; gap: var(--space-10); flex: none; }
.mx-cf textarea { width: 100%; box-sizing: border-box; min-height: 150px; margin-top: var(--space-xs); padding: 6px 0; border: 0; background: transparent; color: var(--text); font: inherit; font-size: var(--step--1); line-height: 1.55; resize: vertical; }
.mx-cf textarea:focus { outline: none; }
.mx-sig { margin: 4px 0 var(--space-xs); font-size: var(--step--1); color: var(--muted); }
.mx-sig summary { cursor: pointer; padding: 4px 0; }
.mx-sig iframe { width: 100%; height: 120px; border: 1px solid var(--mx-bd); border-radius: var(--radius-s); background: #fff; }
.mx-cfoot { display: flex; align-items: center; gap: var(--space-xs); padding-top: 6px; flex-wrap: wrap; }
.mx-cfoot .btn { min-height: var(--tap); height: auto; }

/* between 768 and 1099px the folder pane slides over the list; on a phone the list and the message take turns */
@media (max-width: 1099px) {
  .mx, .mx.fold-off { grid-template-columns: minmax(280px, var(--mx-l, 380px)) 6px minmax(0, 1fr); }
  .mx .mx-div[data-div=f], .mx.fold-off .mx-div[data-div=f] { display: none; }
  .mx .mx-fp, .mx.fold-off .mx-fp { display: block; position: absolute; z-index: 5; left: 0; top: 0; bottom: 0; width: 270px; transform: translateX(-102%); transition: transform .18s ease; box-shadow: 8px 0 24px rgba(0, 0, 0, .18); }
  .mx.fp-open .mx-fp { transform: none; }
  .mx-fp .mx-fh .iconbtn { display: none; }
  .mx-keys { display: none; }
}
@media (max-width: 767px) {
  .mx, .mx.fold-off { display: block; height: calc(100dvh - 56px - 64px - env(safe-area-inset-top, 0px)); }
  .mx .mx-div { display: none !important; }
  .mx .mx-list, .mx .mx-read { position: absolute; inset: 0; }
  .mx[data-view=list] .mx-read { display: none; }
  .mx[data-view=read] .mx-list { display: none; }
  .mx-backbtn { display: inline-flex; }
  .mx-rscroll { padding: var(--space-14) var(--space-14) var(--space-l); }
  .mx-fp { width: min(300px, 86vw) !important; }
  .mx-new span { display: none; }
  .mx-compose { max-height: 78%; }
  .mx-compose.pop { right: 8px; left: 8px; width: auto; bottom: 72px; }
  .mx-team-f { grid-template-columns: 1fr; }
  .mx-th-f { width: 90px; }
  .mx-rbar .btn span { display: none; }
}
@media (prefers-reduced-motion: reduce) { .mx .mx-fp { transition: none; } }
/* the Inbox page needs no outer scroll: the panes scroll themselves */
body.mx-on { overflow: hidden; }
@media print { .mx-fp, .mx-lh, .mx-list, .mx-rbar, .mx-compose { display: none !important; } .mx { display: block; height: auto; } }
/* the floating Add new button would sit on top of Send and the message list's last rows */
body.mx-on #fab { display: none; }
