/* ============================================================
   应用壳 + 通用组件（对应 shadcn: Button / Card / Badge / Tabs /
   Dialog / Select / Textarea / Progress / Skeleton / Checkbox）
   ============================================================ */

*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.6;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, figure { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

::selection { background: var(--brand-soft); color: var(--brand-strong); }

/* 滚动条：细、低调 */
.od-scroll::-webkit-scrollbar,
.scroll-y::-webkit-scrollbar { width: 10px; height: 10px; }
.od-scroll::-webkit-scrollbar-thumb,
.scroll-y::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: var(--r-full);
}
.scroll-y { overflow-y: auto; overscroll-behavior: contain; min-height: 0; }

/* ---------- 应用骨架 ---------- */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
}

/* ---------- 左侧导航 ---------- */

.sidebar {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--panel);
  border-right: 1px solid var(--line);
  min-height: 0;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  height: var(--topbar-h);
  padding: 0 var(--sp-5);
  border-bottom: 1px solid var(--line);
}

.sidebar__mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: var(--r-md);
  background: var(--brand);
  color: #fff;
  --od-icon-size: 16px;
}

.sidebar__wordmark { display: block; font-size: var(--fs-h3); font-weight: 650; letter-spacing: -.01em; }
.sidebar__sub { display: block; font-size: var(--fs-2xs); color: var(--subtle); line-height: 1.2; }

.sidebar__nav { overflow-y: auto; padding: var(--sp-4) var(--sp-3); }

.navitem {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: 8px var(--sp-3);
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--ink-70);
  font-size: var(--fs-body);
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
  --od-icon-size: 17px;
}
.navitem + .navitem { margin-top: 2px; }
@media (hover: hover) {
  .navitem:hover { background: var(--fill-hover); color: var(--ink); }
}
.navitem[aria-current="true"] { background: var(--brand-soft); color: var(--brand-strong); font-weight: 600; }
.navitem__label { flex: 1 1 auto; min-width: 0; }
.navitem__chev { color: var(--subtle); transition: transform var(--dur-fast) var(--ease-out); --od-icon-size: 14px; }
.navitem[data-open="true"] .navitem__chev { transform: rotate(90deg); }

.navsub { margin: 2px 0 var(--sp-2) 0; padding-left: 30px; }
.navsub__item {
  display: block;
  width: 100%;
  padding: 6px var(--sp-3);
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-sm);
  text-align: left;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
@media (hover: hover) {
  .navsub__item:hover { background: var(--fill-hover); color: var(--ink); }
}
.navsub__item[aria-current="true"] { color: var(--brand-strong); font-weight: 600; background: var(--brand-soft); }

.sidebar__legacy {
  padding: var(--sp-4) var(--sp-5) var(--sp-5);
  border-top: 1px solid var(--line);
}
.sidebar__legacy-title { display: block; font-size: var(--fs-2xs); color: var(--subtle); margin-bottom: var(--sp-2); }
.sidebar__legacy-links { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.legacy-link {
  border: 0;
  padding: 0;
  background: none;
  color: var(--muted);
  font-size: var(--fs-2xs);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--line-strong);
  cursor: pointer;
}
@media (hover: hover) { .legacy-link:hover { color: var(--ink); } }

/* ---------- 主区 + 顶栏 ---------- */

.main { display: grid; grid-template-rows: var(--topbar-h) minmax(0, 1fr); min-width: 0; min-height: 0; }

.topbar {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: 0 var(--page-pad);
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.crumbs { display: flex; align-items: center; gap: var(--sp-2); flex: 1 1 auto; min-width: 0; font-size: var(--fs-sm); }
.crumbs__sep { color: var(--line-strong); --od-icon-size: 14px; flex: none; }
.crumbs__item { color: var(--muted); }
.crumbs__item:last-child { color: var(--ink); font-weight: 600; }
.crumbs button.crumbs__item { border: 0; background: none; padding: 0; cursor: pointer; }
@media (hover: hover) { .crumbs button.crumbs__item:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; } }

.topbar__tools { display: flex; align-items: center; gap: var(--sp-2); flex: none; }

