/* Dark only (the user, 2026-11-04). */
:root {
  --bg: #14161b;
  --card: #1d2027;
  --card-low: #191c22;
  --hover: #262a33;
  --text: #e6e8ec;
  --muted: #9aa3b2;
  --line: #2c313b;
  --input: #15171c;
  --input-line: #3a404c;
  --accent: #5865f2;
  --accent-soft: rgba(88, 101, 242, 0.18);
  --link: #aab2ff;
  --good: #3ecf7a;
  --good-fill: #1f7a45;
  --warn-fill: #975a16;
  --warn-text: #ffd99a;
  --warn-soft: #2b2010;
  --bad: #ff8a8a;
  --bad-line: #e05252;
  --advanced: #c3baff;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

a { color: var(--link); }
h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1.2rem; margin: 0; }
.muted { color: var(--muted); font-size: 0.9rem; }
.grow { flex: 1; }

/* Buttons */
.btn, .button, button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  min-height: 44px;
  padding: 0 18px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--input-line); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 0.9rem; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; }

/* Top bar */
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}
.brand { color: var(--text); font-size: 1.2rem; font-weight: 700; text-decoration: none; }
.who { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 0.9rem; margin: 0; }

.narrow { max-width: 28rem; margin: 15vh auto; padding: 0 1rem; text-align: center; }
.narrow h1 { margin-bottom: 1.5rem; }

/* Banners */
.banner { margin: 0; padding: 10px 14px; border-radius: 10px; }
.banner.good { background: #14301f; border: 1px solid #23573a; color: #bdf0d0; }
.banner.bad { background: #3a1717; border: 1px solid #6b2a2a; color: var(--bad); }
.banner.wide { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.banner.wide p { margin: 0; }
.banner.inset { margin: 0 20px 12px; }
.notice { max-width: 60rem; margin: 1rem auto 0; padding: 0 1rem; }

/* Dashboard */
main#bots { max-width: 60rem; margin: 1rem auto; padding: 0 1rem; display: grid; gap: 1rem; }
.bot { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1rem; display: grid; gap: 0.6rem; }
.bot header { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.pill { border-radius: 999px; padding: 1px 10px; font-size: 0.85rem; color: #fff; white-space: nowrap; }
.pill.good { background: var(--good-fill); }
.pill.warn { background: var(--warn-fill); }
.pill.bad { background: #a12a2a; }
.pill.off { background: #4a5160; }
.stats { display: flex; flex-wrap: wrap; gap: 1.5rem; margin: 0; }
.stats dt { color: var(--muted); font-size: 0.8rem; }
.stats dd { margin: 0; font-weight: 600; }
.pending {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--warn-soft);
  border: 1px solid #5c3d0e;
  color: var(--warn-text);
  font-size: 0.9rem;
}

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th { text-align: left; color: var(--muted); font-weight: 500; }
th, td { padding: 0.4rem 0.5rem; border-top: 1px solid var(--line); vertical-align: middle; }
tr.warn td:last-child { color: var(--warn-text); font-weight: 600; }

/* Settings */
.head {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 16px 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
}
.head p { margin: 2px 0 0; }
.mode { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.mode a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
}
.mode a.on { background: var(--accent); color: #fff; }

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px 16px 40px;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: flex-start;
}
.side {
  flex: 1 1 220px;
  max-width: 250px;
  position: sticky;
  top: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.side .bot-name { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.side .bot-name strong { display: block; font-size: 1rem; }
.side .bot-name span { color: var(--muted); font-size: 0.85rem; }
.side a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  min-height: 44px;
}
.side a:hover { background: var(--hover); }
.side a.on { background: var(--accent-soft); font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #5a6272; flex: none; }
.dot.on { background: var(--good); }
.dot.none { background: transparent; }
.chip { display: none; font-size: 0.75rem; border-radius: 999px; padding: 0 8px; background: #5c3d0e; color: var(--warn-text); font-weight: 600; }
.side a.unsaved .chip { display: inline; }
.adv {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid #6b5bd6;
  color: var(--advanced);
  border-radius: 999px;
  padding: 0 7px;
  margin-left: 6px;
  vertical-align: 2px;
}

.content { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 12px; padding: 20px 20px 12px; }
.lead { color: var(--muted); font-size: 0.9rem; margin: 4px 0 0; max-width: 620px; }
.body { padding: 0 20px; }
/* A module switched off keeps its settings, dimmed */
#settings:has(.card-head .switch input:not(:checked)) .body { opacity: 0.55; }
.row { display: flex; flex-wrap: wrap; gap: 8px 24px; padding: 14px 0; border-top: 1px solid var(--line); }
.row.advanced { background: linear-gradient(90deg, rgba(107, 91, 214, 0.1), transparent 60%); margin: 0 -20px; padding: 14px 20px; }
.label { flex: 1 1 220px; min-width: 0; }
.name { font-weight: 600; }
.help { display: block; color: var(--muted); font-size: 0.82rem; font-weight: 400; }
.control { flex: 2 1 340px; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.unit { color: var(--muted); font-size: 0.9rem; display: inline-flex; align-items: center; gap: 6px; }
.empty { padding: 14px 0; margin: 0; border-top: 1px solid var(--line); }

input[type=number], input[type=text], input[type=password], select {
  font: inherit;
  padding: 7px 10px;
  border: 1px solid var(--input-line);
  border-radius: 8px;
  background: var(--input);
  color: var(--text);
  min-height: 42px;
}
input[type=number] { width: 100px; }
input[type=number].wide { width: 150px; }
input[type=text], input[type=password] { width: 280px; max-width: 100%; }
.row.err input, .row.err select { border-color: var(--bad-line); }
.errtext { color: var(--bad); font-size: 0.85rem; flex-basis: 100%; }

.switch { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; min-height: 44px; }
.switch.plain { font-weight: 400; }
.switch input {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 46px;
  height: 26px;
  margin: 0;
  border-radius: 999px;
  background: var(--input-line);
  position: relative;
  cursor: pointer;
}
.switch input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
}
.switch input:checked { background: var(--accent); }
.switch input:checked::after { left: 23px; }
.switch input:not(:checked) ~ .when-on, .switch input:checked ~ .when-off { display: none; }

.choice { display: flex; flex-wrap: wrap; gap: 8px; flex-basis: 100%; }
.choice label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  flex: 1 1 170px;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--input-line);
  border-radius: 8px;
  cursor: pointer;
}
.choice label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input { margin: 4px 0 0; }

.order { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; flex-basis: 100%; }
.order li { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px 4px 12px; }
.order label { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-height: 44px; }
.order li:has(input:not(:checked)) label { color: var(--muted); }
.where { color: var(--muted); font-size: 0.82rem; }
.move { display: flex; gap: 6px; }
/* In balance mode the order doesn't matter */
.control:has(input[value=balance]:checked) .move { display: none; }
.icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--input-line);
  border-radius: 8px;
  background: var(--input);
  color: var(--text);
}

.tablebox { overflow-x: auto; flex-basis: 100%; }
tr:has(input[type=checkbox]:not(:checked)) input[type=number] { opacity: 0.45; }

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: var(--card-low);
  border-radius: 0 0 12px 12px;
}
.state { color: var(--muted); font-size: 0.9rem; }
.state.dirty { color: var(--warn-text); }

dialog {
  max-width: 460px;
  padding: 20px;
  border: 1px solid var(--input-line);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.55); }
dialog h2 { margin-bottom: 6px; }
dialog p { margin: 0 0 16px; }

@media (max-width: 720px) {
  .side { position: static; max-width: none; }
}
