:root {
  --bg: #0b0f14;          /* 深色底 */
  --panel: #121922;        /* 面板 */
  --panel2: #171f2a;       /* 次级面板 */
  --line: #223041;         /* 边框 */
  --ink: #e6ecf3;          /* 主文字 */
  --dim: #8b9aad;          /* 次要文字 */
  --accent: #2dd4bf;       /* 主色：青绿(精密/义齿) */
  --accent2: #0ea5e9;      /* 辅色 */
  --amber: #f59e0b;        /* 高亮 */
  --green: #22c55e; --red: #ef4444; --blue: #38bdf8;
  --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'PingFang SC','Microsoft YaHei',system-ui,sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.6;
  background-image: radial-gradient(1200px 600px at 80% -10%, rgba(45,212,191,.08), transparent 60%),
                    radial-gradient(900px 500px at -10% 110%, rgba(14,165,233,.08), transparent 55%);
  background-attachment: fixed;
}
.hidden { display: none !important; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #2a3a4d; border-radius: 8px; }

/* 登录 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(1000px 600px at 50% -10%, #12333a, #0b0f14 70%); }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 40px 34px; width: 400px; box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.login-brand { font-size: 24px; font-weight: 800; text-align: center; letter-spacing: .5px; }
.login-brand b { color: var(--accent); }
.login-sub { font-size: 12px; color: var(--dim); text-align: center; margin: 8px 0 26px; }
.login-card input { width: 100%; padding: 13px; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px; font-size: 14px; outline: none; color: var(--ink); }
.login-card input:focus { border-color: var(--accent); }
.login-foot { font-size: 11px; color: #5c6b7d; text-align: center; margin-top: 16px; }
.err { color: var(--red); font-size: 12px; min-height: 18px; margin-top: 8px; text-align: center; }

/* 布局 */
.app { display: flex; flex-direction: column; height: 100vh; }
.topbar { height: 60px; background: rgba(18,25,34,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 22px; padding: 0 22px; flex-shrink: 0; position: relative; z-index: 100; }
.brand { display: flex; align-items: center; gap: 9px; font-size: 17px; font-weight: 800; color: #fff; white-space: nowrap; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.brand-sub { color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: 1px; margin-left: 2px; }
.topnav { flex: 1; display: flex; align-items: center; gap: 4px; min-width: 0; }
.tnav-group { position: relative; }
.tnav-btn { background: transparent; color: #c3cede; font-size: 13.5px; padding: 9px 14px; border-radius: 9px; cursor: pointer; white-space: nowrap; font-weight: 600; }
.tnav-btn:hover { background: var(--panel2); color: #fff; }
.tnav-drop { display: none; position: absolute; top: 100%; left: 0; min-width: 172px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 6px; z-index: 60; box-shadow: 0 14px 34px rgba(0,0,0,.55); }
.tnav-group.open .tnav-drop { display: block; }
.tnav-item { padding: 9px 13px; border-radius: 8px; cursor: pointer; font-size: 13px; color: #c3cede; white-space: nowrap; }
.tnav-item:hover { background: var(--panel2); color: #fff; }
.tnav-item.active { background: rgba(45,212,191,.16); color: var(--accent); font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--dim); white-space: nowrap; }
.user-chip { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.user-chip b { color: #fff; font-size: 13px; }
.user-chip i { color: var(--dim); font-style: normal; font-size: 11px; }
.clock { color: var(--dim); font-size: 12px; }
.page-head { padding: 18px 24px 0; display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.page-head h1 { font-size: 20px; font-weight: 800; letter-spacing: .3px; }
.content { flex: 1; overflow-y: auto; padding: 14px 24px 24px; }

/* 卡片与表格 */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.card h3 { font-size: 15.5px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card h3 .bar { width: 4px; height: 16px; background: var(--accent); border-radius: 4px; }
.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 15px 16px; position: relative; overflow: hidden; }
.stat::after { content: ''; position: absolute; right: -20px; top: -20px; width: 70px; height: 70px; border-radius: 50%; background: radial-gradient(circle, rgba(45,212,191,.12), transparent 70%); }
.stat b { font-size: 26px; font-weight: 800; }
.stat span { display: block; font-size: 12px; color: var(--dim); margin-top: 2px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 9px; border-bottom: 1px solid #1b2836; }
th { color: var(--dim); font-weight: 600; font-size: 12px; }
tr:hover td { background: rgba(45,212,191,.03); }

/* 按钮 */
button { border: none; border-radius: 9px; padding: 8px 15px; font-size: 13px; cursor: pointer; font-family: inherit; }
.btn-primary { background: var(--accent); color: #06231f; font-weight: 700; }
.btn-primary:hover { background: #3ee0cd; }
.btn-mini { background: rgba(45,212,191,.14); color: var(--accent); padding: 5px 11px; font-size: 12px; }
.btn-danger { background: rgba(239,68,68,.14); color: #fca5a5; }
.btn-green { background: rgba(34,197,94,.14); color: #86efac; }
.btn-amber { background: rgba(245,158,11,.15); color: #fcd34d; }

/* 徽章 */
.badge { display: inline-block; font-size: 11px; padding: 2px 9px; border-radius: 10px; font-weight: 600; }
.badge-blue { background: rgba(56,189,248,.15); color: #7dd3fc; }
.badge-red { background: rgba(239,68,68,.15); color: #fca5a5; }
.badge-amber { background: rgba(245,158,11,.15); color: #fcd34d; }
.badge-green { background: rgba(34,197,94,.15); color: #86efac; }
.badge-gray { background: rgba(139,154,173,.15); color: #94a3b8; }

/* 弹窗 */
.modal { position: fixed; inset: 0; background: rgba(5,8,12,.7); display: flex; align-items: center; justify-content: center; z-index: 100; backdrop-filter: blur(3px); }
.modal-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; width: min(760px, 94vw); max-height: 90vh; overflow-y: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); font-weight: 700; position: sticky; top: 0; background: var(--panel); z-index: 2; }
.modal-close { background: transparent; font-size: 16px; color: var(--dim); }
.modal-body { padding: 20px; }
.modal-body label { font-size: 12px; color: var(--dim); display: block; margin: 12px 0 5px; }
.modal-body input, .modal-body select, .modal-body textarea { width: 100%; padding: 10px 12px; background: var(--panel2); border: 1px solid var(--line); border-radius: 9px; font-size: 13.5px; outline: none; font-family: inherit; color: var(--ink); }
.modal-body input:focus, .modal-body select:focus, .modal-body textarea:focus { border-color: var(--accent); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--panel); }

/* toast */
.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: #12333a; border: 1px solid var(--accent); color: #d1faf5; padding: 12px 22px; border-radius: 12px; font-size: 14px; z-index: 200; box-shadow: 0 10px 30px rgba(0,0,0,.5); }

/* 聊天 */
.chat-box { border: 1px solid var(--line); border-radius: 12px; height: 420px; overflow-y: auto; padding: 14px; background: var(--panel2); }
.chat-msg { margin-bottom: 12px; max-width: 78%; }
.chat-msg.mine { margin-left: auto; }
.chat-msg .bubble { padding: 9px 13px; border-radius: 14px; font-size: 13.5px; background: #1d2836; border: 1px solid var(--line); }
.chat-msg.mine .bubble { background: rgba(45,212,191,.16); color: #d1faf5; border-color: rgba(45,212,191,.3); }
.chat-msg .meta { font-size: 11px; color: #5c6b7d; margin: 3px 2px 0; }

/* 空态 */
.empty { text-align: center; color: #5c6b7d; padding: 44px; font-size: 14px; }

/* 牙位十字架 */
.tooth-chart { display: flex; flex-direction: column; gap: 14px; }
.tooth-arch { display: flex; justify-content: center; gap: 16px; }
.tooth-quad { display: flex; gap: 5px; }
.tooth-cell { width: 40px; height: 40px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel2); color: #b8c5d6; font-size: 11px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; user-select: none; }
.tooth-cell:hover { border-color: var(--accent); }
.tooth-cell.sel { background: var(--accent); color: #06231f; border-color: var(--accent); box-shadow: 0 0 14px rgba(45,212,191,.5); }
.tooth-cell.miss { background: rgba(245,158,11,.2); border-color: var(--amber); color: #fcd34d; }
.tooth-arch-label { text-align: center; font-size: 11px; color: #5c6b7d; letter-spacing: 3px; margin-bottom: 6px; }

/* 打印 */
.print-view { background: #fff; color: #0f172a; border-radius: 10px; padding: 24px; min-height: 400px; }
.print-view * { color: #0f172a !important; }

/* 标签 */
.tooth-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tooth-tag { background: rgba(45,212,191,.12); border: 1px solid rgba(45,212,191,.25); border-radius: 6px; padding: 3px 9px; font-size: 12px; color: #9deee2; }

/* ===== 生产看板（Kanban）===== */
.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.kanban-col { min-width: 270px; max-width: 290px; flex: 1; background: var(--panel2); border: 1px solid var(--line); border-radius: 14px; display: flex; flex-direction: column; max-height: calc(100vh - 240px); }
.kanban-col-head { padding: 12px 14px; font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel2); border-radius: 14px 14px 0 0; z-index: 1; }
.kanban-col-head .n { min-width: 22px; height: 22px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; background: rgba(255,255,255,.06); }
.kanban-col-body { padding: 10px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 10px; }
.kanban-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; transition: transform .12s, border-color .12s, box-shadow .12s; }
.kanban-card:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 8px 22px rgba(0,0,0,.35); }
.kanban-card .kc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; margin-bottom: 8px; }
.kanban-card .kc-patient { font-size: 14px; font-weight: 700; color: #fff; }
.kanban-card .kc-clinic { font-size: 11px; color: var(--dim); margin-top: 1px; }
.kanban-card .kc-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.kanban-card .kc-meta .chip { font-size: 11px; background: rgba(45,212,191,.1); color: #9deee2; border-radius: 6px; padding: 2px 7px; }
.kanban-card .kc-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.kanban-card .kc-amount { font-size: 15px; font-weight: 800; color: #fcd34d; }
.kanban-card .kc-due { font-size: 11px; color: var(--dim); }
.kanban-card .kc-actions { margin-top: 10px; display: flex; gap: 5px; flex-wrap: wrap; }
.kanban-empty { text-align: center; color: #5c6b7d; font-size: 12px; padding: 18px 6px; }

/* ===== 流程步骤条 ===== */
.stepper { display: flex; align-items: flex-start; margin: 8px 0 4px; overflow-x: auto; }
.stepper .step { flex: 1; min-width: 78px; text-align: center; position: relative; }
.stepper .step .dot { width: 22px; height: 22px; border-radius: 50%; background: var(--panel2); border: 2px solid var(--line); margin: 0 auto 6px; display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--dim); position: relative; z-index: 2; }
.stepper .step.done .dot { background: var(--accent); border-color: var(--accent); color: #06231f; }
.stepper .step.current .dot { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 4px rgba(45,212,191,.15); }
.stepper .step .lb { font-size: 11px; color: var(--dim); }
.stepper .step.done .lb, .stepper .step.current .lb { color: var(--ink); font-weight: 600; }
.stepper .step::before { content: ''; position: absolute; top: 11px; left: -50%; width: 100%; height: 2px; background: var(--line); z-index: 1; }
.stepper .step:first-child::before { display: none; }
.stepper .step.done::before { background: var(--accent); }

/* ===== 统计概览卡 ===== */
.overview-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px,1fr)); gap: 14px; margin-bottom: 18px; }
.ov-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; position: relative; overflow: hidden; }
.ov-card .ov-label { font-size: 12px; color: var(--dim); }
.ov-card .ov-value { font-size: 30px; font-weight: 800; margin: 4px 0 2px; }
.ov-card .ov-sub { font-size: 11px; color: #5c6b7d; }
.ov-card .ov-icon { position: absolute; right: 14px; top: 14px; font-size: 22px; opacity: .35; }

/* ===== 富卡片列表（通用）===== */
.rich-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px,1fr)); gap: 14px; }
.rich-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.rich-card .rc-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.rich-card .rc-title { font-size: 15px; font-weight: 700; color: #fff; }
.rich-card .rc-row { display: flex; justify-content: space-between; font-size: 12.5px; padding: 4px 0; border-bottom: 1px dashed #1b2836; }
.rich-card .rc-row:last-child { border-bottom: none; }
.rich-card .rc-k { color: var(--dim); }
.rich-card .rc-v { color: var(--ink); text-align: right; }

/* 视图切换 */
.seg { display: inline-flex; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg .seg-btn { padding: 6px 14px; border-radius: 8px; font-size: 12.5px; color: var(--dim); cursor: pointer; }
.seg .seg-btn.on { background: var(--accent); color: #06231f; font-weight: 700; }
