/* ============================================================
   小医导诊 · 应用主样式(患者端 + 科室速查 + 后台 + 流程编辑器)
   ============================================================ */
:root {
  --teal: #0e9f8a; --teal-deep: #0b7a6b; --teal-ink: #0f2942;
  --bg: #eef4f3; --card: #ffffff; --line: #d9e8e4; --muted: #64807a;
  --danger: #e0533d; --ok: #17a673; --warn: #d98218; --accent: #ff8a5c;
  --radius: 14px; --shadow: 0 6px 22px rgba(15, 41, 66, .08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  background: var(--bg); color: var(--teal-ink); line-height: 1.6; min-height: 100vh; display: flex; flex-direction: column;
}
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 20px; width: 100%; }
code { background: #e7f2ef; border-radius: 5px; padding: 1px 7px; font-size: .88em; color: var(--teal-deep); }
a { color: var(--teal-deep); }
button { font-family: inherit; }
.btn { appearance: none; border: none; cursor: pointer; font-size: 14px; font-weight: 600; padding: 9px 18px; border-radius: 10px; transition: .15s; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; justify-content: center; }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-deep); }
.btn-ghost { background: #fff; color: var(--teal-deep); border: 1.5px solid #bfe0d9; }
.btn-ghost:hover { border-color: var(--teal); background: #f2faf8; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- 顶栏 ---------- */
.topbar { position: sticky; top: 0; z-index: 60; background: rgba(255,255,255,.94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; gap: 22px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--teal-ink); flex-shrink: 0; }
.brand-logo { width: 32px; height: 32px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-size: 16.5px; } .brand-text i { font-style: normal; font-size: 10.5px; color: var(--muted); }
.nav { display: flex; gap: 2px; margin-left: 8px; }
.nav a { text-decoration: none; color: var(--muted); font-size: 14px; padding: 7px 13px; border-radius: 8px; }
.nav a:hover, .nav a.on { color: var(--teal-deep); background: #e7f4f0; }
.top-tools { margin-left: auto; }
.lang-pill { position: relative; user-select: none; }
.lang-pill > span:first-child { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; padding: 6px 14px; border-radius: 999px; border: 1.5px solid #bfe0d9; background: #fff; color: var(--teal-deep); cursor: pointer; font-weight: 600; }
.lp-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(23,166,115,.15); }
.lp-menu { position: absolute; right: 0; top: calc(100% + 8px); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; display: none; min-width: 130px; z-index: 70; }
.lang-pill.open .lp-menu { display: block; }
.lp-menu button { display: block; width: 100%; text-align: left; border: none; background: none; padding: 8px 14px; font-size: 13.5px; border-radius: 8px; cursor: pointer; }
.lp-menu button:hover { background: #eef7f4; }
.lp-menu button.on { color: var(--teal-deep); font-weight: 700; }

/* ---------- 患者端布局 ---------- */
.view { flex: 1; }
.patient-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; padding: 20px 20px 8px; }
.chat-col { display: flex; flex-direction: column; min-height: calc(100vh - 160px); }
.chat-box { flex: 1; overflow-y: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; display: flex; flex-direction: column; gap: 16px; min-height: 320px; }
.chat-welcome { margin: auto; text-align: center; padding: 26px 10px; max-width: 460px; }
.welcome-mascot { width: 150px; margin-bottom: 8px; }
.chat-welcome h2 { font-size: 20px; margin-bottom: 8px; }
.chat-welcome p { color: var(--muted); font-size: 14px; margin-bottom: 16px; }
.quick-chips { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; }
.quick-chips button { border: 1.5px solid #cbe6df; background: #f4faf8; color: var(--teal-deep); border-radius: 999px; padding: 7px 15px; font-size: 13px; cursor: pointer; transition: .15s; }
.quick-chips button:hover { border-color: var(--teal); background: #e6f5f1; }

/* 消息气泡 */
.msg { display: flex; gap: 10px; max-width: 92%; animation: msgin .25s ease; }
@keyframes msgin { from { opacity: 0; transform: translateY(6px); } }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg-av { width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; font-size: 17px; background: #e7f4f0; }
.msg.user .msg-av { background: #dbe9ff; }
.msg-bubble { background: #f4faf8; border: 1px solid var(--line); border-radius: 14px; padding: 11px 15px; font-size: 15px; }
.msg.user .msg-bubble { background: var(--teal); color: #fff; border-color: var(--teal); }
.msg-bubble .sub { display: block; font-size: 12.5px; color: var(--muted); border-top: 1px dashed var(--line); margin-top: 8px; padding-top: 6px; }
.msg.user .msg-bubble .sub { color: #d9efeb; border-color: rgba(255,255,255,.3); }
.msg-meta { font-size: 11.5px; color: var(--muted); margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.msg.user .msg-meta { justify-content: flex-end; }
.tagchip { background: #e7f4f0; color: var(--teal-deep); padding: 1px 8px; border-radius: 99px; font-size: 11px; }
.tagchip.warn { background: #fdf0dd; color: #a36a12; }
.msg-audio { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.msg-audio audio { height: 32px; max-width: 260px; }

/* 打字机/思考 */
.thinking { display: flex; gap: 10px; max-width: 92%; }
.think-dots { display: inline-flex; gap: 5px; align-items: center; padding: 4px 2px; }
.think-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); animation: bounce 1.2s infinite; }
.think-dots i:nth-child(2) { animation-delay: .15s } .think-dots i:nth-child(3) { animation-delay: .3s }
@keyframes bounce { 30% { transform: translateY(-5px); } }

/* 步骤条(管线可视化) */
.steps-strip { display: flex; gap: 6px; flex-wrap: wrap; padding: 9px 4px; }
.step { font-size: 12px; color: var(--muted); background: #fff; border: 1px solid var(--line); padding: 3px 11px; border-radius: 99px; display: inline-flex; gap: 5px; align-items: center; }
.step.done { color: var(--teal-deep); border-color: #a9dccf; }
.step.done::before { content: "✓"; color: var(--ok); }
.step.active { color: var(--teal-deep); border-color: var(--teal); }
.step.active::before { content: "◐"; animation: rot 1s linear infinite; display: inline-block; }
@keyframes rot { to { transform: rotate(360deg); } }

/* 流程横幅 */
.flow-banner { display: flex; align-items: center; gap: 12px; background: linear-gradient(90deg, #e6f5f1, #fdf6ee); border: 1.5px solid #bfe4d9; border-radius: 12px; padding: 10px 16px; margin-bottom: 12px; }
.fb-icon { font-size: 20px; }
.fb-body b { font-size: 14px; display: block; }
.fb-body span { font-size: 12px; color: var(--muted); }
.fb-exit { margin-left: auto; border: 1px solid #cbe6df; background: #fff; color: var(--muted); border-radius: 8px; padding: 5px 12px; cursor: pointer; font-size: 12.5px; }

/* 紧急/人工卡片 */
.card-alert { border-radius: 14px; padding: 16px 18px; border: 2px solid; animation: msgin .3s ease; }
.card-alert.emergency { border-color: #f0a294; background: #fdf1ee; }
.card-alert.human { border-color: #b9cfee; background: #eff5fc; }
.card-alert h4 { font-size: 15.5px; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.card-alert p { font-size: 14px; color: #4a3f3d; }
.card-alert .btn { margin-top: 10px; }

/* 输入区 */
.composer { display: flex; gap: 10px; align-items: center; padding: 14px 4px 6px; }
.mic-btn { position: relative; width: 52px; height: 52px; border-radius: 50%; border: 2.5px solid var(--teal); background: #fff; color: var(--teal); cursor: pointer; display: grid; place-items: center; transition: .2s; flex-shrink: 0; }
.mic-btn .mic-icon { width: 22px; height: 22px; }
.mic-btn.listening { background: var(--teal); color: #fff; }
.mic-btn.listening .mic-ring { display: block; }
.mic-btn.speech { background: var(--accent); border-color: var(--accent); color: #fff; transform: scale(1.08); }
.mic-btn.speech .mic-ring { display: block; animation-duration: .6s; }
.mic-ring { display: none; position: absolute; inset: -7px; border: 2.5px solid var(--teal); border-radius: 50%; opacity: .5; animation: ringp 1.4s ease-out infinite; }
@keyframes ringp { from { transform: scale(.9); opacity: .6; } to { transform: scale(1.35); opacity: 0; } }
.tts-btn { width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--line); background: #fff; cursor: pointer; font-size: 17px; flex-shrink: 0; }
.tts-btn.off { filter: grayscale(1); opacity: .55; }
#text-input { flex: 1; font: inherit; font-size: 15px; padding: 13px 18px; border: 1.5px solid var(--line); border-radius: 999px; background: #fff; outline: none; }
#text-input:focus { border-color: var(--teal); }
.send-btn { background: var(--teal); color: #fff; border: none; border-radius: 999px; padding: 13px 26px; font-size: 15px; font-weight: 600; cursor: pointer; }
.send-btn:hover { background: var(--teal-deep); }
.mic-hint { font-size: 12px; color: var(--muted); text-align: center; padding: 2px 0 10px; }

/* 侧栏 */
.side-col { display: flex; flex-direction: column; gap: 14px; }
.side-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.side-card h4 { font-size: 14.5px; margin-bottom: 10px; }
.side-card p { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.side-card .btn { width: 100%; }
.info-list { list-style: none; }
.info-list li { display: flex; justify-content: space-between; font-size: 13px; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.info-list li:last-child { border: none; }
.lang-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.lang-tags span { font-size: 12px; background: #eef7f4; border: 1px solid #d3e9e2; padding: 3px 10px; border-radius: 99px; color: var(--teal-deep); }

/* ---------- 科室速查 ---------- */
#view-directory { padding: 30px 0 50px; }
.section-head { margin-bottom: 20px; }
.section-head h2 { font-size: 24px; } .section-head p { color: var(--muted); font-size: 14px; }
.dir-filter input { width: 100%; max-width: 420px; font: inherit; padding: 11px 16px; border: 1.5px solid var(--line); border-radius: 10px; }
.dir-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-top: 18px; }
.dept-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; box-shadow: var(--shadow); }
.dept-card h4 { font-size: 15.5px; display: flex; justify-content: space-between; }
.dept-card .loc { color: var(--teal-deep); font-size: 12.5px; font-weight: 700; }
.dept-card p { font-size: 13px; color: var(--muted); margin: 5px 0; }
.dept-sym { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.dept-sym span { font-size: 11.5px; background: #eef7f4; padding: 2px 8px; border-radius: 99px; color: var(--teal-deep); }

/* ---------- 后台 ---------- */
.admin-wrap { display: grid; grid-template-columns: 170px 1fr; gap: 20px; padding: 20px; }
.admin-tabs { display: flex; flex-direction: column; gap: 6px; }
.admin-tabs button { text-align: left; border: none; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 11px 16px; font-size: 14px; cursor: pointer; color: var(--muted); }
.admin-tabs button.on { background: var(--teal); color: #fff; border-color: var(--teal); font-weight: 600; }
.admin-body { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; min-height: 70vh; }
.admin-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.admin-head h3 { font-size: 19px; margin-right: auto; }
.admin-search { font: inherit; padding: 8px 14px; border: 1.5px solid var(--line); border-radius: 9px; min-width: 220px; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; padding: 10px 12px; background: #eef6f3; color: var(--teal-deep); font-size: 12.5px; position: sticky; top: 0; }
.table td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: top; }
.table tr:hover td { background: #f7fbfa; }
.table-scroll { max-height: 60vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.badge { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 10px; border-radius: 99px; }
.b-cat-dept { background: #e5f0fd; color: #2563c9; } .b-cat-symptom { background: #dff4ea; color: #147a52; }
.b-cat-location { background: #fdf3e2; color: #a36a12; } .b-cat-process { background: #f0e8fd; color: #6d3fc4; }
.b-cat-faq { background: #eef2f5; color: #5a6b7c; } .b-ok { background: #dff4ea; color: #147a52; } .b-warn { background: #fdf0dd; color: #a36a12; }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card { background: #f6faf9; border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.stat-card b { font-size: 26px; color: var(--teal-deep); display: block; }
.stat-card span { font-size: 12.5px; color: var(--muted); }
.dist-rows { margin: 8px 0 20px; }
.dist-row { display: grid; grid-template-columns: 110px 1fr 48px; gap: 10px; align-items: center; font-size: 13px; padding: 4px 0; }
.dist-bar { background: #eef4f2; border-radius: 99px; height: 10px; overflow: hidden; }
.dist-bar i { display: block; height: 100%; background: var(--teal); border-radius: 99px; }
.flow-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.flow-card { border: 1.5px solid var(--line); border-radius: 12px; padding: 16px; background: #fbfdfd; }
.flow-card.enabled { border-color: #a9dccf; background: #f4faf8; }
.flow-card h4 { font-size: 15px; display: flex; justify-content: space-between; align-items: center; }
.flow-card p { font-size: 12.5px; color: var(--muted); margin: 6px 0 10px; min-height: 34px; }
.flow-meta { font-size: 11.5px; color: var(--muted); display: flex; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.switch { position: relative; width: 36px; height: 20px; background: #cfdfda; border-radius: 99px; cursor: pointer; transition: .2s; flex-shrink: 0; }
.switch.on { background: var(--teal); }
.switch::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #fff; top: 2px; left: 2px; transition: .2s; }
.switch.on::after { left: 18px; }
.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-row label { font-size: 13px; font-weight: 600; color: var(--muted); }
.form-row input, .form-row select, .form-row textarea { font: inherit; padding: 9px 12px; border: 1.5px solid var(--line); border-radius: 9px; background: #fbfdfd; }
.form-row textarea { min-height: 64px; resize: vertical; }
.test-box { background: #f6faf9; border: 1px dashed #c5e0d9; border-radius: 10px; padding: 14px; margin-bottom: 16px; }
.test-box h5 { font-size: 13px; color: var(--teal-deep); margin-bottom: 8px; }
.test-hit { font-size: 13px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-top: 8px; }
.test-hit .score { color: var(--teal-deep); font-weight: 700; }

/* 模态框 */
#modal-mask { position: fixed; inset: 0; background: rgba(15,41,66,.45); z-index: 100; display: grid; place-items: center; padding: 20px; }
#modal-box { background: #fff; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.25); width: 100%; max-width: 620px; max-height: 86vh; overflow: auto; padding: 24px; animation: msgin .2s ease; }
.modal-title { font-size: 17px; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; }
.modal-x { border: none; background: none; font-size: 18px; cursor: pointer; color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* 会话时间线 */
.sess-timeline { list-style: none; font-size: 13px; }
.sess-timeline li { padding: 7px 0; border-bottom: 1px dashed var(--line); display: flex; gap: 10px; }
.sess-timeline .t { color: var(--muted); font-size: 11.5px; flex-shrink: 0; width: 118px; }
.ev-user b { color: var(--teal-ink); } .ev-bot b { color: var(--teal-deep); }
.ev-emergency { color: var(--danger); font-weight: 600; }

/* ---------- 流程编辑器 ---------- */
#view-editor { position: fixed; inset: 0; z-index: 90; background: var(--bg); display: flex; flex-direction: column; }
.editor-top { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.ed-name { font: inherit; font-weight: 700; font-size: 15px; padding: 8px 12px; border: 1.5px solid var(--line); border-radius: 9px; min-width: 180px; }
.ed-desc { font: inherit; font-size: 13px; padding: 8px 12px; border: 1.5px solid var(--line); border-radius: 9px; flex: 1; min-width: 160px; color: var(--muted); }
.ed-enabled { font-size: 13.5px; display: flex; align-items: center; gap: 6px; }
.ed-space { flex: 1; }
.editor-main { flex: 1; display: grid; grid-template-columns: 190px 1fr 300px; min-height: 0; }
.ed-palette { background: #fff; border-right: 1px solid var(--line); padding: 12px; overflow-y: auto; }
.ed-palette h5 { font-size: 12px; color: var(--muted); margin: 10px 0 8px; }
.pal-item { display: flex; gap: 8px; align-items: center; border: 1.5px solid var(--line); background: #fbfdfd; border-radius: 10px; padding: 8px 10px; margin-bottom: 6px; font-size: 13px; cursor: grab; user-select: none; transition: .12s; }
.pal-item:hover { border-color: var(--teal); background: #eff9f6; }
.pal-item i { font-style: normal; font-size: 16px; }
.ed-canvas-wrap { position: relative; overflow: hidden; background: radial-gradient(circle, #d8e6e2 1px, transparent 1px) 0 0/22px 22px, #f2f7f6; }
#ed-svg { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#ed-svg.panning { cursor: grabbing; }
.ed-canvas-tools { position: absolute; left: 12px; top: 12px; display: flex; gap: 6px; }
.ed-canvas-tools button { width: 32px; height: 32px; border: 1px solid var(--line); background: #fff; border-radius: 8px; cursor: pointer; font-size: 16px; }
.ed-hint { position: absolute; left: 12px; bottom: 10px; font-size: 11.5px; color: var(--muted); background: rgba(255,255,255,.85); padding: 3px 10px; border-radius: 99px; }
.ed-props { background: #fff; border-left: 1px solid var(--line); overflow-y: auto; padding: 16px; }
.ed-props-empty { color: var(--muted); font-size: 13px; text-align: center; margin-top: 40px; }
.ed-props h5 { font-size: 14px; margin-bottom: 12px; display: flex; gap: 8px; align-items: center; }
.ed-props .del-node { margin-top: 20px; width: 100%; }
.edge-label-input { width: 60px; }

/* SVG 节点 */
.ed-node { cursor: move; }
.ed-node rect.body { fill: #fff; stroke: #9cc9be; stroke-width: 1.6; rx: 11; }
.ed-node.selected rect.body { stroke: var(--teal); stroke-width: 2.6; }
.ed-node.start rect.body { fill: #e8f7f1; }
.ed-node.emergency-node rect.body { stroke: #eb9c8d; fill: #fdf3f0; }
.ed-node text.nt { font-size: 12.5px; font-weight: 700; fill: var(--teal-ink); }
.ed-node text.ns { font-size: 10.5px; fill: #64807a; }
.ed-port { fill: #fff; stroke: var(--teal); stroke-width: 2; cursor: crosshair; }
.ed-port:hover { fill: var(--teal); }
.ed-port.in { stroke: #f2994a; }
.ed-edge path { fill: none; stroke: #86aaa0; stroke-width: 2; }
.ed-edge.selected path { stroke: var(--danger); stroke-width: 2.6; }
.ed-edge text { font-size: 10.5px; fill: #4a6a62; }
.ed-edge.hl path { stroke: var(--teal); stroke-width: 3.4; }
.ed-node.hl rect.body { stroke: var(--teal); stroke-width: 3; }
.temp-edge { stroke: var(--accent); stroke-dasharray: 6 4; stroke-width: 2.4; fill: none; pointer-events: none; }

/* 试运行抽屉 */
.ed-runner { position: absolute; right: 0; bottom: 0; left: 190px; background: #fff; border-top: 1.5px solid var(--line); box-shadow: 0 -8px 30px rgba(15,41,66,.12); z-index: 5; max-height: 45%; display: flex; flex-direction: column; }
.ed-runner-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; font-weight: 700; font-size: 14px; border-bottom: 1px solid var(--line); }
.ed-runner-io { padding: 12px 16px; overflow: auto; }
.ed-runner-in { display: flex; gap: 8px; margin-bottom: 10px; }
.ed-runner-in input { flex: 1; font: inherit; padding: 9px 14px; border: 1.5px solid var(--line); border-radius: 9px; }
.run-step { font-size: 12.5px; background: #f6faf9; border: 1px solid var(--line); border-radius: 8px; padding: 7px 11px; margin-bottom: 6px; display: flex; gap: 8px; }
.run-step .rn { font-family: ui-monospace, monospace; color: var(--teal-deep); }
.run-out-speak { background: #e8f7f1; border-radius: 10px; padding: 10px 13px; font-size: 13.5px; margin: 6px 0; }

/* ---------- 页脚 ---------- */
.footer { background: var(--teal-ink); color: #b9cdd8; padding: 18px 0; font-size: 12px; margin-top: auto; }
.footer-inner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.footer a { color: #9fd8cb; }

/* ---------- 响应式 ---------- */
@media (max-width: 1020px) {
  .patient-layout { grid-template-columns: 1fr; }
  .side-col { flex-direction: row; flex-wrap: wrap; }
  .side-col .side-card { flex: 1 1 240px; }
  .editor-main { grid-template-columns: 170px 1fr 250px; }
}
@media (max-width: 700px) {
  .nav { display: none; }
  .chat-col { min-height: calc(100vh - 150px); }
  .msg { max-width: 100%; }
  .admin-wrap { grid-template-columns: 1fr; }
  .admin-tabs { flex-direction: row; overflow-x: auto; }
  .editor-main { grid-template-columns: 150px 1fr; }
  .ed-props { position: fixed; right: 0; top: 105px; bottom: 0; width: 280px; z-index: 8; box-shadow: -8px 0 24px rgba(0,0,0,.1); }
  .ed-runner { left: 0; }
}
