/* Sevenomail web app: clean & modern, indigo accent, light/dark. */
:root {
  --bg: #f5f6fa;
  --panel: #ffffff;
  --panel-2: #fafbfd;
  --text: #14162b;
  --text-2: #464b66;
  --muted: #7a7f98;
  --line: #e8e9f1;
  --line-2: #f0f1f6;
  --hover: #f3f4f9;
  --brand: #4f46e5;
  --brand-hover: #4338ca;
  --brand-soft: #eef0ff;
  --brand-text: #3730a3;
  --selected: #eef0ff;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --ok: #15803d;
  --ok-soft: #e8f6ee;
  --star: #f59e0b;
  --shadow-sm: 0 1px 2px rgba(20, 22, 43, .05);
  --shadow: 0 1px 3px rgba(20, 22, 43, .06), 0 6px 16px -6px rgba(20, 22, 43, .1);
  --shadow-lg: 0 24px 48px -12px rgba(20, 22, 43, .28), 0 4px 12px rgba(20, 22, 43, .08);
  --radius: 10px;
  --radius-sm: 7px;
  --rail: 256px;
  --list: 420px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0f17;
    --panel: #161824;
    --panel-2: #1a1c2a;
    --text: #e9eaf2;
    --text-2: #b9bcd0;
    --muted: #8a8ea8;
    --line: #262838;
    --line-2: #1f2130;
    --hover: #1f2232;
    --brand: #6d68f5;
    --brand-hover: #7f7bff;
    --brand-soft: #23244a;
    --brand-text: #c7c5ff;
    --selected: #212348;
    --danger: #f87171;
    --danger-soft: #3a1d22;
    --ok: #4ade80;
    --ok-soft: #173023;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 6px 16px -6px rgba(0, 0, 0, .5);
    --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.5 Inter, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); }
[hidden] { display: none !important; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--panel); font-weight: 500; white-space: nowrap;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { background: var(--hover); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 2px 8px -2px rgba(79, 70, 229, .5); }
.btn.primary:hover { background: var(--brand-hover); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 8px;
  border: 0; background: none; color: var(--text-2);
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.on { color: var(--star); }
.icon-btn.on svg { fill: var(--star); }
.icon-btn:disabled { opacity: .4; cursor: default; }

input[type=text], input[type=email], input[type=password], input[type=search], select, textarea {
  width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--panel); outline: none; transition: border-color .12s, box-shadow .12s;
}
textarea { height: auto; padding: 10px 12px; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
label { display: block; font-size: 12px; font-weight: 500; color: var(--text-2); margin: 14px 0 6px; }
.check { display: flex; gap: 8px; align-items: center; margin: 10px 0 0; font-size: 13px; color: var(--text); font-weight: 400; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }
.muted { color: var(--muted); }
.error { color: var(--danger); font-size: 13px; min-height: 1.2em; margin-top: 8px; }

/* ---------- Auth ---------- */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; background:
  radial-gradient(900px 420px at 80% -10%, var(--brand-soft), transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 32px 28px; box-shadow: var(--shadow); }
.auth-card .logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; letter-spacing: -.02em; margin-bottom: 24px; }
.auth-card .logo b { color: var(--brand); }
.auth-card h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.02em; }
.auth-card .btn { width: 100%; height: 42px; margin-top: 20px; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: var(--rail) var(--list) 1fr; height: 100vh; height: 100dvh; }
.rail { display: flex; flex-direction: column; background: var(--panel-2); border-right: 1px solid var(--line); min-height: 0; }
.rail-top { padding: 18px 16px 10px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -.02em; color: var(--text); text-decoration: none; }
.logo img { width: 30px; height: 30px; }
.logo b { color: var(--brand); font-weight: 700; }
.compose-btn { width: 100%; height: 44px; margin-top: 18px; font-weight: 600; border-radius: 12px; }
.rail-scroll { flex: 1; overflow-y: auto; padding: 4px 10px 12px; }
.rail-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 14px 10px 6px; }
.mb { margin-bottom: 2px; }
.mb-btn, .nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; text-align: left;
  padding: 7px 10px; border-radius: 8px; color: var(--text-2); font-weight: 500; min-height: 36px;
}
.mb-btn:hover, .nav-item:hover { background: var(--hover); color: var(--text); }
.mb-btn .addr { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mb-btn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex: none; }
.mb.active > .mb-btn { color: var(--text); font-weight: 600; }
.mb.active > .mb-btn .dot { background: var(--brand); }
.nav-item { padding-left: 14px; }
.nav-item .label { flex: 1; }
.nav-item.active { background: var(--brand-soft); color: var(--brand-text); font-weight: 600; }
.badge { font-size: 12px; font-weight: 600; color: var(--brand-text); background: var(--brand-soft); border-radius: 999px; padding: 0 8px; line-height: 20px; }
.nav-item.active .badge { background: var(--panel); }
.tag { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.rail-foot { border-top: 1px solid var(--line); padding: 10px; position: relative; }
.me-btn { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 8px; border-radius: 10px; text-align: left; }
.me-btn:hover { background: var(--hover); }
.me-btn .who { flex: 1; min-width: 0; }
.me-btn .who div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-btn .who .muted { font-size: 12px; }

.popover { position: absolute; z-index: 40; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 220px; }
.rail-foot .popover { left: 10px; right: 10px; bottom: 64px; }
.popover button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 9px 10px; border-radius: 8px; text-align: left; color: var(--text); }
.popover button:hover { background: var(--hover); }
.popover hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }

