:root {
  --bg: #f6f7f8;
  --panel: #ffffff;
  --border: #dfe3e6;
  --text: #1c2024;
  --muted: #666f78;
  --accent: #1f6f4a;
  --accent-weak: #eaf3ee;
  --danger: #a3341f;
  --user: #eef1f4;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 24px;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, system-ui, sans-serif;
  line-height: 1.7;
}

.header {
  max-width: 1040px;
  margin: 0 auto 20px;
}

.header h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.02em;
}

.sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.layout {
  max-width: 1040px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 16px;
  align-items: start;
}

@media (max-width: 820px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
}

.panel h2 {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.field {
  display: block;
  margin-bottom: 16px;
}

.label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 5px;
}

select,
input[type="password"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #fff;
  font-size: 14px;
  font-family: inherit;
}

[hidden] {
  display: none !important;
}

.hint {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

.hint.err {
  color: var(--danger);
  font-weight: 600;
}

input[type="password"].err {
  border-color: var(--danger);
}

.quality {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  margin: 0 0 16px;
}

.quality legend {
  padding: 0 6px;
}

.radio {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 6px 0;
  cursor: pointer;
}

.radio input {
  margin-top: 5px;
}

.radio strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
}

.radio em {
  display: block;
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
}

.callBtn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.callBtn:disabled {
  background: #b6bcc2;
  cursor: not-allowed;
}

.callBtn.active {
  background: var(--danger);
}

.meterField {
  margin: 14px 0 0;
}

.meter {
  height: 10px;
  background: #e4e8eb;
  border-radius: 5px;
  overflow: hidden;
}

.meterFill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 5px;
  transition: width 80ms linear;
}

.meterFill.hot {
  background: var(--danger);
}

.status {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
  min-height: 1.7em;
}

.status.err {
  color: var(--danger);
}

.note {
  margin: 16px 0 0;
  padding: 10px;
  background: var(--accent-weak);
  border-radius: 5px;
  font-size: 12px;
  color: #2c3a33;
}

.log {
  min-height: 460px;
}

.logBody {
  max-height: 560px;
  overflow-y: auto;
}

.empty {
  color: var(--muted);
  font-size: 13px;
}

.msg {
  margin: 0 0 10px;
  padding: 9px 13px;
  border-radius: 10px;
  font-size: 14px;
  max-width: 80%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg.user {
  background: var(--user);
  margin-left: auto;
  border-bottom-right-radius: 3px;
}

.msg.assistant {
  background: var(--accent-weak);
  border-bottom-left-radius: 3px;
}

.msg .who {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 2px;
}

.event {
  margin: 0 0 10px;
  padding: 9px 13px;
  border-left: 3px solid var(--accent);
  background: #fbfbfb;
  font-size: 12.5px;
  border-radius: 0 5px 5px 0;
}

.event.emergency {
  border-left-color: var(--danger);
  background: #fdf3f1;
}

.recLink {
  display: block;
  margin-top: 5px;
  font-size: 12px;
  color: var(--accent);
  overflow-wrap: anywhere;
}

.event pre {
  margin: 5px 0 0;
  font-size: 11px;
  color: var(--muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: ui-monospace, Consolas, monospace;
}
