:root {
  --bg: #0e1116;
  --panel: #171c24;
  --panel-2: #1e2530;
  --border: #2a3342;
  --text: #e6e9ee;
  --muted: #8b96a5;
  --accent: #35b8a4;
  --accent-2: #2a9385;
  --danger: #e0635f;
  --radius: 10px;
  font-size: 16px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button {
  background: var(--accent);
  color: #06221e;
  border: 0;
  border-radius: var(--radius);
  padding: 0.55rem 1rem;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.95rem;
}
button:hover { background: var(--accent-2); }
button.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
button.ghost:hover { color: var(--text); background: var(--panel-2); }
button.danger { background: var(--danger); color: #fff; }
button:disabled { opacity: 0.5; cursor: default; }
input, textarea, select {
  width: 100%;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.55rem 0.75rem;
  font-size: 0.95rem;
  font-family: inherit;
}
textarea { min-height: 8rem; resize: vertical; }
textarea.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.85rem; }
label { display: block; margin: 0.8rem 0 0.25rem; color: var(--muted); font-size: 0.85rem; }

.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 250px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.sidebar .brand { font-size: 1.15rem; font-weight: 700; margin-bottom: 0.75rem; }
.sidebar a.nav {
  display: block;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  color: var(--text);
}
.sidebar a.nav:hover { background: var(--panel-2); text-decoration: none; }
.sidebar a.nav.active { background: var(--panel-2); color: var(--accent); }
.sidebar .section { margin: 0.9rem 0 0.3rem; color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; }
.sidebar .foot { margin-top: auto; padding-top: 1rem; color: var(--muted); font-size: 0.85rem; }

.main { flex: 1; padding: 1.5rem 2rem; max-width: 900px; margin: 0 auto; width: 100%; min-width: 0; }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.1rem; margin: 1.5rem 0 0.5rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin-bottom: 0.9rem;
}
.row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.error { color: var(--danger); margin: 0.5rem 0; }

.center-box { max-width: 380px; margin: 12vh auto 0; }
.center-box .card { padding: 1.5rem; }

.bot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.9rem; }
.bot-card { cursor: pointer; transition: border-color 0.15s; }
.bot-card:hover { border-color: var(--accent); }
.bot-card .emoji { font-size: 1.7rem; }
.bot-card .name { font-weight: 700; margin: 0.2rem 0; }

.chat { display: flex; flex-direction: column; height: calc(100vh - 3rem); }
.chat-log { flex: 1; overflow-y: auto; padding-right: 0.5rem; }
.msg { max-width: 85%; margin: 0.5rem 0; padding: 0.6rem 0.9rem; border-radius: var(--radius); white-space: pre-wrap; overflow-wrap: break-word; }
.msg.user { background: var(--accent-2); color: #eafffb; margin-left: auto; }
.msg.assistant { background: var(--panel); border: 1px solid var(--border); }
.msg .fb { margin-top: 0.35rem; display: flex; gap: 0.4rem; align-items: center; }
.msg .fb button { background: transparent; border: 1px solid var(--border); color: var(--muted); padding: 0.1rem 0.45rem; border-radius: 6px; font-size: 0.85rem; }
.msg .fb button.sel { border-color: var(--accent); color: var(--accent); }
.chat-input { display: flex; gap: 0.6rem; padding-top: 0.8rem; }
.chat-input textarea { min-height: 3rem; max-height: 10rem; }
.typing { color: var(--muted); font-style: italic; padding: 0.4rem 0; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; }
code, pre { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.85rem; }
pre { background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.8rem 1rem; overflow-x: auto; white-space: pre-wrap; }
.pill { display: inline-block; padding: 0.05rem 0.5rem; border: 1px solid var(--border); border-radius: 99px; font-size: 0.75rem; color: var(--muted); }

@media (max-width: 720px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .sidebar .foot { margin: 0 0 0 auto; padding: 0; }
  .main { padding: 1rem; }
  .chat { height: calc(100vh - 9rem); }
}
