/* ============================================================================
   bMail app.

   Continues the landing page's language rather than inventing a second one:
   confident Archivo headings, softly lit card surfaces, hairline structure, and
   yellow spent only where it means something. Monospace is reserved for things
   that are literally data — addresses, keys, amounts — and never used for
   labels, which is what makes an interface read as a console instead of a
   product.

   Brand: Concept 1 — #F0B90B yellow, #181A1F eerie black, #2A313D obsidian, white.
   ========================================================================= */

:root {
  --yellow: #F0B90B;
  --yellow-lift: #F8CE45;
  --yellow-soft: rgba(240, 185, 11, 0.10);
  --black: #181A1F;
  --obsidian: #2A313D;
  --white: #FFFFFF;

  --ground: #131519;
  --panel: #181B21;
  --raise: #1E222A;
  --well: #101216;

  --line: rgba(255, 255, 255, 0.07);
  --line-firm: rgba(255, 255, 255, 0.13);

  --t-100: rgba(255, 255, 255, 0.94);
  --t-72: rgba(255, 255, 255, 0.72);
  --t-52: rgba(255, 255, 255, 0.52);
  --t-34: rgba(255, 255, 255, 0.34);

  --danger: #E8686C;

  --font: 'Archivo', 'Helvetica Neue', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --sidebar-w: 258px;
  --list-w: 396px;
  --r: 10px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* One recipe for every raised surface, so the app has a single material. */
  --card: linear-gradient(158deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.008) 46%, transparent);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--t-72);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.icon-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.hidden { display: none !important; }

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; border-radius: 4px; }

/* ------------------------------------------------------------------ buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 8px;
  font-family: var(--font); font-size: 0.9rem; font-weight: 640;
  letter-spacing: -0.008em;
  padding: 0 16px; height: 40px;
  cursor: pointer; white-space: nowrap;
  transition: background 0.16s, border-color 0.16s, color 0.16s, transform 0.2s var(--ease);
}
.btn-primary { background: var(--yellow); color: #16181C; }
.btn-primary:hover { background: var(--yellow-lift); transform: translateY(-1px); }
.btn-ghost { background: rgba(255, 255, 255, 0.03); border-color: var(--line-firm); color: var(--t-72); }
.btn-ghost:hover { border-color: rgba(240, 185, 11, 0.5); color: var(--white); }
.btn-ghost.danger { color: var(--danger); border-color: rgba(232, 104, 108, 0.3); }
.btn-ghost.danger:hover { border-color: var(--danger); background: rgba(232, 104, 108, 0.08); }
.btn-block { width: 100%; height: 44px; }
.btn-icon { width: 16px; height: 16px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; flex-shrink: 0;
  background: transparent; border: 0; border-radius: 7px;
  color: var(--t-34); cursor: pointer;
  transition: color 0.16s, background 0.16s;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { color: var(--yellow); background: rgba(255, 255, 255, 0.05); }
.icon-btn.spin svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ gate */

.gate {
  position: fixed; inset: 0; z-index: 40;
  display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(90% 70% at 50% -5%, rgba(240, 185, 11, 0.10), transparent 62%),
    var(--ground);
}
.gate-card {
  width: 100%; max-width: 408px;
  background: var(--card), var(--panel);
  border: 1px solid var(--line-firm);
  border-radius: 16px;
  padding: 38px 34px 26px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.45);
}
.gate-head { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 28px; }
.gate-mark { width: 44px; height: 44px; color: var(--yellow); display: inline-flex; }
.gate-mark svg { width: 100%; height: 100%; }
.gate-title { display: inline-flex; }
.gate-title .word { height: 21px; width: auto; fill: var(--white); display: block; }


