/* ============================================================
   艾维口腔 · 内部学习平台 共用样式
   ============================================================ */
:root {
  --brand: #0d9488;
  --brand-dark: #0f766e;
  --brand-light: #ccfbf1;
  --ink: #0f172a;
  --ink-2: #334155;
  --ink-3: #64748b;
  --ink-4: #94a3b8;
  --line: #e2e8f0;
  --line-2: #eef2f7;
  --bg: #f5f7f9;
  --card: #ffffff;
  --warn: #d97706;
  --warn-bg: #fffbeb;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --ok: #059669;
  --ok-bg: #ecfdf5;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .05);
  --shadow-lg: 0 8px 40px rgba(15, 23, 42, .12);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-dark); text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
table { border-collapse: collapse; width: 100%; }
::selection { background: var(--brand-light); }

/* ---------------------------------------------------- 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; white-space: nowrap;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  transition: all .15s;
}
.btn:hover { border-color: var(--ink-4); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: rgba(15, 23, 42, .05); }
.btn-danger { color: var(--danger); border-color: #fecaca; }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 6px; }
.btn-lg { height: 44px; padding: 0 22px; font-size: 15px; }
.btn-block { width: 100%; }

/* ---------------------------------------------------- 表单 */
.input, .select, .textarea {
  height: 36px; width: 100%; padding: 0 11px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; padding: 8px 11px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(13, 148, 136, .12);
}
.select { appearance: none; padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 12px; font-weight: 500; color: var(--ink-3); margin-bottom: 5px; }
.field .hint { font-size: 11px; color: var(--ink-4); margin-top: 4px; line-height: 1.5; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }

/* ---------------------------------------------------- 卡片 */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-pad { padding: 20px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line-2); gap: 12px;
}
.card-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.card-sub { font-size: 12px; color: var(--ink-4); font-weight: 400; }

/* ---------------------------------------------------- 标签 */
.tag {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px;
  border-radius: 5px; font-size: 11px; font-weight: 500; white-space: nowrap;
}
.tag-required { background: #fef3c7; color: #92400e; }
.tag-optional { background: #e0f2fe; color: #075985; }
.tag-ok { background: var(--ok-bg); color: var(--ok); }
.tag-warn { background: var(--warn-bg); color: var(--warn); }
.tag-danger { background: var(--danger-bg); color: var(--danger); }
.tag-gray { background: #f1f5f9; color: var(--ink-3); }
.tag-brand { background: var(--brand-light); color: var(--brand-dark); }

/* ---------------------------------------------------- 表格 */
.table-wrap { overflow-x: auto; }
.tbl { font-size: 13px; }
.tbl th {
  text-align: left; font-weight: 500; font-size: 12px; color: var(--ink-3);
  padding: 10px 12px; background: #fafbfc; border-bottom: 1px solid var(--line);
  white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tbody tr:hover { background: #fafcfc; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl .num { font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12px; }
.tbl .clickable { cursor: pointer; }
.tbl .clickable:hover { color: var(--brand-dark); }

/* ---------------------------------------------------- 进度条 */
.bar { height: 6px; border-radius: 99px; background: #eef2f7; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--brand); transition: width .4s ease; }
.bar.warn > i { background: var(--warn); }
.bar.danger > i { background: var(--danger); }

/* ---------------------------------------------------- 空态 */
.empty { text-align: center; padding: 48px 20px; color: var(--ink-4); font-size: 13px; }
.empty .ico { font-size: 28px; opacity: .5; margin-bottom: 8px; }

/* ---------------------------------------------------- Toast */
#toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 9999;
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast-item {
  padding: 10px 18px; border-radius: 99px; font-size: 13px; font-weight: 500;
  background: rgba(15, 23, 42, .92); color: #fff; box-shadow: var(--shadow-lg);
  animation: toastIn .25s ease; max-width: 80vw;
}
.toast-item.ok { background: #065f46; }
.toast-item.err { background: #991b1b; }
.toast-item.warn { background: #92400e; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } }

/* ---------------------------------------------------- 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 800;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: fadeIn .15s ease;
}
.modal {
  background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 520px; max-height: 88vh; display: flex; flex-direction: column;
  animation: modalIn .2s cubic-bezier(.2, .9, .3, 1);
}
.modal.wide { max-width: 880px; }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--line-2); display: flex;
  justify-content: space-between; align-items: center; }
.modal-title { font-size: 15px; font-weight: 600; }
.modal-body { padding: 20px 22px; overflow-y: auto; flex: 1; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line-2); display: flex;
  justify-content: flex-end; gap: 10px; }
.modal-x { width: 28px; height: 28px; border-radius: 6px; color: var(--ink-3); font-size: 18px; line-height: 1; }
.modal-x:hover { background: #f1f5f9; color: var(--ink); }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.98); } }

/* ---------------------------------------------------- 工具类 */
.flex { display: flex; }
.aic { align-items: center; }
.jcb { justify-content: space-between; }
.gap4 { gap: 4px; } .gap8 { gap: 8px; } .gap12 { gap: 12px; } .gap16 { gap: 16px; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; } .mb16 { margin-bottom: 16px; }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.tr { text-align: right; }
.tc { text-align: center; }

/* ---------------------------------------------------- 加载 */
.spinner {
  width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, .3);
  border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------- 响应式 */
@media (max-width: 720px) {
  .modal { max-height: 92vh; }
  .row { flex-direction: column; gap: 0; }
}
