/* Bookbot control panel: dark theme, no external fonts or CSS. */
:root {
  --bg: #17131f;
  --panel: #211b2c;
  --panel-2: #2a2238;
  --line: #3a3049;
  --text: #ece7f3;
  --muted: #a59bb5;
  --accent: #c48a4a;      /* the bot's book-card tan */
  --accent-2: #8f6bd0;    /* the bot's spoiler purple */
  --good: #5fbf7f;
  --warn: #e0b04a;
  --bad: #e06464;
  --radius: 10px;
  font-size: 15px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  display: flex;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.45;
}

a { color: var(--accent); }
code, pre, .logbox { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.88em; }
code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.bad-text { color: var(--bad); }
.hidden { display: none !important; }
.right { text-align: right; }

/* ---------- sidebar ---------- */
.sidebar {
  width: 230px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  overflow-y: auto;
}
.brand { display: flex; gap: 10px; align-items: center; margin: 0 6px 18px; }
.brand img { width: 42px; height: 42px; border-radius: 50%; }
.brand-name { font-weight: 700; }
.brand-state { font-size: 0.82em; color: var(--muted); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.good { background: var(--good); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }

nav a {
  display: block;
  padding: 7px 10px;
  border-radius: 7px;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}
nav a:hover { background: var(--panel-2); }
nav a.active { background: var(--accent-2); color: #fff; }
.nav-group {
  margin: 16px 10px 6px;
  font-size: 0.75em;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.server-picker select { width: 100%; margin-bottom: 6px; }
.sidebar { display: flex; flex-direction: column; }
.sidebar nav { flex: 1; }
.sidebar-footer { margin-top: 18px; padding: 12px 6px 0; border-top: 1px solid var(--line); }
.btn.full { width: 100%; }

/* ---------- main ---------- */
main { flex: 1; overflow-y: auto; padding: 22px 28px 60px; min-width: 0; }
header h1 { margin: 0 0 16px; font-size: 1.5em; }
.banner {
  background: var(--panel-2);
  border: 1px solid var(--accent-2);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 16px;
}
.banner.warn { border-color: var(--warn); }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
}
.card h2 { margin: 0 0 10px; font-size: 1.15em; }
.card h3 { margin: 18px 0 8px; font-size: 0.95em; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.tile-value { font-size: 1.3em; font-weight: 700; }
.tile-label { color: var(--muted); font-size: 0.85em; }
.tile.good .tile-value { color: var(--good); }
.tile.warn .tile-value { color: var(--warn); }
.tile.bad .tile-value { color: var(--bad); }

/* ---------- forms ---------- */
input, select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 9px;
  font: inherit;
  min-width: 0;
}
input:focus, select:focus { outline: 2px solid var(--accent-2); outline-offset: 0; }
input.narrow { width: 90px; }
input.wide { width: min(460px, 100%); }
.good-text { color: var(--good); }
.test-out { margin-top: 10px; min-height: 1.4em; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { font-size: 0.85em; color: var(--muted); }
.field small { color: var(--muted); font-size: 0.78em; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-bottom: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.row.tight { gap: 6px; justify-content: flex-end; align-items: center; }
.check { display: flex; gap: 6px; align-items: center; color: var(--muted); }

.btn {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 14px;
  font: inherit;
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: 0.5; cursor: wait; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1b140c; font-weight: 600; }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn.danger:hover { background: var(--bad); color: #fff; }
.btn.small { padding: 4px 10px; font-size: 0.88em; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 0.8em; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
tr:last-child td { border-bottom: none; }
.thumb { width: 34px; height: 50px; object-fit: cover; border-radius: 3px; }

.bar { display: inline-block; width: 160px; height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; vertical-align: middle; }
.bar > div { height: 100%; background: var(--accent); }

/* ---------- features ---------- */
.feature-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.feature-head h2 { margin: 0; }
.feature-list { margin: 0 0 12px; padding-left: 20px; color: var(--muted); }
.feature-list li { margin: 3px 0; }
td.cmd { white-space: nowrap; }
.status-pill { font-size: 0.82em; padding: 3px 10px; border-radius: 99px; border: 1px solid var(--line); }
.status-pill.good { color: var(--good); border-color: var(--good); }
.status-pill.warn { color: var(--warn); border-color: var(--warn); }
.status-pill.bad { color: var(--bad); border-color: var(--bad); }
.pill.danger-pill { background: var(--bad); }

/* ---------- clubs ---------- */
.club-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; }
.club-bar select { min-width: 260px; }
.club-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.club-head h2 { margin: 0 0 2px; }
.row.left { justify-content: flex-start; }

/* ---------- books ---------- */
.book-head { display: flex; gap: 16px; align-items: flex-start; }
.book-head h2 { margin: 0 0 2px; }
.cover { width: 90px; border-radius: 4px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4); }
.cover.small { width: 60px; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; color: var(--muted); font-size: 0.9em; }
.pill.alt { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
.warn-text { color: var(--warn); margin: 0 0 12px; }
.small { font-size: 0.85em; }
.pill { margin-left: 8px; font-size: 0.6em; vertical-align: middle; background: var(--accent-2); color: #fff; padding: 2px 8px; border-radius: 99px; }
details { margin-top: 10px; }
summary { cursor: pointer; color: var(--accent); }
.reviews { padding-left: 18px; }
.reviews li { margin: 6px 0; }
.avatar-preview { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; }
.links { padding-left: 18px; word-break: break-all; }
pre.code { background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 10px; white-space: pre-wrap; word-break: break-all; }

/* ---------- logs ---------- */
.logbox {
  margin-top: 12px;
  height: calc(100vh - 260px);
  min-height: 300px;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
}
.logline { white-space: pre-wrap; word-break: break-word; padding: 1px 0; }
.lvl-WARNING .lvl, li.lvl-WARNING { color: var(--warn); }
.lvl-ERROR .lvl, .lvl-CRITICAL .lvl, li.lvl-ERROR, li.lvl-CRITICAL { color: var(--bad); }
.log-list { list-style: none; padding: 0; margin: 0; }
.log-list li { padding: 4px 0; border-bottom: 1px solid var(--line); }

/* ---------- toasts ---------- */
#toasts { position: fixed; right: 18px; top: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 10; }
.toast {
  background: var(--panel-2);
  border-left: 4px solid var(--good);
  border-radius: 7px;
  padding: 10px 14px;
  max-width: 420px;
  font-size: 1.02em;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: none; }
.toast.err { border-left-color: var(--bad); background: #3a1f27; }

/* ---------- login ---------- */
.login-page { align-items: center; justify-content: center; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 30px; max-width: 440px; text-align: center; }
.login-card img { border-radius: 50%; }
.login-card h1 { font-size: 1.3em; }
.login-form { display: flex; gap: 8px; margin: 16px 0 8px; }
.login-form input { flex: 1; }

@media (max-width: 760px) {
  body { flex-direction: column; }
  .sidebar { display: block; }
  .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--line); }
  main { padding: 16px; }
}

.report-text { max-width: 420px; white-space: pre-wrap; overflow-wrap: anywhere; }
.cover-missing { display: flex; align-items: center; justify-content: center; aspect-ratio: 2 / 3;
  background: #2a2438; color: #8f86a8; font-weight: 700; font-size: 1.4rem; flex-shrink: 0; }
.thumb.cover-missing { font-size: 0.9rem; }
.cover-editor { margin-top: 8px; }
.reader-links { display: flex; gap: 10px; margin-top: 2px; }
.btn.discord-btn { display: block; margin: 16px 0 6px; background: #5865F2; border-color: #5865F2; color: #fff; text-decoration: none; }
.error-text { color: #ff8a8a; }
.signed-in { font-size: 0.85em; margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
