:root {
  --paper: #f3eee4;
  --paper-2: #e7dfd1;
  --cream: #fffaf1;
  --ink: #1c1714;
  --ink-soft: #3f3832;
  --muted: #6f675e;
  --line: #ddd4c6;
  --forest: #1e4a43;
  --forest-2: #163832;
  --mist: #c5ddd6;
  --danger: #9b2c2c;
  --otp: #142e2a;
  --sans: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
  --display: "Newsreader", "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
button, [type="button"], [type="submit"] { cursor: pointer; font-family: inherit; }
button:disabled { opacity: .4; cursor: default; }
.wordmark { font-family: var(--display); font-style: italic; font-size: 2.4rem; color: var(--forest); margin: 0; }
.wordmark-sm { font-family: var(--display); font-style: italic; font-size: 1.45rem; color: var(--forest); }
.sub { color: var(--muted); margin: .4rem 0 1.4rem; }
.login { position: fixed; inset: 0; z-index: 30; min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem; background: var(--paper); }
.login-inner { width: 100%; max-width: 26rem; text-align: center; }
.card {
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 1.125rem;
  padding: 1.4rem;
  text-align: left;
  box-shadow: 0 10px 30px rgba(28, 23, 20, .06);
}
.card.sm { max-width: 22rem; }
.card.wide { width: min(36rem, 100%); max-height: 86dvh; overflow: auto; }
label { display: block; font-size: .875rem; font-weight: 500; color: var(--ink-soft); margin: .7rem 0; }
input, textarea {
  width: 100%; margin-top: .35rem; height: 2.75rem;
  border: 1px solid var(--line); border-radius: .5rem;
  background: var(--cream); color: var(--ink); padding: 0 .75rem;
  font: inherit; outline: none;
}
textarea { height: auto; padding: .6rem .75rem; font-family: var(--mono); font-size: .75rem; }
input:focus, textarea:focus { border-color: var(--forest); box-shadow: 0 0 0 3px rgba(30, 74, 67, .18); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  height: 2.75rem; padding: 0 1rem; border: 0; border-radius: .5rem;
  background: var(--forest); color: var(--cream); font-weight: 600; font-size: .9rem;
}
.btn:hover { background: var(--forest-2); }
.btn.wide { width: 100%; }
.btn.ghost, .btn.secondary { background: var(--cream); color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--paper); }
.btn.danger { background: var(--danger); color: var(--cream); }
.err { color: var(--danger); min-height: 1.2em; font-size: .85rem; }
.app {
  display: grid; grid-template-columns: 260px 340px 1fr;
  height: 100dvh; background: var(--paper);
}
.pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-right: 1px solid var(--line); }
.pane.last { border-right: 0; background: var(--cream); }
#pl { background: var(--cream); }
.pane-h {
  display: flex; align-items: center; gap: .4rem;
  height: 3.5rem; padding: 0 .75rem; border-bottom: 1px solid var(--line);
}
.pane-b { flex: 1; overflow: auto; }
.pad { padding: .75rem; }
.border-b { border-bottom: 1px solid var(--line); }
.icon {
  width: 2.5rem; height: 2.5rem; border: 0; border-radius: .5rem;
  background: transparent; color: var(--ink-soft); font-size: 1.05rem;
}
.icon:hover { background: var(--paper-2); color: var(--ink); }
.grow { flex: 1; min-width: 0; }
.cut { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muted { color: var(--muted); font-size: .75rem; }
.t { font-weight: 600; }
.row-i {
  display: flex; gap: .75rem; align-items: center;
  width: 100%; padding: .7rem 1rem; border: 0; border-bottom: 1px solid var(--line);
  background: transparent; text-align: left; color: inherit;
}
.row-i:hover { background: color-mix(in srgb, var(--cream) 70%, transparent); }
.row-i.active { background: var(--cream); box-shadow: inset 3px 0 0 var(--forest); }
.av {
  width: 2.5rem; height: 2.5rem; border-radius: 50%; flex: none;
  display: grid; place-items: center; color: #fffaf1; font-weight: 600; font-size: .9rem;
}
.unread .t { font-weight: 700; }
.badge {
  min-width: 1.2rem; padding: .1rem .4rem; border-radius: 999px;
  background: var(--forest); color: var(--cream); font-size: .7rem; font-variant-numeric: tabular-nums;
}
.otp-chip { display: inline-block; margin-top: .25rem; padding: .1rem .45rem; border-radius: 999px; background: var(--mist); color: var(--forest-2); font-family: var(--mono); font-size: .7rem; }
.empty { display: grid; place-items: center; height: 100%; color: var(--muted); text-align: center; padding: 2rem; }
.x { opacity: 0; color: var(--muted); background: none; border: 0; }
.row-i:hover .x, .row-i.active .x { opacity: 1; }
.x:hover { color: var(--danger); }
.foot { border-top: 1px solid var(--line); padding: .75rem 1rem; font-size: .75rem; color: var(--muted); }
.otp {
  background: var(--otp); color: var(--cream); border-radius: 1.125rem; padding: 1rem;
}
.otp top, .otp .row { display: flex; justify-content: space-between; align-items: center; }
.otp .code { font-family: var(--mono); font-size: 1.8rem; letter-spacing: .18em; margin: .7rem 0 .3rem; word-break: break-all; }
.otp .hint { font-size: .75rem; color: var(--mist); }
.mail-h { font-family: var(--display); font-size: 1.85rem; line-height: 1.2; margin: 0 0 .8rem; }
.mail-meta { display: flex; gap: .75rem; align-items: center; border-bottom: 1px solid var(--line); padding-bottom: 1rem; margin-bottom: 1rem; }
.tabs { display: flex; gap: .4rem; margin: .8rem 0; }
.frame { width: 100%; min-height: 20rem; border: 1px solid var(--line); border-radius: .75rem; background: #fff; }
.body-t { white-space: pre-wrap; word-break: break-word; font-family: inherit; line-height: 1.65; color: var(--ink-soft); }
.hide { display: none !important; }
.back { display: none; }
.modal {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center;
  background: rgba(28, 23, 20, .4); padding: 1rem;
}
.check { display: flex; align-items: center; gap: .5rem; }
.check input { width: auto; height: auto; margin: 0; }
.actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }
.actions.left { justify-content: flex-start; flex-wrap: wrap; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.1rem 0; }
.row { display: flex; overflow: hidden; border: 1px solid var(--line); border-radius: .5rem; }
.row input { border: 0; margin: 0; border-radius: 0; }
.affix { display: grid; place-items: center; padding: 0 .8rem; background: var(--paper); color: var(--muted); white-space: nowrap; }
#toast {
  position: fixed; top: 1rem; right: 1rem; z-index: 50;
  background: var(--cream); border: 1px solid var(--line); border-radius: .75rem;
  padding: .7rem 1rem; display: none; max-width: 22rem;
}
h3 { font-family: var(--display); font-size: 1.35rem; margin: 0 0 .6rem; }
@media (max-width: 991px) {
  .app { grid-template-columns: 1fr; }
  .pane { display: none; border-right: 0; }
  .view-addr #pa, .view-list #pl, .view-msg #pm { display: flex; }
  .back { display: inline-grid; }
  .x { opacity: 1; }
}
@media (min-width: 992px) and (max-width: 1250px) {
  .app { grid-template-columns: 230px 300px 1fr; }
}
