:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --ink: #1f2430;
  --muted: #6b7280;
  --brand: #15508f;
  --brand-2: #0d3a66;
  --line: #e3e6ea;
  --ok: #1a7f37;
  --warn: #b25900;
  --danger: #b42318;
  --soft: #eef3f9;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 16px;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 18px;
  background: var(--brand); color: #fff; flex-wrap: wrap;
}
.topbar .brand { font-weight: 700; }
.topbar nav a { color: #dbe7f3; text-decoration: none; margin-left: 14px; }
.topbar nav a:hover { color: #fff; }
.topbar nav .muted { color: #cfe0ef; }

.container { max-width: 980px; margin: 0 auto; padding: 22px 18px 60px; }

h1 { font-size: 1.5rem; margin: 0 0 6px; }
h2 { font-size: 1.15rem; margin: 18px 0 8px; }
h3 { font-size: 1rem; margin: 0 0 8px; }
.lede { color: #444; margin: 4px 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 16px 18px; margin: 14px 0;
}
.card.success { border-color: #bfe3c6; background: #f2faf4; }
.alert { background: #fdecec; border: 1px solid #f3c4bf; color: var(--danger);
  padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; }
.alert.warn { background: #fff4e5; border-color: #f5d9b3; color: var(--warn); }
.alert.error { background: #fdecec; border-color: #f3c4bf; color: var(--danger); }
.badge.warn { background: #fff4e5; color: var(--warn); padding: 2px 6px; border-radius: 4px; font-size: .75rem; }
.tip { background: var(--soft); border-left: 3px solid var(--brand);
  padding: 10px 12px; border-radius: 6px; margin-top: 12px; }

button:disabled, .btn.disabled {
  background: #d1d5db; color: #fff; cursor: not-allowed;
}
.btn.disabled:hover { background: #d1d5db; }

.stack { display: flex; flex-direction: column; gap: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 720px) {
  .grid2, .grid3, .grid4 { grid-template-columns: 1fr; }
  .actions { grid-template-columns: 1fr !important; }
}

label { display: block; font-weight: 600; margin-bottom: 8px; }
label.check { font-weight: 400; }
input, select, textarea {
  width: 100%; padding: 9px 10px; font-size: 15px;
  border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink);
}
input.big { font-size: 17px; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }

button, .btn {
  display: inline-block; padding: 9px 16px; font-size: 15px; cursor: pointer;
  border: 0; border-radius: 8px; background: var(--brand); color: #fff;
  text-decoration: none; text-align: center;
}
button:hover, .btn:hover { background: var(--brand-2); }
.btn.secondary { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn.secondary:hover { background: var(--soft); }
button.ok { background: var(--ok); }
button.ok:hover { background: #156329; }
button.danger { background: var(--danger); }
button.danger:hover { background: #8e1a12; }

/* negotiation page */
.sim-header { display: flex; justify-content: space-between; align-items: center; }
.back { color: var(--brand); text-decoration: none; }
.brief { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--brand-2);
  border-radius: 8px; padding: 12px 14px; white-space: pre-wrap; margin: 10px 0; }
.statusbar { display: flex; justify-content: space-between; align-items: center;
  background: var(--soft); padding: 8px 14px; border-radius: 8px; margin: 10px 0; }
.chat { max-height: 360px; overflow-y: auto; border: 1px solid var(--line);
  border-radius: 8px; padding: 10px; background: #fbfbfc; margin: 10px 0; }
.msg { margin-bottom: 8px; }
.msg .who { font-size: .75rem; color: var(--muted); }
.bubble { display: inline-block; padding: 7px 11px; border-radius: 10px; max-width: 88%; }
.msg.participant .bubble { background: #e7f0fb; border: 1px solid #cfe0ef; }
.msg.bot .bubble { background: #fff; border: 1px solid var(--line); }

.actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 14px; }
.action { margin: 0; }
.action.end { background: #fafafa; }
.sweets { border: 1px dashed var(--line); border-radius: 8px; padding: 8px 10px; margin: 6px 0; }
.sweets legend { font-size: .85rem; color: var(--muted); padding: 0 4px; }
.sweets .check.locked { opacity: .55; }

.intel { background: var(--soft); border-radius: 8px; padding: 8px 12px; margin: 8px 0; }
.intel p { margin: 4px 0; font-size: .9rem; }

.strategy-card { border-left: 4px solid var(--brand); }
.strategy-card textarea { margin-top: 6px; }
.strategy-note { background: var(--soft); border-radius: 8px; padding: 12px; white-space: pre-wrap; }

.engagement-hints .hint-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.engagement-hints .hint-grid div {
  padding: 6px 8px; border-radius: 6px; font-size: .85rem;
  background: #f3f4f6; border-left: 3px solid var(--muted);
}
.engagement-hints .hint-grid div.ok {
  background: #f2faf4; border-left-color: var(--ok);
}
.engagement-hints .hint-grid div.need {
  background: #fff4e5; border-left-color: var(--warn);
}
@media (max-width: 560px) {
  .engagement-hints .hint-grid { grid-template-columns: 1fr; }
}

.msg .rationale {
  margin-top: 2px; margin-left: 2px; font-style: italic;
}

.reflection-card { border-left: 4px solid var(--warn); }
.reflection-card textarea { margin-top: 4px; margin-bottom: 10px; }

/* metrics */
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 8px 0; }
.metric { background: var(--soft); border-radius: 8px; padding: 10px; text-align: center; }
.metric .num { display: block; font-size: 1.4rem; font-weight: 700; color: var(--brand-2); }
.metric .lab { font-size: .75rem; color: var(--muted); }
@media (max-width: 560px) { .metrics { grid-template-columns: repeat(2, 1fr); } }

.metric-card .big { font-size: 1.7rem; font-weight: 700; color: var(--brand); }
.mini { width: 100%; font-size: .82rem; margin-top: 6px; }
.mini td { padding: 1px 0; }

table.kv { width: 100%; border-collapse: collapse; }
table.kv td { padding: 5px 8px; border-bottom: 1px solid var(--line); }
table.kv td:nth-child(odd) { color: var(--muted); width: 22%; }

table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th, table.data td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; }
table.data th { background: var(--soft); font-weight: 600; }
table.data td.l { max-width: 220px; }
.consent-text p { margin: 6px 0; }
.codes-box { font-family: ui-monospace, monospace; font-size: 14px; }

footer { text-align: center; padding: 18px; color: var(--muted); }

/* ---- live classroom (join/teach_login + base pages) ---- */
.container.narrow { max-width: 460px; }
label { display: block; margin: 8px 0 4px; font-size: .95rem; }
input[type=text], input[type=password], input[name=code] {
  width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 1rem; box-sizing: border-box; }
button, .btn { background: var(--brand); color: #fff; border: 0; border-radius: 8px;
  padding: 10px 20px; font-size: 1rem; cursor: pointer; text-decoration: none;
  display: inline-block; }
.err { color: var(--danger); background: #fdeceb; padding: 8px 12px; border-radius: 8px; }
.sp, b.sp { color: var(--brand); }
.fignote { color: var(--muted); font-size: .9rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
