/* kotakposku — post-office desk: paper, ink, rubber stamps, airmail stripes. */

:root {
  --paper: #f3eee4;
  --paper-2: #e9e1d2;
  --card: #fbf8f2;
  --ink: #1c1a16;
  --ink-2: #57524a;
  --ink-3: #8a8377;
  --line: #d3c8b4;
  --red: #c8361f;
  --red-soft: #f3d9d1;
  --blue: #1d4f91;
  --green: #2f6b4f;
  --ochre: #a86a12;
  --sheet: #ffffff;
  --shadow: 3px 3px 0 var(--ink);

  --pad: clamp(16px, 4vw, 40px);

  --sans: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #16140f;
    --paper-2: #211e17;
    --card: #1c1a14;
    --ink: #efe8da;
    --ink-2: #b9b1a2;
    --ink-3: #847c6e;
    --line: #3a352b;
    --red: #e2553b;
    --red-soft: #3a1d16;
    --blue: #6f9be0;
    --green: #6fb38f;
    --ochre: #d69a3c;
    --sheet: #fbf8f2;
    --shadow: 3px 3px 0 #000;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font: 400 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; color: inherit; }

[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.mono { font-family: var(--mono); }

.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- airmail strip + brand ---------- */

.airmail {
  flex: none;
  height: 7px;
  background: repeating-linear-gradient(
    -45deg,
    var(--red) 0 12px,
    var(--paper) 12px 18px,
    var(--blue) 18px 30px,
    var(--paper) 30px 36px
  );
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.stamp {
  display: grid;
  place-items: center;
  width: 34px;
  height: 40px;
  padding: 3px;
  flex: none;
  background: var(--red);
  transform: rotate(-4deg);
}

.stamp span {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border: 1.5px dashed var(--paper);
  color: var(--paper);
  font: 700 12px/1 var(--sans);
  font-stretch: 75%;
  letter-spacing: .04em;
}

.stamp-lg { width: 76px; height: 90px; padding: 6px; transform: rotate(-6deg); box-shadow: var(--shadow); }
.stamp-lg span { border-width: 2px; font-size: 26px; }

.wordmark {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  font-stretch: 112%;
  letter-spacing: -.02em;
  line-height: 1;
}

.wordmark em { font-style: normal; color: var(--red); }

.wordmark-lg { font-size: clamp(44px, 8vw, 76px); letter-spacing: -.035em; }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform .08s ease, box-shadow .08s ease, background-color .15s;
}

.btn:hover { background: var(--paper-2); }
.btn:active { transform: translate(1px, 1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-ink { background: var(--ink); color: var(--paper); box-shadow: 2px 2px 0 var(--red); }
.btn-ink:hover { background: var(--ink); box-shadow: 3px 3px 0 var(--red); }
.btn-ink:active { box-shadow: 1px 1px 0 var(--red); }

.btn-lg { min-height: 48px; padding: 0 22px; font-size: 16px; }

.btn-plain { border-color: transparent; color: var(--ink-2); }

.btn-danger { border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: var(--red-soft); }

.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--blue);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1.5px solid transparent;
  border-radius: 3px;
  background: none;
  color: var(--ink-2);
  cursor: pointer;
}

.icon-btn:hover { border-color: var(--ink); color: var(--ink); background: var(--card); }
.icon-btn:disabled { opacity: .35; pointer-events: none; }
.icon-btn.danger:hover { border-color: var(--red); color: var(--red); }

/* ---------- segmented control ---------- */

.seg {
  display: inline-flex;
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  overflow: hidden;
}

.seg button {
  min-height: 34px;
  padding: 0 14px;
  border: 0;
  background: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.seg button + button { border-left: 1.5px solid var(--ink); }
.seg button[aria-selected="true"],
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

/* ---------- label card + postmark ---------- */

.label {
  position: relative;
  padding: 22px 24px 24px;
  background: var(--card);
  border: 1.5px solid var(--ink);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.postmark {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1px;
  width: 84px;
  height: 84px;
  flex: none;
  border: 2px solid var(--red);
  border-radius: 50%;
  color: var(--red);
  text-transform: uppercase;
  text-align: center;
  line-height: 1.05;
  transform: rotate(-12deg);
  opacity: .85;
  box-shadow: inset 0 0 0 3px var(--card), inset 0 0 0 4px var(--red);
  pointer-events: none;
}

.pm-top, .pm-bot { font-size: 7px; font-weight: 700; letter-spacing: .1em; }
.pm-mid { font: 600 12px/1.1 var(--mono); padding: 2px 4px; border-block: 1px solid currentColor; white-space: nowrap; }

/* ---------- form fields ---------- */

.field { display: grid; gap: 5px; min-width: 0; }
.field-label { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }

.input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1.5px solid var(--line);
  border-radius: 3px;
  background: var(--paper);
  font-family: var(--mono);
  font-size: 15px;
}

.input:focus { border-color: var(--ink); outline: none; }

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

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 50;
  padding: 10px 16px;
  border: 1.5px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 3px 3px 0 var(--red);
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* =====================================================================
   Landing page
   ===================================================================== */

.landing {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(40px, 8vh, 88px) var(--pad) 48px;
}

.hero {
  display: grid;
  justify-items: center;
  gap: 18px;
  text-align: center;
  margin-bottom: 44px;
}

.hero-mark { display: flex; align-items: center; gap: 20px; }

.lede {
  margin: 6px 0 0;
  font-size: clamp(18px, 2.6vw, 22px);
  font-weight: 600;
  font-stretch: 105%;
}

.sub {
  margin: 0;
  max-width: 52ch;
  color: var(--ink-2);
  font-size: 16px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.card-head h2 { margin: 6px 0 0; font-size: 22px; font-weight: 800; font-stretch: 108%; }

.card-head .postmark { margin: -14px -10px -24px 0; }

/* username box + domain picker on one line, like an address label */
.addr-field {
  position: relative;
  display: flex;
  align-items: stretch;
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  background: var(--paper);
}

.addr-field:focus-within { box-shadow: 0 0 0 3px var(--red-soft); }

.addr-field input {
  flex: 1;
  min-width: 0;
  min-height: 54px;
  padding: 0 14px;
  border: 0;
  background: none;
  font: 500 18px var(--mono);
  outline: none;
}

.addr-field input[readonly] { color: var(--ink); cursor: default; }

.reroll { align-self: center; margin-right: 4px; }

.domain-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 55%;
  padding: 0 14px;
  border: 0;
  border-left: 1.5px dashed var(--ink-3);
  background: var(--paper-2);
  font: 500 16px var(--mono);
  color: var(--ink-2);
  cursor: pointer;
}

.domain-btn span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.domain-btn:hover { color: var(--ink); background: var(--line); }
.domain-btn .icon { width: 14px; height: 14px; transition: transform .15s; }
.domain-btn[aria-expanded="true"] .icon { transform: rotate(180deg); }

.domain-menu {
  position: absolute;
  right: -1.5px;
  top: calc(100% + 6px);
  z-index: 20;
  min-width: 240px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--card);
  border: 1.5px solid var(--ink);
  box-shadow: var(--shadow);
}

.domain-menu li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 2px;
  font: 500 15px var(--mono);
  cursor: pointer;
}

.domain-menu li:hover, .domain-menu li.active { background: var(--paper-2); }
.domain-menu li[aria-selected="true"]::after { content: "✓"; color: var(--red); font-family: var(--sans); font-weight: 700; }

.hint { margin: 10px 2px 0; min-height: 20px; color: var(--ink-3); font-size: 13px; }
.hint.ok { color: var(--green); }
.hint.bad { color: var(--red); }

.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-top: 18px; }