/* Avatars */
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 14px; flex: none; border: 0; padding: 0; }
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.a0 { background: #6366f1; } .a1 { background: #0ea5e9; } .a2 { background: #10b981; } .a3 { background: #f59e0b; }
.a4 { background: #ec4899; } .a5 { background: #8b5cf6; } .a6 { background: #14b8a6; } .a7 { background: #ef4444; }

/* ---------- List pane ---------- */
.pane-list { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-right: 1px solid var(--line); }
.list-search { display: flex; align-items: center; gap: 8px; padding: 14px 14px 8px; }
.search { position: relative; flex: 1; }
.search svg { position: absolute; left: 11px; top: 10px; color: var(--muted); width: 18px; height: 18px; }
.search input { padding-left: 38px; background: var(--bg); border-color: transparent; height: 40px; border-radius: 10px; }
.search input:focus { background: var(--panel); }
.list-bar { display: flex; align-items: center; gap: 4px; padding: 4px 10px 8px 12px; border-bottom: 1px solid var(--line); min-height: 50px; }
.list-bar h2 { font-size: 16px; margin: 0 0 0 6px; letter-spacing: -.01em; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-bar .count { font-weight: 600; margin: 0 6px; flex: 1; }
.selbox { width: 18px; height: 18px; margin: 0 9px; accent-color: var(--brand); cursor: pointer; }
.list-scroll { flex: 1; overflow-y: auto; }
.row { display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; padding: 12px 14px 12px 12px; border-bottom: 1px solid var(--line-2); cursor: pointer; position: relative; }
.row:hover { background: var(--hover); }
.row.open { background: var(--selected); }
.row.open::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brand); }
.row.selected { background: var(--selected); }
.row .avatar { cursor: pointer; transition: transform .1s; }
.row .avatar:hover { transform: scale(1.06); }
.row.selected .avatar { background: var(--brand); }
.row-main { min-width: 0; }
.row-top { display: flex; align-items: baseline; gap: 8px; }
.row .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.row .n { color: var(--muted); font-size: 12px; margin-left: 4px; }
.row .date { font-size: 12px; color: var(--muted); white-space: nowrap; }
.row .subj { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); margin-top: 1px; }
.row .snip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13px; }
.row.unread .who, .row.unread .subj { color: var(--text); font-weight: 600; }
.row.unread .date { color: var(--brand-text); font-weight: 600; }
.row-side { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 4px; }
.row-side .icon-btn { width: 28px; height: 28px; margin-right: -6px; }
.row-side .icon-btn:not(.on) { opacity: 0; }
.row:hover .row-side .icon-btn, .row-side .icon-btn:focus-visible { opacity: 1; }
.clip { color: var(--muted); width: 14px; height: 14px; }
.empty { padding: 56px 24px; text-align: center; color: var(--muted); }
.empty svg { width: 40px; height: 40px; stroke-width: 1.5; margin-bottom: 8px; color: var(--line); }
.empty strong { display: block; color: var(--text-2); font-size: 15px; margin-bottom: 2px; }
.more { padding: 14px; text-align: center; }
.skeleton { height: 64px; margin: 10px 14px; border-radius: 8px; background: linear-gradient(90deg, var(--line-2), var(--hover), var(--line-2)); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- Reader ---------- */
.pane-reader { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--bg); }
.reader-bar { display: flex; align-items: center; gap: 2px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); min-height: 57px; }
.reader-bar .sep { width: 1px; height: 22px; background: var(--line); margin: 0 6px; }
.reader-bar .grow { flex: 1; }
.reader-scroll { flex: 1; overflow-y: auto; padding: 24px 28px 40px; }
.reader-scroll h1 { font-size: 22px; line-height: 1.3; letter-spacing: -.02em; margin: 0 0 18px; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.reader-scroll h1 .tag { font-size: 11px; }
.msg { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; box-shadow: var(--shadow-sm); overflow: hidden; }
.msg-head { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; cursor: pointer; }
.msg-head .meta { flex: 1; min-width: 0; }
.msg-head .from { font-weight: 600; }
.msg-head .from span { font-weight: 400; color: var(--muted); font-size: 13px; }
.msg-head .to, .msg-head .snip { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-head .when { color: var(--muted); font-size: 12px; white-space: nowrap; display: flex; align-items: center; gap: 2px; }
.msg.collapsed .msg-head { padding: 12px 16px; }
.msg-body { padding: 0 16px 16px 64px; }
.msg-body iframe { width: 100%; border: 0; min-height: 80px; background: #fff; border-radius: 8px; display: block; }
.atts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.att { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; text-decoration: none; color: var(--text); background: var(--panel-2); max-width: 260px; }
.att:hover { border-color: var(--brand); }
.att .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 500; }
.att .sz { color: var(--muted); font-size: 12px; }
.reply-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.reader-empty { flex: 1; display: grid; place-items: center; color: var(--muted); text-align: center; padding: 24px; }
.reader-empty img { width: 64px; height: 64px; opacity: .25; margin: 0 auto 12px; filter: grayscale(1); }

/* ---------- Composer ---------- */
.composer {
  position: fixed; right: 24px; bottom: 0; z-index: 30; width: 600px; max-width: calc(100vw - 32px); height: min(640px, calc(100vh - 48px));
  background: var(--panel); border: 1px solid var(--line); border-bottom: 0; border-radius: 14px 14px 0 0; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
}
.composer.min { height: auto; }
.composer.min .c-body, .composer.min .c-foot { display: none; }
.composer.max { right: 50%; transform: translateX(50%); bottom: 24px; width: min(960px, calc(100vw - 48px)); height: calc(100vh - 48px); border-radius: 14px; border-bottom: 1px solid var(--line); }
.c-head { display: flex; align-items: center; gap: 4px; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--line); background: var(--panel-2); border-radius: 14px 14px 0 0; cursor: pointer; }
.c-head .t { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-head .icon-btn { width: 30px; height: 30px; }
.c-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.c-field { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line-2); padding: 0 16px; min-height: 42px; }
.c-field > span { color: var(--muted); width: 54px; flex: none; font-size: 13px; }
.c-field input, .c-field select { border: 0; box-shadow: none !important; padding: 0; height: 40px; background: none; }
.c-field .links { display: flex; gap: 8px; }
.c-field .links button { border: 0; background: none; color: var(--muted); font-size: 13px; padding: 4px; }
.c-field .links button:hover { color: var(--text); }
.toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px 10px; border-bottom: 1px solid var(--line-2); }
.toolbar .icon-btn { width: 32px; height: 32px; }
.toolbar .icon-btn svg { width: 16px; height: 16px; }
.toolbar .sep { width: 1px; background: var(--line); margin: 6px 4px; }
.editor { flex: 1; overflow-y: auto; padding: 14px 16px; outline: none; line-height: 1.6; min-height: 120px; }
.editor:empty::before { content: attr(data-placeholder); color: var(--muted); }
.editor blockquote, .msg-preview blockquote { margin: 8px 0; padding-left: 12px; border-left: 3px solid var(--line); color: var(--text-2); }
.editor ul, .editor ol { padding-left: 24px; }
.editor .sig { color: var(--text-2); }
.c-files { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel-2); border-radius: 999px; padding: 3px 6px 3px 10px; font-size: 12px; max-width: 240px; }
.chip .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip button { border: 0; background: none; color: var(--muted); display: grid; place-items: center; padding: 2px; border-radius: 50%; }
.chip button:hover { background: var(--hover); color: var(--text); }
.chip button svg { width: 12px; height: 12px; }
.c-foot { display: flex; align-items: center; gap: 8px; padding: 10px 12px 12px 16px; border-top: 1px solid var(--line-2); }
.c-foot .grow { flex: 1; }
.c-foot .status { color: var(--muted); font-size: 13px; }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(12, 14, 28, .45); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .12s ease; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--panel); border-radius: 16px; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); border: 1px solid var(--line); overflow: hidden; }
.modal.wide { max-width: 720px; }
.modal header { display: flex; align-items: center; gap: 8px; padding: 16px 16px 12px 22px; }
.modal header h2 { flex: 1; margin: 0; font-size: 17px; letter-spacing: -.01em; }
.modal .m-body { padding: 0 22px 20px; overflow-y: auto; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--panel-2); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 12px; border-bottom: 2px solid transparent; color: var(--text-2); font-weight: 500; white-space: nowrap; }
.tabs button:hover { color: var(--text); }
.tabs button.active { border-color: var(--brand); color: var(--text); font-weight: 600; }
.sig-editor { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.sig-editor .editor { min-height: 140px; max-height: 260px; }

/* ---------- Admin ---------- */
.pane-admin { grid-column: 2 / -1; overflow-y: auto; background: var(--bg); }
.admin-inner { max-width: 1040px; margin: 0 auto; padding: 28px 28px 48px; }
.admin-inner > h1 { font-size: 24px; letter-spacing: -.02em; margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
.admin-inner > p { margin: 0 0 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow-sm); }
.card h3 { margin: 0 0 4px; font-size: 15px; }
.card > p { margin: 0 0 6px; font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 14px; align-items: end; }
.form-grid .btn { margin-top: 14px; }
.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow-x: auto; box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--panel-2); text-transform: uppercase; letter-spacing: .04em; }
td .muted { font-size: 12px; }
td.actions { white-space: nowrap; text-align: right; }
td.actions .btn { margin-left: 4px; }
.checks { display: flex; flex-wrap: wrap; gap: 4px; }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.pill.ok { color: var(--ok); background: var(--ok-soft); }
.pill.bad { color: var(--danger); background: var(--danger-soft); }
.pill.neutral { color: var(--text-2); background: var(--hover); }
.steps-table td:first-child { width: 28px; }

