/* Thème « verre » sur la palette Catppuccin : Latte (clair), Mocha (sombre).
   Les couleurs sont en triplets RGB pour pouvoir en régler la transparence. */

:root {
  /* Latte */
  --base: 239 241 245;
  --mantle: 230 233 239;
  --crust: 220 224 232;
  --surface0: 204 208 218;
  --surface1: 188 192 204;
  --overlay0: 156 160 176;
  --text: 76 79 105;
  --subtext: 108 111 133;
  --blue: 30 102 245;
  --lavender: 114 135 253;
  --mauve: 136 57 239;
  --pink: 234 118 203;
  --teal: 23 146 153;
  --sky: 4 165 229;
  --green: 64 160 43;
  --yellow: 223 142 29;
  --peach: 254 100 11;
  --red: 210 15 57;

  --glass: rgb(var(--base) / 0.55);
  --glass-strong: rgb(var(--base) / 0.78);
  --glass-border: rgb(255 255 255 / 0.65);
  --glass-shadow: 0 8px 32px rgb(76 79 105 / 0.12);
  --field: rgb(255 255 255 / 0.55);
  --term-bg: rgb(var(--crust) / 0.75);
  --blob-opacity: 0.55;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    /* Mocha */
    --base: 30 30 46;
    --mantle: 24 24 37;
    --crust: 17 17 27;
    --surface0: 49 50 68;
    --surface1: 69 71 90;
    --overlay0: 108 112 134;
    --text: 205 214 244;
    --subtext: 166 173 200;
    --blue: 137 180 250;
    --lavender: 180 190 254;
    --mauve: 203 166 247;
    --pink: 245 194 231;
    --teal: 148 226 213;
    --sky: 137 220 235;
    --green: 166 227 161;
    --yellow: 249 226 175;
    --peach: 250 179 135;
    --red: 243 139 168;

    --glass: rgb(var(--base) / 0.5);
    --glass-strong: rgb(var(--base) / 0.82);
    --glass-border: rgb(255 255 255 / 0.08);
    --glass-shadow: 0 8px 32px rgb(0 0 0 / 0.35);
    --field: rgb(var(--crust) / 0.45);
    --term-bg: rgb(var(--crust) / 0.7);
    --blob-opacity: 0.35;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --base: 30 30 46;
  --mantle: 24 24 37;
  --crust: 17 17 27;
  --surface0: 49 50 68;
  --surface1: 69 71 90;
  --overlay0: 108 112 134;
  --text: 205 214 244;
  --subtext: 166 173 200;
  --blue: 137 180 250;
  --lavender: 180 190 254;
  --mauve: 203 166 247;
  --pink: 245 194 231;
  --teal: 148 226 213;
  --sky: 137 220 235;
  --green: 166 227 161;
  --yellow: 249 226 175;
  --peach: 250 179 135;
  --red: 243 139 168;

  --glass: rgb(var(--base) / 0.5);
  --glass-strong: rgb(var(--base) / 0.82);
  --glass-border: rgb(255 255 255 / 0.08);
  --glass-shadow: 0 8px 32px rgb(0 0 0 / 0.35);
  --field: rgb(var(--crust) / 0.45);
  --term-bg: rgb(var(--crust) / 0.7);
  --blob-opacity: 0.35;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { min-height: 100%; }
body {
  margin: 0;
  background: rgb(var(--base));
  color: rgb(var(--text));
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.mono, code, pre, .call { font-family: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace; }
code { font-size: 0.9em; padding: 0.05em 0.35em; border-radius: 5px; background: rgb(var(--surface0) / 0.6); }
.muted { color: rgb(var(--subtext)); }
.small { font-size: 0.85em; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.call { font-weight: 600; color: rgb(var(--lavender)); }
h1, h2, h3 { margin: 0 0 0.6rem; line-height: 1.25; }
h1 { font-size: 1.7rem; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; }
h3 { font-size: 0.95rem; margin-top: 1rem; color: rgb(var(--subtext)); }

/* ---- Arrière-plan ---- */
.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none;
  background: radial-gradient(ellipse at top, rgb(var(--mantle)), rgb(var(--base)) 60%, rgb(var(--crust))); }
.blob { position: absolute; border-radius: 50%; filter: blur(90px); opacity: var(--blob-opacity); }
.b1 { width: 46vmax; height: 46vmax; left: -12vmax; top: -14vmax; background: rgb(var(--mauve)); }
.b2 { width: 38vmax; height: 38vmax; right: -10vmax; top: 18vh; background: rgb(var(--blue)); }
.b3 { width: 34vmax; height: 34vmax; left: 25vw; bottom: -18vmax; background: rgb(var(--peach)); opacity: calc(var(--blob-opacity) * 0.7); }

/* ---- Verre ---- */
.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  backdrop-filter: blur(22px) saturate(160%);
}

/* ---- Barre du haut ---- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap;
  padding: 0.6rem 1rem; margin: 0.75rem; border-radius: 16px;
}
.brand { display: flex; align-items: center; gap: 0.6rem; color: inherit; text-decoration: none; }
.logo { font-size: 1.6rem; filter: drop-shadow(0 2px 6px rgb(var(--blue) / 0.4)); }
.brand-name { display: block; font-weight: 700; letter-spacing: 0.02em; }
.brand-node { display: block; font-size: 0.8rem; color: rgb(var(--subtext)); font-family: ui-monospace, Menlo, monospace; }
.account { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.who { font-weight: 600; color: rgb(var(--mauve)); font-family: ui-monospace, Menlo, monospace; font-size: 0.9rem; }

.tabs { display: flex; gap: 0.25rem; margin: 0 0.75rem 0.75rem; padding: 0.3rem; border-radius: 14px; overflow-x: auto; }
.tab {
  border: 0; background: transparent; color: rgb(var(--subtext)); font: inherit; font-weight: 500;
  padding: 0.45rem 0.9rem; border-radius: 10px; cursor: pointer; white-space: nowrap;
}
.tab:hover { color: rgb(var(--text)); background: rgb(var(--surface0) / 0.45); }
.tab.active { color: rgb(var(--base)); background: rgb(var(--mauve)); }

main { padding: 0 0.75rem 1rem; max-width: 1280px; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; animation: fade 0.2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.card { border-radius: 18px; padding: 1.1rem 1.2rem; min-width: 0; }
.view > .card + .card { margin-top: 0.9rem; }

/* ---- Accueil ---- */
.home { display: grid; gap: 0.9rem; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); align-items: start; }
.home-side, .home-main { display: grid; gap: 0.9rem; min-width: 0; }
@media (max-width: 900px) {
  .home { grid-template-columns: minmax(0, 1fr); }
  /* Sur mobile : le nœud, puis le terminal, puis les stations entendues. */
  .home-side, .home-main { display: contents; }
  .home .hero { order: 1; }
  .home .term-card { order: 2; }
  .home .chat-card { order: 3; }
  .home-side > :last-child { order: 4; }
}