.switch { margin: 0; color: var(--ink-2); font-size: 14px; }

.login-form { display: grid; gap: 14px; }

.form-error { margin: 0; color: var(--red); font-size: 14px; }
.form-error:empty { display: none; }

/* credentials ticket shown once after creating a mailbox */
.ticket { display: grid; gap: 16px; }

.cred {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1.5px dashed var(--ink-3);
  background: var(--paper);
}

.cred dt { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.cred dd { margin: 0; min-width: 0; font: 600 17px var(--mono); overflow-wrap: anywhere; }

.creds { display: grid; gap: 8px; margin: 0; }

.warn {
  margin: 0;
  padding: 10px 14px;
  border-left: 4px solid var(--red);
  background: var(--red-soft);
  font-size: 14px;
}

.resume {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 12px 16px;
  border: 1.5px solid var(--ink);
  background: var(--paper-2);
  font-size: 14px;
}

.rules {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin: 40px 0 0;
  padding: 0;
  list-style: none;
  border-top: 1.5px solid var(--ink);
}

.rules li { padding: 16px 16px 0 0; color: var(--ink-2); font-size: 14px; }
.rules li + li { padding-left: 16px; border-left: 1px dashed var(--line); }
.rules strong { display: block; margin-bottom: 4px; color: var(--ink); font: 600 20px var(--mono); }

.foot {
  padding: 18px var(--pad) 28px;
  border-top: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 13px;
  text-align: center;
}

.foot p { margin: 0; }

@media (max-width: 600px) {
  .hero-mark { flex-direction: column; gap: 16px; }
  .rules { grid-template-columns: 1fr; }
  .rules li + li { padding-left: 0; border-left: 0; border-top: 1px dashed var(--line); }
  .rules li { padding-bottom: 14px; }
  .addr-field { flex-wrap: wrap; }
  .addr-field input { flex-basis: 70%; }
  .domain-btn { flex: 1 0 100%; max-width: none; min-height: 46px; border-left: 0; border-top: 1.5px dashed var(--ink-3); justify-content: space-between; }
  .domain-menu { left: -1.5px; right: -1.5px; }
  .cred { grid-template-columns: 1fr auto; }
  .cred dt { grid-column: 1 / -1; }
  .card-head .postmark { width: 70px; height: 70px; }
}

/* =====================================================================
   Mail dashboard
   ===================================================================== */

body.app { height: 100vh; height: 100dvh; overflow: hidden; }

.mbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 18px;
  height: 64px;
  padding: 0 16px;
  border-bottom: 1.5px solid var(--ink);
  background: var(--paper);
}

