:root {
  --bg: #f4f5f7;
  --card: #fff;
  --line: #d9dce1;
  --text: #1c2430;
  --muted: #667085;
  --red: #c62828;
  --navy: #13233a;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 "Segoe UI", system-ui, sans-serif; background: var(--bg); color: var(--text); }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 12px; }
a { color: var(--red); }

.side { position: fixed; inset: 0 auto 0 0; width: 210px; background: var(--navy); color: #fff; display: flex; flex-direction: column; padding: 18px 0; }
.brand { padding: 0 20px 18px; font-weight: 700; font-size: 18px; border-bottom: 4px solid var(--red); margin-bottom: 10px; }
.brand small { display: block; font-weight: 400; font-size: 13px; opacity: .7; }
.side nav { display: flex; flex-direction: column; flex: 1; }
.side nav a { color: #cfd6e2; text-decoration: none; padding: 9px 20px; }
.side nav a:hover { background: #1d3252; }
.side nav a.active { background: #1d3252; color: #fff; box-shadow: inset 3px 0 0 var(--red); }
.side-btn { margin: 0 20px; background: transparent; color: #fff; border-color: #3b5174; }
main { margin-left: 210px; padding: 24px 28px 80px; max-width: 1180px; }

.head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.head h1 { margin-right: auto; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 16px; margin-bottom: 14px; }
.muted { color: var(--muted); }
.error { color: var(--red); }
.warn { border-left: 4px solid #d98e04; }
.bad { border-left: 4px solid var(--red); }
.good { border-left: 4px solid #2d9d5b; }

.btn { font: inherit; padding: 7px 13px; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--text); cursor: pointer; text-decoration: none; display: inline-block; }
.btn:hover { filter: brightness(.96); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger { color: var(--red); }
.btn.small { padding: 3px 9px; font-size: 13px; }

.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.field em { display: block; font-style: normal; font-size: 12px; color: var(--muted); margin-top: 3px; }
input[type=text], input[type=password], input[type=number], input[type=search], select, textarea {
  font: inherit; width: 100%; padding: 7px 9px; border: 1px solid #c4c9d1; border-radius: 4px; background: #fff; color: inherit;
}
textarea { min-height: 76px; resize: vertical; }
input[type=color] { width: 46px; height: 30px; padding: 0; border: 1px solid var(--line); background: none; }
.check { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 10px; }
.check input { margin-top: 4px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 16px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 420px); gap: 16px; align-items: start; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { font: inherit; background: none; border: 0; padding: 8px 14px; cursor: pointer; border-bottom: 3px solid transparent; color: var(--muted); }
.tabs button.active { border-color: var(--red); color: var(--text); font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 4px; padding: 2px 4px 2px 8px; background: #fafafa; font-size: 13px; }
.chip i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.chip button { border: 0; background: none; cursor: pointer; font-size: 15px; color: var(--muted); }

.list { padding: 0; }
.item { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item .grow { flex: 1; min-width: 0; }
.tag { font-size: 12px; border-radius: 3px; padding: 1px 7px; background: #eceef1; }
.tag.pending { background: #fff1cc; }
.tag.accepted { background: #d8f2e1; }
.tag.denied { background: #fbdcdc; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stats .card { margin: 0; }
.stats b { display: block; font-size: 26px; }
.answer { white-space: pre-wrap; overflow-wrap: anywhere; margin: 2px 0 12px; }

/* Discord style preview */
.preview { background: #313338; color: #dbdee1; border-radius: 6px; padding: 14px; font-size: 14px; position: sticky; top: 12px; overflow-wrap: anywhere; }
.preview .who { font-weight: 600; color: #fff; margin-bottom: 4px; }
.preview .content { white-space: pre-wrap; }
.embed { background: #2b2d31; border-left: 4px solid; border-radius: 4px; padding: 10px 12px; margin-top: 8px; }
.embed .title { font-weight: 600; color: #fff; }
.embed .desc { white-space: pre-wrap; margin-top: 4px; }
.embed .author, .embed .foot { font-size: 12px; opacity: .85; }
.embed .foot { margin-top: 8px; }
.embed .fields { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.embed .f { flex: 1 1 100%; white-space: pre-wrap; }
.embed .f.inline { flex: 1 1 28%; }
.embed img.big { max-width: 100%; border-radius: 4px; margin-top: 8px; display: block; }
.embed img.thumb { float: right; width: 70px; height: 70px; object-fit: cover; border-radius: 4px; margin-left: 8px; }
.dbtns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.dbtn { border-radius: 4px; padding: 6px 12px; color: #fff; background: #4e5058; font-size: 13px; }
.dbtn.primary { background: #5865f2; }
.dbtn.success { background: #248046; }
.dbtn.danger { background: #da373c; }
.dselect { margin-top: 8px; background: #1e1f22; border-radius: 4px; padding: 9px 12px; color: #949ba4; }

#toast { position: fixed; right: 18px; bottom: 18px; max-width: 420px; }
#toast div { background: var(--navy); color: #fff; padding: 11px 15px; border-radius: 4px; margin-top: 8px; white-space: pre-wrap; box-shadow: 0 3px 12px #0003; }
#toast div.error { background: var(--red); color: #fff; }

body.login { display: grid; place-items: center; min-height: 100vh; background: var(--navy); }
.login .box { background: #fff; padding: 28px; width: min(340px, 92vw); border-radius: 6px; border-top: 5px solid var(--red); }
.login .btn { width: 100%; }

@media (max-width: 860px) {
  .side { position: static; width: auto; }
  .side nav { flex-direction: row; flex-wrap: wrap; }
  main { margin-left: 0; padding: 16px; }
  .split { grid-template-columns: 1fr; }
  .preview { position: static; }
}
