:root {
  color-scheme: dark;
  --page: #111a16;
  --panel: #19251e;
  --raised: #24352b;
  --line: #36493e;
  --ink: #eaf5ee;
  --muted: #acc0b2;
  --mint: #bcf2cf;
  --err: #ffb6a8;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font: 16px/1.5 "Segoe UI", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--page); color: var(--ink); }
button, input, select { font: inherit; }
button, summary, select { cursor: pointer; }
button { font-weight: 650; }
button:disabled { opacity: .58; cursor: wait; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid var(--mint); outline-offset: 3px;
}
a { color: var(--mint); text-underline-offset: .2em; }
h1, h2, h3, p { margin-block: 0; }
h1, h2 { letter-spacing: -.037em; line-height: 1.12; }
h1 { font-size: clamp(2.4rem, 8vw, 3.8rem); font-weight: 620; }
h2 { font-size: clamp(1.7rem, 6vw, 2.45rem); overflow-wrap: anywhere; }
h3 { font-size: 1rem; }

.masthead, main { width: min(1120px, calc(100% - 32px)); margin-inline: auto; }
.masthead {
  min-height: 72px; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; gap: .75rem; align-items: center; font-weight: 680; letter-spacing: -.03em; }
.mark { position: relative; display: inline-block; width: 23px; height: 15px; border: 1.5px solid var(--mint); border-radius: 3px; }
.mark::after {
  content: ""; position: absolute; width: 9px; height: 9px; top: -4px; left: 5.5px;
  border: solid var(--mint); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg);
}
main { padding-block: 22px 48px; }
.gate, .sidebar, .mailbox { border: 1px solid var(--line); background: var(--panel); border-radius: 18px; }
.gate { max-width: 460px; margin: min(12vh, 100px) auto 0; padding: clamp(22px, 6vw, 40px); }
.gate h1 { margin: 8px 0 26px; }
form, .settings label { display: grid; gap: 8px; }
form button { margin-top: 6px; }
label { color: var(--muted); font-size: .88rem; }
input, select {
  color: var(--ink); background: var(--page); border: 1px solid var(--line);
  min-height: 45px; border-radius: 8px; padding: 8px 11px; width: 100%; font-size: 1rem;
}
.domain, .address { font-family: var(--mono); overflow-wrap: anywhere; }
.domain { color: var(--mint); font-size: .78rem; font-weight: 550; }
.primary, .secondary, .danger, .quiet { min-height: 44px; border-radius: 9px; padding: 8px 13px; font-size: .91rem; }
.primary { color: #15291d; background: var(--mint); border: 1px solid var(--mint); }
.primary:hover:enabled { background: #d7ffe5; }
.secondary { color: var(--mint); background: var(--raised); border: 1px solid var(--line); }
.danger { color: var(--err); background: transparent; border: 1px solid #6b4843; }
.quiet { color: var(--muted); background: transparent; border: 1px solid transparent; }
.quiet:hover, .secondary:hover, .danger:hover { background-color: var(--raised); }

.workspace { display: grid; gap: 14px; align-items: start; min-width: 0; }
.sidebar, .mailbox { min-width: 0; }
.sidebar-head, .mailbox-head, .empty, .message { padding: clamp(16px, 4vw, 30px); }
.sidebar-head h1 { margin: 6px 0 18px; }
.sidebar-head .primary { width: 100%; }
.sidebar-head .primary span { margin-right: .25em; font-size: 1.15em; }
.settings { margin-top: 13px; color: var(--muted); font-size: .86rem; }
.settings summary { padding-block: 8px; }
.settings label { margin-top: 8px; }
#inboxes { max-height: 330px; overflow: auto; padding: 0 8px; }
#inboxes:not(:empty) { border-top: 1px solid var(--line); padding-block: 8px; }
.entry {
  width: 100%; color: var(--ink); text-align: left; min-height: 54px;
  background: transparent; border: 1px solid transparent; border-radius: 9px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 12px; padding: 8px 12px;
}
.entry:hover, .entry[aria-current="true"], .entry[aria-expanded="true"] { background: var(--raised); border-color: var(--line); }
.entry-text, .entry-meta { min-width: 0; overflow-wrap: anywhere; }
.entry-meta { display: block; color: var(--muted); font-size: .78rem; font-weight: 400; }
.entry-count { color: var(--mint); font: .78rem var(--mono); white-space: nowrap; }
.mailbox { min-height: 245px; overflow: clip; }
.empty { display: grid; align-content: center; min-height: 245px; gap: 12px; }
.empty p, .empty-messages, .sender { color: var(--muted); }
.mailbox-head { border-bottom: 1px solid var(--line); }
.mailbox-head h2 { margin: 6px 0 10px; }
.address { font-size: .88rem; color: var(--mint); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.section-head { padding: 4px 14px 4px clamp(16px, 4vw, 30px); display: flex; align-items: center; justify-content: space-between; }
.empty-messages { padding: 20px clamp(16px, 4vw, 30px) 28px; }
#messages { padding: 0 8px 8px; }
.message { border-top: 1px solid var(--line); background: #152019; }
.message h3 { margin-top: 10px; font-size: 1.38rem; overflow-wrap: anywhere; }
.message .quiet { margin-left: -13px; }
.sender { padding-block: 3px 14px; overflow-wrap: anywhere; }
.mail-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.attachments { margin-bottom: 0; overflow-wrap: anywhere; }
#notice {
  position: fixed; z-index: 1; bottom: max(16px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 24px); padding: 10px 14px; background: var(--raised); color: var(--ink);
  border: 1px solid var(--line); border-radius: 9px; box-shadow: 0 8px 30px #0006;
}
#notice[data-error="true"] { border-color: #92655c; color: var(--err); }
@media (min-width: 760px) {
  main { padding-block: 32px 64px; }
  .workspace { grid-template-columns: minmax(250px, 320px) minmax(0, 1fr); gap: 16px; }
  .mailbox, .empty { min-height: 385px; }
  #inboxes { max-height: 450px; }
}
