:root {
  --bg: #f4f6f8;
  --panel: #fff;
  --line: #d7dde3;
  --text: #17202a;
  --muted: #627080;
  --accent: #0f6b5f;
  --accent-dark: #0a5148;
  --danger: #a83232;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: Arial, Helvetica, sans-serif; }
button, input { font: inherit; }
button { border: 0; border-radius: 6px; background: var(--accent); color: #fff; cursor: pointer; padding: 10px 14px; }
button:hover { background: var(--accent-dark); }
input { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 10px; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
h1, h2, p { margin: 0; }
h1 { font-size: 22px; margin-bottom: 18px; }
h2 { font-size: 15px; }
.hidden { display: none !important; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-panel, .panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.login-panel { width: min(420px, 100%); padding: 24px; }
.login-panel form, .panel { display: grid; gap: 14px; }
.main { min-height: 100vh; display: grid; grid-template-columns: 320px minmax(0, 1fr); }
.sidebar { border-right: 1px solid var(--line); background: #eef2f4; padding: 18px; overflow: auto; }
.panel { margin-bottom: 14px; padding: 14px; }
.hint { color: var(--muted); font-size: 12px; line-height: 1.4; }
.error { color: var(--danger); min-height: 18px; }
dl { display: grid; gap: 8px; margin: 0; }
dl div { display: flex; justify-content: space-between; gap: 12px; }
dt { color: var(--muted); }
dd { margin: 0; font-weight: 700; }
.folders { display: grid; gap: 6px; }
.folder { display: flex; justify-content: space-between; border: 1px solid var(--line); border-radius: 6px; background: white; color: var(--text); padding: 8px 10px; text-align: left; }
.folder.active { border-color: var(--accent); }
.archive { min-width: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; border-bottom: 1px solid var(--line); background: var(--panel); padding: 14px; }
.content { min-height: 0; display: grid; grid-template-columns: minmax(280px, 38%) minmax(0, 1fr); }
.messages { border-right: 1px solid var(--line); background: #fbfcfd; overflow: auto; }
#messageList { list-style: none; margin: 0; padding: 0; }
.message-item { border-bottom: 1px solid var(--line); }
.message-item button { width: 100%; border-radius: 0; background: transparent; color: var(--text); text-align: left; padding: 12px 14px; }
.message-item button:hover { background: #e8f1ef; }
.subject { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader { overflow: auto; padding: 22px; background: white; }
.reader h2 { font-size: 20px; margin-bottom: 10px; }
.headers { color: var(--muted); font-size: 13px; line-height: 1.6; margin-bottom: 18px; }
.body { line-height: 1.55; white-space: pre-wrap; }
.html-body { width: 100%; min-height: 65vh; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.empty { color: var(--muted); }
@media (max-width: 820px) {
  .main, .content { grid-template-columns: 1fr; }
  .sidebar, .messages { border-right: 0; }
  .messages { max-height: 42vh; border-bottom: 1px solid var(--line); }
}