.mbar .brand { width: 210px; flex: none; }

.search {
  flex: 1;
  min-width: 0;
  max-width: 560px;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 14px;
  border: 1.5px solid var(--line);
  border-radius: 3px;
  background: var(--card);
  color: var(--ink-3);
}

.search:focus-within { border-color: var(--ink); color: var(--ink); }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 15px; }

.mbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.expiry-chip {
  padding: 5px 10px;
  border: 1.5px solid var(--red);
  border-radius: 99px;
  color: var(--red);
  font: 600 12px var(--mono);
  white-space: nowrap;
}

.account { position: relative; }

.avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: var(--card);
  font: 800 16px var(--sans);
  cursor: pointer;
  box-shadow: inset 0 0 0 3px var(--card), inset 0 0 0 4px var(--ink-3);
}

.account-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 30;
  width: 290px;
  padding: 14px;
  background: var(--card);
  border: 1.5px solid var(--ink);
  box-shadow: var(--shadow);
}

.account-menu .who { display: grid; gap: 2px; padding-bottom: 12px; margin-bottom: 8px; border-bottom: 1px dashed var(--line); }
.account-menu .who strong { font-size: 15px; }
.account-menu .who span { color: var(--ink-2); font: 400 13px var(--mono); overflow-wrap: anywhere; }

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 8px;
  border: 0;
  border-radius: 2px;
  background: none;
  text-align: left;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.menu-item:hover { background: var(--paper-2); }
.menu-item.danger { color: var(--red); }

.mail {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 240px minmax(300px, 380px) minmax(0, 1fr);
}

/* ---------- sidebar ---------- */

.side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 16px 0 0;
  border-right: 1px solid var(--line);
  background: var(--paper);
  overflow-y: auto;
}

.side-cta { margin: 0 14px; min-height: 44px; }

.side-address {
  margin: 10px 16px 14px;
  color: var(--ink-2);
  font-size: 12px;
  overflow-wrap: anywhere;
  text-align: center;
}

.folders { display: grid; padding: 10px 0; border-top: 1px solid var(--line); }

.folder {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 16px;
  border: 0;
  background: none;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  position: relative;
}

