:root {
  --bg: #0f1115;
  --panel: #171a21;
  --line: #2a2f3a;
  --text: #e8eaf0;
  --muted: #9aa1b0;
  --accent: #6ea8ff;
  --danger: #ff7b7b;
  --radius: 8px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; }
h1 { font-size: 22px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; margin: 0; }
.error { color: var(--danger); margin: 8px 0 0; }

label { display: block; margin: 12px 0 4px; font-size: 13px; color: var(--muted); }
input[type="text"], input[type="password"] {
  width: 100%; padding: 10px 12px; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius); font: inherit;
}
button {
  font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 8px 14px; cursor: pointer; min-height: 40px;
}
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: #0b1020; border-color: var(--accent); font-weight: 600; }
button.danger { color: var(--danger); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.card button { width: 100%; margin-top: 16px; }

.app { display: grid; grid-template-columns: 300px 1fr; min-height: 100vh; }
.sidebar { border-right: 1px solid var(--line); padding: 16px; background: var(--panel); }
.bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.new-inbox button { width: 100%; margin-top: 8px; }
.new-inbox > .small { margin-top: 6px; }
.manual { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
.manual summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.manual summary:hover { color: var(--text); }
.local-row { display: flex; align-items: center; gap: 6px; }
.local-row input { min-width: 0; }
.suffix { color: var(--muted); font-size: 13px; white-space: nowrap; }
button[disabled] { opacity: 0.6; cursor: progress; }
.list { list-style: none; margin: 16px 0 0; padding: 0; }
.list li button { width: 100%; text-align: left; margin-bottom: 6px; overflow-wrap: anywhere; }
.list li button[aria-current="true"] { border-color: var(--accent); }

.content { padding: 20px; min-width: 0; }
.empty { color: var(--muted); padding: 40px 0; text-align: center; }
.inbox-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 16px; }
.address { font-size: 20px; margin: 2px 0; overflow-wrap: anywhere; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.split { display: grid; grid-template-columns: 280px 1fr; gap: 16px; }
.messages { margin: 0; }
.messages .subject { display: block; font-weight: 600; }
.messages .meta { display: block; font-size: 13px; color: var(--muted); }
.message { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-height: 160px; min-width: 0; }
.code-box { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 12px 0; }
.code { font: 700 32px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0.08em; }
.links { padding-left: 18px; overflow-wrap: anywhere; }
.body-text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 12px 0 0; font-family: inherit; }
iframe.html-body { width: 100%; min-height: 360px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; margin-top: 12px; }
.tabs { display: flex; gap: 8px; margin-top: 12px; }
.toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 8px 14px; border-radius: var(--radius); margin: 0; }

@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .split { grid-template-columns: 1fr; }
}
