:root {
  --bg: #10161c;
  --panel: #182029;
  --ink: #e8eef4;
  --muted: #8ea0b3;
  --line: #2c3a48;
  --accent: #e0a45a;
  --danger: #e07a72;
  --ok: #7dcaa5;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 "Segoe UI", sans-serif;
}
button, input, textarea, select {
  font: inherit;
  color: inherit;
}
button, .ghost {
  background: var(--accent);
  color: #1b140c;
  border: 0;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.hidden { display: none !important; }
header {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
header input { flex: 1; }
.mark { color: var(--accent); letter-spacing: 0.02em; }
input, textarea, select {
  width: 100%;
  background: #0d1318;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}
label { display: block; margin: 10px 0; color: var(--muted); }
.shell { display: grid; grid-template-columns: 220px 340px 1fr; min-height: calc(100vh - 58px); }
aside, #list, #reader { border-right: 1px solid var(--line); padding: 10px; overflow: auto; max-height: calc(100vh - 58px); }
#reader { border-right: 0; }
.folder, .msg {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--ink);
  border: 0;
  border-radius: 8px;
  padding: 8px;
  margin: 2px 0;
}
.folder.active, .msg.active, .folder:hover, .msg:hover { background: #243140; }
.msg small, .muted { color: var(--muted); }
.unread { font-weight: 700; }
.error { color: var(--danger); min-height: 1.2em; }
.ok { color: var(--ok); }
.gate { min-height: 100vh; display: grid; place-items: center; }
.card, dialog {
  width: min(560px, calc(100vw - 24px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  color: var(--ink);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.55); }
dialog header, .row { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
pre, .body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.admin { padding: 18px; display: grid; gap: 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
table { width: 100%; border-collapse: collapse; }
td, th { text-align: left; border-bottom: 1px solid var(--line); padding: 6px; vertical-align: top; }
#assist-log { max-height: 320px; overflow: auto; margin-bottom: 10px; }
.bubble { background: #101820; border-radius: 10px; padding: 8px; margin: 6px 0; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  aside, #list, #reader { max-height: none; border-right: 0; border-bottom: 1px solid var(--line); }
  #nav-toggle { display: inline-block; }
}
