/* guw.no mail — port of design/webmail.html. Tokens are the shared block from
   the mockups; radius stays 0 everywhere and white is the only accent. */

:root {
  --bg: #000;
  --panel: #0a0a0a;
  --panel-2: #101010;
  --raise: #161616;
  --hover: #141414;
  --line: #1c1c1c;
  --line-strong: #2a2a2a;
  --text: #f2f2f2;
  --text-2: #c8c8c8;
  --dim: #8a8a8a;
  --faint: #5e5e5e;
  --accent: #fff;
  --accent-ink: #000;
  --ok: #7fbf9a;
  --warn: #d4b06a;
  --danger: #d9776e;
  --mono: "Cascadia Mono", "Cascadia Code", "SF Mono", Menlo,
    "DejaVu Sans Mono", Consolas, monospace;
  --sans: "Segoe UI Variable Text", "Segoe UI", "SF Pro Text", system-ui,
    sans-serif;
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-md: 13.5px;
  --fs-lg: 15px;
  --lh: 1.5;
  --bar: 40px;
  --status: 24px;
  --t: 120ms;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border-radius: 0;
}

html,
body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: var(--fs-md);
  line-height: var(--lh);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

input,
textarea {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 1px;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: #242424;
}

::-webkit-scrollbar-thumb:hover {
  background: #343434;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::selection {
  background: var(--raise);
  color: var(--text);
}

/* === avatars: square, one grey ramp === */

.av {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  flex: none;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #dcdcdc;
  background: #1e1e1e;
  user-select: none;
  position: relative;
}

.av.a1 { background: #242424; }
.av.a2 { background: #2c2c2c; }
.av.a3 { background: #1a1a1a; }
.av.a4 { background: #303030; }
.av.a5 { background: #212121; }
.av.a6 { background: #282828; }
.av.a7 { background: #171717; color: #a8a8a8; }
.av.a8 { background: #333; }
.av.p1 { background-image: repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.22) 0 2px, transparent 2px 6px); }
.av.p2 { background-image: radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0.28) 0 1px, transparent 1.2px); background-size: 6px 6px; }
.av.p3 { background-image: repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.1) 0 1px, transparent 1px 5px); }
.av.p4 { background-image: radial-gradient(circle at 28% 24%, rgba(255, 255, 255, 0.2) 0 2px, transparent 2.5px); }

/* === top bar === */

.topbar {
  height: var(--bar);
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: relative;
  z-index: 40;
}

.crumb {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
  font-size: var(--fs-sm);
  color: var(--dim);
  white-space: nowrap;
}

.crumb .sl { color: var(--faint); }
.crumb b { color: var(--text); font-weight: 600; }
.crumb .draft { color: var(--warn); font-size: var(--fs-xs); }

.search {
  flex: 1;
  min-width: 0;
  max-width: 520px;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  padding: 0 8px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  transition: background var(--t) linear, border-color var(--t) linear;
}

.search:focus-within {
  background: var(--raise);
  border-color: var(--text);
}

.search .p {
  color: var(--dim);
  flex: none;
  font-size: var(--fs-sm);
  line-height: 1;
}

.search input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  outline: none;
  font-size: var(--fs-sm);
  color: var(--text);
  caret-color: var(--text);
}

.search input::placeholder { color: var(--faint); }
.search input::-webkit-search-cancel-button { display: none; }
.search .kbd { flex: none; font-size: var(--fs-xs); color: var(--faint); }

.tb-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.chatlink,
.acct {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  color: var(--text-2);
  font-size: var(--fs-sm);
  transition: background var(--t) linear, border-color var(--t) linear,
    color var(--t) linear;
}

.chatlink svg { width: 14px; height: 14px; display: block; }
.chatlink:hover,
.acct:hover,
.acct[aria-expanded="true"] {
  background: var(--raise);
  border-color: var(--text);
  color: var(--text);
}

.acct .av { width: 16px; height: 16px; font-size: 7px; }
.acct .ch { color: var(--faint); font-size: 9px; }

.acctwrap { position: relative; display: flex; }

.pop {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: 268px;
  z-index: 60;
  background: var(--raise);
  border: 1px solid var(--line-strong);
  padding: 10px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.9);
}

.pop .ph {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
}

.pop .ph .av { width: 26px; height: 26px; font-size: 9px; }
.pop .ph .nm { font-size: var(--fs-sm); color: var(--text); line-height: 1.3; }
.pop .ph .ad { font-size: var(--fs-xs); color: var(--faint); }