.folder:hover { background: var(--paper-2); }

.folder[aria-current="page"] { background: var(--paper-2); font-weight: 800; }
.folder[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 4px; background: var(--red); }

.badge {
  margin-left: auto;
  min-width: 22px;
  padding: 0 7px;
  border-radius: 99px;
  background: var(--ink);
  color: var(--paper);
  font: 600 11px/1.7 var(--mono);
  text-align: center;
}

.badge:empty { display: none; }
.badge.quiet { background: none; color: var(--ink-3); }

.side-foot { margin-top: auto; padding: 16px; border-top: 1px solid var(--line); }

.life-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.life-head strong { font-size: 14px; }
.life-head span { color: var(--ink-2); font: 500 12px var(--mono); }

.bar { height: 8px; border: 1.5px solid var(--ink); background: var(--card); }
.bar span { display: block; height: 100%; background: repeating-linear-gradient(-45deg, var(--red) 0 5px, var(--ochre) 5px 10px); transition: width .4s; }

.life p { margin: 10px 0 0; color: var(--ink-3); font-size: 12px; line-height: 1.45; }

/* ---------- message list ---------- */

.list {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: var(--card);
}

.list-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 8px 12px 8px 16px;
  border-bottom: 1.5px solid var(--ink);
}

.list-head h2 { margin: 0; font-size: 17px; font-weight: 800; font-stretch: 108%; }
.list-head .tools { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.list-head .btn { min-height: 32px; padding: 0 10px; font-size: 13px; }

.check { display: inline-grid; place-items: center; width: 22px; height: 22px; flex: none; cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--red); cursor: pointer; }

.letters { flex: 1; min-height: 0; margin: 0; padding: 0; list-style: none; overflow-y: auto; }

.row {
  display: grid;
  grid-template-columns: 22px 38px minmax(0, 1fr);
  gap: 0 12px;
  align-items: start;
  padding: 13px 14px 13px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  position: relative;
}

.row:hover { background: var(--paper); }
.row.selected { background: var(--paper-2); }
.row.open { background: var(--paper-2); box-shadow: inset 0 0 0 1.5px var(--ink); }

.row.unread::before { content: ""; position: absolute; left: 0; top: 13px; bottom: 13px; width: 4px; background: var(--red); }

.row .check { margin-top: 8px; }

.who-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  font: 800 15px var(--sans);
  box-shadow: inset 0 0 0 3px var(--card), inset 0 0 0 4px currentColor;
  opacity: .9;
}

.c0 { color: var(--red); } .c1 { color: var(--blue); } .c2 { color: var(--green); } .c3 { color: var(--ochre); }

.row-body { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1px 10px; }

.r-from, .r-subject, .r-preview { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.r-from { font-weight: 500; }
.r-time { color: var(--ink-3); font: 400 12px/1.8 var(--mono); }
.r-subject { grid-column: 1 / -1; font-size: 14px; }
.r-preview { grid-column: 1 / -1; color: var(--ink-2); font-size: 13px; }
.r-meta { grid-column: 1 / -1; display: flex; gap: 10px; margin-top: 3px; color: var(--ink-3); font: 400 11px var(--mono); }
.r-meta .soon { color: var(--red); }

.unread .r-from, .unread .r-subject { font-weight: 800; }

.row.fresh { animation: drop .5s cubic-bezier(.2, .8, .3, 1); }

@keyframes drop {
  from { opacity: 0; transform: translateY(-8px); background: var(--red-soft); }
  to { opacity: 1; transform: none; }
}

.list-empty {
  flex: 1;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 6px;
  padding: 32px 24px;
  color: var(--ink-3);
  text-align: center;
  font-size: 14px;
}

.list-empty strong { color: var(--ink); font-size: 15px; }
.list-empty p { margin: 0; max-width: 30ch; }

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

.reader {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--paper);
}

.reader-empty {
  flex: 1;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  padding: 40px 24px;
  color: var(--ink-3);
  text-align: center;
  background-image: radial-gradient(var(--line) 1px, transparent 1px);
  background-size: 18px 18px;
}

