:root {
  color-scheme: light;
  --bg: #f7f8f4;
  --panel: #ffffff;
  --ink: #17211b;
  --muted: #647067;
  --line: #dfe6dc;
  --green: #168a4a;
  --green-dark: #0f6937;
  --gold: #b88a1c;
  --red: #d34b4b;
  --blue: #2468b2;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button, input, textarea, select {
  font: inherit;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  background: var(--green);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

button.secondary {
  background: #eef4ec;
  color: var(--green-dark);
  border: 1px solid var(--line);
}

button.danger { background: var(--red); }
button:disabled { opacity: .55; cursor: wait; }

input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 44px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}

.shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 92px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.brand {
  font-size: 24px;
  font-weight: 900;
}

.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(10px);
  z-index: 20;
}

.tab {
  min-height: 58px;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  padding: 4px;
  font-size: 12px;
}

.tab.active {
  color: var(--green-dark);
  background: #edf7ef;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 8px 22px rgba(31, 54, 39, .06);
}

.card h2, .card h3 {
  margin: 0 0 12px;
  font-size: 18px;
}

.stack { display: grid; gap: 10px; }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { min-width: 0; }
.spread { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.muted { color: var(--muted); font-size: 13px; }
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 2px 10px;
  background: #eef4ec;
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 700;
}

.score-list {
  display: grid;
  gap: 8px;
}

.score-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.score {
  font-size: 24px;
  font-weight: 900;
}

.positive { color: var(--green-dark); }
.negative { color: var(--red); }
.timeline {
  display: grid;
  gap: 8px;
  max-height: 390px;
  overflow: auto;
}

.event {
  border-left: 4px solid var(--green);
  padding: 8px 10px;
  background: #fbfcfa;
  border-radius: 6px;
}

.qr {
  width: 180px;
  height: 180px;
  image-rendering: pixelated;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.chart {
  width: 100%;
  height: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.chat {
  max-height: 260px;
  overflow: auto;
  display: grid;
  gap: 8px;
}

.message {
  padding: 8px 10px;
  background: #f5f7f2;
  border-radius: 8px;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(23, 33, 27, .42);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 30;
}

.dialog {
  width: min(430px, 100%);
  background: white;
  border-radius: 8px;
  padding: 18px;
  border: 1px solid var(--line);
}

.hidden { display: none !important; }

@media (min-width: 860px) {
  .tabs {
    position: static;
    grid-template-columns: repeat(5, auto);
    justify-content: start;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 14px;
  }
  .tab { min-width: 92px; }
  .room-layout {
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    gap: 12px;
  }
}