.pop .pi {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 26px;
  padding: 0 4px;
  font-size: var(--fs-sm);
  color: var(--text-2);
  text-align: left;
  transition: background var(--t) linear, color var(--t) linear;
}

.pop .pi svg { width: 14px; height: 14px; display: block; color: var(--dim); }
.pop .pi:hover { background: var(--hover); color: var(--text); }
.pop .pi:hover svg { color: var(--text); }
.pop .pi .k { margin-left: auto; font-size: var(--fs-xs); color: var(--faint); }
.pop .psep { height: 1px; background: var(--line); margin: 6px 0; }

/* === shell === */

.app {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 220px 420px minmax(0, 1fr);
}

.app > * { min-height: 0; }

/* === folders === */

.folders {
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.compose {
  flex: none;
  margin: 8px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  background: var(--panel-2);
  border: 1px solid var(--text);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 600;
  transition: background var(--t) linear, border-color var(--t) linear;
}

.compose:hover { background: var(--raise); border-color: var(--accent); }
.compose .k { font-size: var(--fs-xs); font-weight: 400; color: var(--faint); }

.fscroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 0 6px 10px;
}

.frow {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  height: 26px;
  padding: 0 8px;
  color: var(--dim);
  font-size: var(--fs-md);
  cursor: pointer;
  transition: background var(--t) linear, color var(--t) linear;
}

.frow:hover { background: var(--raise); color: var(--text); }

.frow.on {
  background: #1e1e1e;
  color: var(--text);
  box-shadow: inset 2px 0 0 var(--accent);
}

.frow .fi { display: grid; place-items: center; color: inherit; }
.frow .fi svg { width: 14px; height: 14px; display: block; }
.frow .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.frow .n {
  font-size: var(--fs-xs);
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  flex: none;
}

.frow.unread .n,
.frow.on .n { color: var(--text); }
.frow.unread .t { color: var(--text-2); }

.fcat {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 12px 8px 4px;
  font-size: var(--fs-xs);
  color: var(--dim);
  text-align: left;
}

.fcat .plus {
  margin-left: auto;
  color: var(--faint);
  opacity: 0;
  transition: opacity var(--t) linear;
}

.fcat:hover { color: var(--text-2); }
.fcat:hover .plus { opacity: 1; }

/* storage: one fixed-width block-char bar, mono, tabular */
.storage {
  flex: none;
  border-top: 1px solid var(--line);
  padding: 8px 12px;
  font-size: var(--fs-xs);
  color: var(--faint);
}

.storage .bar {
  white-space: pre;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  overflow: hidden;
  text-overflow: clip;
}