.gate-step p { margin: 0 0 20px; font-size: 0.94rem; color: var(--t-72); text-align: center; line-height: 1.6; }
.gate-step strong { color: var(--white); font-weight: 640; }
.gate-hint { font-size: 0.82rem; color: var(--t-34); text-align: center; margin: 12px 0 16px; }
.gate-status { min-height: 20px; margin: 16px 0 0; font-size: 0.85rem; text-align: center; color: var(--t-52); line-height: 1.5; }
.gate-status.bad { color: var(--danger); }
.gate-status.good { color: var(--yellow); }
/* Empty until a wallet is connected, and an empty bordered row reads as a
   stray rule under the button. */
.gate-foot:not(:has(span:not(:empty))) { display: none; }
.gate-foot {
  display: flex; justify-content: space-between; gap: 10px;
  margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line);
  font-size: 0.72rem; color: var(--t-34);
}

.claim-field {
  display: flex; align-items: center;
  background: var(--well); border: 1px solid var(--line-firm); border-radius: 9px;
  padding: 0 14px; transition: border-color 0.16s;
}
.claim-field:focus-within { border-color: var(--yellow); }
.claim-field input {
  flex: 1; min-width: 0; height: 44px;
  background: none; border: 0; outline: none;
  color: var(--white); font-family: var(--mono); font-size: 0.95rem;
}
.claim-suffix { font-family: var(--mono); font-size: 0.86rem; color: var(--yellow); user-select: none; }

/* ------------------------------------------------------------------ shell */

.app { display: flex; height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  display: flex; flex-direction: column;
  padding: 20px 16px 16px;
  background: var(--panel);
  border-right: 1px solid var(--line);
}
.sb-brand { display: flex; align-items: center; gap: 11px; padding: 0 6px 22px; }
.brand-mark { width: 26px; height: 26px; color: var(--yellow); display: inline-flex; }
.brand-mark svg { width: 100%; height: 100%; }
.side-title { display: inline-flex; }
.side-title .word { height: 15px; width: auto; fill: var(--white); display: block; }

.sb-compose { width: 100%; margin-bottom: 22px; }

.sb-nav { display: flex; flex-direction: column; gap: 2px; }
.side-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 9px;
  background: none; border: 0;
  color: var(--t-52); font-family: var(--font); font-size: 0.92rem; font-weight: 540;
  cursor: pointer; text-align: left; width: 100%;
  transition: color 0.15s, background 0.15s;
}
.side-link:hover { color: var(--white); background: rgba(255, 255, 255, 0.04); }
.side-link.active { color: var(--white); background: rgba(255, 255, 255, 0.06); font-weight: 620; }
.side-icon { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85; }
.side-link.active .side-icon { color: var(--yellow); opacity: 1; }
.side-label { flex: 1; }
.pill {
  font-size: 0.74rem; font-weight: 620; color: var(--yellow);
  background: var(--yellow-soft); border-radius: 20px;
  padding: 1px 8px; min-width: 22px; text-align: center;
}
.pill:empty { display: none; }

/* The balance surface: calm by default, assertive only when money is waiting. */
.balance {
  margin-top: auto;
  background: var(--card), var(--raise);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 15px 15px 13px;
  transition: border-color 0.2s;
}
.balance.has-value { border-color: rgba(240, 185, 11, 0.32); }
.bal-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.bal-k { font-size: 0.78rem; color: var(--t-52); }
.bal-v { font-size: 1.32rem; font-weight: 500; color: var(--t-100); letter-spacing: -0.015em; line-height: 1.3; }
.balance.has-value .bal-v { color: var(--yellow); }
.bal-v-sm { font-size: 0.84rem; color: var(--t-72); }
.bal-note { margin: 2px 0 12px; font-size: 0.73rem; color: var(--t-34); line-height: 1.45; }
.bal-row-sub { padding: 5px 0; border-top: 1px solid var(--line); }
.bal-policy {
  display: flex; align-items: center; gap: 7px;
  margin-top: 11px; padding-top: 11px; border-top: 1px solid var(--line);
  font-size: 0.78rem; color: var(--t-52);
}
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--t-34); flex-shrink: 0; }
.dot.on { background: var(--yellow); box-shadow: 0 0 0 3px var(--yellow-soft); }