.hero-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.6rem; }
.hero h1 { font-family: ui-monospace, Menlo, monospace;
  background: linear-gradient(90deg, rgb(var(--mauve)), rgb(var(--blue)));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-head p { margin: -0.4rem 0 0; }
.info { margin: 0.9rem 0 0; padding: 0.7rem 0.9rem; border-radius: 12px; background: var(--field);
  white-space: pre-wrap; font-size: 0.85rem; overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.9rem; }
.stat-chip { padding: 0.25rem 0.7rem; border-radius: 999px; background: rgb(var(--surface0) / 0.55); font-size: 0.85rem; }
.stat-chip b { color: rgb(var(--teal)); }
.ports-mini { margin-top: 0.9rem; display: grid; gap: 0.35rem; }
.port-mini { display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.7rem; border-radius: 12px; background: var(--field); }
.port-mini .port-name { font-weight: 600; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: rgb(var(--green)); box-shadow: 0 0 0 3px rgb(var(--green) / 0.2); flex: none; }
.dot.tx { background: rgb(var(--red)); box-shadow: 0 0 0 3px rgb(var(--red) / 0.25); animation: pulse 0.8s infinite alternate; }
@keyframes pulse { to { opacity: 0.4; } }

.heard-list { list-style: none; margin: 0; padding: 0; }
.heard-list li { display: flex; align-items: baseline; gap: 0.6rem; padding: 0.35rem 0.2rem; border-bottom: 1px solid rgb(var(--surface0) / 0.6); }
.heard-list li:last-child { border-bottom: 0; }

/* ---- Connexion / inscription ---- */
.auth { max-width: 520px; }
.segmented { display: inline-flex; padding: 0.25rem; border-radius: 12px; background: rgb(var(--surface0) / 0.5); margin: 0.4rem 0 1rem; }
.seg { border: 0; background: transparent; color: rgb(var(--subtext)); font: inherit; font-weight: 500;
  padding: 0.4rem 0.9rem; border-radius: 9px; cursor: pointer; }
.seg.active { background: var(--glass-strong); color: rgb(var(--text)); box-shadow: 0 1px 4px rgb(0 0 0 / 0.12); }
.form { display: grid; gap: 0.75rem; }
.form label { display: grid; gap: 0.3rem; font-size: 0.9rem; font-weight: 500; }
.form label.check { display: flex; gap: 0.5rem; align-items: flex-start; font-weight: 400; }
.form label.check input { margin-top: 0.25rem; }
.form .btn.primary { justify-self: start; }
.note { margin: 0; padding: 0.55rem 0.8rem; border-radius: 10px; font-size: 0.85rem;
  background: rgb(var(--yellow) / 0.14); border: 1px solid rgb(var(--yellow) / 0.35); }
.error { margin: 0; color: rgb(var(--red)); font-size: 0.9rem; }
.ok-text { margin: 0; color: rgb(var(--green)); font-size: 0.9rem; }

input:not([type="checkbox"]), select, textarea, .input {
  font: inherit; color: rgb(var(--text)); background: var(--field);
  border: 1px solid rgb(var(--surface1) / 0.7); border-radius: 10px; padding: 0.5rem 0.7rem; min-width: 0;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: 2px solid rgb(var(--mauve)); outline-offset: 1px;
}
input[type="checkbox"] { accent-color: rgb(var(--mauve)); }

/* ---- Boutons ---- */
.btn {
  font: inherit; font-size: 0.9rem; font-weight: 500; cursor: pointer;
  padding: 0.45rem 0.9rem; border-radius: 10px;
  color: rgb(var(--text)); background: rgb(var(--surface0) / 0.65); border: 1px solid var(--glass-border);
  transition: background 0.15s, transform 0.05s;
}
.btn:hover:not(:disabled) { background: rgb(var(--surface1) / 0.75); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { background: rgb(var(--mauve)); color: rgb(var(--base)); border-color: transparent; }
.btn.primary:hover:not(:disabled) { background: rgb(var(--lavender)); }
.btn.danger { background: rgb(var(--red) / 0.15); color: rgb(var(--red)); border-color: rgb(var(--red) / 0.35); }
.btn.danger:hover:not(:disabled) { background: rgb(var(--red) / 0.25); }
.btn.ghost { background: transparent; }
.btn.ghost:hover:not(:disabled) { background: rgb(var(--surface0) / 0.55); }
.btn.icon { padding: 0.4rem 0.6rem; line-height: 1; }
.btn.chip { padding: 0.25rem 0.65rem; font-size: 0.8rem; border-radius: 999px; }
.btn.small { padding: 0.25rem 0.6rem; font-size: 0.8rem; }
.btn.inline { margin-left: 0.6rem; padding: 0.2rem 0.6rem; font-size: 0.85rem; }

.pill { padding: 0.2rem 0.65rem; border-radius: 999px; font-size: 0.78rem; font-weight: 600;
  background: rgb(var(--surface0) / 0.6); color: rgb(var(--subtext)); white-space: nowrap; }
.pill.ok { background: rgb(var(--green) / 0.18); color: rgb(var(--green)); }
.pill.bad { background: rgb(var(--red) / 0.18); color: rgb(var(--red)); }
.tag { display: inline-block; padding: 0.05rem 0.5rem; border-radius: 6px; font-size: 0.78rem;
  background: rgb(var(--blue) / 0.15); color: rgb(var(--blue)); }
.count { color: rgb(var(--subtext)); font-weight: 400; }

.toolbar { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.toolbar h2 { margin: 0; }

/* ---- Terminal ---- */
.terminal-wrap { display: flex; flex-direction: column; }
.cmds { margin: 0 0 0.6rem; }
.terminal {
  margin: 0; height: min(60vh, 560px); overflow-y: auto; padding: 0.9rem 1rem; border-radius: 14px;
  background: var(--term-bg); border: 1px solid var(--glass-border); color: rgb(var(--text));
  font-size: 0.86rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere;
}
.terminal .sys { color: rgb(var(--mauve)); }
.term-input { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.6rem; }
.term-input input { flex: 1; font-family: ui-monospace, Menlo, monospace; }
.prompt { color: rgb(var(--mauve)); font-weight: 700; font-size: 1.2rem; }

/* ---- Administration : statut détaillé ---- */
.grid { display: grid; gap: 0.9rem; grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr)); }
.grid .wide { grid-column: 1 / -1; }
.scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.table th { text-align: left; font-weight: 600; color: rgb(var(--subtext)); font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 0.04em; padding: 0.35rem 0.5rem; border-bottom: 1px solid rgb(var(--surface1) / 0.7); }
.table td { padding: 0.4rem 0.5rem; border-bottom: 1px solid rgb(var(--surface0) / 0.6); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table th.num, .table th.center { text-align: inherit; }
.empty { color: rgb(var(--subtext)); font-style: italic; text-align: center; padding: 0.8rem; }
.row-controls { margin-bottom: 0.5rem; }
.row-controls label { display: inline-flex; gap: 0.5rem; align-items: center; font-size: 0.88rem; }

.ports { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); }
.port { padding: 0.8rem 0.9rem; border-radius: 14px; background: var(--field); border: 1px solid var(--glass-border); min-width: 0; }
.port-head { display: flex; justify-content: space-between; gap: 0.5rem; align-items: center; }
.port-name { font-weight: 600; }
.port-kind { color: rgb(var(--teal)); font-size: 0.8rem; font-weight: 600; margin-top: 0.2rem; }
.port-detail { color: rgb(var(--subtext)); font-size: 0.78rem; overflow-wrap: anywhere; }
.port-stats { display: flex; flex-wrap: wrap; gap: 0.3rem 0.9rem; margin-top: 0.5rem; font-size: 0.85rem; color: rgb(var(--subtext)); }
.port-stats b { color: rgb(var(--text)); }
.tx-badge { font-size: 0.72rem; font-weight: 700; padding: 0.1rem 0.5rem; border-radius: 6px;
  background: rgb(var(--green) / 0.18); color: rgb(var(--green)); }
.tx-badge.on { background: rgb(var(--red) / 0.2); color: rgb(var(--red)); }
.level { margin-top: 0.6rem; }
.level-bar { height: 7px; border-radius: 99px; background: rgb(var(--surface0) / 0.8); overflow: hidden; }
.level-fill { height: 100%; background: linear-gradient(90deg, rgb(var(--teal)), rgb(var(--green))); transition: width 0.4s; }
.level-fill.hot { background: rgb(var(--yellow)); }
.level-fill.clip { background: rgb(var(--red)); }
.level-label { display: flex; justify-content: space-between; font-size: 0.75rem; color: rgb(var(--subtext)); margin-top: 0.2rem; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 0.5rem; }
.stat { padding: 0.55rem 0.7rem; border-radius: 12px; background: var(--field); }
.stat-value { font-size: 1.35rem; font-weight: 700; color: rgb(var(--blue)); }
.stat-label { font-size: 0.78rem; color: rgb(var(--subtext)); }

/* ---- Moniteur ---- */
.monitor { height: min(70vh, 700px); overflow-y: auto; padding: 0.6rem 0.8rem; border-radius: 14px;
  background: var(--term-bg); border: 1px solid var(--glass-border); font-size: 0.82rem; }
.mon-line { display: flex; gap: 0.6rem; padding: 0.08rem 0; }
.mon-time, .mon-port { color: rgb(var(--overlay0)); flex: none; }
.mon-text { overflow-wrap: anywhere; min-width: 0; }
.dir { font-weight: 700; flex: none; }
.dir.rx { color: rgb(var(--green)); }
.dir.tx { color: rgb(var(--peach)); }
.legend { font-size: 0.85rem; display: inline-flex; gap: 0.7rem; }
.check { display: inline-flex; gap: 0.35rem; align-items: center; font-size: 0.9rem; }

/* ---- Utilisateurs ---- */
.users tr.inactive td { opacity: 0.5; }
.users td.actions { white-space: nowrap; text-align: right; }
.users td.actions .btn + .btn { margin-left: 0.3rem; }
.switch { position: relative; display: inline-block; width: 38px; height: 22px; vertical-align: middle; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.slider { position: absolute; inset: 0; border-radius: 99px; background: rgb(var(--surface1)); cursor: pointer; transition: background 0.15s; }
.slider::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; border-radius: 50%;
  background: rgb(var(--base)); transition: transform 0.15s; box-shadow: 0 1px 3px rgb(0 0 0 / 0.25); }
.switch input:checked + .slider { background: rgb(var(--green)); }
.switch input:checked + .slider::before { transform: translateX(16px); }
.switch input:focus-visible + .slider { outline: 2px solid rgb(var(--mauve)); outline-offset: 2px; }

/* ---- Configuration ---- */
.editor { width: 100%; min-height: 60vh; resize: vertical; font-family: ui-monospace, Menlo, monospace;
  font-size: 0.85rem; line-height: 1.5; tab-size: 2; background: var(--term-bg); }
.msg { padding: 0.55rem 0.8rem; border-radius: 10px; margin-bottom: 0.7rem; font-size: 0.9rem; }
.msg.ok { background: rgb(var(--green) / 0.15); color: rgb(var(--green)); }
.msg.err { background: rgb(var(--red) / 0.15); color: rgb(var(--red)); }

/* ---- Dialogue, superposition, pied ---- */
dialog { border-radius: 18px; padding: 1.3rem; color: rgb(var(--text)); width: min(420px, calc(100vw - 32px));
  background: var(--glass-strong); }
dialog::backdrop { background: rgb(var(--crust) / 0.45); backdrop-filter: blur(4px); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 0.5rem; }
.overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgb(var(--crust) / 0.5); backdrop-filter: blur(6px); }
.overlay-box { padding: 1.6rem 2rem; border-radius: 18px; text-align: center; max-width: 90vw; }
.spinner { width: 34px; height: 34px; margin: 0 auto 0.8rem; border-radius: 50%;
  border: 3px solid rgb(var(--surface1)); border-top-color: rgb(var(--mauve)); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.foot { text-align: center; padding: 0 1rem 1.2rem; }

@media (max-width: 600px) {
  .topbar { margin: 0.5rem; padding: 0.5rem 0.75rem; }
  .tabs { margin: 0 0.5rem 0.5rem; }
  main { padding: 0 0.5rem 1rem; }
  .card { padding: 0.9rem; }
  .brand-node { max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .terminal { height: 50vh; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---- Chat ---- */
.chat-log { height: min(45vh, 420px); overflow-y: auto; padding: 0.7rem 0.9rem; border-radius: 14px;
  background: var(--term-bg); border: 1px solid var(--glass-border); display: flex; flex-direction: column; gap: 0.3rem; }
.chat-msg { max-width: 85%; padding: 0.35rem 0.7rem; border-radius: 12px; background: rgb(var(--surface0) / 0.7);
  overflow-wrap: anywhere; align-self: flex-start; font-size: 0.92rem; }
.chat-msg .from { font-weight: 700; color: rgb(var(--lavender)); margin-right: 0.4rem; font-family: ui-monospace, Menlo, monospace; font-size: 0.85em; }
.chat-msg.mine { align-self: flex-end; background: rgb(var(--mauve) / 0.22); }
.chat-msg.private { border: 1px dashed rgb(var(--pink) / 0.7); }
.chat-sys { align-self: center; font-size: 0.8rem; color: rgb(var(--subtext)); text-align: center; white-space: pre-wrap; }
.chat-info { font-family: ui-monospace, Menlo, monospace; font-size: 0.8rem; white-space: pre-wrap; color: rgb(var(--subtext)); }

/* ---- Courrier ---- */
.badge { display: inline-block; min-width: 1.3em; padding: 0 0.4em; margin-left: 0.25rem; border-radius: 999px;
  background: rgb(var(--red)); color: rgb(var(--base)); font-size: 0.75rem; font-weight: 700; text-align: center; }
.tab.active .badge { background: rgb(var(--base)); color: rgb(var(--mauve)); }
.mail { display: grid; gap: 0.9rem; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); align-items: start; }
@media (max-width: 900px) { .mail { grid-template-columns: minmax(0, 1fr); } }
.mail .segmented { margin: 0; }
.mail-items { display: grid; gap: 0.3rem; max-height: 70vh; overflow-y: auto; }
.mail-item { display: grid; grid-template-columns: 1fr auto; gap: 0.1rem 0.6rem; text-align: left; width: 100%;
  padding: 0.55rem 0.75rem; border-radius: 12px; border: 1px solid transparent; background: var(--field);
  color: inherit; font: inherit; cursor: pointer; }
.mail-item:hover { border-color: rgb(var(--mauve) / 0.4); }
.mail-item.selected { border-color: rgb(var(--mauve)); background: rgb(var(--mauve) / 0.12); }
.mail-item .who { font-family: ui-monospace, Menlo, monospace; font-size: 0.85rem; color: rgb(var(--lavender)); }
.mail-item .when { font-size: 0.78rem; color: rgb(var(--subtext)); text-align: right; }
.mail-item .subject { grid-column: 1 / -1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-item.unread .subject { font-weight: 700; }
.mail-item.unread .who::before { content: "● "; color: rgb(var(--mauve)); }
.mail-read { min-height: 12rem; }
.mail-placeholder { text-align: center; margin: 3rem 0; }
.mail-meta { display: grid; grid-template-columns: auto 1fr; gap: 0.2rem 0.8rem; margin: 0 0 0.8rem; font-size: 0.88rem; }
.mail-meta dt { color: rgb(var(--subtext)); }
.mail-meta dd { margin: 0; font-family: ui-monospace, Menlo, monospace; overflow-wrap: anywhere; }
.mail-body { margin: 0; padding: 0.9rem 1rem; border-radius: 14px; background: var(--term-bg); border: 1px solid var(--glass-border);
  white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.88rem; max-height: 60vh; overflow-y: auto; }
dialog.compose { width: min(640px, calc(100vw - 32px)); }
.compose-body { resize: vertical; font-family: ui-monospace, Menlo, monospace; font-size: 0.88rem; }