/* ---------- Misc ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #1d1f33; color: #fff; padding: 11px 18px; border-radius: 10px; z-index: 60; box-shadow: var(--shadow-lg); max-width: calc(100vw - 32px); font-weight: 500; animation: up .15s ease; }
@keyframes up { from { transform: translate(-50%, 8px); opacity: 0; } }
.fab { display: none; }
.scrim { display: none; }
.mobile-only { display: none !important; }

/* ---------- Tablet: hide reader until a conversation is open ---------- */
@media (max-width: 1180px) {
  :root { --list: 360px; }
}
/* ---------- Mobile: one pane at a time ---------- */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .mobile-only { display: inline-grid !important; }
  .desktop-only { display: none !important; }
  .rail { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 45; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  .app.drawer .rail { transform: none; }
  .app.drawer .scrim { display: block; position: fixed; inset: 0; background: rgba(12, 14, 28, .4); z-index: 44; }
  .pane-list, .pane-reader, .pane-admin { grid-column: 1; grid-row: 1; border: 0; }
  .app[data-view=reader] .pane-list, .app[data-view=list] .pane-reader { display: none; }
  .app[data-view=admin] .pane-list, .app[data-view=admin] .pane-reader { display: none; }
  .list-search { padding: 10px 10px 6px; padding-top: max(10px, env(safe-area-inset-top)); }
  .row { padding: 12px 14px; }
  .row-side .icon-btn:not(.on) { opacity: 1; }
  .reader-bar { padding: 8px; padding-top: max(8px, env(safe-area-inset-top)); }
  .reader-scroll { padding: 16px 12px 96px; }
  .msg-body { padding: 0 12px 14px; }
  .fab { display: grid; place-items: center; position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); width: 58px; height: 58px; border-radius: 18px; border: 0; background: var(--brand); color: #fff; box-shadow: 0 10px 24px -6px rgba(79, 70, 229, .6); z-index: 20; }
  .fab svg { width: 24px; height: 24px; }
  .app[data-view=admin] .fab, .app[data-view=reader] .fab { display: none; }
  .composer, .composer.max { inset: 0; width: auto; max-width: none; height: auto; border-radius: 0; transform: none; border: 0; }
  .c-head { border-radius: 0; padding-top: max(8px, env(safe-area-inset-top)); }
  .c-foot { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .admin-inner { padding: 16px 14px 48px; }
  .modal-bg { padding: 0; align-items: end; }
  .modal { max-width: none; border-radius: 16px 16px 0 0; max-height: 92vh; }
  .toast { bottom: calc(90px + env(safe-area-inset-bottom)); }
}
.rail-note { padding: 0 10px; }
.person { display: flex; gap: 10px; align-items: center; }
.domain-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.domain-bar label { margin: 0; }
.domain-bar select { width: auto; min-width: 220px; }
.addr-field { display: flex; flex-direction: column; gap: 8px; }
.addr-row { display: flex; align-items: center; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); overflow: hidden; }
.addr-row:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.addr-row input, .addr-row select { border: 0; box-shadow: none !important; border-radius: 0; }
.addr-row input { flex: 1; min-width: 80px; }
.addr-row select { width: auto; max-width: 55%; background: var(--panel-2); border-left: 1px solid var(--line); }
.addr-row .at { color: var(--muted); padding: 0 2px 0 4px; }
.form-grid .span-2 { grid-column: span 2; }
code.val { display: block; font-size: 12px; color: var(--text-2); word-break: break-all; margin-top: 4px; }
@media (max-width: 860px) { .form-grid .span-2 { grid-column: auto; } }
.gap-top { margin-top: 14px; }
.new-secret { margin-top: 14px; padding: 14px; border-radius: 10px; background: var(--ok-soft); display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.new-secret > div { flex-basis: 100%; }
code.secret { font-size: 18px; letter-spacing: .08em; font-weight: 600; background: var(--panel); padding: 6px 12px; border-radius: 8px; }
.setup-card h3 { display: flex; align-items: center; gap: 8px; }
.steps-list { margin: 8px 0; padding-left: 20px; color: var(--text-2); }
.steps-list li { margin: 4px 0; }
.qr-box { display: grid; grid-template-columns: auto 1fr; gap: 16px 20px; align-items: start; margin-top: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); }
.qr-box img { background: #fff; border-radius: 8px; image-rendering: pixelated; }
.qr-box > p { grid-column: 1 / -1; margin: 0; }
@media (max-width: 600px) { .qr-box { grid-template-columns: 1fr; } }
.sender-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