.sb-me { margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line); }
.me-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.me-name {
  font-size: 0.88rem; font-weight: 620; color: var(--white);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.me-sub { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 1px; }
.me-addr { font-size: 0.72rem; color: var(--t-34); }
.me-net { font-size: 0.7rem; color: var(--t-34); }

/* ------------------------------------------------------------------ work */

.workspace { flex: 1; min-width: 0; display: flex; }
.pane { display: flex; flex-direction: column; min-height: 0; }

.list-pane {
  width: var(--list-w); flex-shrink: 0;
  border-right: 1px solid var(--line);
  background: var(--ground);
}
.pane-head {
  flex-shrink: 0; padding: 20px 20px 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.ph-left { display: flex; flex-direction: column; gap: 1px; min-width: 0; }

/* Sync is the one thing a chain-backed inbox needs constantly, so it is a
   labelled control next to the list it refreshes, not an unmarked glyph. */
.sync-btn {
  display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0;
  height: 32px; padding: 0 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-firm); border-radius: 8px;
  color: var(--t-52); font-family: var(--font); font-size: 0.82rem; font-weight: 560;
  cursor: pointer; transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.sync-btn svg { width: 14px; height: 14px; }
.sync-btn:hover { color: var(--white); border-color: rgba(240, 185, 11, 0.5); background: rgba(255, 255, 255, 0.06); }
.sync-btn:disabled { cursor: default; color: var(--t-34); }
.sync-btn.busy svg { animation: spin 0.85s linear infinite; }
.pane-head h2 {
  margin: 0; font-size: 1.32rem; font-weight: 700;
  color: var(--white); letter-spacing: -0.022em;
}
.pane-sub { font-size: 0.76rem; color: var(--t-34); white-space: nowrap; }

.mail-list { flex: 1; overflow-y: auto; padding: 0 12px 16px; scrollbar-width: thin; }

.mail-item {
  position: relative;
  padding: 13px 14px;
  border-radius: var(--r);
  cursor: pointer;
  transition: background 0.14s;
}
.mail-item + .mail-item { margin-top: 2px; }
.mail-item:hover { background: rgba(255, 255, 255, 0.035); }
.mail-item.active { background: var(--card), var(--raise); box-shadow: inset 0 0 0 1px var(--line-firm); }
.mail-item.active::before {
  content: ""; position: absolute; left: 0; top: 14px; bottom: 14px;
  width: 2px; border-radius: 2px; background: var(--yellow);
}
.mail-item-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 3px; }
.mail-item-from {
  font-family: var(--mono); font-size: 0.78rem; color: var(--t-52);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mail-item.active .mail-item-from { color: var(--yellow); }
.mail-item-date { font-size: 0.72rem; color: var(--t-34); flex-shrink: 0; }
/* Read mail recedes; unread asserts itself. The weight and colour do the work,
   with the dot as a scannable second signal rather than the only one. */
.mail-item-subject {
  font-size: 0.92rem; font-weight: 500; color: var(--t-52); line-height: 1.4;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mail-item.unread .mail-item-subject { font-weight: 640; color: var(--t-100); }
.mail-item.unread .mail-item-from { color: var(--t-72); }
.mail-item.unread .mail-item-top::after {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--yellow); flex-shrink: 0; align-self: center;
}
.mail-item-bad .mail-item-subject { color: var(--danger); font-weight: 500; }
.stamp-chip {
  display: inline-block; margin-top: 8px;
  font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 0.7rem;
  color: var(--yellow); background: var(--yellow-soft);
  border-radius: 20px; padding: 2px 9px;
}
.mail-empty { padding: 44px 20px; text-align: center; font-size: 0.88rem; color: var(--t-34); }

/* ------------------------------------------------------------------ reader */

.read-pane { flex: 1; min-width: 0; background: var(--ground); }

.read-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 40px; text-align: center;
}
.re-title { margin: 0; font-size: 1.02rem; font-weight: 620; color: var(--t-52); }
.re-note { margin: 0; max-width: 340px; font-size: 0.86rem; color: var(--t-34); line-height: 1.6; }

.read { flex: 1; display: flex; flex-direction: column; min-height: 0; }
/* Mail reads from the left, hard against the list, the way every mail client
   works. Centring it looked composed on a wide screen and wrong everywhere
   else: the eye leaves the list and has to travel to find the message.
   The measure is a max-width on the text itself, not the column. */
.read-col { padding-inline: 34px; }


/* The body is now built from nodes, so it sets its own rhythm rather than
   relying on pre-wrap to hold the shape of the plaintext. */
.read-scroll { flex: 1; overflow-y: auto; scrollbar-width: thin; position: relative; }

/* Four parts, each its own element, separated by rules:
   title, sender, message, on-chain detail. */

/* 1. title */
.read-head { padding-block: 34px 0; max-width: calc(74ch + 68px); }

/* Short yellow rule above the subject, the same editorial device the landing
   page uses to open a section. It gives the title something to sit against so
   it reads as a heading rather than the first line of text on the page. */
.head-rule {
  display: block; width: 26px; height: 2px; border-radius: 2px;
  background: var(--yellow); margin-bottom: 16px;
}
.read-head h3 {
  margin: 0;
  font-size: clamp(1.55rem, 2.1vw, 1.95rem);
  font-weight: 720;
  color: var(--white);
  letter-spacing: -0.032em;
  line-height: 1.14;
  text-wrap: balance;
}

/* dividers, faded at both ends so a rule reads as part of the page */
.read-sep { padding-block: 26px; max-width: calc(74ch + 68px); }
.read-sep span {
  display: block; height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-firm) 6%, var(--line-firm) 74%, transparent);
}

