:root {
  --bg: #f5f7fa;
  --card: #fff;
  --ink: #1f2933;
  --muted: #6b7785;
  --accent: #2c7a7b;
  --accent-d: #235e5f;
  --err: #c0392b;
  --line: #e3e8ee;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: -apple-system, "Segoe UI", "Noto Sans TC", sans-serif;
  min-height: 100vh; display: flex; justify-content: center;
}
.wrap { width: 100%; max-width: 420px; padding: 32px 18px 60px; }
.brand { text-align: center; margin-bottom: 22px; }
.logo { font-size: 26px; font-weight: 700; color: var(--accent); }
.tag { font-size: 13px; color: var(--muted); margin-top: 4px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 24px; box-shadow: 0 1px 3px rgba(0,0,0,.05); margin-bottom: 16px;
}
.card h2 { margin: 0 0 16px; font-size: 19px; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
input {
  display: block; width: 100%; margin-top: 5px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 9px; font-size: 15px;
}
input:focus { outline: none; border-color: var(--accent); }
button {
  width: 100%; padding: 11px; border: 0; border-radius: 9px; cursor: pointer;
  background: var(--accent); color: #fff; font-size: 15px; font-weight: 600;
}
button:hover { background: var(--accent-d); }
button:disabled { opacity: .6; cursor: default; }
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
button.ghost:hover { background: #f0f3f6; }
.consent { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; color: var(--muted); line-height: 1.5; }
.consent input { width: auto; margin: 2px 0 0; flex: none; }
.consent a { color: var(--accent); }
.switch { text-align: center; font-size: 13px; color: var(--muted); margin: 14px 0 0; }
.switch a { color: var(--accent); }
.msg { font-size: 13px; margin: 12px 0 0; min-height: 18px; }
.msg.err { color: var(--err); }
.msg.ok { color: var(--accent); }
.hint { font-size: 13px; color: var(--muted); background: #f0f5f5; padding: 12px; border-radius: 9px; }
#dash-info { font-size: 14px; line-height: 1.7; }
#dash-info b { color: var(--accent-d); }
#dash-info .role { background: #eef3f3; color: var(--accent-d); border-radius: 6px; padding: 1px 7px; font-size: 12px; }
.hidden { display: none; }

/* ---- scribe ---- */
.dash-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
button.small { width: auto; padding: 6px 12px; font-size: 13px; }
.backup-warn { background: #fef2f2; border: 1px solid #fca5a5; color: #b4493f; border-radius: 9px; padding: 9px 12px; font-size: 13px; margin-bottom: 12px; }
.recover-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; background: #fff7ed; border: 1px solid #fdba74; color: #9a3412; border-radius: 9px; padding: 10px 12px; margin-bottom: 12px; font-size: 13px; }
.recover-acts { display: flex; gap: 6px; }
.recover-acts button { width: auto; padding: 5px 12px; font-size: 13px; }
.style-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.style-detail { flex: 1; }
.style-detail summary { color: var(--accent-d); font-weight: 600; }
#style-text { white-space: pre-wrap; font-size: 13px; color: #445; background: #f0f5f5; padding: 10px; border-radius: 8px; margin-top: 6px; }
#btn-learn { flex: none; }
.rec-controls { display: flex; gap: 10px; }
.rec-controls > button, .rec-controls > .upload-btn { flex: 1; }
#file-audio { display: none; }
.upload-btn { display: flex; align-items: center; justify-content: center; padding: 11px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; font-size: 15px; color: var(--muted); margin: 0; }
.upload-btn:hover { background: #f0f3f6; }
#btn-rec.recording { background: var(--err); }
.rec-status { font-size: 13px; min-height: 20px; margin: 12px 0; color: var(--muted); }
.rec-status.busy { color: var(--accent-d); }
.rec-status.ok { color: var(--accent); }
.rec-status.err { color: var(--err); }
.draft-banner { background: #fff7ed; border: 1px solid #fdba74; color: #9a3412; border-radius: 9px; padding: 9px 12px; font-size: 13px; margin-bottom: 14px; }
.draft-banner .used { color: #b45309; font-size: 11px; }
.src-audio-wrap { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; font-size: 12px; }
.src-audio-wrap audio { height: 32px; flex: 1; }
#soap-result textarea { width: 100%; margin-top: 5px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; font-size: 14px; font-family: inherit; resize: vertical; }
#soap-result textarea:focus { outline: none; border-color: var(--accent); }
#soap-transcript { white-space: pre-wrap; font-size: 13px; color: #334; background: #f7f9fa; padding: 10px; border-radius: 8px; max-height: 240px; overflow: auto; }
#ai-original { font-size: 13px; }
.aio-row { padding: 5px 8px; border-radius: 6px; margin: 3px 0; background: #f7f9fa; color: #556; }
.aio-row.changed { background: #fff7ed; color: #9a3412; }
.aio-row b { color: var(--accent-d); margin-right: 4px; }
details summary { cursor: pointer; font-size: 13px; color: var(--muted); margin: 6px 0; }
.soap-actions { display: flex; gap: 8px; margin-top: 14px; }
.soap-actions button { flex: 1; padding: 9px; font-size: 14px; }
#recent-notes { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
.note-row { font-size: 13px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.note-st { font-size: 11px; border-radius: 5px; padding: 1px 6px; margin-right: 6px; }
.note-st.draft { background: #fff7ed; color: #9a3412; }
.note-st.confirmed { background: #ecfdf5; color: #065f46; }
.owner-box { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.owner-head { font-size: 14px; font-weight: 600; color: var(--accent-d); margin-bottom: 10px; }
.owner-head .owner-sub { font-weight: 400; font-size: 12px; color: var(--muted); margin-left: 8px; }
#owner-summary { width: 100%; margin-top: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; font-size: 14px; font-family: inherit; line-height: 1.6; resize: vertical; }
#owner-summary:focus { outline: none; border-color: var(--accent); }
.owner-actions { display: flex; gap: 8px; margin-top: 10px; }
.owner-actions button { flex: 1; padding: 9px; font-size: 14px; }
.owner-hint { font-size: 12px; color: var(--muted); background: #fff7ed; border: 1px solid #fde4c4; border-radius: 8px; padding: 8px 10px; margin: 10px 0 0; line-height: 1.5; }
@media print { body * { visibility: hidden; } #soap-result, #soap-result * { visibility: visible; } #soap-result { position: absolute; left: 0; top: 0; } .soap-actions, .owner-actions, .draft-banner .used { display: none; } }
