:root {
  color-scheme: light dark;
  --bg: #faf8f4;
  --fg: #2b2620;
  --panel-bg: #ffffff;
  --border: #ddd3c4;
  --muted: #7a6a55;
  --accent: #8b6f47;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Noto Sans TC", "PingFang TC", sans-serif;
  background: var(--bg);
  color: var(--fg);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-bg);
}
.topbar h1 { font-size: 16px; margin: 0; }

.badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 10px;
  letter-spacing: 0.02em;
}
.badge-pending { background: #eee; color: #666; }
.badge-ok { background: #e3f3e6; color: #2c7a3d; }
.badge-warn { background: #fbf0d9; color: #92660f; }
.badge-fail { background: #fbe4e4; color: #a3312f; }

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

.panel {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  min-width: 0;
}
.panel-wide { grid-column: 1 / -1; }

.panel h2 { font-size: 14px; margin: 0 0 8px; color: var(--accent); }
.panel h3 { font-size: 12px; margin: 14px 0 6px; color: var(--muted); }

.hint { font-size: 11px; color: var(--muted); line-height: 1.5; margin: 0 0 10px; }

.scroll-list {
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  font-size: 12px;
}

.log-entry { padding: 6px 0; border-bottom: 1px dashed var(--border); }
.log-entry:last-child { border-bottom: none; }
.log-entry .log-name { font-weight: 600; }
.log-entry .log-error { color: #a3312f; }
.log-entry pre { white-space: pre-wrap; word-break: break-all; margin: 4px 0 0; font-size: 11px; background: #f5f0e8; padding: 6px; border-radius: 4px; }

.checklist-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.checklist-table td { padding: 4px 4px; border-bottom: 1px solid var(--border); vertical-align: top; }
.checklist-table .icon { width: 22px; text-align: center; }
.checklist-table .note { color: var(--muted); }

.draft-fields dt { font-size: 11px; color: var(--muted); margin-top: 8px; }
.draft-fields dd { margin: 2px 0 0; font-size: 12px; white-space: pre-wrap; word-break: break-word; }
.draft-fields dd.empty { color: #b3a68f; font-style: italic; }

.autotest-header { display: flex; align-items: center; justify-content: space-between; }
.autotest-body { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.autotest-col h3 { margin-top: 0; }

.round-block { border-bottom: 1px dashed var(--border); padding: 8px 0; }
.round-block:last-child { border-bottom: none; }
.round-label { font-size: 10px; color: var(--muted); letter-spacing: 0.05em; }
.bubble-player { background: #efe7d8; padding: 6px 10px; border-radius: 8px; margin: 4px 0; font-size: 12px; }
.bubble-char { font-size: 12px; }

.qa-row { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; padding: 3px 0; }
.qa-warning { color: #a3312f; }

/* ---- Creator mode: KPI dashboard (option 1a) ------------------------- */

.layout-1a { padding: 12px; }

.dashboard-1a {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
  overflow-x: auto;
}
.dashboard-1a-inner { min-width: 760px; }

.kpi-strip {
  display: grid;
  grid-template-columns: 280px 1fr 340px;
  gap: 1px;
  background: var(--border);
}
.kpi-cell-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
}
.kpi-cell { background: var(--panel-bg); padding: 14px 18px; }
.kpi-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.kpi-value { font-size: 26px; font-weight: 700; font-family: ui-monospace, Menlo, monospace; color: var(--fg); margin-top: 4px; }
.kpi-bar { height: 4px; background: var(--border); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.kpi-bar-fill { height: 100%; background: var(--accent); }
.kpi-sub { font-size: 10px; color: var(--muted); margin-top: 8px; min-height: 1.3em; }
.kpi-sub.kpi-sub-warn { color: #a3312f; }

.panels-1a {
  display: grid;
  grid-template-columns: 280px 1fr 340px;
  background: var(--border);
  gap: 1px;
  border-top: 1px solid var(--border);
}
.panel-1a { background: var(--panel-bg); padding: 16px; min-width: 0; }
.panel-1a h3 {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin: 0 0 10px;
}
.panel-1a h3.panel-1a-subhead { margin-top: 16px; }
.panel-1a-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.panel-1a-head h3 { margin: 0; }
.panel-1a-head select {
  margin-left: auto;
  font-size: 10.5px;
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
}
.panel-1a-divider { height: 1px; background: var(--border); margin: 10px 0; }

.checklist-compact-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid #f1eee6; }
.checklist-compact-row .icon { width: 16px; text-align: center; font-size: 12px; }
.checklist-compact-row .label { font-size: 11.5px; color: var(--fg); flex: 1; }

.field-bar { margin-bottom: 7px; }
.field-bar-head { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); margin-bottom: 2px; }
.field-bar-head .pct { font-family: ui-monospace, monospace; }
.field-bar-track { height: 4px; background: #f1eee6; border-radius: 2px; overflow: hidden; }
.field-bar-fill { height: 100%; background: var(--accent); }

.log-compact-row {
  font-size: 10.5px;
  padding: 4px 0;
  border-bottom: 1px solid #f1eee6;
  font-family: ui-monospace, monospace;
  color: var(--muted);
  cursor: pointer;
}
.log-compact-row:last-child { border-bottom: none; }
.log-compact-row.log-compact-error { color: #a3312f; }
.log-compact-detail {
  margin: 4px 0 6px;
  padding: 6px;
  background: #f5f0e8;
  border-radius: 4px;
  font-size: 10.5px;
  white-space: pre-wrap;
  word-break: break-all;
}

.mode-switch { display: flex; gap: 6px; margin-right: auto; margin-left: 12px; }
.mode-btn {
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
}
.mode-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.lang-btn {
  font-size: 12px;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel-bg);
  color: inherit;
  cursor: pointer;
  line-height: 1;
}
.lang-btn:hover { border-color: var(--accent); color: var(--accent); }

.hidden { display: none !important; }

.scenario-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 12px;
}
.scenario-row:last-child { border-bottom: none; }
.scenario-row .scenario-label { flex: 1; }
.scenario-row .scenario-status { color: var(--muted); }

.compare-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.compare-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  font-size: 12px;
  min-width: 0;
}
.compare-card h4 { margin: 0 0 6px; font-size: 13px; color: var(--accent); }
.compare-card .compare-char { margin: 6px 0; white-space: pre-wrap; word-break: break-word; }
.compare-card .compare-vars { margin: 0; font-size: 11px; background: #f5f0e8; padding: 6px; border-radius: 4px; white-space: pre-wrap; word-break: break-all; }

.compare-alert {
  background: #fbe4e4;
  color: #a3312f;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  margin-bottom: 10px;
}
.compare-alert.compare-alert-ok { background: #e3f3e6; color: #2c7a3d; }

.compare-table { border-collapse: collapse; width: 100%; font-size: 12px; }
.compare-table th, .compare-table td { border: 1px solid var(--border); padding: 4px 6px; text-align: left; vertical-align: top; }
.compare-table th { background: #f5f0e8; color: var(--muted); font-weight: 600; }
