﻿:root {
  color-scheme: light; --ink:#202d29; --muted:#64736d; --line:#e0e8e3; --paper:#fff;
  --base:#f5f7f5; --green:#166651; --deep:#164538; --mint:#e6f2ec; --amber:#825713;
  font-family:"Microsoft YaHei","PingFang SC",system-ui,sans-serif; color:var(--ink); background:var(--base);
  font-size:16px;
}
* {box-sizing:border-box}
body {margin:0; min-width:320px}
.site-footer {display:grid;place-items:center;min-height:40px;padding:8px 16px;border-top:1px solid var(--line);background:var(--paper);font-size:.8125rem;text-align:center}
.site-footer a {color:var(--muted)}
button,input,textarea,select {font:inherit}
button,a,input,textarea,select {outline-offset:4px}
button:focus-visible,a:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible {outline:2px solid #38a58a}
button {cursor:pointer}
button:disabled {cursor:wait;opacity:.6}
button,a { -webkit-tap-highlight-color:transparent }
a {color:var(--green)}
h1,h2,h3,p {margin:0}
h1 {font-size:2rem;letter-spacing:-.05em;line-height:1.22}
h2 {font-size:1.28rem}
h3 {font-size:1.05rem}
small,.small {font-size:.8125rem}
.muted {color:var(--muted)}
.eyebrow {color:var(--green);font-weight:750;font-size:.8125rem;letter-spacing:.14em}
.icon {width:19px;height:19px;display:inline-block;flex:none;vertical-align:middle;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.brand {display:flex;align-items:center;gap:12px;color:var(--deep);font-size:1.08rem;font-weight:800;white-space:nowrap}
.brand-icon {display:grid;place-items:center;width:40px;height:40px;background:var(--deep);color:#fff;border-radius:13px;flex:none}
.brand-icon .icon {width:23px;height:23px}
.shell {display:grid;grid-template-columns:222px minmax(0,1fr);min-height:100vh}
.sidebar {padding:30px 16px 16px;display:flex;flex-direction:column;background:#fff;border-right:1px solid var(--line);position:sticky;top:0;height:100dvh}
.sidebar .brand {padding-left:8px;margin-bottom:41px}
.nav-label {padding-left:12px;margin:0 0 9px;color:var(--muted);font-size:.81rem}
.nav {display:grid;gap:4px}
.nav button,.user-button {border:0;text-align:left;background:transparent;width:100%;display:flex;align-items:center;gap:11px;color:var(--muted);padding:11px 12px;border-radius:9px;font-size:.91rem;white-space:nowrap}
.nav button:hover,.user-button:hover {background:var(--base);color:var(--deep)}
.nav button.active {background:var(--mint);color:var(--deep);font-weight:750}
.user-button {margin-top:auto;border-top:1px solid var(--line);border-radius:0;padding:15px 4px 0}
.user-button span:last-child {min-width:0;overflow:hidden;text-overflow:ellipsis}
.user-button small {display:block;margin-top:3px}
.avatar {display:grid;place-items:center;flex:none;background:#e6f0e9;color:#1c593f;width:38px;height:38px;border-radius:11px;font-weight:750}
.workspace {min-width:0}
.top {height:68px;background:#fff;border-bottom:1px solid var(--line);display:flex;justify-content:space-between;align-items:center;padding:0 32px;gap:12px}
.breadcrumb {font-size:.87rem;color:var(--muted);display:flex;gap:9px;align-items:center}
.breadcrumb strong {color:var(--ink)}
.top-mentor {display:flex;align-items:center;gap:8px;font-size:.85rem;color:var(--muted)}
.wrap {max-width:1410px;margin:auto;padding:32px}
.hero {display:flex;align-items:flex-end;justify-content:space-between;gap:18px;margin-bottom:26px}
.hero .eyebrow {margin-bottom:8px}
.hero p:not(.eyebrow) {margin-top:9px;color:var(--muted);font-size:.9rem}
.actions,.row {display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.spread {display:flex;justify-content:space-between;align-items:center;gap:12px}
.btn {display:inline-flex;align-items:center;justify-content:center;gap:7px;border:1px solid var(--line);background:#fff;color:var(--ink);padding:9px 13px;min-height:39px;border-radius:8px;text-decoration:none;font-size:.875rem;line-height:1.2;white-space:nowrap}
.btn:hover {border-color:#9db8aa;background:#f9fbf9}
.btn.primary {background:var(--green);border-color:var(--green);color:#fff;font-weight:700}
.btn.primary:hover {background:var(--deep)}
.btn.subtle {border-color:transparent;background:transparent;color:var(--green)}
.btn.danger {color:#9d3228}
.btn.icon-only {width:40px;padding:0}
.stats {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;margin-bottom:22px}
.stat {padding:15px 17px;background:#fff;border:1px solid var(--line);border-radius:13px;display:flex;align-items:center;gap:13px;text-align:left;color:var(--ink)}
.stat:hover {border-color:#a9c9b9}
.stat .stat-icon {width:42px;height:42px;border-radius:11px;display:grid;place-items:center;background:#e7f3ed;color:#1c674d}
.stat:nth-child(2) .stat-icon {background:#fbf1df;color:#8a611f}
.stat:nth-child(3) .stat-icon {background:#edf0f8;color:#506899}
.stat small {display:block;color:var(--muted);margin-bottom:2px}
.stat strong {font-size:1.38rem;line-height:1.15}
.panel {border:1px solid var(--line);border-radius:14px;background:#fff;min-width:0}
.dashboard {display:grid;grid-template-columns:minmax(310px,.88fr) minmax(0,1.37fr);gap:16px;align-items:start}
.list-head,.detail-head {padding:17px 18px;border-bottom:1px solid var(--line)}
.searchbar {display:flex;gap:8px;margin-top:13px}
.searchfield {position:relative;flex:1;min-width:0}
.searchfield .icon {position:absolute;left:11px;top:11px;color:var(--muted);pointer-events:none}
.searchfield input {padding-left:36px;width:100%}
input,textarea,select {border:1px solid #dce6df;border-radius:8px;background:#fff;color:var(--ink);padding:9px 11px;min-height:39px;min-width:0}
select {appearance:none;background-image:linear-gradient(45deg,transparent 50%,#526b61 50%),linear-gradient(135deg,#526b61 50%,transparent 50%);background-position:calc(100% - 14px) 16px,calc(100% - 10px) 16px;background-size:4px 4px;background-repeat:no-repeat;padding-right:25px}
textarea {resize:vertical;min-height:90px;line-height:1.6}
input::placeholder,textarea::placeholder {color:#768680}
.cases {padding:8px;max-height:660px;overflow:auto}
.case-item {display:grid;grid-template-columns:40px minmax(0,1fr);gap:10px;text-align:left;width:100%;background:#fff;border:1px solid transparent;border-radius:9px;padding:11px 10px;color:var(--ink)}
.case-item:hover {background:#f6f9f7}
.case-item.selected {background:#edf6f0;border-color:#d8e9df}
.case-item:nth-child(3n+2) .avatar {background:#f5eddf;color:#765629}
.case-item:nth-child(3n) .avatar {background:#eaf0f7;color:#526a8b}
.case-item .title {display:flex;align-items:center;gap:7px;flex-wrap:wrap}
.case-item .summary {display:block;font-size:.86rem;color:#4c5e55;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin:4px 0}
.case-item .meta {font-size:.79rem;color:var(--muted);display:flex;gap:9px;flex-wrap:wrap}
.badge {display:inline-flex;align-items:center;gap:4px;border:0;background:#edf4ef;color:#2b664c;border-radius:6px;padding:3px 7px;line-height:1.2;font-size:.78rem;max-width:100%;overflow-wrap:anywhere}
.badge.warn {background:#fbefda;color:#855615}
.badge.gray {background:#eff2f1;color:#586862}
.badge button {color:inherit;background:none;border:0;padding:0 2px}
.badge input {min-height:0;accent-color:var(--green);margin:2px 3px 2px 1px}
.empty {display:grid;place-items:center;text-align:center;padding:46px 18px;color:var(--muted);gap:10px}
.empty .empty-icon {width:54px;height:54px;border-radius:15px;display:grid;place-items:center;background:var(--mint);color:var(--green)}
.empty h3 {color:var(--ink)}
.empty p {font-size:.87rem;line-height:1.6}
.detail-head .avatar {width:49px;height:49px;font-size:1.13rem}
.detail-head .patient {display:flex;align-items:center;gap:11px}
.detail-head .patient p {margin-top:5px;font-size:.82rem;color:var(--muted)}
.detail-head .actions {margin-top:15px}
.visit-tabs {display:flex;gap:9px;overflow:auto;padding:0 16px;border-bottom:1px solid var(--line);min-height:44px}
.visit-tabs button {white-space:nowrap;padding:10px 4px;background:none;border:0;border-bottom:2px solid transparent;color:var(--muted);font-size:.86rem}
.visit-tabs button.current {color:var(--green);border-color:var(--green);font-weight:700}
.detail-content {padding:6px 18px 20px}
.visit-meta {display:flex;gap:12px;align-items:center;flex-wrap:wrap;color:var(--muted);font-size:.83rem;padding:13px 0;border-bottom:1px solid var(--line)}
.visit-record {padding:14px 0}
.visit-record+.visit-record {border-top:1px solid var(--line);margin-top:4px;padding-top:18px}
.visit-header {align-items:flex-start;background:#eef6f1;border-radius:9px;padding:11px 12px;flex-wrap:wrap}
.visit-header .visit-meta {padding:5px 0 0;border:0}
.section {padding:15px 0;border-bottom:1px solid #edf1ee;min-width:0}
.section:last-child {border-bottom:0}
.section h3 {margin-bottom:8px}
.section p,.value {white-space:pre-wrap;overflow-wrap:anywhere;font-size:.91rem;line-height:1.66}
.section .subvalue {display:grid;grid-template-columns:78px 1fr;gap:8px;margin-bottom:5px}
.subvalue span:first-child {color:var(--muted);font-size:.85rem}
.rx-box {background:#f8faf8;border:1px solid var(--line);padding:12px;border-radius:10px;margin:8px 0}
.rx-grid {display:grid;grid-template-columns:repeat(auto-fit,minmax(112px,1fr));gap:7px;margin:9px 0}
.herb {display:flex;align-items:center;justify-content:space-between;gap:5px;border:1px solid #dfe8e1;background:white;padding:6px 7px;border-radius:7px;text-align:left;color:var(--ink);font-size:.87rem;min-height:34px;overflow-wrap:anywhere}
.herb b {flex:none;font-weight:600;color:var(--green);background:#eaf3ed;border-radius:4px;padding:2px 5px;font-size:.78rem}
.form-screen {max-width:1010px}
.form-body {padding:2px 21px 17px}
.form-body .section {padding:19px 0}
.form-body .section h3 {margin-bottom:11px}
.grid {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:11px}
.grid.four {grid-template-columns:repeat(4,minmax(0,1fr))}
.field {display:grid;gap:6px;color:var(--muted);font-size:.87rem;margin:5px 0;min-width:0}
.field input,.field textarea,.field select {width:100%;color:var(--ink);font-size:.94rem}
.field textarea.code {min-height:125px}
.hint {font-size:.84rem;color:var(--muted);margin:8px 0;line-height:1.6}
.form-foot {padding:14px 21px;border-top:1px solid var(--line);display:flex;justify-content:flex-end;gap:8px}
.folded {padding:8px 0}
.folded .spread {min-height:36px}
.folded h3 {margin:0}
.slot {border:1px dashed #c8dbcf;background:#f4f9f5;border-radius:8px;padding:10px;margin-top:8px}
.warning {border:1px solid #e9d5a7;background:#fffaee;color:#765010;border-radius:8px;padding:10px 11px;font-size:.87rem;line-height:1.6;margin:10px 0}
dialog {border:1px solid var(--line);border-radius:15px;padding:0;width:min(560px,calc(100% - 24px));max-height:calc(100dvh - 30px);color:var(--ink);box-shadow:0 18px 85px #10261f30}
dialog.wide {width:min(1080px,calc(100% - 24px))}
dialog::backdrop {background:#12231e63}
.modal-head {padding:17px 20px;border-bottom:1px solid var(--line);background:#fff;position:sticky;top:0;z-index:1}
.modal-body {padding:16px 20px}
.modal-foot {position:sticky;bottom:0;background:#fff;border-top:1px solid var(--line);padding:12px 20px;display:flex;justify-content:flex-end;gap:8px}
.modal-foot.split {justify-content:space-between}
#toast {position:fixed;inset:auto 23px 22px auto;margin:0;border:0;z-index:10;max-width:min(430px,calc(100% - 40px));background:var(--deep);color:white;border-radius:9px;padding:11px 16px;box-shadow:0 10px 26px #14271f39;display:none;font-size:.9rem}
#toast.visible {display:block}
#toast.error {background:#822d26}
.login {min-height:calc(100dvh - 40px);display:grid;grid-template-columns:1.05fr 1fr;background:#fff}
.login-side {position:relative;overflow:hidden;display:flex;flex-direction:column;justify-content:space-between;min-height:420px;padding:clamp(28px,7vw,90px);color:white;background:#174b3d}
.login-side .brand {color:#f9fdf9}
.login-side .brand-icon {background:#d9eee2;color:#164538}
.login-side .story {position:relative;z-index:1;margin:auto 0}
.login-side .story h1 {font-size:clamp(2rem,5vw,4.5rem);letter-spacing:-.065em}
.login-side .story p {color:#d6e9df;margin-top:14px;line-height:1.7}
.orbit {position:absolute;width:660px;height:660px;border:1px solid #7daf963e;border-radius:50%;right:-350px;bottom:-270px;box-shadow:0 0 0 44px #8dc4a917,0 0 0 90px #8dc4a914,0 0 0 138px #8dc4a913}
.login-main {display:grid;place-items:center;padding:28px}
.login-form {width:min(100%,360px)}
.login-form h2 {font-size:1.8rem;margin-bottom:6px}
.login-form p {margin-bottom:24px}
.login-form label {margin-bottom:13px}
.login-form .primary {width:100%;margin-top:7px}
.login-form .hint {margin-top:15px}
.table-wrap {overflow:auto}
table {width:100%;border-collapse:collapse;text-align:left;font-size:.9rem}
th,td {border-bottom:1px solid var(--line);padding:12px 14px;white-space:nowrap}
th {color:var(--muted);font-weight:650}
.scan-layout {display:grid;grid-template-columns:1fr 1fr;gap:15px}
.scan-original {width:100%;max-height:55vh;object-fit:contain;border:1px solid var(--line);border-radius:8px;background:#f4f7f4}
iframe.scan-original {height:48vh}
.ocr-raw {white-space:pre-wrap;overflow-wrap:anywhere;max-height:30vh;overflow:auto;background:#f4f7f4;padding:10px;border-radius:8px;font-size:.83rem}
.scan-tabs {max-height:100px;overflow:auto;margin:9px 0 14px}
.scan-tabs [draggable="true"] {cursor:grab}
.scan-tabs .scan-drop {outline:2px solid var(--green);outline-offset:-3px;background:var(--mint);color:var(--deep)}
.drop-target {margin:12px 0;padding:22px;border:1px dashed #aabfb2;border-radius:10px;text-align:center;color:var(--muted);background:#f7faf8}
.drop-target.over {border-color:var(--green);background:var(--mint);color:var(--deep)}
.busy {display:flex;gap:10px;align-items:center;padding:18px 0}
.spinner {display:inline-block;width:19px;height:19px;border:2px solid #cfdfd5;border-top-color:var(--green);border-radius:50%;animation:spin .9s linear infinite}
@keyframes spin {to {transform:rotate(360deg)}}
@media (max-width:1180px) {.shell {grid-template-columns:182px minmax(0,1fr)} .wrap{padding:24px} .top{padding:0 24px} .hero{align-items:flex-start}}
@media (max-width:930px) {.shell{grid-template-columns:65px minmax(0,1fr)} .sidebar{padding:18px 9px}.sidebar .brand{padding:0 3px;margin-bottom:30px}.sidebar .brand-text,.nav-label,.nav button span,.user-button span:last-child{display:none}.nav button{justify-content:center;padding:12px}.user-button{justify-content:center}.wrap{padding:17px}.top{padding:0 17px}}
@media (max-width:720px) {.hero{flex-direction:column}.dashboard{grid-template-columns:1fr}.cases{max-height:319px}.stats{gap:6px}.stat{padding:9px;gap:6px}.stat .stat-icon{width:29px;height:29px}.stat .icon{width:15px}.stat strong{font-size:1.05rem}.stat small{font-size:.75rem}.grid.four{grid-template-columns:repeat(2,minmax(0,1fr))}.scan-layout,.login{grid-template-columns:1fr}.login-side{min-height:240px}.login-side .story{margin-top:30px}}
@media (max-width:430px) {.shell {grid-template-columns:1fr}.sidebar {height:auto;position:static;padding:8px 11px;flex-direction:row;justify-content:space-between;align-items:center}.sidebar .brand,.user-button{margin:0;border:0;padding:0;width:auto}.nav{display:flex}.nav button{padding:8px}.sidebar .brand-icon,.user-button .avatar{width:34px;height:34px}.top{height:48px}.wrap{padding:13px}.stats .stat-icon{display:none}.dashboard{grid-template-columns:minmax(0,1fr)}.login-side{min-height:200px}}
@media (max-width:720px) {
  .btn, .field, .field input, .field textarea, .field select,
  .section p, .value, .subvalue span:first-child, .hint, .badge,
  .visit-meta, .visit-tabs button, .case-item .summary, .case-item .meta,
  .hero p:not(.eyebrow), .small, small, .stat small, .empty p,
  .top-mentor, .breadcrumb, .detail-head .patient p, .herb, .herb b,
  .warning, .ocr-raw, .table-wrap table, #toast, .eyebrow {font-size:12pt}
  .btn, input:not([type=checkbox]), select, .herb, .visit-tabs button {min-height:44px}
  .btn, .case-item .meta, .visit-meta {line-height:1.35}
  .btn.icon-only {width:44px}
  .visit-tabs button {padding-inline:7px}
  .rx-grid {grid-template-columns:repeat(auto-fit,minmax(min(100%,126px),1fr))}
  .rx-box, .panel, .dialog {overflow-wrap:anywhere}
  .case-item .summary {white-space:normal}
  .detail-head .spread {flex-wrap:wrap}
  .modal-head, .modal-body, .modal-foot {padding-inline:14px}
  .form-body, .form-foot {padding-inline:13px}
  .top-mentor {overflow:hidden;text-overflow:ellipsis;max-width:57%;justify-content:flex-start}
}
@media (max-width:430px) {
  .nav button {min-width:40px;min-height:44px}
  .top {gap:6px}
  .hero .actions {row-gap:8px}
  .stat small {white-space:normal}
}