.storage .bar .f { color: var(--text-2); }
.storage .bar .e { color: #2a2a2a; }

.storage .bar .lbl {
  color: var(--faint);
  margin-left: 6px;
}

/* === message list === */

.listcol {
  background: var(--bg);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.lhead {
  height: var(--bar);
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
}

.lhead .t {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lhead .c { font-size: var(--fs-xs); color: var(--faint); flex: none; }
.lhead .sp { margin-left: auto; display: flex; gap: 2px; flex: none; }

.gbtn {
  height: 22px;
  min-width: 22px;
  padding: 0 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  color: var(--dim);
  font-size: var(--fs-xs);
  line-height: 1;
  transition: color var(--t) linear, background var(--t) linear;
}

.gbtn:hover { color: var(--text); background: var(--hover); }

.ib {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  white-space: nowrap;
  flex-shrink: 0;
  color: var(--dim);
  font-size: var(--fs-xs);
  line-height: 1;
  transition: color var(--t) linear;
}

.ib::before { content: "["; color: var(--faint); }
.ib::after { content: "]"; color: var(--faint); }
.ib svg { width: 14px; height: 14px; display: block; margin: 0 1px; flex: none; }
.ib:hover { color: var(--text); }
.ib:hover::before,
.ib:hover::after { color: var(--text-2); }
.ib.on { color: var(--text); }
.ib.on::before,
.ib.on::after { color: var(--text-2); }

.mlist { flex: 1; overflow-y: auto; min-height: 0; }

.mrow {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid #0e0e0e;
  transition: background var(--t) linear;
}

.mrow:hover { background: var(--raise); }

/* light-sweep on hover: one pass, then gone */
.mrow::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
}

.mrow.on {
  background: #1e1e1e;
  box-shadow: inset 2px 0 0 var(--accent);
}

.mrow.archived,
.mrow.trashed { opacity: 0.4; }
.mrow.trashed .sub { text-decoration: line-through; }

.mrow .mk {
  color: var(--text);
  font-size: var(--fs-sm);
  line-height: 1.35;
  text-align: center;
  user-select: none;
}

.mrow .wrap { min-width: 0; }
.mrow .l1 { display: flex; align-items: baseline; gap: 8px; min-width: 0; }

.mrow .tm {
  font-size: var(--fs-xs);
  color: var(--faint);
  flex: none;
  font-variant-numeric: tabular-nums;
}

.mrow .who {
  font-size: var(--fs-md);
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.mrow .sub {
  font-size: var(--fs-md);
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}

.mrow .flags { display: flex; align-items: center; gap: 4px; flex: none; color: var(--faint); }
.mrow .flags svg { width: 12px; height: 12px; display: block; }
.mrow .flags .star { color: var(--text-2); }

.mrow .pv {
  font-size: var(--fs-sm);
  color: var(--faint);
  margin-top: 1px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.mrow.unread .who { color: var(--text); font-weight: 600; }
.mrow.unread .sub { color: var(--text-2); font-weight: 600; }
.mrow.unread .pv { color: var(--dim); }
.mrow.unread .tm { color: var(--text-2); }
.mrow.on .who,
.mrow.on .sub { color: var(--text); }
.mrow.on .pv { color: var(--dim); }

/* the unread dot pulses, slowly, only when motion is allowed */
.mrow.unread .mk { color: var(--text); }

/* === reading pane === */

.read {
  --rpad: 24px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
  position: relative;
}

.rscroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 0 0 24px;
  display: flex;
  flex-direction: column;
}

.rscroll > .blank { flex: 1; }
.rhead { padding: 16px var(--rpad) 0; }

.rsubj {
  font-size: 22px;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  overflow-wrap: anywhere;
}

.rtags { display: flex; align-items: center; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  color: var(--dim);
  font-size: var(--fs-xs);
}

.tag svg { width: 12px; height: 12px; display: block; }
.tag.warn { color: var(--warn); border-color: #3a3222; }

.kvblock {
  margin: 16px var(--rpad) 0;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 2px;
}

.kv {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 10px;
  font-size: var(--fs-sm);
  align-items: baseline;
}

.kv .k { color: var(--faint); font-size: var(--fs-xs); }
.kv .v { color: var(--text-2); overflow-wrap: anywhere; min-width: 0; }
.kv .v .em { color: var(--text); }
.kv .v .ad { color: var(--faint); }

.acts {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
  margin: 12px var(--rpad) 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.abtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  color: var(--text-2);
  font-size: var(--fs-sm);
  transition: background var(--t) linear, border-color var(--t) linear,
    color var(--t) linear;
}

.abtn svg { width: 14px; height: 14px; display: block; color: var(--dim); flex: none; }
.abtn:hover { background: var(--raise); border-color: var(--text); color: var(--text); }
.abtn:hover svg { color: var(--text); }
.abtn.primary { background: var(--panel-2); border-color: var(--text); color: var(--text); }
.abtn.primary svg { color: var(--text); }
.abtn.primary:hover { background: var(--raise); border-color: var(--accent); color: var(--accent); }
.acts .sp { margin-left: auto; display: flex; gap: 2px; }

.body { padding: 16px var(--rpad) 0; }

.body .mail {
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  color: #e6e6e6;
  text-align: left;
}

.body .mail p { margin: 0 0 12px; }
.body .mail p:last-child { margin-bottom: 0; }
.body .mail strong { color: var(--text); font-weight: 600; }
.body .mail a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: var(--faint);
}
.body .mail a:hover { text-decoration-color: var(--text); }
.body .mail ul { margin: 0 0 12px; padding-left: 18px; }
.body .mail li { margin-bottom: 4px; }
.body .mail .sig { color: var(--dim); font-size: 13px; margin-top: 16px; text-align: left; }
.body .mail table { border-collapse: collapse; width: 100%; margin: 0 0 12px; font-size: 13px; }
.body .mail th,
.body .mail td { border: 1px solid var(--line-strong); padding: 4px 8px; text-align: left; }
.body .mail th { color: var(--text); font-weight: 600; background: var(--panel-2); }
.body .mail td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* plain-text body: mono, pre-wrap, autolinked */
.textbody {
  font-family: var(--mono);
  font-size: var(--fs-md);
  line-height: 1.65;
  color: var(--text-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-width: 72ch;
}

.textbody a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: var(--faint);
}

.textbody a:hover { text-decoration-color: var(--text); }

/* html body lives in a sandboxed iframe */
.frame {
  width: 100%;
  border: 0;
  display: block;
  background: transparent;
  min-height: 120px;
}

.remote {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  margin-bottom: 16px;
  padding: 0 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: var(--fs-xs);
  color: var(--dim);
}

.remote svg { width: 14px; height: 14px; display: block; flex: none; color: var(--faint); }

.remote .lb { margin-left: auto; }

.remote button {
  height: 20px;
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  color: var(--text-2);
  font-size: var(--fs-xs);
  transition: color var(--t) linear, border-color var(--t) linear;
}

.remote button:hover { color: var(--text); border-color: var(--text); }

.quote { margin: 16px var(--rpad) 0; border-left: 1px solid var(--line-strong); padding-left: 12px; }

.quote .qt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  color: var(--faint);
  font-family: var(--mono);
  padding: 2px 0;
  transition: color var(--t) linear;
}

.quote .qt:hover { color: var(--text-2); }
.quote .qt .dots { letter-spacing: 1px; }

.quote .qbody {
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.6;
  color: var(--dim);
  margin-top: 6px;
  text-align: left;
}

.attach { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px var(--rpad) 0; }

.acard {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  min-width: 240px;
  max-width: 320px;
  transition: background var(--t) linear, border-color var(--t) linear;
}

.acard:hover { background: var(--raise); border-color: var(--line-strong); }

.acard .fi {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex: none;
  border: 1px solid var(--line-strong);
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.02em;
}

.acard .fn {
  font-size: var(--fs-sm);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.acard .fs { font-size: var(--fs-xs); color: var(--faint); margin-top: 1px; }
.acard .dl { color: var(--dim); display: grid; place-items: center; padding: 0 2px; }
.acard .dl svg { width: 14px; height: 14px; display: block; }
.acard .dl:hover { color: var(--text); }

.thread { margin: 20px var(--rpad) 0; border-top: 1px solid var(--line); padding-top: 12px; }

.thread .th {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  font-size: var(--fs-xs);
  color: var(--dim);
  padding: 2px 0 8px;
  transition: color var(--t) linear;
}

.thread .th:hover { color: var(--text-2); }
.thread .th .g { color: var(--faint); font-size: 9px; }
.thread .th .n { color: var(--text-2); }
.thread .th .sp { margin-left: auto; color: var(--faint); }

.tmsg {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid #0e0e0e;
}

.tmsg .av { width: 24px; height: 24px; font-size: 9px; }
.tmsg .mh { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.tmsg .au { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.tmsg .ad { font-size: var(--fs-xs); color: var(--faint); }
.tmsg .st {
  font-size: var(--fs-xs);
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  margin-left: auto;
}

.tmsg .tx { font-size: var(--fs-md); color: var(--text-2); overflow-wrap: anywhere; margin-top: 1px; }
.tmsg.collapsed .tx { display: none; }
.tmsg.collapsed .mh { cursor: pointer; }

.tmsg .peek {
  font-size: var(--fs-sm);
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.tmsg:not(.collapsed) .peek { display: none; }
.tmsg .mini { display: flex; gap: 2px; margin-top: 4px; }

.tmsg .mini button {
  height: 20px;
  padding: 0 4px;
  font-size: 10px;
  color: var(--faint);
  border: 1px solid transparent;
  transition: color var(--t) linear, border-color var(--t) linear;
}

.tmsg .mini button:hover { color: var(--text); border-color: var(--line-strong); }

/* === compose pane === */

.compose-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
  position: relative;
}

.chead {
  height: var(--bar);
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

.chead .t { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.chead .st { font-size: var(--fs-xs); color: var(--faint); }
.chead .sp { margin-left: auto; display: flex; gap: 2px; flex: none; }

.cscroll { flex: 1; overflow-y: auto; min-height: 0; padding: 14px 16px 20px; }

.field {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  padding: 6px 10px;
  margin-bottom: 6px;
  position: relative;
  transition: background var(--t) linear, border-color var(--t) linear;
}

.field:focus-within { background: var(--raise); border-color: var(--text); }

.field::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
}

.field .lb {
  flex: none;
  width: 56px;
  font-size: var(--fs-xs);
  color: var(--dim);
  padding-top: 3px;
  user-select: none;
}

.field:focus-within .lb { color: var(--text-2); }

.field .in {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: none;
  font-size: var(--fs-md);
  color: var(--text);
  caret-color: var(--text);
  padding: 2px 0;
  line-height: var(--lh);
}

.field .in::placeholder { color: var(--faint); }
.field .tail { flex: none; display: flex; align-items: center; gap: 2px; padding-top: 1px; }

.field .tail button {
  height: 20px;
  padding: 0 4px;
  font-size: var(--fs-xs);
  color: var(--faint);
  transition: color var(--t) linear, background var(--t) linear;
}

.field .tail button:hover { color: var(--text); background: var(--hover); }

.chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; flex: 1; min-width: 0; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 20px;
  padding: 0 4px 0 5px;
  background: var(--raise);
  border: 1px solid var(--line-strong);
  font-size: var(--fs-sm);
  color: var(--text-2);
  white-space: nowrap;
}

.chip .x { color: var(--faint); font-size: var(--fs-xs); padding: 0 1px; line-height: 1; }
.chip .x:hover { color: var(--text); }

.chips input {
  flex: 1;
  min-width: 80px;
  background: transparent;
  border: 0;
  outline: none;
  font-size: var(--fs-md);
  color: var(--text);
  caret-color: var(--text);
  padding: 2px 0;
}

.chips input::placeholder { color: var(--faint); }

.acwrap { position: relative; }

.acdrop {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 50;
  width: min(460px, 100%);
  background: var(--raise);
  border: 1px solid var(--line-strong);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.9);
}

.acdrop .ah {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-xs);
  color: var(--faint);
}

.acdrop .ah .k { color: var(--text-2); }
.acdrop .ah .esc { margin-left: auto; }
.acdrop ul { list-style: none; padding: 4px 0; max-height: 220px; overflow-y: auto; }

.acdrop li {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 6px 10px;
  cursor: pointer;
  transition: background var(--t) linear;
}

.acdrop li .av { width: 24px; height: 24px; font-size: 9px; }
.acdrop li .nm { font-size: var(--fs-sm); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acdrop li .ad { font-size: var(--fs-xs); color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acdrop li .tg { font-size: var(--fs-xs); color: var(--faint); flex: none; }
.acdrop li:hover { background: var(--hover); }
.acdrop li.sel { background: var(--raise); box-shadow: inset 2px 0 0 var(--accent); }
.acdrop li.sel .nm { color: var(--text); }
.acdrop li.sel .ad,
.acdrop li.sel .tg { color: var(--text-2); }

.editor {
  background: var(--panel);
  border: 1px solid var(--line-strong);
  display: flex;
  flex-direction: column;
  margin-top: 2px;
  transition: background var(--t) linear, border-color var(--t) linear;
}

.editor:focus-within { background: var(--raise); border-color: var(--text); }

.fmt {
  display: flex;
  align-items: center;
  gap: 1px;
  flex: none;
  padding: 4px 6px;
  border-bottom: 1px solid var(--line);
}

.fmt button {
  height: 20px;
  min-width: 22px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-xs);
  color: var(--dim);
  line-height: 1;
  transition: color var(--t) linear, background var(--t) linear;
}

.fmt button:hover { color: var(--text); background: var(--hover); }
.fmt button svg { width: 12px; height: 12px; display: block; }
.fmt .div { width: 1px; height: 12px; background: var(--line-strong); margin: 0 4px; flex: none; }
.fmt .sp { margin-left: auto; font-size: var(--fs-xs); color: var(--faint); padding-right: 2px; }

.ebody { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.ebody textarea {
  flex: 1;
  min-height: 220px;
  width: 100%;
  resize: none;
  background: transparent;
  border: 0;
  outline: none;
  font-family: var(--mono);
  font-size: var(--fs-md);
  line-height: 1.65;
  color: var(--text);
  caret-color: var(--text);
  padding: 10px 12px;
}

.ebody textarea::placeholder { color: var(--faint); }

.attachrow { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }

.achip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 4px 0 8px;
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  font-size: var(--fs-sm);
  color: var(--text-2);
}

.achip svg { width: 12px; height: 12px; display: block; color: var(--dim); flex: none; }
.achip .sz { font-size: var(--fs-xs); color: var(--faint); }
.achip .x { color: var(--faint); font-size: var(--fs-xs); padding: 0 2px; line-height: 1; }
.achip .x:hover { color: var(--text); }

.addatt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 8px;
  border: 1px dashed var(--line-strong);
  color: var(--faint);
  font-size: var(--fs-sm);
  transition: color var(--t) linear, border-color var(--t) linear;
}

.addatt svg { width: 12px; height: 12px; display: block; }
.addatt:hover { color: var(--text); border-color: var(--text); }

.cfoot {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.send {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 12px;
  background: var(--panel-2);
  border: 1px solid var(--text);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 600;
  transition: background var(--t) linear, border-color var(--t) linear;
}

.send svg { width: 14px; height: 14px; display: block; }
.send .k { font-size: var(--fs-xs); font-weight: 400; color: var(--faint); }
.send:hover { background: var(--raise); border-color: var(--accent); }
.send[disabled] { opacity: 0.5; cursor: default; }

.sbtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  color: var(--text-2);
  font-size: var(--fs-sm);
  transition: background var(--t) linear, border-color var(--t) linear,
    color var(--t) linear;
}

.sbtn svg { width: 14px; height: 14px; display: block; color: var(--dim); }
.sbtn:hover { background: var(--raise); border-color: var(--text); color: var(--text); }
.sbtn:hover svg { color: var(--text); }
.sbtn.danger:hover { border-color: var(--danger); color: var(--danger); }
.sbtn.danger:hover svg { color: var(--danger); }

.cfoot .sp {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--fs-xs);
  color: var(--faint);
}

.cfoot .sp kbd { font-family: var(--mono); font-size: var(--fs-xs); color: var(--text-2); }

/* === status bar === */

.status {
  height: var(--status);
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  font-size: var(--fs-xs);
  color: var(--faint);
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
}

.status .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--ok); flex: none; }
.status .dot.off { background: var(--faint); }
.status .sep { color: var(--line-strong); }
.status .r { margin-left: auto; display: flex; gap: 12px; flex: none; }
.status .r span { white-space: nowrap; }
.status kbd { font-family: var(--mono); font-size: var(--fs-xs); color: var(--text-2); }
.status .msg { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; }
.status .msg.err { color: var(--danger); }