.reader-empty p { margin: 0; padding: 4px 10px; background: var(--paper); color: var(--ink); font-weight: 700; font-size: 17px; }

.envelope {
  width: 120px;
  fill: none;
  stroke: var(--ink-3);
  stroke-width: 1.5;
  stroke-linejoin: round;
  background: var(--paper);
}

.env-stamp { stroke: var(--red); stroke-dasharray: 2 2; }

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

.toolbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 56px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
  overflow-x: auto;
}

.toolbar .sep { width: 1px; height: 22px; margin: 0 6px; background: var(--line); flex: none; }
.toolbar .icon-btn[aria-pressed="true"] { border-color: var(--ink); color: var(--paper); background: var(--ink); }
.toolbar .back { display: none; }

.letter-scroll { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }

.letter-head { padding: 22px 28px 16px; }

.subject {
  margin: 0 0 14px;
  font-size: clamp(20px, 2.2vw, 26px);
  font-weight: 800;
  font-stretch: 105%;
  line-height: 1.2;
  letter-spacing: -.01em;
  overflow-wrap: anywhere;
}

.meta { display: grid; gap: 4px; margin: 0; font-size: 14px; }
.meta div { display: grid; grid-template-columns: 78px 1fr; gap: 8px; }
.meta dt { color: var(--ink-3); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; line-height: 1.9; }
.meta dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.meta .mono { font-size: 13px; color: var(--ink-2); }

.spam-note {
  margin: 14px 0 0;
  padding: 8px 12px;
  border-left: 4px solid var(--ochre);
  background: var(--paper-2);
  font-size: 13px;
}

.files { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; }
.files:empty { display: none; }

.files a {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  max-width: 100%;
  padding: 6px 10px;
  border: 1px dashed var(--ink-3);
  border-radius: 3px;
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
}

.files a:hover { border-style: solid; border-color: var(--ink); }
.files .name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; max-width: 240px; }
.files .size { color: var(--ink-3); font: 400 11px var(--mono); }

.paper {
  flex: 1;
  display: flex;
  min-height: 460px;
  padding: 0 20px 20px;
}

.paper iframe, .plain {
  flex: 1;
  width: 100%;
  margin: 0;
  border: 1px solid var(--line);
  background: var(--sheet);
  box-shadow: 2px 2px 0 var(--line);
}