.iconbtn {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  --od-icon-size: 18px;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
@media (hover: hover) { .iconbtn:hover { background: var(--fill-hover); color: var(--ink); } }
.iconbtn[aria-expanded="true"] { background: var(--brand-soft); color: var(--brand-strong); }

.iconbtn__dot {
  position: absolute;
  top: 5px;
  right: 5px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--r-full);
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: var(--r-full);
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: var(--fs-xs);
  font-weight: 700;
  border: 1px solid var(--brand-line);
}

.viewport { overflow-y: auto; overscroll-behavior: contain; min-height: 0; position: relative; }
.viewport[data-fill="true"] { overflow: hidden; }

.page { max-width: var(--content-max); margin: 0 auto; padding: var(--page-pad); }
.page--fill { max-width: none; height: 100%; padding: 0; margin: 0; }

.page-head { display: flex; align-items: flex-start; gap: var(--sp-4); margin-bottom: var(--sp-6); }
.page-head__text { flex: 1 1 auto; min-width: 0; }
.page-title { font-size: var(--fs-h1); font-weight: 680; letter-spacing: -.015em; line-height: 1.3; }
.page-desc { margin-top: var(--sp-1); font-size: var(--fs-sm); color: var(--muted); }
.page-head__actions { display: flex; align-items: center; gap: var(--sp-2); flex: none; }

.section-title { font-size: var(--fs-h3); font-weight: 650; letter-spacing: -.01em; }
.section-head { display: flex; align-items: baseline; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.section-head__hint { font-size: var(--fs-xs); color: var(--subtle); margin-left: auto; }

/* ---------- Button ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 var(--sp-4);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--panel);
  color: var(--ink);
  font-size: var(--fs-sm);
  font-weight: 560;
  white-space: nowrap;
  cursor: pointer;
  --od-icon-size: 15px;
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
@media (hover: hover) { .btn:hover { background: var(--fill-hover); border-color: var(--line-strong); } }
.btn:active { transform: translateY(1px); }

.btn--primary { background: var(--brand); border-color: var(--brand); color: #fff; }
@media (hover: hover) { .btn--primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); color: #fff; } }

.btn--ghost { border-color: transparent; background: transparent; color: var(--ink-70); }
@media (hover: hover) { .btn--ghost:hover { background: var(--fill-hover); color: var(--ink); } }

.btn--danger { border-color: var(--danger); color: var(--danger); background: var(--panel); }
@media (hover: hover) { .btn--danger:hover { background: var(--danger-soft); color: #b8403d; } }

.btn--solid-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
@media (hover: hover) { .btn--solid-danger:hover { background: #cb4f4b; border-color: #cb4f4b; color: #fff; } }

.btn--lg { height: 42px; padding: 0 var(--sp-6); font-size: var(--fs-body); border-radius: var(--r-lg); }
.btn--sm { height: 28px; padding: 0 var(--sp-3); font-size: var(--fs-xs); border-radius: var(--r-md); --od-icon-size: 14px; }
.btn--block { width: 100%; }

.btn:disabled,
.btn[aria-disabled="true"] {
  background: var(--fill-hover);
  border-color: var(--line);
  color: var(--subtle);
  cursor: not-allowed;
  transform: none;
}
.btn--primary:disabled,
.btn--primary[aria-disabled="true"] { background: #c9cbf0; border-color: #c9cbf0; color: #fff; }

/* ---------- Card / Panel ---------- */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
}
.card--pad { padding: var(--sp-5); }
.card__head { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--line); }
.card__title { font-size: var(--fs-h3); font-weight: 650; flex: 1 1 auto; min-width: 0; }
.card__body { padding: var(--sp-5); }

/* ---------- Badge ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--r-full);
  background: var(--fill-hover);
  color: var(--ink-70);
  font-size: var(--fs-2xs);
  font-weight: 600;
  white-space: nowrap;
  --od-icon-size: 12px;
}
.badge--brand { background: var(--brand-soft); color: var(--brand-strong); }
.badge--success { background: var(--success-soft); color: #117a54; }
.badge--warning { background: var(--warning-soft); color: #a86c13; }
.badge--danger { background: var(--danger-soft); color: #b8403d; }
.badge--outline { background: transparent; border: 1px solid var(--line-strong); color: var(--muted); }
.badge--dim { background: var(--fill-soft); color: var(--subtle); }

.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }

/* ---------- Tabs ---------- */

.tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--fill-hover); border-radius: var(--r-lg); }
.tabs__btn {
  border: 0;
  padding: 0 var(--sp-3);
  height: 28px;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 560;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
@media (hover: hover) { .tabs__btn:hover { color: var(--ink); } }
.tabs__btn[aria-selected="true"] { background: var(--panel); color: var(--ink); box-shadow: var(--shadow-sm); }
.tabs__count { font-variant-numeric: tabular-nums; opacity: .7; margin-left: 4px; }

/* ---------- 表单 ---------- */

.field__label { display: block; font-size: var(--fs-xs); font-weight: 600; color: var(--ink-70); }
.field__label-row { display: flex; align-items: baseline; gap: var(--sp-2); }
.field__req { color: var(--danger); font-weight: 700; }
.field__count { margin-left: auto; font-size: var(--fs-2xs); color: var(--subtle); font-variant-numeric: tabular-nums; font-family: var(--font-mono); }
.field__count[data-over="true"] { color: var(--danger); font-weight: 700; }
.field__hint { display: block; font-size: var(--fs-2xs); color: var(--subtle); margin-top: 2px; }
.field__error { display: block; font-size: var(--fs-2xs); color: var(--danger); font-weight: 600; margin-top: 4px; }

.input,
.textarea,
.select {
  display: block;
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--panel);
  color: var(--ink);
  font-size: var(--fs-sm);
  line-height: 1.5;
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.input:focus,
.textarea:focus,
.select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.input[aria-invalid="true"],
.textarea[aria-invalid="true"] { border-color: var(--danger); }
.input[aria-invalid="true"]:focus,
.textarea[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px var(--danger-soft); }
.textarea { resize: vertical; min-height: 64px; }

/* 输入框尾部 AI 优化 */
.input-ai {
  position: relative;
  display: block;
}
.input-ai__field {
  width: 100%;
  padding-right: 38px;
}
.input-ai--multi .input-ai__field {
  padding-right: 12px;
  padding-bottom: 36px;
}
.input-ai__btn {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--brand);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.input-ai--multi .input-ai__btn {
  top: auto;
  bottom: 8px;
  transform: none;
}
.input-ai__btn:hover:not(:disabled) { background: var(--brand-soft); }
.input-ai__btn:disabled { color: var(--subtle); cursor: not-allowed; }
.input-ai__btn .od-icon { width: 15px; height: 15px; }
.input-ai-pop {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  min-width: min(100%, 320px);
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--panel);
  box-shadow: 0 12px 32px rgba(23, 32, 51, 0.12);
  display: grid;
  gap: 10px;
}
.input-ai-pop__head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--brand);
}
.input-ai-pop__acts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.select {
  appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23697386' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  cursor: pointer;
}

