:root {
  --bg: #f6f7f9; --panel: #ffffff; --text: #1a1d23; --muted: #5f6672; --line: #d9dde3; --field-line: #aab2bf; --accent: #0068b7;
  --warn: #b42318; --ok: #1a7f37; --pending: #9a6700; --sel: #e8f1fa;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #14161a; --panel: #1a1d23; --text: #e8eaee; --muted: #a0a7b2; --line: #333842; --field-line: #4b5363; --accent: #5aa7e6;
    --warn: #ff7b72; --ok: #56d364; --pending: #e3b341; --sel: #1f2c3a; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Meiryo", sans-serif; }
.bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; padding: 0.6rem 1rem; background: var(--panel); border-bottom: 1px solid var(--line); }
.app-title { font-size: 1.05rem; }
.store-pick { display: flex; align-items: center; gap: 0.5rem; }
.store-pick select { max-width: 60vw; padding: 0.3rem 0.5rem; border: 1px solid var(--field-line); border-radius: 6px; background: var(--panel); color: var(--text); font: inherit; }
.unread { color: var(--muted); font-size: 0.9rem; white-space: nowrap; }
.who { display: flex; align-items: center; gap: 0.75rem; color: var(--muted); overflow-wrap: anywhere; }
button { font: inherit; cursor: pointer; }
button:disabled { opacity: 0.5; cursor: default; }
.tool { padding: 0.3rem 0.8rem; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); }
.primary { padding: 0.5rem 1.2rem; border: 0; border-radius: 6px; background: var(--accent); color: #fff; }
.gate { max-width: 28rem; margin: 4rem auto; padding: 2rem; text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.panes { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 1rem; padding: 1rem; min-height: calc(100vh - 3.2rem); }
.list, .detail { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 0.5rem; overflow: auto; }
.detail { padding: 1rem; }
.mails { list-style: none; margin: 0; padding: 0; }
.mails button { display: block; width: 100%; padding: 0.6rem 0.7rem; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); text-align: left; }
.mails button[aria-current="true"] { background: var(--sel); }
.mail-top { display: flex; justify-content: space-between; gap: 0.5rem; color: var(--muted); font-size: 0.85rem; }
.mail-top > :first-child { min-width: 0; overflow-wrap: anywhere; }
.mail-top > :last-child { flex: none; }
.mail-subject { font-weight: 600; overflow-wrap: anywhere; }
.badge { display: inline-block; padding: 0 0.45rem; border-radius: 999px; border: 1px solid currentColor; font-size: 0.8rem; white-space: nowrap; }
.badge.ok { color: var(--ok); } .badge.warn { color: var(--warn); } .badge.pending { color: var(--pending); } .badge.muted { color: var(--muted); }
.status { color: var(--muted); }
.back { margin-bottom: 0.75rem; }
.detail h1 { margin: 0 0 0.5rem; font-size: 1.1rem; overflow-wrap: anywhere; }
.rows { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.3rem 1rem; margin: 0 0 1rem; }
.rows > div { display: contents; }
.rows dt { color: var(--muted); }
.rows dd { margin: 0; overflow-wrap: anywhere; }
.body { white-space: pre-wrap; overflow-wrap: anywhere; padding: 0.75rem; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; }
.link { padding: 0; border: 0; background: none; color: var(--accent); text-decoration: underline; text-align: left; overflow-wrap: anywhere; }
.atts { list-style: none; padding: 0; }
.atts li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; padding: 0.4rem 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.thread { list-style: none; padding: 0; }
.thread li { margin: 0.5rem 0 0.5rem 2rem; padding: 0.6rem 0.8rem; border: 1px solid var(--line); border-radius: 8px; background: var(--sel); }
.thread .meta { color: var(--muted); font-size: 0.85rem; margin-bottom: 0.3rem; }
.reply-box { margin-top: 1rem; }
.reply-text { display: block; width: 100%; min-height: 8em; padding: 0.6rem 0.7rem; border: 1px solid var(--field-line); border-radius: 6px; background: var(--panel); color: var(--text); font: inherit; resize: vertical; }
.reply-text:focus { border-color: var(--accent); outline: 0.15em solid var(--sel); }
.hint { color: var(--muted); font-size: 0.85rem; }
.actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 0.6rem; }
.sheet { width: min(40rem, 94vw); max-height: 90vh; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); }
.sheet::backdrop { background: rgb(0 0 0 / 0.4); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 0.6rem 1rem; border-bottom: 1px solid var(--line); }
.sheet-head h2 { margin: 0; font-size: 1rem; }
.sheet-body { padding: 1rem; }
.link-url { overflow-wrap: anywhere; font-family: ui-monospace, monospace; padding: 0.5rem; background: var(--bg); border-radius: 6px; }
.viewer { width: min(60rem, 96vw); }
.viewer-bar { display: flex; align-items: center; justify-content: center; gap: 1rem; padding: 0.5rem; }
.viewer-body { padding: 0.5rem; text-align: center; }
.viewer-body img { max-width: 100%; height: auto; background: #fff; }
@media (max-width: 800px) {
  .panes { grid-template-columns: minmax(0, 1fr); padding: 0.5rem; gap: 0.5rem; }
  .panes.reading .list { display: none; }
  .panes:not(.reading) .detail { display: none; }
}
@media (min-width: 801px) { .back { display: none; } }