/* 2. sender */
.read-id {
  display: flex; align-items: center; gap: 13px;
  max-width: calc(74ch + 68px);
  padding-block: 6px;
}
.avatar {
  width: 40px; height: 40px; flex-shrink: 0;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--yellow-soft); border: 1px solid rgba(240, 185, 11, 0.3);
  color: var(--yellow); font-size: 1rem; font-weight: 680; line-height: 1;
  user-select: none;
}
.read-who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.read-from {
  font-size: 0.9rem; color: var(--t-100); font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.read-to { font-size: 0.78rem; color: var(--t-34); }
.read-aside { margin-left: auto; display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.read-date { font-size: 0.82rem; color: var(--t-52); white-space: nowrap; }
.read-aside .stamp-chip { margin-top: 0; }

/* 3. the message, boxed on its own */
.msg-box { max-width: calc(74ch + 68px); position: relative; z-index: 1; }
/* No surface behind the message: it aligns to the same left edge as the title
   and the sender, so the whole thing reads as one column of content. */
.read-body {
  padding-block: 14px 8px;
  font-size: 1.02rem; line-height: 1.85; color: var(--t-72);
  overflow-wrap: anywhere;
}

/* the mark, in the pane and outside the message box */
.read-watermark {
  position: absolute; right: 4%; bottom: 8%;
  width: min(300px, 30%); aspect-ratio: 1;
  color: var(--white); opacity: 0.03;
  pointer-events: none; z-index: 0;
}
.read-watermark svg { width: 100%; height: 100%; fill: currentColor; }
.read-head, .read-id, .read-sep, .read-notes, .read-proof { position: relative; z-index: 1; }

.body-p { margin: 0 0 1.35em; }
.body-p:last-child { margin-bottom: 0; }

/* Quoted text from an earlier message, folded back a level. */
.body-quote {
  margin: 0 0 1.15em; padding: 2px 0 2px 16px;
  border-left: 2px solid var(--line-firm);
  color: var(--t-52); font-size: 0.95rem;
}
.body-link { color: var(--yellow); text-decoration: none; border-bottom: 1px solid rgba(240,185,11,0.35); }
.body-link:hover { border-bottom-color: var(--yellow); }
.body-fail {
  padding: 16px 18px; border-radius: var(--r);
  border: 1px solid rgba(232, 104, 108, 0.3); background: rgba(232, 104, 108, 0.06);
  color: var(--danger); font-size: 0.9rem;
}

/* Anything the decryption pass flagged. */
.read-notes { padding-block: 20px 0; max-width: calc(74ch + 68px); }
.note-line {
  margin: 0 0 8px; padding: 10px 14px; border-radius: 8px;
  background: rgba(240, 185, 11, 0.07); border: 1px solid rgba(240, 185, 11, 0.22);
  color: var(--t-72); font-size: 0.84rem; line-height: 1.55;
}

/* The part an ordinary mail client cannot show: proof it happened, and what it
   cost. Understated by default, one click from the explorer. */
.read-proof { padding-block: 30px 64px; max-width: calc(74ch + 68px); }
.proof-h {
  margin: 0 0 14px; font-size: 0.74rem; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--t-34);
}
.proof-grid {
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--card), var(--panel);
  overflow: hidden;
}
.proof-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding: 13px 17px;
}
.proof-row + .proof-row { border-top: 1px solid var(--line); }
.proof-k { font-size: 0.84rem; color: var(--t-52); flex-shrink: 0; }
.proof-v { font-size: 0.79rem; color: var(--t-72); text-align: right; text-decoration: none; }
a.proof-v { color: var(--yellow); }
a.proof-v:hover { text-decoration: underline; text-underline-offset: 3px; }
.read-actions {
  flex-shrink: 0; display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  padding-block: 16px; border-top: 1px solid var(--line);
}
.read-actions:empty { display: none; }
.read-note { font-size: 0.78rem; color: var(--t-34); }

