:root {
	--bg: #fff; --fg: #222; --muted: #777; --line: #e5e5e5;
	--accent: #2383e2; --danger: #e23838; --hover: #f5f5f5;
}
@media (prefers-color-scheme: dark) {
	:root { --bg: #191919; --fg: #eee; --muted: #999; --line: #333; --hover: #2a2a2a; }
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, system-ui, 'Hiragino Sans', sans-serif;
	background: var(--bg); color: var(--fg); }
#app { display: grid; grid-template-columns: 200px 360px 1fr; height: 100vh; }
#sidebar { border-right: 1px solid var(--line); padding: 12px; display: flex; flex-direction: column; gap: 6px; }
#sidebar button, #sidebar input { padding: 8px 10px; text-align: left; background: transparent;
	border: 0; color: var(--fg); border-radius: 6px; cursor: pointer; }
#sidebar button:hover { background: var(--hover); }
#sidebar .nav.active { background: var(--accent); color: #fff; }
#list { border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.list-header { padding: 8px 12px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: center; }
#btn-trash-bulk { background: var(--danger); color: #fff; border: 0; padding: 6px 10px; border-radius: 6px; cursor: pointer; }
#btn-trash-bulk:disabled { background: var(--muted); cursor: not-allowed; }
#mail-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
#mail-list li { padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; display: grid;
	grid-template-columns: auto 1fr; gap: 8px; align-items: start; }
#mail-list li.unread { font-weight: 600; }
#mail-list li.selected { background: var(--hover); }
.mail-meta .row-top { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; }
.mail-meta .row-top .date { white-space: nowrap; flex-shrink: 0; }
.mail-meta .from { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.mail-meta .subject { font-size: 14px; }
.mail-meta .preview { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis;
	white-space: nowrap; max-width: 280px; }
#detail { overflow-y: auto; padding: 16px; }
#action-bar.sticky { position: sticky; top: 0; background: var(--bg); z-index: 10; display: flex; gap: 8px;
	padding: 8px 0; border-bottom: 1px solid var(--line); }
#action-bar button { padding: 6px 12px; border: 1px solid var(--line); background: var(--bg);
	color: var(--fg); border-radius: 6px; cursor: pointer; }
#btn-trash { background: var(--danger); color: #fff; border-color: var(--danger); }
#summary-area { margin: 12px 0; border: 1px solid var(--line); border-radius: 6px; padding: 8px; }
#attachments { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
#detail-body { line-height: 1.6; }
#detail-headers { color: var(--muted); font-size: 12px; margin: 8px 0; }

/* コンポーズダイアログ */
dialog { border: 0; border-radius: 8px; padding: 16px; max-width: 600px; width: 90%; }
dialog form { display: flex; flex-direction: column; gap: 8px; }
dialog label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); }
dialog input, dialog select, dialog textarea { padding: 8px; border: 1px solid var(--line);
	border-radius: 4px; background: var(--bg); color: var(--fg); font-size: 14px; }
#c-suggestions { list-style: none; margin: 0; padding: 0; max-height: 120px; overflow-y: auto; }
#c-suggestions li { padding: 4px 8px; cursor: pointer; }
#c-suggestions li:hover { background: var(--hover); }

/* レスポンシブ */
@media (max-width: 900px) {
	#app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
	#sidebar { flex-direction: row; overflow-x: auto; }
	#list, #detail { display: none; }
	#app.show-list #list { display: flex; }
	#app.show-detail #detail { display: block; }
}