.plain {
  padding: 20px;
  overflow: auto;
  color: #1c1a16;
  font: 400 13px/1.6 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---------- new-mail pop-ups (top right, under the bar) ---------- */

.notices {
  position: fixed;
  top: 84px;
  right: 16px;
  z-index: 45;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.notice {
  position: relative;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 2px 12px;
  align-items: start;
  padding: 16px 10px 14px 14px;
  border: 1.5px solid var(--ink);
  background: var(--card);
  box-shadow: var(--shadow);
  cursor: pointer;
  pointer-events: auto;
  animation: notice-in .35s cubic-bezier(.2, .9, .3, 1.2);
}

/* airmail edge along the top, like the envelope it is */
.notice::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 5px;
  background: repeating-linear-gradient(-45deg, var(--red) 0 8px, var(--card) 8px 12px, var(--blue) 12px 20px, var(--card) 20px 24px);
}

.notice:hover { background: var(--paper); }

.notice.leaving { animation: notice-out .25s ease forwards; }

.notice .who-mark { grid-row: span 3; margin-top: 2px; }

.n-eyebrow { font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--red); }
.n-from, .n-subject { grid-column: 2; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.n-from { font-weight: 800; font-size: 14px; }
.n-subject { color: var(--ink-2); font-size: 13px; }

.n-close { grid-column: 3; grid-row: 1 / span 3; width: 28px; height: 28px; margin: -6px -2px 0 0; }
.n-close .icon { width: 15px; height: 15px; }

/* time-left bar so people can see when it goes away */
.n-timer {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 100%;
  background: var(--ink-3);
  transform-origin: left;
  animation: notice-timer var(--life, 7s) linear forwards;
}

.notice:hover .n-timer { animation-play-state: paused; }

@keyframes notice-in { from { opacity: 0; transform: translate(24px, -6px) rotate(1.5deg); } to { opacity: 1; transform: none; } }
@keyframes notice-out { to { opacity: 0; transform: translateX(30px); } }
@keyframes notice-timer { to { transform: scaleX(0); } }

#btn-sound[aria-pressed="false"] { color: var(--ink-3); }

/* ---------- expired / signed-out overlay ---------- */

.gate {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
}

.gate .label { max-width: 440px; text-align: center; display: grid; gap: 14px; justify-items: center; }
.gate h2 { margin: 0; font-size: 22px; font-weight: 800; }
.gate p { margin: 0; color: var(--ink-2); }

/* ---------- dashboard responsive ---------- */

.nav-toggle { display: none; }

@media (max-width: 1100px) {
  .mail { grid-template-columns: 210px minmax(280px, 340px) minmax(0, 1fr); }
  .mbar .brand { width: auto; }
  .expiry-chip { display: none; }
}

@media (max-width: 820px) {
  .mbar { gap: 8px; padding: 0 10px; }
  .mbar-right { gap: 2px; }
  .notices { right: 8px; left: 8px; width: auto; top: 80px; }
  .search { padding: 0 10px; }
  .mbar .brand .wordmark { display: none; }
  .nav-toggle { display: inline-grid; }

  .mail { grid-template-columns: 1fr; }

  .side {
    position: fixed;
    left: 0;
    top: 71px;
    bottom: 0;
    z-index: 25;
    width: min(280px, 86vw);
    border-right: 1.5px solid var(--ink);
    box-shadow: var(--shadow);
    transform: translateX(-105%);
    transition: transform .2s ease;
  }

  body.nav-open .side { transform: none; }

  .reader { display: none; }
  body.reading .list { display: none; }
  body.reading .reader { display: flex; }
  .toolbar .back { display: inline-grid; }

  .letter-head { padding: 18px 16px 14px; }
  .paper { padding: 0 10px 10px; min-height: 60vh; }
}

/* =====================================================================
   Admin
   ===================================================================== */

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.admin-top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px var(--pad);
  border-bottom: 1.5px solid var(--ink);
}

.admin-top .btn { margin-left: auto; }

.tag {
  padding: 3px 10px;
  border: 1.5px solid var(--red);
  color: var(--red);
  font: 700 11px var(--sans);
  letter-spacing: .14em;
  text-transform: uppercase;
  transform: rotate(-3deg);
}

.admin-gate { flex: 1; display: grid; place-items: start center; padding: clamp(40px, 10vh, 100px) var(--pad); }
.admin-gate .label { width: min(440px, 100%); }

.admin {
  flex: 1;
  display: grid;
  gap: 28px;
  align-content: start;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px var(--pad) 56px;
}

/* grid items may shrink, so wide tables scroll inside their card instead of widening the page */
.admin > * { min-width: 0; }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 0; padding: 0; list-style: none; }

.tile {
  display: grid;
  gap: 2px;
  padding: 16px 18px;
  border: 1.5px dashed var(--ink-3);
  background: var(--card);
}

.tile-num { font: 600 34px/1.1 var(--mono); }
.tile-label { color: var(--ink-2); font-size: 13px; font-weight: 600; letter-spacing: .04em; }

.add-form { display: flex; gap: 12px; flex-wrap: wrap; }
.add-form .addr-field { flex: 1 1 320px; }
.add-form .at { display: grid; place-items: center; padding: 0 2px 0 14px; color: var(--ink-3); font: 500 18px var(--mono); }
.add-form .addr-field input { padding-left: 4px; }

.domains-card { border: 1.5px solid var(--ink); background: var(--card); box-shadow: var(--shadow); }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1.5px solid var(--ink);
}

.section-head h2 { margin: 0; font-size: 18px; font-weight: 800; font-stretch: 108%; }

/* positioned so the absolutely placed .sr header labels scroll and clip with the table */
.table-wrap { position: relative; overflow-x: auto; }