/* ------------------------------------------------------------------ settings */

.settings { flex: 1; overflow-y: auto; padding-block: 30px 56px; scrollbar-width: thin; }

.set-group { margin-bottom: 30px; }
.set-h {
  margin: 0 0 12px; font-size: 1.06rem; font-weight: 660;
  color: var(--white); letter-spacing: -0.015em;
}
.set-row {
  background: var(--card), var(--panel);
  border: 1px solid var(--line); border-radius: var(--r);
  padding: 18px;
}
.set-row + .set-row { margin-top: 10px; }
.set-row label { display: block; font-size: 0.92rem; font-weight: 580; color: var(--t-100); margin-bottom: 6px; }
.set-tag {
  font-size: 0.72rem; font-weight: 500; color: var(--t-34);
  border: 1px solid var(--line); border-radius: 20px; padding: 1px 8px; margin-left: 6px;
}
.set-inline { display: flex; align-items: center; gap: 9px; margin-top: 12px; }
.set-unit { font-size: 0.82rem; color: var(--t-34); flex-shrink: 0; }
.set-hint { margin: 0; font-size: 0.84rem; color: var(--t-34); line-height: 1.6; }
.set-warn { color: var(--danger); opacity: 0.85; margin-top: 14px; }
.set-key {
  margin: 12px 0 10px; font-size: 0.75rem; color: var(--t-52);
  background: var(--well); border: 1px solid var(--line); border-radius: 8px;
  padding: 11px 13px; word-break: break-all; line-height: 1.6;
}
.set-contracts { display: flex; flex-direction: column; gap: 14px; }
.contract { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; text-decoration: none; }
.contract-k { font-size: 0.88rem; color: var(--t-72); }
.contract-v { font-size: 0.78rem; color: var(--t-34); transition: color 0.15s; }
.contract:hover .contract-v { color: var(--yellow); }

