:root {
  color-scheme: light dark;
  --accent: #0b5cad;
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1b1b1f;
  --sub: #6b6f76;
  --line: #e3e5e8;
  --mine: #dcebfb;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111214; --card: #1c1d20; --text: #ececef; --sub: #9a9ea6; --line: #2c2e33; --mine: #1d3550; }
}
* { box-sizing: border-box; }
html, body { overflow-x: hidden; }
body { margin: 0; background: var(--bg); color: var(--text); -webkit-text-size-adjust: 100%; }
.bar {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 4px;
  padding: calc(env(safe-area-inset-top) + 6px) 8px 6px; background: var(--card); border-bottom: 1px solid var(--line);
}
.bar h1 { flex: 1; margin: 0 4px; font-size: 17px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button, select, input, textarea { font: inherit; font-size: 16px; color: var(--text); }
button { padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); }
button:disabled { opacity: 0.5; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; width: 100%; }
button.icon { border: none; background: none; font-size: 22px; padding: 4px 10px; color: var(--accent); }
main { padding: 12px 12px calc(env(safe-area-inset-bottom) + 84px); max-width: 720px; margin: 0 auto; }
.lead { font-size: 16px; margin: 32px 0 16px; text-align: center; }
.note, .banner { background: #fff7e0; color: #5c4400; border-radius: 10px; padding: 10px 12px; font-size: 14px; }
@media (prefers-color-scheme: dark) { .note, .banner { background: #3a3220; color: #f3e2b0; } }
.banner { margin-bottom: 10px; }
.list { list-style: none; margin: 0; padding: 0; background: var(--card); border-radius: 12px; overflow: hidden; }
.row { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: none; }
.row.unread .name::before { content: "● "; color: var(--accent); }
.row.unread .name, .row.bold .name { font-weight: 700; }
.rowTop { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.who { display: flex; align-items: center; gap: 6px; min-width: 0; }
.preview { margin-top: 3px; color: var(--sub); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.name { font-weight: 600; }
.sub { color: var(--sub); font-size: 13px; white-space: pre-line; }
.status { color: var(--accent); font-size: 13px; }
.warn { color: #9a5b00; font-size: 13px; white-space: pre-line; }
.empty { text-align: center; color: var(--sub); margin-top: 40px; }
.from { margin-bottom: 10px; }
.openStatus { background: var(--card); border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; }
.body { background: var(--card); border-radius: 12px; padding: 14px; white-space: pre-wrap; word-break: break-word; line-height: 1.6; }
.body.preview { white-space: normal; margin-top: 8px; }
.quote { color: var(--sub); }
img.stamp { height: 44px; vertical-align: middle; margin: 2px; }
.picture img { max-width: 100%; max-height: 360px; border-radius: 8px; border: 1px solid var(--line); margin: 4px 0; display: block; }
.sealed { background: var(--card); border-radius: 12px; padding: 24px 16px; text-align: center; }
.sealedTitle { font-size: 20px; font-weight: 700; }
.files { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.files button { width: 100%; text-align: left; }
.files button.disabled { opacity: 0.6; }
.actions { margin-top: 12px; }
.actions.sticky { position: sticky; bottom: calc(env(safe-area-inset-bottom) + 8px); }
.card { background: var(--card); border-radius: 12px; padding: 14px; margin-bottom: 12px; display: grid; gap: 8px; }
.label { font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 10px; border-radius: 16px; background: var(--bg); border: 1px solid var(--line); }
.chipX { border: none; background: none; padding: 2px 8px; font-size: 16px; color: var(--sub); }
textarea { width: 100%; border-radius: 12px; border: 1px solid var(--line); padding: 12px; background: var(--card); resize: vertical; }
.tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 0; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; }
.check input { width: 20px; height: 20px; }
.palette { background: var(--card); border-radius: 12px; padding: 8px; margin-bottom: 10px; display: flex; flex-wrap: wrap; gap: 4px; }
.stampButton { border: none; background: none; padding: 2px; }
.stampButton img { height: 40px; display: block; }
.stampButton.emoji img { height: 44px; }
#sendButton { margin-top: 4px; }
.tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.tabs button { flex: 1; padding: 8px; }
.tabs button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.pickTools { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.pickTools select { grid-column: 1 / -1; padding: 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); }
.pickTools input[type="search"] { padding: 9px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); min-width: 0; }
.pick { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.pick:last-child { border-bottom: none; }
.pick.picked { background: var(--mine); }
.pick.dim { opacity: 0.45; }
.side { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 22px; }
.pickMain { flex: 1; min-width: 0; }
.checkmark { width: 22px; text-align: center; color: var(--accent); font-weight: 700; font-size: 18px; }
.star { border: none; background: none; padding: 0; font-size: 13px; color: #e8a317; line-height: 1; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot.active { background: #22a447; }
.dot.away { background: #e8a317; }
.dot.offline { background: #fff; border: 1px solid #8a8a8a; }
.convHeader { margin-bottom: 8px; }
.conv { display: flex; flex-direction: column; gap: 8px; }
.day { align-self: center; color: var(--sub); font-size: 12px; margin-top: 6px; }
.bubble { max-width: 86%; padding: 8px 12px; border-radius: 14px; background: var(--card); line-height: 1.55; word-break: break-word; }
.bubble.mine { align-self: flex-end; background: var(--mine); }
.bubble.theirs { align-self: flex-start; }
.bubble .meta { font-size: 11px; color: var(--sub); margin-bottom: 2px; }
.bubble .text { white-space: pre-wrap; }
.linkish { border: none; background: none; padding: 4px 0; color: var(--accent); text-align: left; font-size: 14px; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 2; display: flex; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a { flex: 1; text-align: center; padding: 12px 4px; color: var(--sub); text-decoration: none; font-size: 14px; }
.tabbar a.on { color: var(--accent); font-weight: 700; }
.count { display: inline-block; margin-left: 4px; min-width: 18px; padding: 0 5px; border-radius: 9px; background: #d93025; color: #fff; font-size: 12px; line-height: 18px; }
.fab {
  position: fixed; right: 18px; bottom: calc(env(safe-area-inset-bottom) + 64px); z-index: 3; width: 54px; height: 54px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 30px; font-weight: 300; display: flex; align-items: center; justify-content: center; text-decoration: none;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
}
#signout { width: 100%; }
.version { text-align: center; margin-top: 16px; }
.error { color: #c62828; background: #fdecea; border-radius: 10px; padding: 10px 12px; margin: 0 0 12px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 130px); z-index: 4; background: #323232; color: #fff; padding: 10px 16px; border-radius: 20px; margin: 0; }
[hidden] { display: none !important; }
