:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1f2328;
  --muted: #646d78;
  --line: #e2e6eb;
  --accent: #1a73e8;
  --accent-text: #ffffff;
  --unread: #eef4fe;
  --danger: #c62828;
  --alert-bg: #fdecea;
  --notice-bg: #fff8e1;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --card: #1a1f25;
    --text: #e6e9ed;
    --muted: #9aa4af;
    --line: #2a3139;
    --accent: #5b9cf5;
    --accent-text: #0b1420;
    --unread: #18263a;
    --danger: #ef6b6b;
    --alert-bg: #3a1d1d;
    --notice-bg: #3a3218;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
.top { background: var(--card); border-bottom: 1px solid var(--line); padding: 12px 16px; }
.brand { color: var(--text); font-weight: 700; text-decoration: none; font-size: 17px; }
.brand span { color: var(--accent); }
main { max-width: 860px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 20px; }
.narrow { max-width: 420px; margin: 24px auto; }
h1 { font-size: 20px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
label { display: block; margin: 12px 0; font-weight: 600; font-size: 14px; }
input { display: block; width: 100%; margin-top: 6px; padding: 10px 12px; font-size: 15px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); }
button, .btn { display: inline-block; border: 0; border-radius: 8px; padding: 10px 16px; font-size: 14px; font-weight: 600; cursor: pointer; background: var(--accent); color: var(--accent-text); text-decoration: none; }
form button[type=submit] { margin-top: 8px; }
.narrow form button { width: 100%; }
.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.danger { color: var(--danger); }
.alert { background: var(--alert-bg); padding: 10px 12px; border-radius: 8px; }
.notice { background: var(--notice-bg); padding: 8px 12px; border-radius: 8px; font-size: 14px; }
.bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.bar form { margin: 0; }
.bar form button { margin: 0; }
.actions { display: flex; gap: 8px; }
.addr { word-break: break-all; }
.list { background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.msg { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
.msg:last-child { border-bottom: 0; }
.msg:hover { background: var(--bg); }
.msg.unread { background: var(--unread); }
.msg.unread .from, .msg.unread .subject { font-weight: 700; }
.from, .subject, .snippet { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.subject, .snippet { grid-column: 1 / -1; }
.snippet { color: var(--muted); font-size: 13px; }
.bots { display: flex; gap: 8px; margin: 4px 0 8px; }
.bots .btn { flex: 1; text-align: center; }
.foot { text-align: center; padding: 8px 16px 24px; }
.clip { font-size: 11px; font-weight: 600; border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; color: var(--muted); }
.empty { padding: 24px 16px; text-align: center; color: var(--muted); margin: 0; }
.empty[hidden] { display: none; }
.live { margin: 0 0 8px; }
.msg.new { animation: arrive 3s ease-out; }
@keyframes arrive { from { background: var(--notice-bg); } to { background: var(--unread); } }
@media (prefers-reduced-motion: reduce) { .msg.new { animation: none; } }
.subject { word-break: break-word; }
h1.subject { white-space: normal; }
.meta { margin: 0 0 12px; word-break: break-all; }
iframe.body { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.atts { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.att { word-break: break-all; }
@media (max-width: 560px) {
  .card { padding: 16px; }
  iframe.body { height: 65vh; }
}