input[type="text"], textarea {
  background: var(--well); border: 1px solid var(--line-firm); border-radius: 8px;
  color: var(--white); font-family: var(--font); font-size: 0.92rem;
  padding: 10px 13px; outline: none; width: 100%;
  transition: border-color 0.16s;
}
input.mono, textarea.mono { font-family: var(--mono); }
input[type="text"]:focus, textarea:focus { border-color: var(--yellow); }
input::placeholder, textarea::placeholder { color: var(--t-34); }
.set-inline input { flex: 1; min-width: 0; }
textarea { resize: vertical; line-height: 1.7; }

/* Independence notice. Quiet, but present wherever someone lands: the connect
   screen and the settings pane. */
.indie-note {
  margin: 16px 0 0;
  font-size: 0.74rem;
  line-height: 1.6;
  color: var(--t-34);
  max-width: 60ch;
}
.gate-card .indie-note {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  text-align: center;
}
.settings .indie-note { margin: 4px 0 20px; }

/* ------------------------------------------------------------------ modal */

.modal {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center; padding: 24px;
  background: rgba(8, 9, 12, 0.74);
}
.modal-card {
  width: 100%; max-width: 600px; max-height: 88vh;
  display: flex; flex-direction: column;
  background: var(--card), var(--panel);
  border: 1px solid var(--line-firm); border-radius: 16px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.55);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 14px; flex-shrink: 0;
}
.modal-head .microlabel {
  font-family: var(--font); font-size: 1.06rem; font-weight: 660;
  letter-spacing: -0.015em; text-transform: none; color: var(--white);
}
.modal-close {
  background: none; border: 0; color: var(--t-34); cursor: pointer;
  width: 30px; height: 30px; display: grid; place-items: center; border-radius: 7px;
}
.modal-close svg { width: 17px; height: 17px; }
.modal-close:hover { color: var(--white); background: rgba(255, 255, 255, 0.06); }
.modal-body { padding: 6px 24px 18px; overflow-y: auto; scrollbar-width: thin; }
.modal-body label {
  display: block; font-family: var(--font); font-size: 0.82rem; font-weight: 560;
  letter-spacing: 0; text-transform: none; color: var(--t-52);
  margin: 0 0 7px;
}
.modal-body input, .modal-body textarea { margin-bottom: 16px; }
.compose-hint { margin: -10px 0 16px; font-size: 0.8rem; color: var(--t-34); min-height: 16px; line-height: 1.5; }
.compose-hint.bad { color: var(--danger); }
.compose-hint.good { color: var(--yellow); }
.modal-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 24px 20px; border-top: 1px solid var(--line); flex-shrink: 0;
}
.compose-status { font-size: 0.84rem; color: var(--t-52); }

/* ------------------------------------------------------------------ toast */

.toast {
  position: fixed; bottom: 24px; left: 50%; translate: -50% 0; z-index: 60;
  background: var(--card), var(--raise);
  border: 1px solid var(--line-firm); border-radius: 10px;
  padding: 13px 18px; font-size: 0.88rem; color: var(--t-100);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  max-width: min(540px, calc(100vw - 40px));
}
.toast.bad { border-color: rgba(232, 104, 108, 0.4); }

/* ------------------------------------------------------------------ scroll */

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 6px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); background-clip: content-box; }

/* ------------------------------------------------------------------ narrow */

/* ------------------------------------------------------------------ narrow */

.read-back { display: none; }

@media (max-width: 1100px) {
  :root { --sidebar-w: 224px; --list-w: 336px; }
  .read-col { padding-inline: 24px; }
}

/* Tablet: the sidebar keeps its rail but loses its labels and the money card,
   so the list and the message both stay usable. */
@media (max-width: 900px) {
  :root { --sidebar-w: 66px; --list-w: 300px; }
  .side-label, .sb-brand .side-title, .balance, .me-sub, .me-name { display: none; }
  .sidebar { padding: 16px 10px; align-items: center; }
  .sb-brand { padding: 0 0 16px; justify-content: center; }
  .sb-compose { width: 44px; padding: 0; }
  .sb-compose { font-size: 0; gap: 0; }
  .sb-compose .btn-icon { width: 18px; height: 18px; }
  .side-link { justify-content: center; padding: 10px; }
  .pill { position: absolute; margin-left: 26px; margin-top: -14px; font-size: 0.6rem; padding: 0 5px; }
  .sb-nav { position: relative; }
  .sb-me { margin-top: auto; display: flex; justify-content: center; }
}

