
/* Typography and contrast guardrails:
 * - Keep text at 12px or larger; the .tooth label is the sole 11px exception.
 * - Do not use #9ca3af or lighter gray as text color; reserve it for borders,
 *   separators, and placeholders.
 */
:root{--primary:#0d9488;--primary-light:#14b8a6;--primary-dark:#0f766e;--primary-50:#f0fdfa;--warn:#f59e0b;--danger:#ef4444;--success:#10b981;--purple:#8b5cf6;--fs-base:14px;--fs-sm:13px;--fs-xs:12px;--text-1:#111827;--text-2:#374151;--text-3:#4b5563;--text-4:#6b7280;--border:#e5e7eb;--rail:108px;--sub:122px;--top:60px;}
*{box-sizing:border-box;}
html{background:#f5f7fa;}
html,body{min-width:1200px;}
a{text-decoration:none;}
a:focus,button:focus{outline:none;}
a:focus-visible,button:focus-visible,:focus-visible{outline:2px solid var(--primary);outline-offset:2px;}
body{margin:0;overflow-x:auto;font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",sans-serif;background:#f5f7fa;color:var(--text-1);font-size:var(--fs-base);}
body.prototype-nav{display:flex;align-items:flex-start;}
body.prototype-nav>.main{flex:1;min-width:0;width:auto;margin:0;min-height:100vh;display:flex;flex-direction:column;}
.topbar{position:sticky;top:0;background:#fff;border-bottom:1px solid var(--border);height:60px;flex-shrink:0;display:flex;align-items:center;padding:0 16px;z-index:60;gap:12px;min-width:0;overflow:visible;}
body.prototype-nav .topbar{height:60px;}
.topbar-page-title{flex:0 1 220px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--text-2);font-size:14px;font-weight:600;}
.topbar-right{display:flex;align-items:center;gap:10px;margin-left:auto;min-width:0;white-space:nowrap;}
.topbar-shortcut{display:flex;flex:0 0 54px;flex-direction:column;align-items:center;justify-content:center;gap:2px;min-height:42px;padding:2px 3px;color:var(--text-2);font-size:12px;line-height:1.15;text-decoration:none;white-space:nowrap;}
.topbar-right>.topbar-shortcut{flex:0 0 54px;}
.topbar-shortcut:hover{color:var(--primary);}
.topbar-shortcut .svg-icon-sm{width:17px;height:17px;}
@media (max-width:1360px){.topbar-right>.topbar-shortcut{display:none}}
.content{padding:18px 20px;min-width:0;overflow-x:auto;}
/* Prototype navigation: keep the 108 / 122 / 60 geometry in one place. */
.rail{position:sticky;top:0;left:0;height:100vh;width:108px;flex:0 0 108px;background:#fff;border-right:1px solid var(--border);display:flex;flex-direction:column;z-index:60;}
.rail-brand{height:60px;display:flex;align-items:center;justify-content:flex-start;gap:7px;padding:0 10px;border-bottom:1px solid var(--border);flex-shrink:0;}
.rail-brand img{width:26px;height:26px;border-radius:8px;display:block;}
.rail-brand .bn{display:block;font-size:14.5px;font-weight:800;color:#111;letter-spacing:.01em;white-space:nowrap;}
.rail-logo-fallback{width:26px;height:26px;display:inline-flex;align-items:center;justify-content:center;color:#0f766e;}
.rail-nav{flex:1;overflow-y:auto;padding:8px;display:flex;flex-direction:column;gap:2px;scrollbar-width:none;}
.rail-nav::-webkit-scrollbar{display:none;}
.rail-item{position:relative;display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:9px;padding:0 10px;height:41px;flex-shrink:0;border-radius:9px;color:var(--text-2);background:transparent;border:0;width:100%;text-decoration:none;cursor:pointer;transition:color .15s,background .15s;}
.rail-item:hover{color:#0f766e;background:#f7f9f9;}
.rail-item.active,.rail-item.is-pending{color:#0f766e;font-weight:700;background:#f0fdfa;}
.rail-item.active::before{content:"";position:absolute;left:1px;top:50%;transform:translateY(-50%);width:3px;height:16px;border-radius:2px;background:#0d9488;}
.rail-item .ri{width:21px;height:21px;display:flex;align-items:center;justify-content:center;flex-shrink:0;color:#0f766e;}
.rail-item .ri .svg-icon{width:18px;height:18px;}
.rail-item .rl{font-size:14.5px;font-weight:600;line-height:1.2;white-space:nowrap;color:#33474a;}
.rail-item.active .rl{font-weight:700;color:#0f766e;}
.rail-item:disabled{cursor:not-allowed;opacity:.5;}
body.prototype-nav .subnav{position:sticky;top:0;left:108px;height:100vh;width:122px;flex:0 0 122px;background:#f8fafc;border-right:1px solid var(--border);display:flex;flex-direction:column;z-index:50;}
.sub-head{height:60px;flex-shrink:0;padding:0 6px;display:flex;align-items:center;gap:5px;border-bottom:1px solid var(--border);background:linear-gradient(180deg,#fff,#f8fafc);}
.sub-head .sh-ic{width:20px;height:20px;border-radius:6px;background:#0d9488;color:#fff;display:flex;align-items:center;justify-content:center;flex-shrink:0;}
.sub-head .sh-ic .svg-icon-sm{width:15px;height:15px;}
.sub-head .sh-name{font-size:14px;font-weight:800;color:#111;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.sub-body{flex:1;overflow-y:auto;padding:8px 4px 18px;}
body.prototype-nav .sub-item{width:100%;display:flex;align-items:center;gap:4px;padding:9px 6px;margin:0 0 2px;min-height:0;border:0;border-radius:7px;background:transparent;color:#33474a;text-align:left;white-space:nowrap;font-size:14px;font-weight:500;cursor:pointer;text-decoration:none;transition:all .13s;}
body.prototype-nav .sub-item:hover{background:#fff;color:#0f766e;box-shadow:0 1px 2px rgba(15,23,42,.06);}
body.prototype-nav .sub-item.active{background:#f0fdfa;color:#0f766e;font-weight:700;box-shadow:inset 3px 0 0 #0d9488;}
.sub-item .dot{width:4px;height:4px;border-radius:50%;background:#c3d2d1;flex-shrink:0;}
.sub-item.active .dot,.sub-item:hover .dot{background:#0d9488;}
.sub-item .si-label{overflow:hidden;text-overflow:ellipsis;}
body.prototype-nav .sub-item.planned{color:var(--text-4);cursor:not-allowed;box-shadow:none;}
.sub-sect{margin-top:10px;}
.sub-sect:first-child{margin-top:2px;}
.sub-sect-label{width:100%;display:flex;align-items:center;gap:4px;padding:7px;border:1px solid transparent;border-radius:8px;background:#f1f5f9;text-align:left;cursor:pointer;font-size:11px;font-weight:700;color:#64748b;}
.sub-sect-label .ssl-name{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.sub-sect-label .ssl-chev{width:13px;height:13px;flex-shrink:0;margin-left:auto;transition:transform .2s;}
.sub-sect.open .sub-sect-label{background:#f0fdfa;color:#0f766e;border-color:#ccfbf1;}
.sub-sect.collapsed .ssl-chev{transform:rotate(-90deg);}
.sub-sect-items{display:grid;grid-template-rows:1fr;transition:grid-template-rows .22s ease;}
.sub-sect.collapsed .sub-sect-items{grid-template-rows:0fr;}
.sub-sect-inner{overflow:hidden;min-height:0;display:flex;flex-direction:column;}
@media(prefers-reduced-motion:reduce){.sub-sect-items,.ssl-chev{transition:none!important;}}
@media(max-width:768px){
  html.ui1-mobile-shell body.prototype-nav .subnav nav.sub-body{display:block;min-width:0;}
  html.ui1-mobile-shell body.prototype-nav .subnav .sub-item{min-height:0;margin:0 0 2px;padding:9px 6px;font-size:14px;}
}
.badge{background:var(--danger);color:#fff;font-size:var(--fs-xs);padding:1px 6px;border-radius:10px;}
.card{background:#fff;border-radius:12px;padding:18px;box-shadow:0 1px 3px rgba(0,0,0,.04);margin-bottom:16px;min-width:0;overflow:auto;}
.card-title{font-size:16px;font-weight:600;margin-bottom:14px;display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px;}
.stat-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:14px;margin-bottom:16px;}
.stat{background:#fff;border-radius:12px;padding:16px;box-shadow:0 1px 3px rgba(0,0,0,.04);position:relative;overflow:hidden;}
.stat-label{font-size:var(--fs-sm);color:var(--text-4);}
.stat-val{font-size:24px;font-weight:700;margin-top:6px;}
.stat-trend{font-size:var(--fs-xs);margin-top:6px;}
.stat-icon{position:absolute;right:12px;top:14px;opacity:.15;}
table.tbl{width:100%;border-collapse:collapse;font-size:var(--fs-base);}
table.tbl th{text-align:left;padding:10px 12px;background:#f9fafb;color:var(--text-3);font-weight:500;font-size:var(--fs-sm);border-bottom:1px solid #e5e7eb;}
table.tbl td{padding:10px 12px;border-bottom:1px solid #f3f4f6;}
table.tbl tr:hover td{background:#f9fafb;}
.tag{display:inline-block;padding:2px 8px;border-radius:4px;font-size:var(--fs-xs);}
.tag-green{background:#d1fae5;color:#065f46;} .tag-blue{background:#dbeafe;color:#1e40af;}
.tag-red{background:#fee2e2;color:#991b1b;} .tag-orange{background:#fed7aa;color:#9a3412;}
.tag-gray{background:#f3f4f6;color:#4b5563;} .tag-purple{background:#ede9fe;color:#5b21b6;}
.btn{padding:6px 14px;border-radius:6px;border:none;cursor:pointer;font-size:var(--fs-base);display:inline-flex;align-items:center;gap:4px;background:#fff;border:1px solid #e5e7eb;color:#4b5563;}
.btn:hover{background:#f9fafb;}
.btn-primary{background:var(--primary);color:#fff;border-color:var(--primary);} .btn-primary:hover{background:var(--primary-dark);border-color:var(--primary-dark);}
.btn-white{background:#fff;border:1px solid #e5e7eb;color:#4b5563;} .btn-white:hover{background:#f9fafb;}
.btn-danger{background:var(--danger);color:#fff;border-color:var(--danger);} .btn-warn{background:var(--warn);color:#fff;border-color:var(--warn);}
.btn-success{background:var(--success);color:#fff;border-color:var(--success);}
.btn-sm{padding:4px 10px;font-size:var(--fs-sm);}
.input,.select,.textarea{width:100%;padding:7px 10px;border:1px solid #d1d5db;border-radius:6px;font-size:var(--fs-base);background:#fff;}
.input:focus,.select:focus,.textarea:focus{outline:none;border-color:var(--primary);box-shadow:0 0 0 2px rgba(13,148,136,.1);}
.field{margin-bottom:12px;}
.field label{display:block;font-size:var(--fs-sm);color:var(--text-2);margin-bottom:4px;}
.tabs{display:flex;border-bottom:1px solid #e5e7eb;margin-bottom:14px;gap:4px;}
.tab{padding:8px 16px;cursor:pointer;border-bottom:2px solid transparent;color:#6b7280;font-size:13px;}
.tab.active{color:var(--primary);border-bottom-color:var(--primary);font-weight:600;}
.modal-mask{position:fixed;inset:0;background:rgba(0,0,0,.45);z-index:100;display:none;align-items:center;justify-content:center;}
.modal-mask.show{display:flex;}
.modal-box{background:#fff;border-radius:12px;width:620px;max-width:95vw;max-height:90vh;display:flex;flex-direction:column;box-shadow:0 10px 40px rgba(0,0,0,.2);}
.modal-sm{width:420px;} .modal-lg{width:780px;} .modal-xl{width:1080px;} .modal-full{width:96vw;height:94vh;}
.modal-head{padding:14px 20px;border-bottom:1px solid #e5e7eb;display:flex;justify-content:space-between;align-items:center;font-weight:600;}
.modal-body{padding:18px 20px;overflow:auto;flex:1;min-width:0;}
.modal-foot{padding:12px 20px;border-top:1px solid #e5e7eb;display:flex;justify-content:flex-end;gap:8px;}
.toast{position:fixed;top:70px;left:50%;transform:translateX(-50%) translateY(-20px);background:#333;color:#fff;padding:10px 20px;border-radius:8px;z-index:200;opacity:0;transition:all .3s;pointer-events:none;font-size:13px;}
.toast.show{opacity:1;transform:translateX(-50%) translateY(0);}
.toast.success{background:var(--success);} .toast.error{background:var(--danger);}
.toast.warn{background:var(--warn);} .toast.info{background:#3b82f6;}
.dd{position:relative;}
.dd-menu{position:absolute;top:100%;right:0;background:#fff;border:1px solid #e5e7eb;border-radius:8px;box-shadow:0 8px 24px rgba(0,0,0,.12);min-width:160px;display:none;z-index:70;padding:4px 0;margin-top:4px;max-height:70vh;overflow-y:auto;}
.topbar-right .dd{z-index:1;}
.content{position:relative;z-index:1;}
.content-enter{opacity:0;animation:content-enter .12s ease-out forwards;}
@keyframes content-enter{to{opacity:1;}}
@media (prefers-reduced-motion:reduce){.content-enter{animation:none;opacity:1;}}
@view-transition{navigation:auto;}
.ui1-page-header{display:flex;align-items:center;justify-content:space-between;gap:16px;}
.ui1-page-header>h1{margin:0;font-size:22px;line-height:1.25;}
.ui1-page-header>[data-header-actions]:empty{display:none;}

.dd-menu.show{display:block;}
.dd-item{padding:8px 14px;cursor:pointer;font-size:13px;display:flex;align-items:center;gap:8px;}
.dd-item:hover{background:#f0fdfa;color:var(--primary);}
.avatar{width:30px;height:30px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;color:#fff;font-size:12px;font-weight:600;flex-shrink:0;}
.svg-icon{width:18px;height:18px;stroke-width:1.5;fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0;}
.svg-icon-sm{width:16px;height:16px;stroke-width:1.5;fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0;}
.nav-icon{width:18px;height:18px;stroke-width:1.5;fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0;}
.tooth{width:34px;height:40px;border:1.5px solid #d1d5db;border-radius:50% 50% 45% 45%/55% 55% 45% 45%;display:inline-flex;align-items:center;justify-content:center;font-size:11px;color:var(--text-4);cursor:pointer;margin:2px;background:#fff;user-select:none;}
.tooth.implant{background:#ede9fe;border-color:#8b5cf6;color:#5b21b6;}
.tooth.missing{background:#fee2e2;border-color:#ef4444;color:#991b1b;}
.tooth.filled{background:#fed7aa;border-color:#f59e0b;color:#9a3412;}
.tooth.crown{background:#dbeafe;border-color:#3b82f6;color:#1e40af;}
.step{display:flex;align-items:center;gap:8px;padding:8px 0;}
.step-dot{width:28px;height:28px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:12px;background:#e5e7eb;color:#6b7280;flex-shrink:0;font-weight:600;}
.step-dot.done{background:var(--success);color:#fff;}
.step-dot.active{background:var(--primary);color:#fff;box-shadow:0 0 0 4px rgba(13,148,136,.15);}
.step-line{flex:1;height:2px;background:#e5e7eb;}
.step-line.done{background:var(--success);}
.kpi{padding:14px;border-radius:10px;color:#fff;}
.kanban-col{background:#f5f7fa;border-radius:10px;padding:12px;min-height:400px;}
.kanban-col h4{margin:0 0 10px 0;font-size:13px;color:#4b5563;display:flex;align-items:center;justify-content:space-between;}
.k-card{background:#fff;border-radius:8px;padding:12px;margin-bottom:10px;box-shadow:0 1px 2px rgba(0,0,0,.04);cursor:grab;border-left:3px solid var(--primary);}
.k-card:hover{box-shadow:0 4px 12px rgba(0,0,0,.08);}
.k-card.red{border-left-color:#ef4444;}
.k-card.orange{border-left-color:#f59e0b;}
.k-card.blue{border-left-color:#3b82f6;}
.k-card.purple{border-left-color:#8b5cf6;}
.k-card.green{border-left-color:#10b981;}
.mini-phone{width:360px;height:720px;border:10px solid #1f2937;border-radius:36px;overflow:hidden;background:#f5f7fa;box-shadow:0 20px 60px rgba(0,0,0,.2);position:relative;}
.mini-status{height:30px;background:#000;color:#fff;display:flex;align-items:center;justify-content:space-between;padding:0 18px;font-size:var(--fs-xs);}
.mini-body{height:calc(100% - 80px);overflow-y:auto;}
.mini-tab{position:absolute;bottom:0;left:0;right:0;height:50px;background:#fff;border-top:1px solid #e5e7eb;display:grid;grid-template-columns:repeat(4,1fr);}
.mini-tab-item{display:flex;flex-direction:column;align-items:center;justify-content:center;font-size:var(--fs-xs);color:var(--text-4);gap:2px;cursor:pointer;}
.mini-tab-item.active{color:var(--primary);}
.inline-btn{cursor:pointer;display:inline-flex;align-items:center;gap:3px;}
.coupon-card{border-radius:10px;overflow:hidden;background:linear-gradient(135deg,#ef4444,#f97316);color:#fff;padding:16px;position:relative;}
.coupon-card::before,.coupon-card::after{content:'';position:absolute;width:16px;height:16px;background:#f5f7fa;border-radius:50%;top:50%;transform:translateY(-50%);}
.coupon-card::before{left:-8px;} .coupon-card::after{right:-8px;}
.level-card{border-radius:12px;padding:20px;color:#fff;position:relative;overflow:hidden;}
.tool-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:14px;}
.tool-item{background:#fff;border-radius:10px;padding:16px;text-align:center;cursor:pointer;border:1px solid #f0f0f0;transition:all .15s;}
.tool-item:hover{border-color:var(--primary);transform:translateY(-2px);box-shadow:0 4px 12px rgba(13,148,136,.15);}
.tool-icon{width:48px;height:48px;border-radius:12px;display:inline-flex;align-items:center;justify-content:center;color:#fff;margin-bottom:8px;}
.form-row{display:grid;grid-template-columns:1fr 1fr;gap:12px;}
label.checklist,.checklist label{display:inline-flex;align-items:center;gap:6px;margin-right:14px;font-size:var(--fs-sm);cursor:pointer;}
.progress-bar{height:6px;background:#e5e7eb;border-radius:3px;overflow:hidden;}
.progress-fill{height:100%;background:var(--primary);border-radius:3px;}
.print-receipt{width:280px;background:#fff;padding:14px;font-family:'Courier New',monospace;font-size:var(--fs-xs);border:1px dashed #ccc;margin:0 auto;min-height:400px;}
.dashed{border-top:1px dashed #999;margin:8px 0;}
/* >>> BEGIN layout_guard */
.topbar-search{min-width:0;}
.topbar-search .input{min-width:0;}
.topbar-right>*{flex:0 0 auto;}
.platform-chip{display:flex;align-items:center;gap:6px;padding:6px 10px;border-radius:6px;background:var(--primary-50);color:var(--primary);font-weight:600;font-size:12px;}
.content>div,[style*="display:grid"]>*{min-width:0;}
.card .tbl{min-width:640px;}
.modal-body .tbl{min-width:560px;}
body[data-role="saas"] .topbar{position:sticky;top:0;z-index:60;}
/* <<< END layout_guard */

@keyframes pulse{0%,100%{transform:scale(1);opacity:1;}50%{transform:scale(1.04);opacity:.85;}}

