* { box-sizing: border-box; margin: 0; }
:root {
  --page:#F4F2EC; --card:#FFFFFF; --sub:#F1EFE8; --border:#E6E3DB;
  --tp:#1B1B19; --ts:#5F5E5A; --tm:#8C8B82;
  --acc-bg:#E6F1FB; --acc-tx:#185FA5; --acc:#378ADD;
  --suc-bg:#E1F5EE; --suc-tx:#0F6E56;
  --war-bg:#FAEEDA; --war-tx:#854F0B;
  --dan-bg:#FCEBEB; --dan-tx:#A32D2D;
}
body {
  font-family:"Noto Sans JP","Yu Gothic UI",system-ui,sans-serif;
  background:var(--page); color:var(--tp); font-size:16px; line-height:1.6;
}
.topbar {
  display:flex; align-items:center; gap:20px; flex-wrap:wrap;
  padding:14px 24px; background:var(--card); border-bottom:1px solid var(--border);
  position:sticky; top:0; z-index:10;
}
.brand { font-weight:700; font-size:18px; }
.brand small { font-size:12px; font-weight:400; color:var(--ts); margin-left:8px; }
.beta { font-size:12px; color:var(--acc-tx); background:var(--acc-bg); border-radius:8px; padding:3px 8px; margin-left:6px; }
.tabs { display:flex; gap:6px; flex-wrap:wrap; }
.tabs button {
  font:inherit; font-size:15px; padding:9px 18px; border:1px solid transparent;
  background:transparent; border-radius:10px; cursor:pointer; color:var(--ts);
}
.tabs button.active { background:var(--acc); color:#fff; font-weight:700; }
.tabs button:not(.active):hover { background:var(--sub); }

main { max-width:860px; margin:0 auto; padding:28px 20px 80px; }
.tab { display:none; }
.tab.active { display:block; }
h1 { font-size:24px; margin-bottom:4px; }
.sub { color:var(--ts); margin-bottom:16px; }
.card {
  background:var(--card); border:1px solid var(--border); border-radius:16px;
  padding:22px; margin-bottom:20px; display:flex; flex-direction:column; gap:14px;
}
.row { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.row.space { justify-content:space-between; }
.label { font-size:14px; color:var(--tm); }
.hint { font-size:14px; color:var(--ts); background:var(--sub); border-radius:10px; padding:10px 14px; }
.empty { color:var(--tm); font-size:15px; }
.hidden { display:none !important; }

.avatar {
  width:44px; height:44px; border-radius:50%; background:var(--acc-bg); color:var(--acc-tx);
  display:flex; align-items:center; justify-content:center; font-weight:700; flex-shrink:0;
}
.avatar.small { width:36px; height:36px; font-size:13px; }
input[type=text], input[type=password], textarea {
  font:inherit; padding:12px 14px; border:1px solid var(--border); border-radius:10px;
  background:#fff; flex:1; min-width:200px;
}
textarea { width:100%; resize:vertical; }
.consent { display:flex; align-items:center; gap:8px; font-size:15px; color:var(--ts); cursor:pointer; }
.consent input { width:22px; height:22px; accent-color:var(--acc); }

.btn {
  font:inherit; font-size:16px; padding:12px 20px; border-radius:12px; cursor:pointer;
  border:1px solid var(--border); background:#fff; color:var(--tp);
}
.btn:hover { background:var(--sub); }
.btn:disabled { opacity:.45; cursor:not-allowed; }
.btn.big { padding:16px 22px; font-size:17px; font-weight:700; flex:1; }
.btn.small { padding:8px 14px; font-size:14px; }
.btn.primary { background:var(--acc); border-color:var(--acc); color:#fff; }
.btn.primary:hover { background:#2f7cc9; }
.btn.accent { background:var(--acc-bg); border-color:#bcd6f0; color:var(--acc-tx); }
.btn.danger { background:var(--dan-bg); border-color:#e3b5b5; color:var(--dan-tx); }

.rec-bar {
  display:flex; align-items:center; gap:14px; background:var(--sub);
  border-radius:12px; padding:14px 16px;
}
.rec-bar.on { background:var(--dan-bg); }
.rec-dot { width:12px; height:12px; border-radius:50%; background:var(--tm); }
.rec-bar.on .rec-dot { background:var(--dan-tx); animation:blink 1s infinite; }
@keyframes blink { 50% { opacity:.25; } }
.rec-label { font-weight:700; }
.rec-bar.on .rec-label { color:var(--dan-tx); }
.rec-time { font-family:Consolas,monospace; font-size:20px; font-weight:700; }
.rec-hint { color:var(--tm); font-size:14px; margin-left:auto; }

.transcript { display:flex; flex-direction:column; gap:10px; min-height:80px; }
.line { display:flex; gap:10px; align-items:flex-start; }
.line .tag {
  flex-shrink:0; font-size:12px; font-weight:700; border-radius:6px; padding:3px 8px; margin-top:3px;
}
.line.staff .tag { background:var(--acc-bg); color:var(--acc-tx); }
.line.patient .tag { background:var(--sub); color:var(--ts); }
.line .txt { flex:1; }
.line .txt.interim { color:var(--tm); }

.checklist { list-style:none; display:flex; flex-direction:column; border:1px solid var(--border); border-radius:12px; overflow:hidden; }
.checklist li { display:flex; align-items:center; gap:10px; padding:13px 15px; border-top:1px solid var(--border); }
.checklist li:first-child { border-top:0; }
.checklist li.ok .mark { color:var(--suc-tx); }
.checklist li.ng { background:var(--war-bg); }
.checklist li.ng .mark { color:var(--war-tx); }
.checklist .mark { font-weight:700; font-size:18px; width:22px; text-align:center; }
.checklist .st { margin-left:auto; font-size:14px; }
.checklist li.ok .st { color:var(--suc-tx); }
.checklist li.ng .st { color:var(--war-tx); }
.note { border-radius:10px; padding:12px 14px; margin-top:10px; font-size:14.5px; }
.note.warn { background:var(--war-bg); }
.note.warn b { color:var(--war-tx); }
.note.info { background:var(--sub); }

.soap-row { display:flex; gap:10px; align-items:flex-start; }
.soap-tag {
  flex-shrink:0; width:30px; height:30px; border-radius:8px; background:var(--acc-bg); color:var(--acc-tx);
  display:flex; align-items:center; justify-content:center; font-weight:700; margin-top:6px;
}
.paste-strip {
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  background:var(--acc-bg); border-radius:10px; padding:10px 14px; color:var(--acc-tx); font-size:14.5px;
}

.seg { display:flex; background:var(--sub); border-radius:12px; padding:4px; }
.seg button {
  font:inherit; font-size:15px; font-weight:700; padding:9px 20px; border:0; border-radius:9px;
  background:transparent; color:var(--ts); cursor:pointer;
}
.seg button.on { background:var(--acc); color:#fff; }
.bill-name { font-weight:700; }
.stepnum {
  display:inline-flex; width:24px; height:24px; border-radius:50%; background:var(--acc); color:#fff;
  align-items:center; justify-content:center; font-size:13px; font-weight:700; margin-right:6px;
}
.menu-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(260px,1fr)); gap:12px; }
.menu-btn {
  display:flex; align-items:center; justify-content:space-between; gap:10px; text-align:left;
  font:inherit; background:var(--acc-bg); border:0; border-radius:14px; padding:16px; cursor:pointer;
}
.menu-btn:hover { filter:brightness(.97); }
.menu-btn .nm { font-weight:700; font-size:16px; }
.menu-btn .pr { color:var(--ts); font-size:14px; }
.menu-btn .plus {
  width:40px; height:40px; border-radius:50%; background:var(--acc); color:#fff; flex-shrink:0;
  display:flex; align-items:center; justify-content:center; font-size:22px; font-weight:700;
}
.bill-item { display:flex; align-items:center; gap:12px; padding:8px 0; border-bottom:1px solid var(--border); }
.bill-item .nm { flex:1; font-weight:700; }
.bill-item .qty button {
  font:inherit; width:32px; height:32px; border-radius:8px; border:1px solid var(--border); background:#fff; cursor:pointer;
}
.total-bar {
  display:flex; align-items:center; justify-content:space-between;
  background:var(--acc-bg); border-radius:14px; padding:16px 18px; color:var(--acc-tx);
}
.total-bar b { font-size:28px; }

.chat-card { min-height:420px; }
.chat-log { flex:1; display:flex; flex-direction:column; gap:10px; overflow-y:auto; max-height:420px; }
.msg { max-width:85%; padding:12px 16px; border-radius:14px; font-size:15.5px; white-space:pre-wrap; }
.msg.bot { background:var(--sub); align-self:flex-start; border-bottom-left-radius:4px; }
.msg.user { background:var(--acc); color:#fff; align-self:flex-end; border-bottom-right-radius:4px; }
.msg.bot.new { border:1px dashed var(--war-tx); background:var(--war-bg); }
.msg .meta { display:block; font-size:12px; color:var(--tm); margin-top:6px; }
.chat-input { display:flex; gap:10px; }

.badge { background:var(--sub); color:var(--ts); border-radius:8px; padding:2px 10px; font-size:13px; }
.badge.warn { background:var(--war-bg); color:var(--war-tx); font-weight:700; }
.unans-item { border:1px solid var(--border); border-radius:12px; padding:14px; display:flex; flex-direction:column; gap:8px; margin-bottom:10px; }
.unans-item .q { font-weight:700; }
.unans-item .when { font-size:12.5px; color:var(--tm); }
.kb-item { padding:12px 0; border-bottom:1px solid var(--border); }
.kb-item .q { font-weight:700; }
.kb-item .a { color:var(--ts); font-size:14.5px; }
.kb-item .src { font-size:12px; border-radius:6px; padding:2px 8px; margin-left:8px; }
.kb-item .src.seed { background:var(--sub); color:var(--tm); }
.kb-item .src.learned { background:var(--suc-bg); color:var(--suc-tx); }

.userbox { margin-left:auto; display:flex; align-items:center; gap:10px; color:var(--ts); font-size:14.5px; }
.now-strip { background:var(--acc-bg); color:var(--acc-tx); border-radius:10px; padding:10px 14px; font-size:15px; }
.pat-item {
  display:flex; align-items:center; gap:12px; padding:12px; border:1px solid var(--border);
  border-radius:12px; margin-bottom:8px; flex-wrap:wrap;
}
.pat-item.on { background:var(--suc-bg); border-color:#9fd9c3; }
.pat-info { flex:1; display:flex; flex-direction:column; min-width:150px; }
.pat-info .nm { font-weight:700; }
.pat-info .meta { font-size:12.5px; color:var(--tm); }
.rec-list { margin:0 0 10px 20px; display:flex; flex-direction:column; gap:8px; }
.rec-item { background:var(--sub); border-radius:10px; padding:10px 14px; }
.rec-item .when { font-size:12.5px; color:var(--tm); }
.rec-item .body { white-space:pre-wrap; font-size:14.5px; }

.eval-chart { display:flex; align-items:flex-end; gap:10px; height:110px; margin-bottom:6px; }
.eval-chart .col { flex:1; display:flex; flex-direction:column; align-items:center; gap:5px; height:100%; justify-content:flex-end; }
.eval-chart .bar { width:100%; border-radius:6px 6px 0 0; background:var(--acc-bg); }
.eval-chart .bar.hi { background:var(--acc); }
.eval-chart .lbl { font-size:11px; color:var(--tm); }
.eval-chart .lbl.hi { color:var(--acc-tx); font-weight:500; }
.eval-chart .val { font-size:11px; color:var(--ts); }

.print-only { display:none; }
@media print {
  body > header, body > main { display:none !important; }
  .print-only { display:block; font-size:14px; color:#000; }
  .doc { padding:40px; }
  .doc h1 { text-align:center; font-size:26px; letter-spacing:12px; margin-bottom:30px; }
  .doc .to { font-size:18px; border-bottom:2px solid #000; display:inline-block; padding:0 30px 6px 4px; margin-bottom:8px; }
  .doc .date { text-align:right; }
  .doc table { width:100%; border-collapse:collapse; margin:24px 0; }
  .doc th, .doc td { border:1px solid #000; padding:10px 12px; text-align:left; }
  .doc td.num { text-align:right; }
  .doc .grand { font-size:20px; font-weight:700; text-align:right; }
  .doc .issuer { margin-top:36px; text-align:right; line-height:1.8; font-size:15px; }
  .doc .issuer .inote { font-size:13px; }
  .doc .issuer .logo { max-height:64px; max-width:240px; margin-bottom:8px; }
  .doc .biko { margin-top:16px; border:1px solid #000; padding:10px 12px; white-space:pre-wrap; }
}
