:root {
  color-scheme: light;
  --bg:#f3f7f5;
  --panel:#fff;
  --panel-2:#f8fbf9;
  --text:#14211c;
  --muted:#68776f;
  --border:#dbe6e0;
  --brand:#176c50;
  --brand-dark:#145a44;
  --brand-soft:#e4f3ec;
  --blue:#276ca8;
  --blue-soft:#e8f2fb;
  --warn:#a35c09;
  --warn-soft:#fff3df;
  --danger:#b53d3d;
  --danger-soft:#fdeceb;
  --shadow:0 12px 32px rgba(31,63,49,.08);
}
* { box-sizing:border-box; }
[hidden] { display:none !important; }
body { margin:0; color:var(--text); background:var(--bg); font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; font-size:14px; }
button,input,select,textarea { font:inherit; }
button { color:inherit; }
h1,h2,h3,p { margin:0; }
h1 { font-size:26px; line-height:1.2; font-weight:650; }
h2 { font-size:17px; font-weight:650; }
h3 { font-size:14px; font-weight:650; }
.muted { color:var(--muted); }
.login-screen { min-height:100vh; display:grid; place-items:center; padding:24px; background:radial-gradient(circle at 30% 20%,#e2f2ea 0,transparent 35%),var(--bg); }
.login-card { width:min(430px,100%); padding:30px; border:1px solid var(--border); border-radius:18px; background:var(--panel); box-shadow:var(--shadow); }
.login-brand,.app-brand { display:flex; align-items:center; gap:10px; }
.login-brand { margin-bottom:18px; }
.login-brand div,.app-brand div { display:grid; gap:2px; }
.login-brand span:not(.brand-mark),.app-brand span:not(.brand-mark) { color:var(--muted); font-size:12px; }
.brand-mark { display:grid; place-items:center; width:38px; height:38px; border-radius:11px; color:#fff; background:var(--brand); font-weight:750; }
.demo-label { display:inline-flex; margin-bottom:22px; padding:6px 9px; border-radius:999px; color:var(--brand); background:var(--brand-soft); font-size:12px; }
.login-card h1 { margin-bottom:7px; }
.form-stack { display:grid; gap:14px; margin-top:22px; }
.form-stack label,.form-grid label { display:grid; gap:6px; color:var(--muted); }
input,select,textarea { width:100%; min-height:40px; padding:9px 10px; border:1px solid var(--border); border-radius:9px; color:var(--text); background:var(--panel); outline:none; }
textarea { resize:vertical; line-height:1.45; }
input:focus,select:focus,textarea:focus { border-color:var(--brand); box-shadow:0 0 0 3px var(--brand-soft); }
input:disabled,select:disabled,textarea:disabled { color:var(--text); background:#f3f6f4; opacity:1; }
.form-error { min-height:18px; color:var(--danger); }
.button { display:inline-flex; align-items:center; justify-content:center; gap:7px; min-height:38px; padding:8px 12px; border:1px solid var(--border); border-radius:9px; background:var(--panel); cursor:pointer; }
.button:hover { border-color:var(--brand); }
.button:disabled { opacity:.55; cursor:not-allowed; }
.button-primary { color:#fff; border-color:var(--brand); background:var(--brand); }
.button-primary:hover { background:var(--brand-dark); }
.confirm-button { color:#fff; border-color:var(--danger); background:var(--danger); }
.button-ghost { border-color:transparent; background:transparent; }
.button-block { width:100%; }
.button-small { min-height:31px; padding:5px 9px; font-size:12px; }
.text-button { padding:4px; border:0; color:var(--brand); background:transparent; cursor:pointer; }
.demo-users { display:flex; flex-wrap:wrap; gap:6px; align-items:center; margin-top:20px; color:var(--muted); font-size:12px; }
.demo-users button { padding:4px 6px; border:0; color:var(--brand); background:transparent; cursor:pointer; }
.app { min-height:100vh; }
.topbar { position:sticky; top:0; z-index:15; display:flex; align-items:center; justify-content:space-between; gap:16px; min-height:64px; padding:10px 18px; color:#effaf5; background:var(--brand-dark); box-shadow:0 1px 0 rgba(255,255,255,.12); }
.app-brand .brand-mark { background:rgba(255,255,255,.16); }
.app-brand span:not(.brand-mark) { color:#d5eee3; }
.topbar-tools { display:flex; align-items:center; gap:8px; }
.branch-field { display:flex; align-items:center; gap:8px; }
.branch-field span { font-size:12px; opacity:.75; }
.branch-field select { width:170px; min-height:36px; color:#fff; border-color:rgba(255,255,255,.25); background:rgba(255,255,255,.1); }
.branch-field select option { color:var(--text); background:#fff; }
.icon-button { position:relative; display:grid; place-items:center; width:38px; height:38px; border:1px solid rgba(255,255,255,.22); border-radius:9px; color:inherit; background:rgba(255,255,255,.08); cursor:pointer; }
.counter { position:absolute; top:-6px; right:-6px; display:grid; place-items:center; min-width:19px; height:19px; padding:0 4px; border:2px solid var(--brand-dark); border-radius:999px; color:#fff; background:var(--danger); font-size:10px; }
.user-button { display:flex; align-items:center; gap:8px; padding:0; border:0; color:#fff; background:transparent; }
.avatar { display:grid; place-items:center; width:36px; height:36px; border-radius:50%; color:var(--brand-dark); background:#e9f6f0; font-weight:700; }
.user-copy { display:grid; gap:2px; text-align:left; }
.user-copy small { color:#d5eee3; }
.topbar .button-ghost { color:#fff; }
.app-layout { display:grid; grid-template-columns:86px minmax(0,1fr); min-height:calc(100vh - 64px); }
.sidebar { position:sticky; top:64px; align-self:start; display:grid; gap:6px; padding:14px 9px; border-right:1px solid var(--border); background:var(--panel); min-height:calc(100vh - 64px); }
.nav-item { display:flex; flex-direction:column; align-items:center; gap:5px; min-height:58px; padding:8px 4px; border:0; border-radius:10px; color:var(--muted); background:transparent; cursor:pointer; }
.nav-item span { font-size:17px; }
.nav-item em { font-size:11px; font-style:normal; }
.nav-item:hover,.nav-item.is-active { color:var(--brand); background:var(--brand-soft); }
.workspace { min-width:0; padding:20px; }
.global-banner { display:flex; align-items:center; gap:8px; margin-bottom:14px; padding:9px 12px; border:1px solid #b8decb; border-radius:10px; color:var(--brand); background:var(--brand-soft); }
.global-banner span { color:var(--muted); }
.page { display:none; }
.page.is-active { display:block; }
.page-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; margin-bottom:16px; }
.page-heading p,.panel-heading p { margin-top:4px; color:var(--muted); }
.heading-actions { display:flex; gap:8px; }
.heading-actions input { width:160px; }
.stats-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; margin-bottom:14px; }
.stats-grid-three { grid-template-columns:repeat(3,minmax(0,1fr)); }
.stat { display:grid; gap:4px; padding:15px; border:1px solid var(--border); border-radius:12px; text-align:left; background:var(--panel); box-shadow:var(--shadow); }
button.stat { cursor:pointer; }
button.stat:hover { border-color:var(--brand); }
.stat span,.stat small { color:var(--muted); }
.stat strong { margin:4px 0; font-size:25px; font-weight:700; }
.content-grid { display:grid; grid-template-columns:minmax(0,1.25fr) minmax(300px,.75fr); gap:14px; margin-bottom:14px; }
.content-grid-main { grid-template-columns:minmax(0,1.45fr) minmax(300px,.72fr); }
.panel { min-width:0; padding:16px; border:1px solid var(--border); border-radius:12px; background:var(--panel); box-shadow:var(--shadow); }
.panel-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:13px; }
.badge { display:inline-flex; align-items:center; gap:5px; width:max-content; padding:4px 8px; border-radius:999px; font-size:12px; white-space:nowrap; }
.badge::before { content:""; width:7px; height:7px; border-radius:50%; background:currentColor; }
.badge-green { color:var(--brand); background:var(--brand-soft); }
.badge-blue { color:var(--blue); background:var(--blue-soft); }
.badge-warn { color:var(--warn); background:var(--warn-soft); }
.badge-danger { color:var(--danger); background:var(--danger-soft); }
.badge-neutral { color:var(--muted); background:var(--panel-2); }
.loading { color:var(--muted); }
.list { display:grid; }
.list-row { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:10px; align-items:center; padding:10px 0; border-bottom:1px solid var(--border); }
.list-row:last-child { border-bottom:0; }
.list-row strong { display:block; margin-bottom:3px; }
.list-row small { color:var(--muted); }
.compact-schedule { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:9px; }
.compact-column { padding:10px; border:1px solid var(--border); border-radius:10px; background:var(--panel-2); }
.compact-column h3 { margin-bottom:8px; }
.compact-appointment { padding:9px; border-left:3px solid var(--brand); border-radius:7px; background:var(--panel); }
.compact-appointment + .compact-appointment { margin-top:6px; }
.compact-appointment strong,.compact-appointment span,.compact-appointment small { display:block; }
.compact-appointment span,.compact-appointment small { margin-top:3px; color:var(--muted); }
.route-line { position:relative; display:grid; grid-template-columns:repeat(5,minmax(80px,1fr)); margin:10px 0 18px; }
.route-line::before { content:""; position:absolute; top:16px; left:8%; right:8%; height:2px; background:var(--border); }
.route-step { position:relative; z-index:1; display:grid; justify-items:center; gap:6px; color:var(--muted); text-align:center; }
.route-step b { display:grid; place-items:center; width:33px; height:33px; border:2px solid var(--border); border-radius:50%; background:var(--panel); }
.route-step.done b { color:#fff; border-color:var(--brand); background:var(--brand); }
.route-step.current { color:var(--brand); }
.route-step.current b { border-color:var(--brand); background:var(--brand-soft); }
.check-result { margin-top:10px; }
.check-grid { display:flex; flex-wrap:wrap; gap:6px; }
.check-item { padding:5px 8px; border-radius:7px; color:var(--brand); background:var(--brand-soft); }
.split-layout { display:grid; grid-template-columns:minmax(260px,.72fr) minmax(0,1.4fr); gap:14px; }
.search-field { display:flex; align-items:center; gap:7px; margin-bottom:10px; padding:0 9px; border:1px solid var(--border); border-radius:9px; color:var(--muted); }
.search-field input { padding-left:0; border:0; box-shadow:none; }
.patient-list { display:grid; gap:5px; }
.patient-button { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px; padding:10px; border:1px solid transparent; border-radius:9px; text-align:left; background:transparent; cursor:pointer; }
.patient-button:hover,.patient-button.is-selected { border-color:var(--border); background:var(--brand-soft); }
.patient-button span { color:var(--muted); }
.patient-code { font-family:ui-monospace,SFMono-Regular,Consolas,monospace; font-size:11px; }
.empty-state { display:grid; justify-items:center; gap:8px; min-height:340px; align-content:center; color:var(--muted); text-align:center; }
.empty-icon { display:grid; place-items:center; width:58px; height:58px; border-radius:50%; background:var(--brand-soft); font-size:25px; }
.patient-hero { display:flex; align-items:center; justify-content:space-between; gap:12px; padding-bottom:14px; border-bottom:1px solid var(--border); }
.patient-name { display:flex; align-items:center; gap:10px; }
.patient-name .avatar { width:44px; height:44px; }
.detail-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:9px; margin:13px 0; }
.detail-field { padding:10px; border:1px solid var(--border); border-radius:9px; background:var(--panel-2); }
.detail-field span { display:block; margin-bottom:3px; color:var(--muted); }
.case-card { padding:12px; border:1px solid var(--border); border-radius:10px; background:var(--panel-2); }
.case-card + .case-card { margin-top:8px; }
.case-head { display:flex; justify-content:space-between; gap:10px; }
.case-actions,.row-actions { display:flex; flex-wrap:wrap; align-items:center; gap:7px; }
.case-actions { margin-top:11px; }
.family-contact { display:grid; gap:4px; padding:11px; border:1px solid var(--border); border-radius:9px; background:var(--panel-2); }
.family-contact span { color:var(--muted); }
.family-contact strong { line-height:1.5; }
.clinical-section-heading { margin-top:18px; }
.plan-history { display:grid; margin-top:11px; border-top:1px solid var(--border); }
.plan-version-row { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:10px; align-items:center; padding:9px 0; border-bottom:1px solid var(--border); }
.plan-version-row small { display:block; margin-top:3px; color:var(--muted); }
.plan-version-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; align-items:center; gap:7px; }
.treatment-items { display:flex; flex-wrap:wrap; gap:6px; margin-top:9px; }
.treatment-item { padding:5px 7px; border-radius:7px; color:var(--muted); background:var(--panel); }
.schedule-legend { display:flex; flex-wrap:wrap; gap:14px; margin-bottom:12px; color:var(--muted); }
.schedule-legend span { display:flex; align-items:center; gap:6px; }
.legend-dot { width:9px; height:9px; border-radius:50%; background:var(--brand); }
.legend-dot.booked { background:var(--blue); }
.legend-dot.online { background:var(--warn); }
.schedule-board { display:grid; grid-template-columns:repeat(3,minmax(220px,1fr)); gap:10px; overflow-x:auto; }
.chair-column { min-width:220px; padding:11px; border:1px solid var(--border); border-radius:10px; background:var(--panel-2); }
.chair-head { display:flex; justify-content:space-between; margin-bottom:10px; }
.chair-head span { color:var(--muted); }
.appointment-card { margin-bottom:8px; padding:10px; border:1px solid var(--border); border-left:4px solid var(--blue); border-radius:9px; background:var(--panel); }
.appointment-card.confirmed { border-left-color:var(--brand); }
.appointment-card .appointment-time { display:flex; justify-content:space-between; gap:8px; margin-bottom:6px; }
.appointment-card strong { display:block; }
.appointment-card p { margin:4px 0; color:var(--muted); }
.appointment-card small { display:block; color:var(--muted); }
.appointment-action { margin-top:8px; }
.task-list { display:grid; }
.task-row { display:grid; grid-template-columns:22px minmax(0,1fr) auto auto; gap:10px; align-items:center; padding:11px 0; border-bottom:1px solid var(--border); }
.task-row:last-child { border-bottom:0; }
.task-row input { width:18px; min-height:18px; accent-color:var(--brand); }
.task-row.is-done { opacity:.55; }
.task-row.is-done strong { text-decoration:line-through; }
.table-wrap { overflow-x:auto; }
table { width:100%; border-collapse:collapse; }
th,td { padding:10px 9px; border-bottom:1px solid var(--border); text-align:left; white-space:nowrap; }
th { color:var(--muted); font-weight:500; }
tbody tr:last-child td { border-bottom:0; }
.money { font-variant-numeric:tabular-nums; text-align:right; }
.integrity-banner { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:14px; padding:13px 15px; border:1px solid #b8decb; border-radius:10px; color:var(--brand); background:var(--brand-soft); }
.hash { color:var(--muted); font-family:ui-monospace,SFMono-Regular,Consolas,monospace; font-size:12px; }
.integration-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; margin-bottom:14px; }
.integration-card { padding:15px; border:1px solid var(--border); border-radius:12px; background:var(--panel); box-shadow:var(--shadow); }
.integration-card .integration-head { display:flex; justify-content:space-between; gap:8px; margin-bottom:16px; }
.integration-card p { min-height:36px; margin:7px 0 14px; color:var(--muted); }
.api-panel { margin-bottom:20px; }
.api-list { display:grid; grid-template-columns:minmax(180px,.7fr) minmax(200px,1fr); gap:0 16px; }
.api-list code,.api-list span { padding:9px 0; border-bottom:1px solid var(--border); }
.api-list code { color:var(--brand); }
.drawer { position:fixed; z-index:30; top:0; right:0; width:min(420px,100%); height:100vh; overflow:auto; padding:18px; border-left:1px solid var(--border); background:var(--panel); box-shadow:-18px 0 42px rgba(15,35,26,.16); }
.drawer-header { display:flex; justify-content:space-between; gap:10px; margin-bottom:16px; }
.drawer .icon-button { color:var(--text); border-color:var(--border); background:var(--panel); }
.modal-backdrop { position:fixed; z-index:40; inset:0; display:grid; place-items:center; padding:20px; background:rgba(13,28,21,.46); }
.modal { width:min(620px,100%); max-height:calc(100vh - 40px); overflow:auto; padding:20px; border:1px solid var(--border); border-radius:14px; background:var(--panel); box-shadow:0 24px 70px rgba(0,0,0,.24); }
.modal.modal-wide { width:min(1040px,100%); }
.modal.modal-workspace { width:min(1480px,100%); max-height:calc(100vh - 20px); padding:0; overflow:hidden; }
.modal-header { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:16px; }
.modal-header .icon-button { color:var(--text); border-color:var(--border); background:var(--panel); }
.form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.form-grid .full { grid-column:1 / -1; }
.check-label { display:flex !important; grid-column:1 / -1; grid-template-columns:20px 1fr; align-items:center; color:var(--text) !important; }
.check-label input { width:18px; min-height:18px; accent-color:var(--brand); }
.plan-editor-head,.plan-total,.protocol-section-head { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.plan-editor-head { margin:18px 0 9px; }
.plan-editor { display:grid; gap:8px; }
.plan-item-row { display:grid; grid-template-columns:110px minmax(220px,1fr) 130px 38px; gap:8px; align-items:end; padding:10px; border:1px solid var(--border); border-radius:10px; background:var(--panel-2); }
.plan-item-row label { display:grid; gap:5px; color:var(--muted); }
.remove-button { color:var(--danger); border-color:var(--border) !important; background:var(--panel) !important; }
.plan-total { margin-top:12px; padding:12px; border-radius:9px; background:var(--brand-soft); }
.plan-total strong { font-size:19px; color:var(--brand); }
.protocol-form { display:grid; gap:12px; }
.protocol-section { display:grid; gap:11px; padding:15px; border:1px solid var(--border); border-radius:11px; background:var(--panel-2); }
.protocol-section > label { display:grid; gap:6px; color:var(--muted); }
.protocol-section-head span { color:var(--muted); font-size:12px; }
.protocol-items { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:7px; }
.protocol-item { display:grid; grid-template-columns:20px minmax(0,1fr); gap:8px; align-items:start; padding:9px; border:1px solid var(--border); border-radius:9px; background:var(--panel); }
.protocol-item input { width:18px; min-height:18px; accent-color:var(--brand); }
.protocol-item small { display:block; margin-top:3px; color:var(--muted); }
.signed-note { align-self:center; color:var(--brand); }
.doctor-workspace { display:grid; grid-template-columns:280px minmax(0,1fr); grid-template-rows:auto minmax(0,1fr) auto; max-height:calc(100vh - 22px); background:#f6f8f7; }
.doctor-header { grid-column:1 / -1; display:flex; align-items:center; justify-content:space-between; gap:18px; min-height:82px; padding:15px 20px; color:#fff; background:linear-gradient(115deg,var(--brand-dark),#0e4938); }
.doctor-header h2 { margin:4px 0; font-size:21px; }
.doctor-header p { color:#cce5da; }
.doctor-header .icon-button { border-color:rgba(255,255,255,.25); }
.eyebrow { color:#9fd0bb; font-size:11px; font-weight:700; letter-spacing:.08em; text-transform:uppercase; }
.doctor-sidebar { overflow:auto; padding:16px; border-right:1px solid var(--border); background:#edf3f0; }
.doctor-sidebar section { display:grid; gap:8px; padding:13px 0; border-bottom:1px solid #d5e2dc; }
.doctor-sidebar section:first-child { padding-top:0; }
.doctor-sidebar section:last-child { border-bottom:0; }
.sidebar-label { color:#52675e; font-size:11px; font-weight:700; letter-spacing:.07em; text-transform:uppercase; }
.doctor-alert { display:grid; gap:3px; padding:9px; border-radius:8px; border-left:3px solid var(--warn); color:#6f430a; background:var(--warn-soft); }
.doctor-alert span { line-height:1.35; font-size:12px; }
.doctor-alert-critical { border-left-color:var(--danger); color:#842f2f; background:var(--danger-soft); }
.doctor-alert-info { border-left-color:var(--blue); color:#245a87; background:var(--blue-soft); }
.doctor-alert-ok { border-left-color:var(--brand); color:var(--brand); background:var(--brand-soft); }
.workspace-check { display:grid; grid-template-columns:18px 1fr; gap:8px; align-items:start; color:var(--text); font-size:12px; line-height:1.35; }
.workspace-check input { width:16px; min-height:16px; margin-top:1px; accent-color:var(--brand); }
.finance-preview div { display:flex; justify-content:space-between; gap:10px; color:var(--muted); font-size:12px; }
.finance-preview strong { color:var(--text); }
.finance-preview .finance-total { margin-top:2px; padding-top:9px; border-top:1px solid #d5e2dc; font-size:13px; }
.finance-preview .finance-total strong { color:var(--brand); font-size:16px; }
.readiness-head { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.readiness-head strong { color:var(--brand); font-size:16px; }
.readiness-track { height:7px; overflow:hidden; border-radius:999px; background:#d9e5df; }
.readiness-track span { display:block; width:0; height:100%; border-radius:inherit; background:var(--brand); transition:width .2s ease; }
.readiness-checklist { display:grid; gap:3px; }
.readiness-item { display:grid; grid-template-columns:17px 1fr; gap:6px; align-items:center; width:100%; min-height:28px; padding:4px 0; border:0; color:#6d766f; background:transparent; text-align:left; cursor:pointer; }
.readiness-item span { display:grid; place-items:center; width:17px; height:17px; border:1px solid #aebcb5; border-radius:50%; font-size:10px; }
.readiness-item.is-done { color:var(--brand); }
.readiness-item.is-done span { color:#fff; border-color:var(--brand); background:var(--brand); }
.encounter-history { display:grid; gap:6px; }
.encounter-history-item { display:grid; gap:3px; padding:8px; border:1px solid #d5e2dc; border-radius:8px; background:rgba(255,255,255,.65); }
.encounter-history-item strong { font-size:11px; }
.encounter-history-item span { display:-webkit-box; overflow:hidden; color:var(--muted); font-size:11px; line-height:1.35; -webkit-box-orient:vertical; -webkit-line-clamp:2; }
.doctor-main { overflow:auto; padding:18px; }
.completion-summary { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:12px; padding:13px 15px; border:1px solid #a9d6c1; border-radius:11px; color:var(--brand); background:var(--brand-soft); }
.completion-summary > div { display:grid; gap:5px; }
.completion-summary span { color:var(--muted); }
.workspace-section { display:grid; gap:13px; margin-bottom:12px; padding:16px; border:1px solid var(--border); border-radius:12px; background:var(--panel); box-shadow:0 4px 16px rgba(31,63,49,.04); }
.workspace-section.is-incomplete { border-color:#e5c081; box-shadow:0 0 0 2px rgba(224,157,43,.08); }
.workspace-section > label { display:grid; gap:6px; color:var(--muted); }
.workspace-section-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.workspace-section-head > div:first-child { display:flex; align-items:flex-start; gap:10px; }
.workspace-section-head > div:first-child > span { display:grid; place-items:center; width:29px; height:29px; flex:0 0 auto; border-radius:8px; color:var(--brand); background:var(--brand-soft); font-size:11px; font-weight:750; }
.workspace-section-head h3 { margin-bottom:3px; font-size:15px; }
.workspace-section-head p { color:var(--muted); font-size:12px; }
.required-mark { align-self:center; padding:4px 7px; border-radius:999px; color:var(--warn); background:var(--warn-soft); font-size:11px; white-space:nowrap; }
.dentition-toolbar { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:9px; border:1px solid var(--border); border-radius:10px; background:var(--panel-2); }
.dentition-switch { display:flex; gap:3px; padding:3px; border-radius:8px; background:#e5ece8; }
.dentition-switch button { min-height:32px; padding:6px 11px; border:0; border-radius:6px; color:var(--muted); background:transparent; cursor:pointer; }
.dentition-switch button.is-active { color:#fff; background:var(--brand); box-shadow:0 2px 7px rgba(13,104,75,.2); }
.dentition-switch button:disabled { cursor:default; }
.mixed-dentition-controls { display:flex; align-items:center; gap:7px; }
.mixed-dentition-controls select { min-width:190px; min-height:34px; padding:6px 9px; }
.odontogram-stack { display:grid; gap:8px; }
.odontogram-row { display:grid; grid-template-columns:118px minmax(0,1fr); gap:10px; align-items:center; padding:8px; border:1px solid var(--border); border-radius:10px; background:#fff; }
.odontogram-row-label { display:grid; gap:3px; color:var(--text); }
.odontogram-row-label span { color:var(--muted); font-size:10px; }
.odontogram-primary { border-color:#d8ceec; background:#fcfaff; }
.odontogram-arches { display:grid; gap:7px; min-width:0; }
.odontogram-arch { display:grid; grid-template-columns:92px minmax(0,1fr); gap:7px; align-items:center; min-width:0; }
.odontogram-arch-label { color:var(--muted); font-size:10px; }
.odontogram { display:grid; grid-template-columns:repeat(16,minmax(42px,1fr)); gap:5px; overflow-x:auto; padding:3px 0; }
.odontogram-columns-10 { grid-template-columns:repeat(10,minmax(42px,1fr)); }
.odontogram-columns-16 { grid-template-columns:repeat(16,minmax(42px,1fr)); }
.tooth-button { display:grid; justify-items:center; gap:3px; min-width:42px; min-height:54px; padding:7px 4px; border:1px solid var(--border); border-radius:8px; color:var(--text); background:#fff; cursor:pointer; }
.tooth-button small { max-width:46px; overflow:hidden; color:var(--muted); font-size:9px; text-overflow:ellipsis; white-space:nowrap; }
.tooth-button:hover,.tooth-button.is-selected { border-color:var(--brand); box-shadow:0 0 0 2px var(--brand-soft); }
.tooth-placeholder { display:grid; place-items:center; align-content:center; gap:1px; min-width:42px; min-height:54px; padding:5px 3px; border:1px dashed #b8c9c0; border-radius:8px; color:var(--brand); background:rgba(255,255,255,.52); cursor:pointer; }
.tooth-placeholder span { font-size:15px; line-height:1; }
.tooth-placeholder small { color:var(--muted); font-size:9px; }
.tooth-placeholder:disabled { opacity:.42; cursor:default; }
.tooth-placeholder:disabled span { visibility:hidden; }
.tooth-button.tooth-caries { color:#9a5a00; background:#fff4df; }
.tooth-button.tooth-pulpitis { color:#a73535; background:#fdeceb; }
.tooth-button.tooth-filled { color:#276ca8; background:#e8f2fb; }
.tooth-button.tooth-crown,.tooth-button.tooth-implant { color:#685318; background:#fff8d9; }
.tooth-button.tooth-missing { color:#79837e; background:repeating-linear-gradient(135deg,#f1f4f2,#f1f4f2 5px,#e4e9e6 5px,#e4e9e6 10px); }
.tooth-button.tooth-watch { color:#674e9f; background:#f1edfb; }
.tooth-editor { display:grid; grid-template-columns:minmax(130px,1fr) minmax(180px,1fr) auto; gap:8px; align-items:center; padding:10px; border-radius:9px; background:var(--panel-2); }
.tooth-transition-actions { display:flex; grid-column:1 / -1; flex-wrap:wrap; gap:7px; align-items:center; }
.structured-rows { display:grid; gap:7px; }
.structured-row { display:grid; align-items:center; gap:7px; }
.diagnosis-row { grid-template-columns:minmax(280px,1.5fr) minmax(120px,.6fr) 38px; }
.prescription-row { grid-template-columns:1.1fr .72fr .72fr .62fr 1.2fr 38px; }
.doctor-plan-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:7px; }
.doctor-plan-item { display:grid; grid-template-columns:18px minmax(0,1fr); gap:9px; align-items:start; padding:10px; border:1px solid var(--border); border-radius:9px; background:var(--panel-2); }
.doctor-plan-item input { width:17px; min-height:17px; margin-top:1px; accent-color:var(--brand); }
.doctor-plan-item small { display:block; margin-top:3px; color:var(--muted); }
.material-list { display:grid; gap:6px; }
.material-row { display:grid; grid-template-columns:18px minmax(0,1fr) 125px 100px; gap:9px; align-items:center; padding:9px 10px; border:1px solid var(--border); border-radius:9px; background:var(--panel-2); }
.material-row > input { width:17px; min-height:17px; accent-color:var(--brand); }
.material-row small { display:block; margin-top:3px; color:var(--muted); }
.material-quantity { display:grid; grid-template-columns:minmax(65px,1fr) auto; gap:5px; align-items:center; }
.material-quantity input { min-height:34px; padding:6px 8px; }
.material-cost { font-variant-numeric:tabular-nums; font-weight:650; text-align:right; }
.doctor-footer { grid-column:1 / -1; display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:66px; padding:12px 18px; border-top:1px solid var(--border); background:var(--panel); box-shadow:0 -5px 18px rgba(31,63,49,.05); }
.doctor-footer > span:first-child { color:var(--muted); font-size:12px; }
.modal-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:18px; }
.toast { position:fixed; z-index:50; right:20px; bottom:20px; display:flex; align-items:center; gap:9px; max-width:380px; padding:12px 14px; border:1px solid var(--border); border-radius:10px; background:var(--panel); box-shadow:var(--shadow); }
.toast > span { display:grid; place-items:center; width:23px; height:23px; border-radius:50%; color:#fff; background:var(--brand); }
@media (max-width:980px) {
  .user-copy,.branch-field span { display:none; }
  .branch-field select { width:130px; }
  .stats-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .content-grid,.content-grid-main,.split-layout { grid-template-columns:1fr; }
  .doctor-workspace { grid-template-columns:230px minmax(0,1fr); }
  .prescription-row { grid-template-columns:repeat(2,minmax(0,1fr)) 38px; }
  .prescription-row .remove-button { grid-column:3; grid-row:1 / 3; }
  .integration-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .detail-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:650px) {
  .topbar { position:static; padding:10px 12px; }
  .app-brand div,.topbar .button-ghost,.branch-field { display:none; }
  .app-layout { grid-template-columns:1fr; }
  .sidebar { position:sticky; top:0; z-index:14; display:flex; min-height:auto; overflow-x:auto; padding:6px; border-right:0; border-bottom:1px solid var(--border); }
  .nav-item { min-width:74px; min-height:52px; }
  .workspace { padding:14px; }
  .global-banner { align-items:flex-start; flex-direction:column; }
  .page-heading { align-items:stretch; flex-direction:column; }
  .heading-actions { flex-direction:column; }
  .heading-actions input { width:100%; }
  .stats-grid,.stats-grid-three,.integration-grid,.detail-grid,.form-grid { grid-template-columns:1fr; }
  .plan-item-row { grid-template-columns:1fr; }
  .plan-item-row .remove-button { width:100%; }
  .plan-version-row,.protocol-items { grid-template-columns:1fr; }
  .plan-version-actions { justify-content:flex-start; }
  .compact-schedule { grid-template-columns:1fr; }
  .route-line { grid-template-columns:1fr; gap:8px; }
  .route-line::before { display:none; }
  .route-step { grid-template-columns:34px 1fr; align-items:center; justify-items:start; text-align:left; }
  .task-row { grid-template-columns:22px minmax(0,1fr) auto; }
  .task-row > :last-child { display:none; }
  .api-list { grid-template-columns:1fr; }
  .api-list code { padding-bottom:2px; border-bottom:0; }
  .api-list span { padding-top:2px; }
  .modal-backdrop { padding:10px; }
  .modal.modal-workspace { max-height:calc(100vh - 10px); }
  .doctor-workspace { grid-template-columns:1fr; grid-template-rows:auto auto minmax(0,1fr) auto; max-height:calc(100vh - 12px); }
  .doctor-header { grid-column:1; align-items:flex-start; padding:13px 14px; }
  .doctor-header p { font-size:12px; }
  .doctor-sidebar { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:0 14px; max-height:220px; border-right:0; border-bottom:1px solid var(--border); }
  .doctor-sidebar section { padding:10px 0; }
  .doctor-main { padding:10px; }
  .completion-summary { align-items:stretch; flex-direction:column; }
  .workspace-section { padding:12px; }
  .workspace-section-head { align-items:stretch; flex-direction:column; }
  .dentition-toolbar { align-items:stretch; flex-direction:column; }
  .dentition-switch { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); }
  .mixed-dentition-controls { align-items:stretch; flex-direction:column; }
  .mixed-dentition-controls select { width:100%; min-width:0; }
  .odontogram-row { grid-template-columns:1fr; }
  .odontogram-row-label { display:flex; align-items:center; justify-content:space-between; }
  .tooth-editor,.diagnosis-row,.prescription-row,.material-row,.doctor-plan-list { grid-template-columns:1fr; }
  .diagnosis-row .remove-button,.prescription-row .remove-button { grid-column:auto; grid-row:auto; width:100%; }
  .material-row > input { justify-self:start; }
  .material-cost { text-align:left; }
  .doctor-footer { grid-column:1; align-items:stretch; flex-direction:column; padding:10px; }
  .doctor-footer .row-actions { display:grid; grid-template-columns:1fr; }
  .login-card { padding:22px; }
}
