:root {
  --bg: #0f172a;
  --panel: #111827;
  --panel-2: #182132;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #d9e2ec;
  --blue: #17324d;
  --teal: #127c8a;
  --soft: #eef4f8;
  --green: #197149;
  --amber: #a16207;
  --danger: #b42318;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: Inter, Aptos, Arial, sans-serif; background: #e8eef4; color: var(--ink); }
button, input, select, textarea { font: inherit; }
a { color: var(--teal); }

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  background: linear-gradient(90deg, #0f172a 0%, #17324d 52%, #127c8a 100%);
  color: white;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.topbar h1 { margin: 0; font-size: 1.3rem; }
.topbar p { margin: 0.15rem 0 0; color: rgba(255,255,255,0.82); font-size: 0.95rem; }

.badge-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.badge {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.78rem;
}

.layout {
  display: grid;
  grid-template-columns: 360px 1fr 360px;
  gap: 1rem;
  padding: 1rem;
}

.column { display: flex; flex-direction: column; gap: 1rem; }
.panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
  padding: 1rem;
}
.panel h2, .panel h3 { margin: 0 0 0.75rem; }
.panel p.helper { margin: 0 0 0.75rem; color: var(--muted); font-size: 0.92rem; }

.stack { display: flex; flex-direction: column; gap: 0.75rem; }
.row { display: flex; gap: 0.75rem; }
.row.wrap { flex-wrap: wrap; }
.row > * { flex: 1; }

label.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.88rem;
  color: #334155;
}

input[type="text"],
select,
textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  padding: 0.8rem 0.9rem;
  background: white;
}

textarea { resize: vertical; min-height: 100px; }

button {
  border: none;
  border-radius: 14px;
  padding: 0.8rem 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease;
}
button:hover { transform: translateY(-1px); }
button:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

button.primary { background: var(--blue); color: white; }
button.secondary { background: #dbe7f1; color: var(--blue); }
button.ghost { background: #f4f7fb; color: #334155; border: 1px solid #dbe5ef; }
button.success { background: var(--green); color: white; }
button.warning { background: #fef3c7; color: #92400e; }

.chat-log {
  height: 52vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-right: 0.35rem;
}

.msg {
  border-radius: 18px;
  padding: 0.85rem 0.95rem;
  max-width: 92%;
  white-space: pre-wrap;
  line-height: 1.45;
}
.msg.user { align-self: flex-end; background: #dff2ff; }
.msg.assistant { align-self: flex-start; background: #eff6ff; }
.msg.system { align-self: center; background: #f8fafc; color: var(--muted); font-size: 0.88rem; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border-radius: 999px;
  padding: 0.38rem 0.72rem;
  background: #eef4f8;
  color: #334155;
  font-size: 0.82rem;
}
.status .dot {
  width: 9px; height: 9px; border-radius: 50%; background: #94a3b8;
}
.status.live .dot { background: #10b981; }
.status.warn .dot { background: #f59e0b; }

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  max-height: 32vh;
  overflow: auto;
}

.small-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.8rem;
  background: #fbfdff;
}
.small-card h4 { margin: 0 0 0.35rem; font-size: 0.98rem; }
.small-card p { margin: 0.15rem 0; color: #475569; }
.small-card ul { margin: 0.45rem 0 0 1rem; padding: 0; }

.word-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 0.8rem;
  align-items: center;
  min-height: 90px;
}
.word-cloud span {
  display: inline-block;
  color: var(--blue);
  background: #eef4f8;
  padding: 0.24rem 0.5rem;
  border-radius: 999px;
}

.poll-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: #f8fafc;
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
}
.bar {
  height: 8px;
  background: #dbe7f1;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.35rem;
}
.bar > div {
  height: 100%;
  background: linear-gradient(90deg, #127c8a, #17324d);
}

.footer-note { color: var(--muted); font-size: 0.82rem; }
.hidden { display: none !important; }

.participant-layout {
  max-width: 920px;
  margin: 0 auto;
  padding: 1rem;
  display: grid;
  gap: 1rem;
}

@media (max-width: 1180px) {
  .layout { grid-template-columns: 1fr; }
  .chat-log { height: 42vh; }
}