/* Phone: one column. Navigation moves to a bottom bar the thumb can reach, the
   list fills the screen, and the message slides in over it.
   Before this, .read-pane was simply display:none under 640px, which meant a
   message could be tapped but never opened. */
@media (max-width: 760px) {
  .app { flex-direction: column; }

  .sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    width: auto; height: 60px;
    flex-direction: row; align-items: center; gap: 4px;
    padding: 0 10px;
    border-right: 0; border-top: 1px solid var(--line-firm);
    background: var(--panel);
  }
  .sb-brand, .balance, .sb-me { display: none; }
  .sb-nav { flex-direction: row; flex: 1; gap: 2px; }
  .side-link {
    flex-direction: column; justify-content: center; gap: 3px;
    padding: 6px 2px; font-size: 0.66rem; font-weight: 560;
    border-radius: 8px;
  }
  .side-label { display: block; flex: none; }
  .side-icon { width: 19px; height: 19px; }
  .side-link.active { background: transparent; color: var(--yellow); }
  .side-link.active .side-icon { color: var(--yellow); }
  .pill {
    position: absolute; margin: -6px 0 0 16px;
    font-size: 0.58rem; padding: 0 4px; min-width: 15px;
  }
  .sb-compose {
    order: 9; width: 44px; height: 44px; padding: 0; margin: 0;
    font-size: 0; gap: 0; border-radius: 12px; flex-shrink: 0;
  }
  .sb-compose .btn-icon { width: 19px; height: 19px; }

  .workspace { padding-bottom: 60px; }
  .list-pane { width: 100%; border-right: 0; }

  /* The message becomes a sheet over the list rather than a third column. */
  .read-pane {
    position: fixed; inset: 0; bottom: 60px; z-index: 25;
    background: var(--ground);
    transform: translateX(100%);
    transition: transform 0.26s var(--ease);
    display: flex; flex-direction: column;
  }
  .read-pane.mobile-open { transform: none; }

  .read-back {
    display: none;
    position: fixed; top: 0; left: 0; right: 0; z-index: 26;
    align-items: center; gap: 6px;
    height: 48px; padding: 0 14px;
    background: var(--panel); border: 0; border-bottom: 1px solid var(--line);
    color: var(--t-72); font-family: var(--font); font-size: 0.88rem; font-weight: 560;
    cursor: pointer;
  }
  .read-pane.mobile-open .read-back { display: flex; }
  .read-back svg { width: 18px; height: 18px; }
  .read-pane.mobile-open .read-scroll,
  .read-pane.mobile-open .settings { padding-top: 48px; }

  .read-col { padding-inline: 18px; }
  .read-head { padding-block: 22px 0; }
  .read-head h3 { font-size: 1.32rem; }
  .read-id { flex-wrap: wrap; gap: 10px; }
  .read-aside { margin-left: 0; width: 100%; padding-left: 53px; }
  .read-actions { padding-inline: 18px; }
  .read-watermark { width: 220px; opacity: 0.02; }

  .pane-head { padding: 16px 16px 10px; }
  .pane-head h2 { font-size: 1.16rem; }
  .mail-list { padding: 0 8px 12px; }
  .mail-item { padding: 12px 12px; }

  .modal { padding: 0; align-items: stretch; }
  .modal-card { max-width: none; max-height: 100vh; height: 100%; border-radius: 0; border: 0; }
  .toast { bottom: 72px; }
}

@media (max-width: 380px) {
  .side-label { font-size: 0.6rem; }
  .read-head h3 { font-size: 1.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
