:root {
  --bg: #f6f7f9;
  --panel: #fff;
  --line: #e3e6ea;
  --ink: #1d2229;
  --muted: #6b7480;
  --accent: #2f6fed;
  --err-bg: #fdecec;
  --err-ink: #b3261e;
  --ok-bg: #eaf7ee;
  --ok-ink: #1c7a3c;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.topbar .source { color: var(--muted); font-size: 12px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search input { width: 320px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; }
.upload { display: flex; align-items: center; gap: 8px; }
.btn { padding: 6px 12px; border: 1px solid var(--accent); background: var(--accent); color: #fff; border-radius: 8px; font-size: 13px; cursor: pointer; }
.btn:hover { filter: brightness(.95); }
.btn[disabled] { opacity: .6; cursor: default; }
.btn.ghost { background: transparent; color: var(--accent); }
.upload-status { color: var(--muted); font-size: 12px; max-width: 220px; }

.health { padding: 8px 16px; font-size: 13px; border-bottom: 1px solid var(--line); }
.health.error { background: var(--err-bg); color: var(--err-ink); }
.health.ok { background: var(--ok-bg); color: var(--ok-ink); }
.health .meta { color: var(--muted); margin-left: 8px; font-size: 12px; }

.panes { flex: 1; display: grid; grid-template-columns: 220px 340px 1fr; min-height: 0; }
.panes > * { overflow: auto; border-right: 1px solid var(--line); background: var(--panel); }
h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0; padding: 10px 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); }

ul { list-style: none; margin: 0; padding: 0; }
.folder { display: flex; justify-content: space-between; padding: 7px 12px; cursor: pointer; }
.folder.child { padding-left: 24px; }
.folder:hover, .msg:hover { background: #f0f3f8; }
.folder.active, .msg.active { background: #e6efff; }
.folder .count { color: var(--muted); }
.empty { padding: 12px; color: var(--muted); }

.msg { padding: 9px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.msg .row { display: flex; justify-content: space-between; gap: 8px; }
.msg .from { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg .date { color: var(--muted); font-size: 12px; white-space: nowrap; }
.msg .subject { color: #333; margin-top: 2px; }
.status { padding: 8px 12px; color: var(--muted); font-size: 12px; }

.reading { padding: 0; }
.reading .placeholder { color: var(--muted); padding: 24px; }
.reading .head { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.reading h1 { font-size: 18px; margin: 0 0 8px; }
.reading .fields div { font-size: 13px; margin: 2px 0; }
.reading .fields b { display: inline-block; width: 52px; color: var(--muted); font-weight: 600; }
.reading .atts { padding: 8px 16px; border-bottom: 1px solid var(--line); }
.reading .atts ul { padding-left: 16px; list-style: disc; }
.body { width: 100%; height: calc(100% - 120px); min-height: 300px; border: 0; }