/* === empty / loading / error === */

.blank {
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.blank-inner {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  position: relative;
  z-index: 1;
}

.blank-inner img { width: 96px; height: 96px; opacity: 0.5; }
.blank-inner .t { font-size: var(--fs-sm); color: var(--dim); }
.blank-inner .h { font-size: var(--fs-xs); color: var(--faint); }

.dither {
  position: absolute;
  inset: 0;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1;
  color: #1a1a1a;
  white-space: pre;
  overflow: hidden;
  user-select: none;
  pointer-events: none;
  padding: 8px;
}

.spin { color: var(--dim); font-variant-numeric: tabular-nums; }

/* === motion, only when the reader allows it === */

@media (prefers-reduced-motion: no-preference) {
  .mrow.unread .mk { animation: dot 2.4s ease-in-out infinite; }
  .mrow.fresh { animation: slide 260ms ease-out both; }
  .mrow { animation: cascade 220ms ease-out both; animation-delay: calc(var(--i, 0) * 15ms); }
  .mrow.leaving { animation: swipe 180ms ease-in both; }
  .scramble { animation: none; }
  .dither { animation: dither 6s steps(6) infinite; }
  .spin { animation: none; }
  .compose-pane { animation: rise 220ms cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .status .msg { animation: typein 320ms steps(24) both; }
  .abtn::after,
  .gbtn::after { animation: none; }
  .mrow:hover::after { animation: sweep 560ms ease-out; }
  .field:focus-within::after { animation: sweep 620ms ease-out; }
}

@keyframes sweep {
  from { opacity: 1; transform: translateX(-100%); }
  to { opacity: 0; transform: translateX(100%); }
}

@keyframes cascade {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

@keyframes swipe {
  from { opacity: 1; transform: none; }
  to { opacity: 0; transform: translateX(28px); }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@keyframes typein {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}

@keyframes dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@keyframes slide {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

@keyframes dither {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

/* === narrow: the reading pane keeps the room, the list narrows === */

@media (max-width: 1270px) {
  .app { grid-template-columns: 200px 360px minmax(0, 1fr); }
  .status .r span:nth-child(n + 4) { display: none; }
  .status .guw,
  .status .guw-sep { display: none; }
}

@media (max-width: 1100px) {
  .app { grid-template-columns: 180px 320px minmax(0, 1fr); }
  .read { --rpad: 16px; }
  .status .r span:nth-child(n + 3) { display: none; }
}