.dtable { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 14px; }
.dtable th { padding: 10px 18px; text-align: left; color: var(--ink-3); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; border-bottom: 1px solid var(--line); }
.dtable td { padding: 14px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.dtable tr:last-child td { border-bottom: 0; }
.dtable tr.paused td:first-child .d-name { color: var(--ink-3); text-decoration: line-through; text-decoration-thickness: 1px; }
.dtable .num { text-align: right; font-family: var(--mono); }
.dtable .d-name { font: 600 15px var(--mono); }
.dtable .muted { color: var(--ink-3); font-size: 13px; }
.dtable .row-actions { display: flex; justify-content: flex-end; gap: 4px; }

/* on/off switch drawn as a rubber stamp slider */
.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; font-weight: 600; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle .track { position: relative; width: 40px; height: 22px; border: 1.5px solid var(--ink); border-radius: 99px; background: var(--paper-2); transition: background .15s; }
.toggle .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%; background: var(--ink); transition: transform .15s; }
.toggle input:checked + .track { background: var(--green); }
.toggle input:checked + .track::after { transform: translateX(18px); background: var(--card); }
.toggle input:focus-visible + .track { outline: 2px solid var(--blue); outline-offset: 2px; }

.mx { display: inline-block; padding: 2px 9px; border: 1.5px solid currentColor; border-radius: 99px; font: 600 11px var(--mono); white-space: nowrap; }
.mx.cloudflare { color: var(--green); }
.mx.other { color: var(--ochre); }
.mx.none, .mx.error { color: var(--red); }
.mx.checking { color: var(--ink-3); border-style: dashed; }

.list-empty-admin { margin: 0; padding: 28px 18px; color: var(--ink-3); text-align: center; }

.guide .card-head { margin-bottom: 8px; }
.steps { margin: 0; padding-left: 22px; display: grid; gap: 12px; color: var(--ink-2); }
.steps li::marker { font: 600 14px var(--mono); color: var(--red); }
.steps strong { color: var(--ink); }

.copy-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
  padding: 6px 6px 6px 12px;
  border: 1px dashed var(--ink-3);
  background: var(--paper);
  font-size: 13px;
}

.copy-line code { font: 500 13px var(--mono); color: var(--ink); overflow-wrap: anywhere; }
.copy-line .icon-btn { margin-left: auto; width: 30px; height: 30px; }

/* mailboxes: search + new in the section head, editor panel above the list */
.mb-tools { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.mb-search { width: 240px; min-height: 38px; font-size: 14px; }

.mb-panel .card-head h2 .mono { font-size: 19px; overflow-wrap: anywhere; }
.mb-form { display: grid; gap: 18px; }
.mb-form .hint { margin-top: 4px; min-height: 0; }
.mb-form .addr-field input { min-height: 46px; padding-right: 4px; font-size: 16px; }
.mb-form .at { display: grid; place-items: center; padding: 0 12px 0 2px; color: var(--ink-3); font: 500 17px var(--mono); }

.domain-select {
  max-width: 55%;
  padding: 0 12px;
  border: 0;
  border-left: 1.5px dashed var(--ink-3);
  background: var(--paper-2);
  color: var(--ink-2);
  font: 500 15px var(--mono);
  cursor: pointer;
}

.pw-row { display: flex; gap: 8px; }
.pw-row .input { flex: 1; min-width: 0; }
.expiry-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.expiry-row .input { flex: 0 1 240px; }
.expiry-row .seg { max-width: 100%; overflow-x: auto; }
.mb-result { margin-top: 20px; }

.dtable .mb-left { display: block; font: 600 14px var(--mono); }
.dtable .mb-left.soon { color: var(--red); }
.dtable .mb-date { display: block; font-size: 12px; }
.list-more { margin: 0; padding: 12px 18px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 13px; }

/* like the sign-up domain picker: the domain drops to its own row on phones */
@media (max-width: 600px) {
  .domain-select { flex: 1 0 100%; max-width: none; min-height: 44px; border-left: 0; border-top: 1.5px dashed var(--ink-3); }
}

@media (max-width: 700px) {
  .tiles { grid-template-columns: 1fr; }
  .tile { grid-template-columns: auto 1fr; align-items: baseline; gap: 12px; }
  .tile-num { font-size: 26px; }
  .section-head { flex-wrap: wrap; }
  .mb-tools { width: 100%; }
  .mb-search { flex: 1; width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