/* 单选 / 多选按钮组（Checkbox / RadioGroup） */
.choice-group { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.choice {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px var(--sp-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--panel);
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
@media (hover: hover) { .choice:hover { border-color: var(--brand-line); background: var(--fill-soft); } }
.choice input { position: absolute; opacity: 0; width: 0; height: 0; }
.choice__box {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  flex: none;
  border: 1.5px solid var(--line-strong);
  border-radius: 5px;
  color: transparent;
  --od-icon-size: 11px;
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.choice__box--radio { border-radius: 50%; }
.choice input:checked ~ .choice__box { background: var(--brand); border-color: var(--brand); color: #fff; }
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.choice input:focus-visible ~ .choice__box { outline: 2px solid var(--brand); outline-offset: 2px; }
.choice__text { white-space: nowrap; }
.choice--disabled { cursor: not-allowed; background: var(--fill-soft); color: var(--subtle); border-color: var(--line); }
.choice--disabled:hover { border-color: var(--line); background: var(--fill-soft); }
.choice--disabled .choice__box { border-color: var(--line); }

.choice--card {
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-lg);
  min-width: 0;
}
.choice--card .choice__text { white-space: normal; font-weight: 600; }
.choice--card .choice__desc { font-size: var(--fs-2xs); color: var(--muted); }
.choice--card .choice__box { position: absolute; top: 10px; right: 10px; }
.choice--card .choice__text { padding-right: 22px; }

/* ---------- Progress ---------- */

.progress { position: relative; height: 6px; border-radius: var(--r-full); background: var(--fill-hover); overflow: hidden; }
.progress__bar { height: 100%; border-radius: var(--r-full); background: var(--brand); transition: width var(--dur-slow) var(--ease-out); }
.progress--success .progress__bar { background: var(--success); }
.progress--warning .progress__bar { background: var(--warning); }
.progress--danger .progress__bar { background: var(--danger); }
.progress--thin { height: 4px; }

.progress--indeterminate .progress__bar { width: 38% !important; animation: slide 1.4s var(--ease-out) infinite; }
@keyframes slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(300%); }
}

/* ---------- Skeleton ---------- */

.skel { border-radius: var(--r-md); background: linear-gradient(90deg, #edeff5 25%, #f6f7fa 50%, #edeff5 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skel--text { height: 12px; }
.skel--line { height: 10px; }

/* ---------- Dialog ---------- */

dialog.modal {
  width: min(560px, calc(100vw - 48px));
  max-height: calc(100vh - 96px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
dialog.modal::backdrop { background: rgba(23, 32, 51, .42); }
dialog.modal[open] { animation: pop var(--dur-mid) var(--ease-out); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }

.modal--wide { width: min(680px, calc(100vw - 48px)); }
.modal__inner { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; max-height: calc(100vh - 96px); }
.modal__head { display: flex; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-5) var(--sp-5) var(--sp-4); border-bottom: 1px solid var(--line); }
.modal__title { font-size: var(--fs-h2); font-weight: 660; letter-spacing: -.01em; }
.modal__desc { margin-top: 2px; font-size: var(--fs-sm); color: var(--muted); }
.modal__body { padding: var(--sp-5); overflow-y: auto; min-height: 0; }
.modal__foot { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--line); background: var(--fill-soft); }
.modal__foot .spacer { flex: 1 1 auto; }

/* ---------- 浮层菜单 / 通知 ---------- */

.pop {
  position: absolute;
  z-index: 60;
  min-width: 200px;
  padding: var(--sp-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--panel);
  box-shadow: var(--shadow-md);
  animation: popin var(--dur-fast) var(--ease-out);
}
@keyframes popin { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.menuitem {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: 7px var(--sp-3);
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--ink);
  font-size: var(--fs-sm);
  text-align: left;
  cursor: pointer;
  --od-icon-size: 15px;
}
@media (hover: hover) { .menuitem:hover { background: var(--fill-hover); } }
.menuitem--danger { color: var(--danger); }
@media (hover: hover) { .menuitem--danger:hover { background: var(--danger-soft); } }
.menuitem__sub { display: block; font-size: var(--fs-2xs); color: var(--subtle); }
.menu-sep { height: 1px; margin: var(--sp-2) 0; background: var(--line); }
.menu-label { display: block; padding: 4px var(--sp-3); font-size: var(--fs-2xs); color: var(--subtle); font-weight: 600; }

/* 通知面板 */
.notif { position: fixed; top: calc(var(--topbar-h) + 4px); right: var(--page-pad); width: 340px; max-height: calc(100vh - var(--topbar-h) - 24px); overflow-y: auto; z-index: 70; }
.notif__head { display: flex; align-items: center; padding: var(--sp-2) var(--sp-3) var(--sp-3); border-bottom: 1px solid var(--line); margin-bottom: var(--sp-2); }
.notif__title { font-size: var(--fs-sm); font-weight: 650; flex: 1 1 auto; }
.notif-item { display: flex; gap: var(--sp-3); width: 100%; padding: var(--sp-3); border: 0; border-radius: var(--r-md); background: transparent; text-align: left; cursor: pointer; }
@media (hover: hover) { .notif-item:hover { background: var(--fill-hover); } }
.notif-item__icon { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: var(--r-md); --od-icon-size: 15px; }
.notif-item__icon--success { background: var(--success-soft); color: #117a54; }
.notif-item__icon--danger { background: var(--danger-soft); color: #b8403d; }
.notif-item__icon--brand { background: var(--brand-soft); color: var(--brand-strong); }
.notif-item__text { flex: 1 1 auto; min-width: 0; }
.notif-item__title { display: block; font-size: var(--fs-sm); font-weight: 560; }
.notif-item__meta { display: block; font-size: var(--fs-2xs); color: var(--subtle); margin-top: 1px; }
.notif-item__unread { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); flex: none; align-self: center; }

/* ---------- Toast ---------- */

.toast-stack { position: fixed; right: var(--sp-6); bottom: var(--sp-6); z-index: 90; display: flex; flex-direction: column; gap: var(--sp-2); pointer-events: none; }
.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  max-width: 380px;
  padding: 10px var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--ink);
  color: #fff;
  font-size: var(--fs-sm);
  box-shadow: var(--shadow-md);
  animation: toastin var(--dur-mid) var(--ease-out);
  --od-icon-size: 16px;
}
@keyframes toastin { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.toast--out { animation: toastout var(--dur-fast) var(--ease-in) forwards; }
@keyframes toastout { to { opacity: 0; transform: translateY(6px); } }
.toast__icon--success { color: #5ddfae; }
.toast__icon--danger { color: #ff9c99; }

/* ---------- 空态 ---------- */

.empty {
  display: grid;
  justify-items: center;
  gap: var(--sp-3);
  padding: var(--sp-12) var(--sp-6);
  text-align: center;
}
.empty__icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: var(--r-xl); background: var(--brand-soft); color: var(--brand); --od-icon-size: 24px; }
.empty__title { font-size: var(--fs-h2); font-weight: 650; }
.empty__desc { max-width: 46ch; font-size: var(--fs-sm); color: var(--muted); }
.empty__actions { margin-top: var(--sp-2); display: flex; gap: var(--sp-2); }

/* ---------- 提示条 ---------- */

.callout {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--fill-soft);
  font-size: var(--fs-sm);
  --od-icon-size: 16px;
}
.callout__icon { flex: none; margin-top: 2px; color: var(--muted); }
.callout__text { flex: 1 1 auto; min-width: 0; }
.callout__title { display: block; font-weight: 620; }
.callout__desc { display: block; color: var(--muted); font-size: var(--fs-xs); margin-top: 1px; }
.callout--warning { background: var(--warning-soft); border-color: #f3dcb4; }
.callout--warning .callout__icon { color: #a86c13; }
.callout--danger { background: var(--danger-soft); border-color: #f5cfcd; }
.callout--danger .callout__icon { color: #b8403d; }
.callout--brand { background: var(--brand-soft); border-color: var(--brand-line); }
.callout--brand .callout__icon { color: var(--brand-strong); }
.callout--success { background: var(--success-soft); border-color: #c4ead9; }
.callout--success .callout__icon { color: #117a54; }

/* ---------- 体检结果列表（脚本体检 / 渲染前检查 / 成片体检共用） ---------- */

.health-list {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 6px;
  background: var(--fill-soft);
}
.health-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--sp-3);
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--panel);
  text-align: left;
  font: inherit;
  color: var(--ink);
  --od-icon-size: 16px;
}
button.health-item { cursor: pointer; transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out); }
@media (hover: hover) { button.health-item:hover { border-color: var(--brand); background: var(--brand-soft); } }
.health-item__icon { display: grid; place-items: center; margin-top: 1px; color: var(--subtle); }
.health-item[data-level="pass"] .health-item__icon { color: #159e6c; }
.health-item[data-level="advice"] .health-item__icon { color: #a86c13; }
.health-item[data-level="issue"] .health-item__icon { color: #c2524f; }
.health-item[data-level="must"] .health-item__icon { color: var(--danger); }
.health-item[data-level="must"] { border-color: #f0c9c7; }
.health-item__body { display: grid; gap: 1px; min-width: 0; }
.health-item__label { font-size: var(--fs-sm); font-weight: 600; }
.health-item__detail { font-size: var(--fs-xs); color: var(--muted); line-height: 1.5; }
.health-item__jump { font-size: var(--fs-2xs); color: var(--brand-strong); font-weight: 600; margin-top: 2px; }
.health-item__level { flex: none; }

/* ---------- 平台安全区遮挡层 ---------- */

.safe-host { position: absolute; inset: 0; pointer-events: none; }
.safe-overlay { position: absolute; inset: 0; }
.safe-zone {
  position: absolute;
  background: rgba(16, 22, 38, .52);
  backdrop-filter: saturate(.4);
  display: grid;
  place-items: center;
  padding: 4px;
}
.safe-zone--top { top: 0; left: 0; right: 0; border-bottom: 1px dashed rgba(255, 255, 255, .5); }
.safe-zone--bottom { bottom: 0; left: 0; right: 0; border-top: 1px dashed rgba(255, 255, 255, .5); }
.safe-zone--right { top: 0; bottom: 0; right: 0; border-left: 1px dashed rgba(255, 255, 255, .5); }
.safe-zone__label {
  font-size: 9px;
  line-height: 1.3;
  font-weight: 600;
  color: #fff;
  text-align: center;
  letter-spacing: .02em;
}
.safe-zone--right .safe-zone__label { writing-mode: vertical-rl; }

.select--sm { height: 28px; padding: 0 26px 0 8px; font-size: var(--fs-xs); background-position: right 7px center; }

/* ---------- 原型切换器（开发用调试入口，非产品 UI） ---------- */

.protobtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  background: var(--fill-soft);
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 600;
  cursor: pointer;
  --od-icon-size: 14px;
}
@media (hover: hover) { .protobtn:hover { color: var(--ink); border-color: var(--muted); } }
.protobtn[aria-expanded="true"] { background: var(--ink); border-color: var(--ink); border-style: solid; color: #fff; }

.protopanel {
  position: fixed;
  top: calc(var(--topbar-h) + 8px);
  right: var(--page-pad);
  z-index: 80;
  width: 320px;
  max-height: calc(100vh - var(--topbar-h) - 32px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border: 1px solid var(--ink);
  border-radius: var(--r-xl);
  background: var(--panel);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: popin var(--dur-mid) var(--ease-out);
}
.protopanel__head { padding: var(--sp-4) var(--sp-4) var(--sp-3); border-bottom: 1px solid var(--line); background: var(--ink); color: #fff; }
.protopanel__title { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); font-weight: 650; --od-icon-size: 15px; }
.protopanel__desc { display: block; font-size: var(--fs-2xs); color: #aab3c4; margin-top: 2px; }
.protopanel__head .iconbtn { width: 28px; height: 28px; color: #aab3c4; --od-icon-size: 16px; }
@media (hover: hover) { .protopanel__head .iconbtn:hover { background: rgba(255, 255, 255, .14); color: #fff; } }
.protopanel__body { overflow-y: auto; padding: var(--sp-3); min-height: 0; }
.protopanel__foot { padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--line); background: var(--fill-soft); font-size: var(--fs-2xs); color: var(--subtle); }

.protogroup + .protogroup { margin-top: var(--sp-4); }
.protogroup__title { display: block; font-size: var(--fs-2xs); font-weight: 700; color: var(--subtle); letter-spacing: .04em; margin-bottom: 6px; padding-left: 2px; }
.protogroup__list { display: flex; flex-wrap: wrap; gap: 5px; }
.protochip {
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: 4px 9px;
  background: var(--panel);
  color: var(--ink-70);
  font-size: var(--fs-xs);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
@media (hover: hover) { .protochip:hover { background: var(--fill-hover); border-color: var(--muted); } }
.protochip[aria-current="true"] { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }

/* ---------- 通用小件 ---------- */

.meta { font-size: var(--fs-xs); color: var(--muted); }
.meta--mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.divider { height: 1px; background: var(--line); border: 0; margin: var(--sp-5) 0; }

.spin { animation: spin 1s linear infinite; transform-origin: center; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* ---------- 窄屏兜底（本原型面向桌面，窄屏保证不横向滚动） ---------- */

@media (max-width: 1024px) {
  :root { --sidebar-w: 64px; }
  .sidebar__wordmark, .sidebar__sub, .navitem__label, .navitem__chev,
  .sidebar__legacy, .navsub { display: none; }
  .navitem { justify-content: center; padding: 10px; }
  .sidebar__brand { justify-content: center; padding: 0; }
}
@media (max-width: 760px) {
  :root { --page-pad: 16px; }
  .app { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .sidebar { grid-template-rows: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar__nav { display: flex; gap: 4px; overflow-x: auto; padding: var(--sp-2); }
  .navitem { width: auto; }
  .navitem + .navitem { margin-top: 0; }
}
