/* =========================================================================
  业务运营后台 · 飞书风格 UI Kit
   ---------------------------------------------------------------------------
   设计基调：飞书（Lark）企业后台
   - 主色：Lark Blue #3370FF
   - 基底：冷灰 #F5F6F7，克制层级，浅边框代替阴影
   - 圆角：中小（6 / 8 / 12）
   - 字体：PingFang SC / HarmonyOS Sans / Microsoft YaHei
   - 密度：中等偏密，行高 1.5
   兼容性：沿用旧模板的语义类名（panel / chip / nav-link / field ...），
          所有 35+ 页面无需改动即可统一换肤。
   ========================================================================= */

:root {
  /* 色板 — 飞书蓝主色系 */
  --brand: #3370ff;
  --brand-hover: #4e86ff;
  --brand-active: #245bdb;
  --brand-strong: #245bdb;
  --brand-soft: rgba(51, 112, 255, 0.08);
  --brand-soft-strong: rgba(51, 112, 255, 0.14);
  --brand-ring: rgba(51, 112, 255, 0.2);

  /* 中性 */
  --bg: #f5f6f7;
  --bg-soft: #f7f8fa;
  --surface: #ffffff;
  --surface-solid: #ffffff;
  --surface-muted: #f7f8fa;
  --surface-hover: #f2f3f5;

  --border: #e5e6eb;
  --border-strong: #c9cdd4;
  --border-soft: #f2f3f5;

  --text: #1f2329;
  --text-muted: #4e5969;
  --text-faint: #86909c;
  --text-disabled: #c9cdd4;

  /* 功能色 */
  --success: #00b42a;
  --success-soft: #e8f8ee;
  --warning: #ff7d00;
  --warning-soft: #fff3e8;
  --danger: #f53f3f;
  --danger-soft: #ffece8;
  --info: #3370ff;
  --info-soft: rgba(51, 112, 255, 0.08);

  /* 尺寸 */
  --sidebar-width: 232px;
  --sidebar-collapsed: 64px;

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 12px;

  /* 阴影 — 克制 */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-pop: 0 6px 16px rgba(15, 23, 42, 0.1);

  --transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 240ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* -------------------------------------------------------------------------
   基础
   ------------------------------------------------------------------------- */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

.photo-match-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.photo-match-card {
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 8px;
  display: grid;
  grid-template-columns: minmax(132px, 190px) minmax(210px, 300px) minmax(360px, 1fr);
  min-width: 0;
  overflow: hidden;
}

.photo-match-card__image {
  align-items: center;
  background: #f8fafc;
  color: var(--text-muted, #64748b);
  display: flex;
  justify-content: center;
  min-height: 160px;
  min-width: 0;
  position: relative;
}

.photo-match-card__image img {
  height: 100%;
  max-height: 220px;
  max-width: 100%;
  object-fit: contain;
  width: 100%;
}

.photo-match-card__queue {
  background: rgba(15, 23, 42, 0.72);
  border-radius: 999px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  left: 10px;
  line-height: 1;
  padding: 6px 8px;
  position: absolute;
  top: 10px;
}

.photo-match-card__meta,
.photo-match-card__review {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 14px;
}

.photo-match-card__meta {
  align-content: start;
  border-right: 1px solid var(--border-soft, #f2f3f5);
  background: #ffffff;
}

.photo-match-card__review {
  align-content: start;
  background: #fbfdff;
}

.photo-match-card__head,
.photo-match-manual-search {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.photo-match-card__head strong,
.photo-match-candidates span {
  overflow-wrap: anywhere;
}

.photo-match-batches {
  display: grid;
  gap: 12px;
}

.photo-match-batches > summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
}

.photo-match-batches > summary span {
  font-weight: 700;
}

.photo-match-batches > summary small {
  color: var(--text-muted, #64748b);
}

.photo-match-review-filters,
.photo-match-section-title {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  min-width: 0;
}

.photo-match-candidates,
.photo-match-history-candidates,
.photo-match-ocr {
  display: grid;
  gap: 10px;
}

.photo-match-candidate-card {
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
}

.photo-match-candidate-card.is-compact {
  background: var(--surface-muted, #f8fafc);
}

.photo-match-candidate-card__head,
.photo-match-candidate-card__actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  min-width: 0;
}

.photo-match-candidate-card__head > div,
.photo-match-candidate-card__actions form {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.photo-match-candidate-card__facts,
.photo-match-duplicate-detail,
.photo-match-ocr__body {
  display: grid;
  gap: 8px 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}

.photo-match-candidate-card__facts div,
.photo-match-duplicate-detail div,
.photo-match-ocr__body div {
  min-width: 0;
}

.photo-match-candidate-card__facts dt,
.photo-match-duplicate-detail dt,
.photo-match-ocr__body dt {
  color: var(--text-muted, #64748b);
  font-size: 12px;
}

.photo-match-candidate-card__facts dd,
.photo-match-duplicate-detail dd,
.photo-match-ocr__body dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.photo-match-candidate-card__facts .is-strong dd {
  color: var(--text, #0f172a);
  font-size: 15px;
  font-weight: 700;
}

.photo-match-candidate-card__facts .is-wide,
.photo-match-duplicate-detail .is-wide {
  grid-column: 1 / -1;
}

.photo-match-ocr pre {
  background: var(--surface-muted, #f8fafc);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 8px;
  margin: 0;
  max-height: 160px;
  overflow: auto;
  padding: 10px;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 900px) {
  .photo-match-grid {
    grid-template-columns: 1fr;
  }

  .photo-match-card {
    grid-template-columns: 1fr;
  }

  .photo-match-card__meta {
    border-right: 0;
    border-bottom: 1px solid var(--border-soft, #f2f3f5);
  }

  .photo-match-candidate-card__facts,
  .photo-match-duplicate-detail,
  .photo-match-ocr__body {
    grid-template-columns: 1fr;
  }

  .photo-match-candidate-card__actions,
  .photo-match-candidate-card__actions form,
  .photo-match-review-filters {
    align-items: stretch;
    flex-direction: column;
  }
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 0;
  color: var(--text);
  font-family: "PingFang SC", "HarmonyOS Sans SC", "HarmonyOS Sans",
    "Microsoft YaHei", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  color: var(--text);
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
}

a {
  color: var(--brand);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--brand-hover);
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 8px;
  padding: 8px 16px;
  background: var(--brand);
  color: #fff;
  border-radius: var(--radius-sm);
  z-index: 100;
}
.skip-link:focus {
  top: 8px;
  color: #fff;
}

/* -------------------------------------------------------------------------
   表单控件
   ------------------------------------------------------------------------- */
button,
input,
select,
textarea {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  padding: 0 12px;
  color: var(--text);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), box-shadow var(--transition),
    background var(--transition);
}

input,
select {
  height: 32px;
}

textarea {
  padding: 8px 12px;
  min-height: 80px;
  resize: vertical;
  line-height: 1.5;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-faint);
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--border-strong);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}

input:disabled,
select:disabled,
textarea:disabled {
  background: var(--surface-muted);
  color: var(--text-disabled);
  cursor: not-allowed;
}

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='none' stroke='%234E5969' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.3' d='m3 4.5 3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}

input[type="checkbox"],
input[type="radio"] {
  width: 16px;
  height: 16px;
  min-height: 16px;
  margin: 0;
  padding: 0;
  accent-color: var(--brand);
  cursor: pointer;
}

input[type="file"] {
  padding: 4px;
  height: auto;
  cursor: pointer;
}

/* -------------------------------------------------------------------------
   按钮 — 飞书标准
   ------------------------------------------------------------------------- */
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 64px;
  height: 32px;
  padding: 0 16px;
  color: #ffffff;
  font-weight: 500;
  background: var(--brand);
  border: 1px solid var(--brand);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition),
    box-shadow var(--transition), transform var(--transition);
  white-space: nowrap;
}

button:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
}

button:active {
  background: var(--brand-active);
  border-color: var(--brand-active);
}

button:focus-visible {
  outline: 2px solid var(--brand-ring);
  outline-offset: 2px;
}

button:disabled {
  background: var(--border);
  border-color: var(--border);
  color: var(--text-faint);
  cursor: not-allowed;
}

.ghost-button,
a.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 64px;
  height: 32px;
  padding: 0 16px;
  color: var(--text);
  font-weight: 500;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.ghost-button:hover {
  color: var(--brand);
  background: var(--surface-solid);
  border-color: var(--brand);
}

.ghost-button:active {
  color: var(--brand-active);
  border-color: var(--brand-active);
}

.ghost-button.active {
  color: var(--brand);
  background: #eef4ff;
  border-color: var(--brand);
}

.primary-button,
a.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 64px;
  height: 32px;
  padding: 0 16px;
  color: #ffffff;
  font-weight: 600;
  background: var(--brand);
  border: 1px solid var(--brand);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition),
    box-shadow var(--transition), transform var(--transition);
  white-space: nowrap;
}

.primary-button:hover,
a.primary-button:hover {
  color: #ffffff;
  background: var(--brand-hover);
  border-color: var(--brand-hover);
  box-shadow: 0 8px 20px rgba(51, 112, 255, 0.18);
}

.primary-button:active,
a.primary-button:active {
  background: var(--brand-active);
  border-color: var(--brand-active);
}

.text-link {
  color: var(--brand);
  font-weight: 500;
  transition: color var(--transition);
}

.text-link:hover {
  color: var(--brand-hover);
  text-decoration: underline;
  text-underline-offset: 2px;
}

button:disabled,
.primary-button:disabled,
.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

/* -------------------------------------------------------------------------
   表格
   ------------------------------------------------------------------------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

th,
td {
  padding: 11px 14px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-soft);
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-muted);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

td.num,
th.num,
.num-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

tbody tr {
  transition: background var(--transition);
}

tbody tr:hover td {
  background: var(--surface-muted);
}

tbody tr:last-child td {
  border-bottom: none;
}

/* -------------------------------------------------------------------------
   Shell 布局
   ------------------------------------------------------------------------- */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
  background: var(--bg);
  transition: grid-template-columns var(--transition-slow);
}

.shell.sidebar-collapsed {
  grid-template-columns: var(--sidebar-collapsed) minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 30;
  overflow: hidden;
  background: var(--surface-solid);
  border-right: 1px solid var(--border);
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 16px 12px 12px;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-inner::-webkit-scrollbar {
  width: 4px;
}
.sidebar-inner::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

/* 品牌区 */
.brand {
  padding: 4px 8px 16px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border-soft);
}

.brand-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #3370ff, #5b8cff);
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(51, 112, 255, 0.25);
}

.brand-kicker {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brand h1 {
  margin: 4px 0 4px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0;
}

.brand p {
  margin: 0;
  color: var(--text-faint);
  font-size: 12px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.brand-meta {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.brand-meta span {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 11px;
  font-weight: 500;
}

/* 侧边栏折叠按钮 */
.sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  width: 28px;
  height: 28px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.sidebar-toggle:hover {
  background: var(--surface-hover);
  border-color: var(--border);
  color: var(--text);
}

.sidebar-toggle:active,
.sidebar-toggle:focus-visible {
  background: var(--surface-hover);
  outline: none;
}

.sidebar-toggle-icon {
  position: relative;
  width: 14px;
  height: 14px;
  display: inline-block;
}

.sidebar-toggle-icon::before {
  content: "";
  position: absolute;
  left: 0;
  top: 2px;
  width: 2px;
  height: 10px;
  background: currentColor;
  border-radius: 1px;
}

.sidebar-toggle-icon::after {
  content: "";
  position: absolute;
  right: 0;
  top: 3px;
  width: 6px;
  height: 6px;
  border-top: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
  transform: rotate(-135deg);
  transition: transform var(--transition);
}

.shell.sidebar-collapsed .sidebar-toggle-icon::after {
  transform: rotate(45deg);
}

.toggle-label {
  display: none;
}

/* 导航 */
.nav {
  display: grid;
  gap: 4px;
  margin-top: 4px;
}

.nav-section {
  display: grid;
  gap: 2px;
  padding: 6px 0;
}

.nav-section + .nav-section {
  border-top: 1px solid var(--border-soft);
  margin-top: 4px;
  padding-top: 10px;
}

.nav-group {
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  transition: background var(--transition), border-color var(--transition);
}

.nav-group[open],
.nav-group.is-active {
  background: rgba(51, 112, 255, 0.035);
  border-color: rgba(51, 112, 255, 0.14);
}

.nav-group__summary {
  min-height: 38px;
  padding: 7px 9px 7px 10px;
  border-radius: var(--radius-sm);
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.nav-group__summary::-webkit-details-marker {
  display: none;
}

.nav-group__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border-radius: var(--radius-xs);
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.nav-group__summary::after {
  content: "›";
  flex: 0 0 auto;
  color: var(--text-faint);
  transform: rotate(0deg);
  transition: transform var(--transition);
}

.nav-group[open] > .nav-group__summary::after {
  transform: rotate(90deg);
}

.nav-group__summary:hover,
.nav-group.is-active > .nav-group__summary {
  background: var(--surface-muted);
  color: var(--brand-strong);
}

.nav-group[open] > .nav-group__summary .nav-group__mark,
.nav-group.is-active > .nav-group__summary .nav-group__mark {
  background: var(--brand-soft-strong);
  color: var(--brand-strong);
}

.nav-group__title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-group__count {
  flex: 0 0 auto;
  min-width: 28px;
  height: 20px;
  padding: 0 6px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.nav-group__badge {
  min-width: 22px;
  height: 20px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.72) inset;
}

.nav-group__items {
  display: grid;
  gap: 3px;
  margin-top: 2px;
}

.nav-subgroups {
  display: grid;
  gap: 4px;
}

.nav-subgroup {
  display: grid;
  gap: 2px;
  border-radius: var(--radius-sm);
}

.nav-subgroup__summary {
  min-height: 32px;
  padding: 6px 10px 6px 12px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.nav-subgroup__summary::-webkit-details-marker {
  display: none;
}

.nav-subgroup__summary::after {
  content: "›";
  flex: 0 0 auto;
  color: var(--text-faint);
  transform: rotate(0deg);
  transition: transform var(--transition);
}

.nav-subgroup[open] > .nav-subgroup__summary::after {
  transform: rotate(90deg);
}

.nav-subgroup__summary:hover,
.nav-subgroup.is-active > .nav-subgroup__summary {
  background: var(--surface-muted);
  color: var(--text);
}

.nav-subgroup__count {
  margin-left: auto;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 600;
}

.nav-subgroup__icon {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-radius: var(--radius-xs);
  background: var(--surface-muted);
  color: var(--text-muted);
}

.nav-subgroup__icon .nav-icon {
  width: 15px;
  height: 15px;
}

.nav-subgroup__title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-subgroup__items {
  display: grid;
  gap: 2px;
}

.nav-subgroup__items .nav-link {
  margin-left: 8px;
  padding-right: 10px;
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.4;
  transition: background var(--transition), color var(--transition);
}

.nav-icon-box,
.nav-group__mark,
.nav-link__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-icon {
  display: block;
  width: 18px;
  height: 18px;
}

.nav-icon--ai-letter text {
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

.nav-link__icon {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-radius: var(--radius-xs);
  background: var(--surface-muted);
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
}

.nav-link__text {
  flex: 1;
  min-width: 0;
  font-weight: 500;
  color: inherit;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-link__text small {
  display: block;
  margin-top: 2px;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-link.compact {
  align-items: center;
}

.nav-link.compact small {
  display: none;
}

.nav-badge {
  flex: 0 0 auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.nav-badge--danger {
  background: rgba(245, 63, 63, 0.12);
  color: var(--danger);
}

.nav-badge--warning {
  background: rgba(245, 158, 11, 0.14);
  color: #b45309;
}

.nav-link:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.nav-link:hover .nav-link__icon {
  background: var(--brand-soft);
  color: var(--brand);
}

.nav-link.active {
  background: var(--brand-soft);
  color: var(--brand);
}

.nav-link.active .nav-link__icon {
  background: var(--brand);
  color: #ffffff;
}

.nav-link.active .nav-link__text,
.nav-link.active small {
  color: var(--brand);
}

/* 侧边栏收起态 */
.shell.sidebar-collapsed .brand h1,
.shell.sidebar-collapsed .brand p,
.shell.sidebar-collapsed .brand-kicker,
.shell.sidebar-collapsed .brand-meta,
.shell.sidebar-collapsed .nav-group__title,
.shell.sidebar-collapsed .nav-group__badge,
.shell.sidebar-collapsed .nav-group__count,
.shell.sidebar-collapsed .nav-subgroup__summary,
.shell.sidebar-collapsed .nav-link__text,
.shell.sidebar-collapsed .nav-link small,
.shell.sidebar-collapsed .sidebar-note {
  display: none;
}

.shell.sidebar-collapsed .nav-group__summary {
  grid-template-columns: 1fr;
  justify-content: center;
  min-height: 34px;
  padding: 7px 0;
}

.shell.sidebar-collapsed .nav-group__mark {
  margin: 0 auto;
}

.shell.sidebar-collapsed .nav-group__summary::after {
  display: none;
}

.shell.sidebar-collapsed .brand {
  padding: 4px 0 12px;
  margin-bottom: 6px;
  display: flex;
  justify-content: center;
}

.shell.sidebar-collapsed .brand-header {
  margin: 0;
  justify-content: center;
}

.shell.sidebar-collapsed .nav-link {
  justify-content: center;
  padding: 7px 0;
}

.shell.sidebar-collapsed .nav-link__icon {
  margin: 0;
}

.shell.sidebar-collapsed .sidebar-inner {
  padding: 16px 8px 12px;
}

.sidebar-note {
  display: grid;
  gap: 4px;
  margin-top: auto;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--brand-soft);
  border: 1px solid rgba(51, 112, 255, 0.14);
}

.sidebar-note strong {
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-strong);
}

.sidebar-note span {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.5;
}

.footer-nav {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border-soft);
}

.footer-nav + .sidebar-note {
  margin-top: 10px;
}

/* -------------------------------------------------------------------------
   主区域
   ------------------------------------------------------------------------- */
.mobile-backdrop {
  display: none;
}

.main {
  min-width: 0;
  padding: 0;
}

/* 页头 */
.page-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: var(--surface-solid);
  border-bottom: 1px solid var(--border);
}

.page-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.page-copy {
  min-width: 0;
}

.page-kicker {
  color: var(--text-faint);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.page-copy h2 {
  margin: 2px 0 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.page-subtitle {
  display: none;
}

.page-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: nowrap;
}

.page-actions,
.header-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.header-meta {
  padding-right: 8px;
  border-right: 1px solid var(--border-soft);
}

.header-meta:last-child {
  border-right: none;
  padding-right: 0;
}

.notification-popover {
  position: relative;
}

.user-menu {
  position: relative;
}

.user-menu__avatar,
.user-menu__avatar-fallback {
  width: 20px;
  height: 20px;
  margin-right: 4px;
  border-radius: var(--radius-xs);
  flex: 0 0 auto;
}

.user-menu__avatar {
  display: block;
  object-fit: cover;
}

.user-menu__avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand);
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.user-menu__chevron {
  margin-left: 4px;
  opacity: 0.6;
}

.user-menu__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 224px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop);
  z-index: 80;
  overflow: hidden;
}

.user-menu__head {
  padding: 12px;
  border-bottom: 1px solid var(--border-soft);
}

.user-menu__name {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.user-menu__roles {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.user-menu__link {
  display: block;
  padding: 8px 12px;
  color: var(--text);
  font-size: 13px;
  text-decoration: none;
  transition: background var(--transition);
}

.user-menu__link:hover {
  background: var(--surface-hover);
}

.user-menu__form {
  margin: 0;
}

.user-menu__logout {
  width: 100%;
  min-width: 0;
  height: auto;
  justify-content: flex-start;
  padding: 8px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  text-align: left;
}

.user-menu__logout:hover {
  border-color: transparent;
  background: var(--surface-hover);
  color: var(--text);
}

.header-logout-form {
  margin: 0;
}

.header-logout-button {
  min-width: auto;
  height: 30px;
  padding: 0 10px;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
}

.header-logout-button:hover {
  color: var(--danger);
  border-color: #fecaca;
  background: #fff5f5;
}

.notification-trigger {
  position: relative;
  min-width: 30px;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-solid);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: none;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.notification-trigger:hover {
  color: var(--brand);
  border-color: rgba(51, 112, 255, 0.28);
  background: var(--brand-soft);
}

.notification-trigger.has-unread {
  color: var(--brand);
  border-color: rgba(51, 112, 255, 0.24);
  background: var(--surface-solid);
}

.notification-trigger__icon {
  width: 16px;
  height: 16px;
  display: block;
}

.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border-radius: 999px;
  background: #ff4d4f;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--surface-solid);
}

.notification-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(360px, 86vw);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop);
  z-index: 80;
  overflow: hidden;
}

.notification-menu__head,
.notification-menu__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
}

.notification-menu__head strong {
  font-size: 13px;
  color: var(--text);
}

.notification-menu__head a,
.notification-menu__foot button {
  font-size: 12px;
  color: var(--brand);
  background: transparent;
  border: 0;
  padding: 0;
  min-width: 0;
  height: auto;
  text-decoration: none;
  cursor: pointer;
}

.notification-menu__foot {
  border-top: 1px solid var(--border-soft);
  border-bottom: 0;
  justify-content: flex-end;
  margin: 0;
}

.notification-menu__list {
  display: grid;
  max-height: 320px;
  overflow-y: auto;
}

.notification-menu__item {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border-soft);
}

.notification-menu__item:hover {
  background: var(--surface-hover);
}

.notification-menu__item span {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}

.notification-menu__item small {
  color: var(--text-faint);
  font-size: 11px;
}

.notification-menu__item.is-unread {
  background: rgba(51, 112, 255, 0.06);
}

.notification-menu__empty {
  padding: 18px 12px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

.test-env-notice {
  display: grid;
  gap: 8px;
  margin: 12px 24px 0;
  padding: 10px 12px;
  border: 1px solid rgba(217, 119, 6, 0.32);
  border-radius: var(--radius-md);
  background: #fffbeb;
  color: #78350f;
  font-size: 12px;
  line-height: 1.5;
}

.test-env-notice__main,
.test-env-notice__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  min-width: 0;
}

.test-env-notice strong {
  color: #92400e;
}

.test-env-notice span {
  overflow-wrap: anywhere;
}

.main-inner {
  display: grid;
  gap: 16px;
  padding: 16px 24px 32px;
}

/* 移动端菜单按钮 */
.mobile-menu-btn {
  display: none;
  min-width: 32px;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
}

.mobile-menu-btn span {
  display: block;
  width: 16px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  box-shadow: 0 -5px currentColor, 0 5px currentColor;
}

.inline-mini {
  display: inline-flex;
  margin: 0;
}

.inline-mini button {
  min-width: auto;
}

.danger-button {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(245, 63, 63, 0.28);
}

.danger-button:hover {
  background: rgba(245, 63, 63, 0.14);
  color: var(--danger);
}

/* -------------------------------------------------------------------------
   Chip / Tag
   ------------------------------------------------------------------------- */
.chip,
.sub-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--radius-xs);
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid transparent;
}

.chip.soft {
  background: var(--brand-soft);
  color: var(--brand);
}

.chip.subtle {
  background: var(--surface-muted);
  color: var(--text-muted);
  border-color: var(--border-soft);
}

.chip.success,
.status-chip.status-approved {
  background: var(--success-soft);
  color: var(--success);
}

.chip.warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.chip.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.chip.release-chip {
  background: var(--brand);
  color: #ffffff;
}

.super-admin-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 18px;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid rgba(100, 116, 139, 0.24);
  background: rgba(248, 250, 252, 0.92);
  color: #64748b;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.chip.role-chip {
  background: rgba(51, 112, 255, 0.1);
  color: var(--brand);
  border-color: rgba(51, 112, 255, 0.15);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.status-chip.status-submitted,
.status-chip.status-pending {
  background: var(--warning-soft);
  color: var(--warning);
}

.status-chip.status-draft {
  background: var(--surface-muted);
  color: var(--text-muted);
}

.status-chip.status-rejected,
.status-chip.status-returned {
  background: var(--danger-soft);
  color: var(--danger);
}

.entity-cell {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.entity-cell.compact {
  gap: 6px;
  margin: 2px 0;
}

.entity-avatar {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid var(--border-subtle);
  background: #eff6ff;
  color: #2563eb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex: 0 0 auto;
}

.entity-avatar.mini {
  width: 24px;
  height: 24px;
  font-size: 12px;
}

.entity-avatar.placeholder {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
}

.avatar-upload {
  --avatar-size: 64px;
  width: var(--avatar-size);
  max-width: var(--avatar-size);
  flex: 0 0 var(--avatar-size);
}

.avatar-upload-sm {
  --avatar-size: 40px;
}

.avatar-upload-md {
  --avatar-size: 56px;
}

.avatar-upload-lg {
  --avatar-size: 82px;
}

.avatar-upload-xl {
  --avatar-size: 96px;
}

.avatar-upload-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  width: var(--avatar-size);
}

.avatar-upload-trigger {
  position: relative;
  width: var(--avatar-size);
  height: var(--avatar-size);
  max-width: var(--avatar-size);
  max-height: var(--avatar-size);
  min-width: var(--avatar-size);
  min-height: var(--avatar-size);
  border-radius: 999px;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border: 1px solid var(--border-subtle);
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  color: #2563eb;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.65);
}

.avatar-upload-trigger.static {
  cursor: default;
}

.avatar-upload-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.avatar-upload-input[hidden] {
  display: none !important;
}

.avatar-upload-img,
.avatar-upload-fallback {
  width: var(--avatar-size) !important;
  height: var(--avatar-size) !important;
  max-width: var(--avatar-size) !important;
  max-height: var(--avatar-size) !important;
  border-radius: inherit;
  flex: 0 0 var(--avatar-size);
}

.avatar-upload-img[hidden],
.avatar-upload-fallback[hidden] {
  display: none !important;
}

.avatar-upload-img {
  object-fit: cover;
  display: block;
}

.avatar-upload-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: calc(var(--avatar-size) * 0.34);
  color: #2563eb;
  background: radial-gradient(circle at 30% 20%, #ffffff 0, #e0f2fe 42%, #dbeafe 100%);
}

.avatar-upload-fallback.upload-text {
  padding: 0 14px;
  font-size: 13px;
  line-height: 1.25;
  letter-spacing: 0;
  text-align: center;
  color: #245bdb;
  background: linear-gradient(145deg, #f8fbff 0%, #e8f1ff 100%);
}

.help-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 4px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: help;
  vertical-align: middle;
  box-shadow: 0 4px 12px rgba(51, 112, 255, 0.18);
}

.help-tip__content {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  z-index: 60;
  width: max-content;
  max-width: min(360px, 72vw);
  padding: 12px 14px;
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.65;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16);
  transform: translateX(-50%) translateY(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
}

.help-tip__content::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 12px;
  height: 12px;
  background: #fff;
  transform: translate(-50%, -6px) rotate(45deg);
}

.help-tip:hover .help-tip__content,
.help-tip:focus .help-tip__content,
.help-tip:focus-within .help-tip__content {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.avatar-upload-overlay {
  position: absolute;
  inset: auto 0 0;
  padding: 6px 4px;
  background: rgba(15, 23, 42, 0.66);
  color: #fff;
  font-size: 12px;
  text-align: center;
  transform: translateY(100%);
  transition: transform 0.16s ease;
  pointer-events: none;
}

.avatar-upload-trigger:hover .avatar-upload-overlay,
.avatar-upload-trigger:focus-within .avatar-upload-overlay {
  transform: translateY(0);
}

.avatar-upload-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.avatar-upload-with-copy {
  width: auto !important;
  max-width: 100% !important;
  flex: 0 1 auto;
}

.avatar-upload-with-copy .avatar-upload-row {
  width: auto !important;
  max-width: 100%;
}

.avatar-upload-with-copy .avatar-upload-copy {
  min-width: 10rem;
}

.entity-cell .avatar-upload-copy,
.official-live-table .avatar-upload-copy {
  display: none;
}

.avatar-source-label,
.avatar-upload-hint,
.avatar-upload-meta {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.avatar-upload-meta {
  color: var(--primary);
}

.avatar-upload.is-uploading .avatar-upload-trigger::after {
  content: "上传中";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.62);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.avatar-upload.has-error .avatar-upload-meta {
  color: var(--danger);
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.official-live-table {
  min-width: 1120px;
  table-layout: fixed;
}

.official-live-table th:nth-child(1),
.official-live-table td:nth-child(1) {
  width: 116px;
}

.official-live-table th:nth-child(2),
.official-live-table td:nth-child(2) {
  width: 220px;
}

.official-live-table th:nth-child(3),
.official-live-table td:nth-child(3) {
  width: 150px;
}

.official-live-table th:nth-child(4),
.official-live-table td:nth-child(4) {
  width: 180px;
}

.official-live-table th:nth-child(5),
.official-live-table td:nth-child(5),
.official-live-table th:nth-child(6),
.official-live-table td:nth-child(6),
.official-live-table th:nth-child(7),
.official-live-table td:nth-child(7),
.official-live-table th:nth-child(8),
.official-live-table td:nth-child(8) {
  width: 98px;
}

.official-live-table th:nth-child(9),
.official-live-table td:nth-child(9) {
  width: 160px;
}

.official-live-table th:nth-child(10),
.official-live-table td:nth-child(10) {
  width: 150px;
}

.official-live-table .entity-cell {
  display: flex;
  min-width: 0;
}

.official-live-table .entity-cell > div:last-child {
  min-width: 0;
}

.official-live-table .entity-cell strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.official-live-table .avatar-upload,
.official-live-table .avatar-upload-row,
.official-live-table .avatar-upload-trigger,
.official-live-table .avatar-upload-img,
.official-live-table .avatar-upload-fallback {
  --avatar-size: 40px;
}

.official-live-table td {
  overflow-wrap: normal;
}

.official-business-panel,
.diagnostic-panel,
.nested-panel,
.table-wrap {
  min-width: 0;
  max-width: 100%;
}

.official-live-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}

.business-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.overview-card {
  position: relative;
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  color: var(--text);
  text-decoration: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

a.overview-card:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow-sm);
}

.overview-card span {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}

.overview-card strong {
  color: var(--text);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.overview-card small {
  color: var(--text-faint);
  font-size: 12px;
}

.overview-card.warning::before,
.overview-card.danger::before,
.overview-card.action::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
}

.overview-card.warning::before { background: var(--warning); }
.overview-card.danger::before { background: var(--danger); }
.overview-card.action::before { background: var(--brand); }

.overview-card.warning strong { color: var(--warning); }
.overview-card.danger strong { color: var(--danger); }
.overview-card.action strong { color: var(--brand); }

.sync-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
}

.sync-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.sync-panel__header strong {
  font-size: 15px;
}

.sync-panel__note {
  color: var(--text-muted);
  font-size: 12px;
}

.sync-form {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(180px, 1.2fr) minmax(170px, 1fr) minmax(170px, 1fr);
  gap: 12px;
  align-items: end;
}

.sync-quick-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  grid-column: 1 / span 3;
}

.sync-submit {
  display: flex;
  justify-content: flex-end;
}

.main,
.main-inner,
.panel,
.table-toolbar,
.entity-cell > div {
  min-width: 0;
}

.nowrap-cell {
  white-space: nowrap;
}

.time-cell {
  min-width: 74px;
}

.time-main {
  display: inline-block;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.ellipsis-text {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action-stack {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.inline-details {
  margin-top: 4px;
  color: var(--text-muted);
}

.inline-details > summary {
  cursor: pointer;
  color: var(--brand);
  font-size: 12px;
  list-style: none;
}

.inline-details > summary::-webkit-details-marker {
  display: none;
}

.danger-text {
  color: var(--danger);
}

.segmented-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
}

.diagnostic-panel > summary {
  cursor: pointer;
  list-style: none;
}

.diagnostic-panel > summary::-webkit-details-marker {
  display: none;
}

.nested-panel {
  margin-top: 16px;
  box-shadow: none;
}

/* -------------------------------------------------------------------------
   Panel / 卡片
   ------------------------------------------------------------------------- */
.panel {
  position: relative;
  padding: 20px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition);
}

.panel-title {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.panel + .panel {
  margin-top: 0;
}

.hero-card,
.dashboard-hero {
  background: var(--surface-solid);
  border-color: var(--border);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr);
  gap: 24px;
}

.dashboard-hero-copy {
  min-width: 0;
}

.dashboard-hero-side {
  display: grid;
  gap: 12px;
  align-content: start;
}

.eyebrow {
  display: inline-block;
  padding: 2px 8px;
  margin-bottom: 8px;
  border-radius: var(--radius-xs);
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero-title {
  margin: 4px 0 8px;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.hero-copy {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
  margin: 0 0 16px;
}

.hero-actions,
.quick-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.quick-action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.quick-action-card {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  color: var(--text);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition), box-shadow var(--transition),
    transform var(--transition);
}

.quick-action-card:hover {
  color: var(--text);
  border-color: var(--brand);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.quick-action-card strong {
  font-size: 14px;
}

.quick-action-card span {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.order-create-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.order-create-card {
  border-left: 3px solid var(--brand);
}

.order-create-card.is-default {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.order-create-card--incense {
  border-left-color: #16a34a;
}

.order-create-card--incense.is-default {
  border-color: #16a34a;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.12);
}

.order-create-legacy-notice {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.order-create-legacy-notice .ghost-button {
  justify-self: start;
}

@media print {
  .order-create-help {
    display: none !important;
  }
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.metric-tile {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.metric-tile span {
  color: var(--text-faint);
  font-size: 12px;
}

.metric-tile strong {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

.hero-filter-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 12px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.hero-filter-form .field {
  margin: 0;
  flex: 1;
}

.health {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.health span {
  color: var(--text-muted);
  font-size: 13px;
}

.health strong {
  font-size: 14px;
  font-weight: 600;
}

.health.is-good {
  background: var(--success-soft);
  border-color: rgba(0, 180, 42, 0.2);
}
.health.is-good strong {
  color: var(--success);
}
.health.is-warn {
  background: var(--warning-soft);
  border-color: rgba(255, 125, 0, 0.2);
}
.health.is-warn strong {
  color: var(--warning);
}
.health.is-danger {
  background: var(--danger-soft);
  border-color: rgba(245, 63, 63, 0.2);
}
.health.is-danger strong {
  color: var(--danger);
}

.notice-panel {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: var(--info-soft);
}

.notice-panel strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-strong);
}

.notice-panel p {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

.notice-info {
  background: var(--info-soft);
  border-color: rgba(51, 112, 255, 0.16);
}
.notice-panel.warning {
  background: var(--warning-soft);
  border-color: rgba(255, 125, 0, 0.2);
}
.notice-panel.warning strong {
  color: var(--warning);
}
.notice-panel.danger {
  background: var(--danger-soft);
  border-color: rgba(245, 63, 63, 0.2);
}
.notice-panel.danger strong {
  color: var(--danger);
}

.info-list {
  display: grid;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface-solid);
  border-bottom: 1px solid var(--border-soft);
}

.info-row:last-child {
  border-bottom: none;
}

.info-row span {
  color: var(--text-muted);
  font-size: 13px;
}

.info-row strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.empty-state {
  display: grid;
  gap: 4px;
  justify-items: center;
  padding: 40px 20px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  text-align: center;
}

.empty-state strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.empty-state span {
  color: var(--text-faint);
  font-size: 13px;
  line-height: 1.6;
  max-width: 380px;
}

.hint-card {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.hint-card strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.hint-card p {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.6;
}

.hint-card.danger {
  border-color: rgba(245, 63, 63, 0.28);
  background: #fff1f0;
}

.hint-card.danger strong {
  color: #c7362f;
}

.hint-card.danger p {
  color: #7a2e2b;
}

/* -------------------------------------------------------------------------
   内容网格
   ------------------------------------------------------------------------- */
.content-grid {
  display: grid;
  gap: 16px;
}

.content-grid.two {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
}

@media (max-width: 1180px) {
  .content-grid.two {
    grid-template-columns: minmax(0, 1fr);
  }
}

.stack-grid {
  display: grid;
  gap: 16px;
  align-content: start;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.stat-card {
  position: relative;
  display: grid;
  gap: 4px;
  padding: 16px 18px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.stat-label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}

.stat-value {
  color: var(--text);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.stat-note {
  color: var(--text-faint);
  font-size: 12px;
  line-height: 1.5;
}

.stat-card.accent {
  border-left: 3px solid var(--brand);
}
.stat-card.accent .stat-value { color: var(--brand-strong); }

.stat-card.warning {
  border-left: 3px solid var(--warning);
}
.stat-card.warning .stat-value { color: var(--warning); }

.stat-card.info {
  border-left: 3px solid var(--info);
}
.stat-card.info .stat-value { color: var(--info); }

.stat-card.danger {
  border-left: 3px solid var(--danger);
}
.stat-card.danger .stat-value { color: var(--danger); }

.stat-card.success {
  border-left: 3px solid var(--success);
}
.stat-card.success .stat-value { color: var(--success); }

.stat-card.data-available {
  position: relative;
  border-left: 3px solid #059669;
  background: #f0fdf4;
}

.stat-card.data-available strong {
  color: #047857;
}

.stat-card small {
  color: var(--text-muted);
  font-size: 12px;
}

/* -------------------------------------------------------------------------
   问题卡片（dashboard issue cards）
   ------------------------------------------------------------------------- */
.dashboard-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.dashboard-badge-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.issue-card {
  position: relative;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all var(--transition);
}

.issue-card.is-clickable:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.issue-card.is-empty {
  opacity: 0.72;
}

.issue-card.danger {
  border-top: 3px solid var(--danger);
}

.issue-card.warning {
  border-top: 3px solid var(--warning);
}

.issue-card.neutral {
  border-top: 3px solid var(--text-faint);
}

.issue-card-link {
  display: grid;
  gap: 6px;
  padding: 14px 16px 16px;
  color: inherit;
  text-decoration: none;
}

.issue-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.issue-card-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border-radius: var(--radius-xs);
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12px;
  font-weight: 600;
}

.issue-card.danger .issue-card-mark {
  background: var(--danger-soft);
  color: var(--danger);
}
.issue-card.warning .issue-card-mark {
  background: var(--warning-soft);
  color: var(--warning);
}
.issue-card.neutral .issue-card-mark {
  background: var(--surface-muted);
  color: var(--text-muted);
}

.issue-card-eyebrow {
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.issue-card-title {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.issue-card-count {
  color: var(--text);
  font-size: 26px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
  margin: 4px 0;
}

.issue-card.danger .issue-card-count { color: var(--danger); }
.issue-card.warning .issue-card-count { color: var(--warning); }

.issue-card-desc {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
  min-height: 36px;
}

.issue-card-cta {
  color: var(--brand);
  font-size: 12px;
  font-weight: 500;
  margin-top: 4px;
}

.issue-card.is-empty .issue-card-cta {
  color: var(--text-faint);
}

/* -------------------------------------------------------------------------
   表单布局
   ------------------------------------------------------------------------- */
.stack-form {
  display: grid;
  gap: 16px;
}

.inline-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.inline-form.compact .field {
  margin: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.field {
  display: grid;
  gap: 4px;
  margin: 0;
}

.field > span {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}

.field.wide {
  grid-column: 1 / -1;
}

.field.checkbox-row {
  flex-direction: row;
  display: flex;
  align-items: center;
  gap: 8px;
}

.field.checkbox-row > span {
  order: 1;
  margin: 0;
}

.field.checkbox-row input[type="checkbox"] {
  order: 0;
  width: 16px;
  height: 16px;
}

.permission-module-overview {
  display: grid;
  gap: 14px;
}

.permission-module-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.permission-module-tabs .ghost-button.active {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-weight: 700;
}

.permission-relationship-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.permission-relationship-grid > div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
  min-width: 0;
}

.permission-relationship-grid strong {
  color: var(--text);
}

.permission-relationship-grid span {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.permission-card-list {
  display: grid;
  gap: 10px;
}

.permission-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 220px);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
}

.permission-card-main {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.permission-card-main input[type="checkbox"] {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-top: 3px;
}

.permission-card-text {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  min-width: 0;
}

.permission-action-name {
  color: var(--text);
  font-weight: 700;
}

.permission-card-text small {
  flex-basis: 100%;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.permission-scope-field {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.permission-scope-field > span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

@media (max-width: 720px) {
  .permission-module-tabs {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .permission-module-tabs .ghost-button {
    justify-content: center;
    width: 100%;
  }

  .permission-relationship-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .permission-card {
    grid-template-columns: 1fr;
  }
}

.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.actions button {
  min-width: 88px;
}

.scheduler-task-list {
  display: grid;
  gap: 10px;
}

.scheduler-task-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.1fr) minmax(220px, 1.4fr) minmax(220px, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fff;
}

.scheduler-task-check {
  align-self: center;
}

.scheduler-task-check > span {
  color: var(--text-main);
  font-weight: 700;
}

.scheduler-task-copy {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.scheduler-task-input {
  min-width: 0;
}

.scheduler-time-field {
  min-width: 0;
  max-width: 260px;
  justify-self: stretch;
}

.scheduler-time-inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(88px, 1fr));
  gap: 10px;
}

@media (max-width: 900px) {
  .scheduler-task-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
}

/* -------------------------------------------------------------------------
   Flash 提示
   ------------------------------------------------------------------------- */
.flash-stack {
  display: grid;
  gap: 8px;
  padding: 0 24px;
  margin-top: 12px;
}

.flash {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  font-size: 13px;
  line-height: 1.5;
  animation: flashIn 180ms ease-out;
  transition: opacity 180ms ease, transform 180ms ease;
}

@keyframes flashIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.flash-content {
  flex: 1;
  min-width: 0;
  color: var(--text);
}

.flash.success {
  background: var(--success-soft);
  border-color: rgba(0, 180, 42, 0.2);
  color: #0a6e1c;
}
.flash.success .flash-content { color: #0a6e1c; }

.flash.warning,
.flash.warn {
  background: var(--warning-soft);
  border-color: rgba(255, 125, 0, 0.25);
  color: #a74b00;
}
.flash.warning .flash-content,
.flash.warn .flash-content { color: #a74b00; }

.flash.error,
.flash.danger {
  background: var(--danger-soft);
  border-color: rgba(245, 63, 63, 0.25);
  color: #a31717;
}
.flash.error .flash-content,
.flash.danger .flash-content { color: #a31717; }

.flash.info {
  background: var(--info-soft);
  border-color: rgba(51, 112, 255, 0.2);
  color: var(--brand-strong);
}
.flash.info .flash-content { color: var(--brand-strong); }

.flash-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  width: 24px;
  height: 24px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  color: currentColor;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.6;
  box-shadow: none;
}

.flash-close:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.05);
}

/* -------------------------------------------------------------------------
   表格工具条
   ------------------------------------------------------------------------- */
.table-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.table-toolbar > div:first-child {
  min-width: 0;
  flex: 1;
}

.toolbar-note {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.6;
  margin-top: 4px;
}

/* -------------------------------------------------------------------------
   登录页
   ------------------------------------------------------------------------- */
body.login-page {
  padding: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(51, 112, 255, 0.12), transparent 45%),
    radial-gradient(circle at 80% 80%, rgba(91, 140, 255, 0.08), transparent 50%),
    linear-gradient(180deg, #f7f9fc 0%, #eef2f7 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
  gap: 0;
  width: min(960px, 92vw);
  max-width: 100%;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.login-aside {
  position: relative;
  padding: 48px 40px;
  background: linear-gradient(135deg, #3370ff 0%, #5b8cff 60%, #7aa6ff 100%);
  color: #ffffff;
  overflow: hidden;
}

.login-aside::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 85% 15%, rgba(255, 255, 255, 0.18), transparent 35%),
    radial-gradient(circle at 15% 85%, rgba(255, 255, 255, 0.12), transparent 40%);
  pointer-events: none;
}

.login-aside-card {
  position: relative;
  display: grid;
  gap: 14px;
}

.login-aside .eyebrow {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  border-radius: var(--radius-xs);
}

.login-aside h1 {
  margin: 0;
  color: #ffffff;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.login-aside > .login-aside-card > p {
  color: rgba(255, 255, 255, 0.88);
  font-size: 14px;
  line-height: 1.7;
  margin: 0;
}

.login-feature-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.login-feature-item {
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-md);
}

.login-feature-item strong {
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
}

.login-feature-item span {
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  line-height: 1.55;
}

.login-card {
  padding: 48px 44px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: var(--surface-solid);
}

.login-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #3370ff, #5b8cff);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 2px 8px rgba(51, 112, 255, 0.3);
}

.login-card-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.login-card-header p {
  color: var(--text-muted);
  font-size: 13px;
  margin: 2px 0 0;
}

.login-form {
  display: grid;
  gap: 14px;
}

.demo-account-panel {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  padding: 12px;
}

.demo-account-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.demo-account-head strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.demo-account-head span {
  font-size: 12px;
  color: var(--text-muted);
}

.demo-account-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.demo-account-button {
  min-width: 0;
  height: auto;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  color: var(--text);
  box-shadow: none;
  display: grid;
  gap: 2px;
  justify-items: start;
  text-align: left;
}

.demo-account-button span {
  font-size: 11px;
  color: var(--text-muted);
}

.demo-account-button strong {
  font-size: 13px;
  font-weight: 600;
  color: #245bdb;
}

.demo-account-button:hover {
  border-color: rgba(51, 112, 255, 0.36);
  background: rgba(51, 112, 255, 0.06);
}

.login-submit {
  width: 100%;
  height: 36px;
  margin-top: 4px;
  font-size: 14px;
  font-weight: 500;
}

.login-anchor-entry {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 36px;
  border: 1px solid rgba(51, 112, 255, 0.28);
  border-radius: var(--radius-sm);
  color: #245bdb;
  background: rgba(51, 112, 255, 0.06);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.login-anchor-entry:hover {
  background: rgba(51, 112, 255, 0.1);
  border-color: rgba(51, 112, 255, 0.45);
  transform: translateY(-1px);
}

.login-footer-note {
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
  color: var(--text-faint);
  font-size: 12px;
  line-height: 1.6;
}

@media (max-width: 720px) {
  .login-shell {
    grid-template-columns: minmax(0, 1fr);
    width: min(420px, 92vw);
  }
  .login-aside {
    padding: 28px 24px;
  }
  .login-card {
    padding: 28px 24px;
  }
  .demo-account-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .page-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
  }

  .page-actions .ghost-button,
  .page-actions .primary-button,
  .hero-actions .ghost-button,
  .hero-actions .primary-button,
  .quick-actions .ghost-button,
  .quick-actions .primary-button {
    width: 100%;
    min-height: 40px;
  }

  .hero-title {
    font-size: 19px;
  }

  .metric-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quick-action-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .inline-form,
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .table-wrap {
    overflow: visible;
    border: none;
    background: transparent;
  }

  .table-wrap table,
  .table-wrap thead,
  .table-wrap tbody,
  .table-wrap tr,
  .table-wrap th,
  .table-wrap td {
    display: block;
  }

  .table-wrap thead {
    display: none;
  }

  .table-wrap tbody {
    display: grid;
    gap: 10px;
  }

  .table-wrap tr {
    padding: 8px 12px;
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xs);
  }

  .table-wrap td {
    display: grid;
    grid-template-columns: minmax(88px, 36%) minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    padding: 9px 0;
    text-align: right;
    border-bottom: 1px solid var(--border-soft);
    white-space: normal;
    word-break: break-word;
  }

  .table-wrap td:last-child {
    border-bottom: none;
  }

  .table-wrap td::before {
    content: attr(data-label);
    color: var(--text-faint);
    font-size: 12px;
    font-weight: 500;
    text-align: left;
  }

  .table-wrap td[data-label="操作"] .text-link,
  .table-wrap td[data-label="操作"] .ghost-button,
  .table-wrap td[data-label="操作"] .primary-button {
    justify-self: end;
  }
}

@media (min-width: 961px) and (max-width: 1180px) {
  .page-header {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .page-heading {
    flex: 1 1 260px;
  }

  .page-toolbar {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .page-actions {
    flex: 1 1 auto;
  }
}

/* -------------------------------------------------------------------------
   响应式：移动端
   ------------------------------------------------------------------------- */
@media (max-width: 960px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    transform: translateX(-100%);
    transition: transform var(--transition-slow);
    box-shadow: var(--shadow-lg);
  }

  .shell.mobile-open .sidebar {
    transform: translateX(0);
  }

  .mobile-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    z-index: 25;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
    border: none;
    padding: 0;
    cursor: pointer;
  }

  .shell.mobile-open .mobile-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-menu-btn {
    display: inline-flex;
  }

  .page-header {
    position: static;
    top: auto;
    z-index: 10;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
    padding: max(10px, env(safe-area-inset-top)) 16px 10px;
  }

  .page-heading {
    flex: 1 1 calc(100% - 48px);
    min-width: 0;
  }

  .page-toolbar {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }

  .page-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }

  .main-inner {
    padding: 12px 16px 24px;
  }

  .flash-stack {
    padding: 0 16px;
  }

  .hero-grid {
    grid-template-columns: 1fr;
  }

  .sync-form {
    grid-template-columns: 1fr;
  }

  .sync-quick-actions,
  .sync-submit {
    grid-column: 1;
    justify-content: flex-start;
  }

  .header-meta {
    display: flex;
    margin-left: 0;
    gap: 6px;
    padding-right: 0;
    border-right: none;
    flex: 1 1 auto;
    justify-content: flex-end;
    min-width: 0;
  }

  .header-meta > .chip {
    display: none;
  }

  .header-user-button {
    width: 32px;
    min-width: 32px !important;
    padding: 0 !important;
    justify-content: center;
  }

  .header-user-button .header-user-name,
  .header-user-button > svg {
    display: none;
  }

  .header-logout-button {
    width: 32px;
    min-width: 32px !important;
    padding: 0;
  }

  .header-logout-button span {
    display: none;
  }

  .notification-trigger {
    width: 32px;
    min-width: 32px;
    height: 32px;
  }

  .notification-menu {
    position: fixed;
    top: 56px;
    left: 12px;
    right: 12px;
    width: auto;
  }

  .user-menu__panel {
    position: fixed;
    top: 56px;
    right: 12px;
    width: min(240px, calc(100vw - 24px));
  }
}

/* -------------------------------------------------------------------------
   一些实用工具类（兼容旧模板）
   ------------------------------------------------------------------------- */
.text-muted { color: var(--text-muted) !important; }
.text-faint { color: var(--text-faint) !important; }
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 8px !important; }
.mt-2 { margin-top: 16px !important; }

.hidden { display: none !important; }

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.check-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.check-card strong,
.check-card small {
  display: block;
}

.check-card small {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 12px;
}

/* CSRF 错误页 */
.csrf-error {
  max-width: 520px;
  margin: 80px auto;
  padding: 32px 36px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

/* 打印 */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.form-grid .full,
.field.full {
  grid-column: 1 / -1;
}

.field.inline-check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
}

.field.inline-check input {
  width: auto;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.action-cell {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.action-cell form {
  margin: 0;
}

.table-action-tip {
  width: 16px;
  height: 16px;
  font-size: 11px;
}

.anchor-profile-form {
  display: block;
}

.panel-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-heading-row .btn-secondary {
  flex: 0 0 auto;
}

.anchor-profile-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.anchor-avatar-panel {
  display: grid;
  justify-items: center;
  gap: 12px;
  min-height: 260px;
  padding: 20px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 50% 10%, rgba(51, 112, 255, 0.1), transparent 42%),
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: var(--shadow-xs);
}

.anchor-avatar-panel-title {
  justify-self: start;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.anchor-avatar-panel .avatar-upload {
  width: auto !important;
  max-width: none !important;
  flex: none;
}

.anchor-avatar-panel .avatar-upload-row {
  width: auto !important;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.anchor-avatar-panel .avatar-upload-copy {
  align-items: center;
  text-align: center;
}

.anchor-avatar-panel p {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.65;
  text-align: center;
}

.anchor-profile-fields {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.anchor-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 14px 18px;
}

.anchor-profile-form .field > span,
.anchor-profile-form .toggle-copy strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.anchor-profile-form .field small,
.anchor-profile-form .toggle-copy small {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.55;
}

.anchor-toggle-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
}

.toggle-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-solid);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.toggle-card:hover {
  border-color: rgba(51, 112, 255, 0.34);
  background: #fbfdff;
  box-shadow: var(--shadow-xs);
}

.toggle-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-box {
  position: relative;
  width: 36px;
  height: 20px;
  flex: 0 0 36px;
  margin-top: 1px;
  border-radius: 999px;
  background: #d8dee8;
  transition: background var(--transition);
}

.toggle-box::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.22);
  transition: transform var(--transition);
}

.toggle-card input:checked + .toggle-box {
  background: var(--brand);
}

.toggle-card input:checked + .toggle-box::after {
  transform: translateX(16px);
}

.toggle-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.anchor-profile-fields .form-actions {
  justify-content: flex-end;
  padding-top: 2px;
  align-items: center;
  flex-wrap: wrap;
}

.form-editing-hint {
  margin-right: auto;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
}

.anchor-list-table td {
  vertical-align: middle;
}

.anchor-list-table tr.is-editing {
  background: rgba(51, 112, 255, 0.06);
  box-shadow: inset 3px 0 0 var(--primary);
}

.row-edit-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--primary);
  background: rgba(51, 112, 255, 0.12);
  font-size: 12px;
  font-weight: 600;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 220px;
}

.inline-form {
  display: inline-flex;
  margin: 0;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), color var(--transition), box-shadow var(--transition);
}

.btn-secondary:hover {
  border-color: rgba(51, 112, 255, 0.42);
  background: #f6f9ff;
  color: var(--primary);
  box-shadow: var(--shadow-xs);
}

.status-pill.muted {
  color: var(--text-muted);
  background: #f2f4f8;
}

@media (max-width: 960px) {
  .anchor-profile-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .anchor-avatar-panel {
    min-height: auto;
  }
}

@media (max-width: 720px) {
  .anchor-field-grid,
  .anchor-toggle-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media print {
  .sidebar, .page-header, .flash-stack, .page-actions {
    display: none !important;
  }
  .shell {
    grid-template-columns: 1fr;
  }
  .panel {
    box-shadow: none;
    border-color: #000;
  }
}

/* =========================================================================
   巨量后台风 · 增量组件
   - filter-bar    标准筛选条（白底，一行排列，主操作右对齐）
   - segmented     连体分段控件（替代多 ghost 按钮拼接）
   - kpi-strip     轻量 KPI 条（用于业务标题下方的统计条）
   - step-mini     横排小步骤卡片（可折叠，企业内部引导）
   - xs-button     表格内 28px 紧凑按钮
   - more-menu     基于 <details> 的"更多▾"下拉
   - status-pill   状态徽章（柔和填充 + 小圆点）
   - page-intro    替代 hero-card 的轻量页面引导块
   ========================================================================= */

/* ---- filter-bar ---------------------------------------------------------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
}

.filter-bar .field {
  margin: 0;
  min-width: 160px;
}

.filter-bar .field.compact {
  min-width: 130px;
}

/* 直播平台 chip（v1.0 引入；SVG 标识跟随品牌色） */
.platform-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px 1px 6px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-left: 3px solid var(--platform-color, #6b7280);
  border-radius: 3px;
  font-size: 11px;
  color: #1f2937;
  white-space: nowrap;
  vertical-align: middle;
  user-select: none;
  line-height: 1.4;
}
.platform-chip__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 12px;
  height: 12px;
  color: var(--platform-color, #6b7280);
}
.platform-chip__icon svg {
  width: 100%;
  height: 100%;
  display: block;
}
.platform-chip__label { font-weight: 500; }
.platform-chip--xs {
  padding: 0 5px;
  font-size: 10px;
}
.platform-chip--xs .platform-chip__icon { width: 10px; height: 10px; }
.platform-chip--lg {
  padding: 3px 9px;
  font-size: 12px;
}
.platform-chip--lg .platform-chip__icon { width: 14px; height: 14px; }

.ops-account-cell {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 210px;
}

.ops-account-avatar {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  background: #f2f5ff;
  border: 1px solid rgba(51, 112, 255, 0.14);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
}

.ops-account-avatar.placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #3370ff;
  font-size: 14px;
  font-weight: 700;
}

.ops-source-avatar-wrap {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ops-source-badge {
  position: absolute;
  right: -5px;
  bottom: -5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 2px solid #fff;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.14);
}

.ops-source-badge--manual {
  color: #b25b00;
  background: #fff0d9;
}

.ops-source-badge--official {
  color: #fff;
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
}

.ops-account-main {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.ops-account-main strong {
  display: block;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.select-col {
  width: 42px;
  text-align: center;
}

.select-col input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.select-col input[type="checkbox"]:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.ops-bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 14px 0 12px;
  padding: 12px 14px;
  border: 1px solid #dbe7ff;
  border-radius: 8px;
  background: #f5f8ff;
}

.ops-bulk-copy {
  display: grid;
  gap: 2px;
}

.ops-bulk-copy strong {
  font-size: 14px;
  color: var(--text);
}

.ops-bulk-copy span {
  font-size: 12px;
  color: var(--text-muted);
}

.ops-account-id {
  font-size: 10px;
  color: #9ca3af;
}

/* 筛选提示文字（v1.0 简化） */
.filter-hint {
  margin: 8px 0 0 0;
  padding: 6px 10px;
  background: #f0f9ff;
  border-left: 3px solid #3b82f6;
  border-radius: 0 4px 4px 0;
  font-size: 12px;
  color: #1e40af;
  line-height: 1.6;
}
.filter-hint strong { color: #1e3a8a; }

/* KPI 区拆两行：必处理 / 仅查看（v1.0 简化） */
.kpi-row-label {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  color: #6b7280;
  margin-right: 4px;
  align-self: center;
  white-space: nowrap;
}
.kpi-actionable .kpi-card { border-left: 3px solid transparent; }
.kpi-actionable .kpi-card.warning { border-left-color: #f59e0b; }
.kpi-actionable .kpi-card.danger { border-left-color: #dc2626; }
.kpi-overview .kpi-card { background: #f9fafb; }
.top-gap-sm { margin-top: 8px; }

.review-workbench-panel {
  margin-bottom: 0;
}

.review-workbench-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.review-workbench-card {
  display: grid;
  gap: 4px;
  min-height: 96px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.review-workbench-card:hover {
  color: var(--text);
  border-color: var(--brand);
  box-shadow: var(--shadow-sm);
}

.review-workbench-card.active {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.review-workbench-card.warning { border-left-color: #f59e0b; }
.review-workbench-card.danger { border-left-color: #dc2626; }
.review-workbench-card.info { border-left-color: #3b82f6; }
.review-workbench-card.success { border-left-color: #16a34a; }

.review-workbench-label,
.review-workbench-meta {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
}

.review-workbench-card strong {
  color: var(--text);
  font-size: 26px;
  font-weight: 650;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

/* 可搜索下拉（用于直播账号筛选） v1.0 引入 */
[x-cloak] { display: none !important; }
.searchable-select { position: relative; min-width: 220px; }
.searchable-select input[type="text"] {
  width: 100%;
  box-sizing: border-box;
  padding: 4px 8px;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 4px;
  font-size: 13px;
}
.searchable-select input[type="text"]:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}
.searchable-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  margin: 2px 0 0 0;
  padding: 4px 0;
  list-style: none;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  max-height: 320px;
  overflow-y: auto;
}
.searchable-dropdown li {
  padding: 6px 10px;
  cursor: pointer;
  font-size: 13px;
  color: #1f2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.searchable-dropdown li:hover { background: #eff6ff; }
.searchable-dropdown li.active { background: #dbeafe; font-weight: 600; }
.searchable-dropdown li.empty { color: #9ca3af; font-style: italic; cursor: default; }
.searchable-dropdown li.empty:hover { background: transparent; }

.subject-bind-form {
  align-items: flex-end;
  gap: 12px;
}

.subject-bind-form .field {
  min-width: min(760px, 100%);
}

.subject-advertiser-combobox {
  position: relative;
  width: min(860px, 100%);
}

.subject-advertiser-search {
  width: 100%;
}

.subject-advertiser-dropdown {
  max-height: 300px;
}

.subject-advertiser-dropdown li {
  display: grid;
  gap: 2px;
}

.subject-advertiser-dropdown li small {
  color: var(--text-muted);
  font-size: 12px;
}

.filter-bar .filter-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.filter-bar .toolbar-note {
  flex-basis: 100%;
  margin-top: 0;
  color: var(--text-faint);
}

/* ---- segmented control --------------------------------------------------- */
.segmented {
  display: inline-flex;
  padding: 2px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  gap: 0;
}

.segmented > a,
.segmented > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  min-width: 56px;
  padding: 0 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  box-shadow: none;
}

.segmented > a:hover,
.segmented > button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.6);
}

.segmented > a.active,
.segmented > button.active,
.segmented > a[aria-current="page"] {
  background: var(--surface-solid);
  color: var(--brand);
  box-shadow: var(--shadow-xs);
}

/* ---- kpi-strip ----------------------------------------------------------- */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.kpi-card {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition);
}

.kpi-card:hover {
  border-color: var(--border-strong);
}

.kpi-card .kpi-label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}

.kpi-card .kpi-value {
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.kpi-card .kpi-meta {
  color: var(--text-faint);
  font-size: 12px;
  line-height: 1.4;
}

/* ---- step-mini ----------------------------------------------------------- */
.step-mini {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.step-mini-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  transition: border-color var(--transition);
}

.step-mini-card:hover {
  color: var(--text);
  border-color: var(--brand);
}

.step-mini-card .step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.step-mini-card .step-body strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
}

.step-mini-card .step-body span {
  display: block;
  color: var(--text-faint);
  font-size: 12px;
  line-height: 1.4;
}

.step-mini-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  height: auto;
  min-width: auto;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: none;
}

.step-mini-toggle:hover {
  background: transparent;
  border: none;
  color: var(--brand);
}

.step-mini-toggle::after {
  content: "▾";
  display: inline-block;
  transition: transform var(--transition);
  font-size: 10px;
}

.step-mini-toggle[aria-expanded="false"]::after {
  transform: rotate(-90deg);
}

.step-mini[hidden] {
  display: none;
}

/* ---- xs-button (table row 紧凑按钮) -------------------------------------- */
.xs-button,
button.xs-button,
a.xs-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  min-width: auto;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-xs);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  box-shadow: none;
}

.xs-button:hover,
a.xs-button:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--surface-solid);
}

.xs-button.danger {
  color: var(--danger);
}

.xs-button.danger:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-soft);
}

/* Live session overview (#81) */
.live-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.live-kpi-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.live-overview-filter {
  align-items: end;
}

.live-overview-primary-actions {
  align-self: end;
}

.live-overview-filter .inline-check {
  min-height: 42px;
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

.live-sync-suggestion-grid,
.live-sync-action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.live-sync-suggestion-grid > div,
.live-sync-action-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.live-sync-suggestion-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.live-sync-suggestion-grid strong {
  color: var(--text);
  font-size: 20px;
}

.live-sync-action-card {
  display: grid;
  gap: 10px;
  align-content: start;
}

.live-sync-action-card--force {
  border-color: #fecaca;
  background: #fffafa;
}

.source-summary-inline,
.source-summary-cell {
  min-width: 0;
}

.source-summary-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  width: fit-content;
  max-width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-subtle, #e5e7eb);
  border-radius: 8px;
  background: #f8fafc;
}

.source-summary-inline span,
.source-summary-inline small {
  color: var(--text-muted);
  font-size: 12px;
}

.source-summary-inline strong,
.source-summary-cell strong {
  color: var(--text);
  overflow-wrap: anywhere;
}

.session-marker-cell {
  display: grid;
  gap: 2px;
  min-width: 76px;
}

.session-marker-cell strong {
  color: var(--text);
}

.session-marker-cell span {
  color: var(--text-muted);
  font-size: 12px;
}

.overview-extension-stack {
  display: grid;
  gap: 6px;
  min-width: 260px;
  max-width: 340px;
}

.overview-product-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.overview-product-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 92px;
}

.overview-product-thumb,
.overview-product-more {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  border: 1px solid #dbe4ef;
  background: #f8fafc;
}

.overview-product-thumb {
  display: inline-flex;
  overflow: hidden;
}

.overview-product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.overview-product-thumb:hover {
  border-color: var(--brand);
}

.overview-product-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
}

.overview-product-text {
  min-width: 0;
}

.overview-product-text strong,
.overview-product-text .strong-link {
  display: -webkit-box;
  max-width: 220px;
  overflow: hidden;
  color: var(--text);
  line-height: 1.35;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.overview-extension-chipline {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.overview-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
}

.overview-chip--available {
  border-color: #86efac;
  background: #f0fdf4;
  color: #047857;
  font-weight: 700;
}

.watch-metric-cell {
  position: relative;
  display: grid;
  gap: 2px;
  min-width: 96px;
  width: max-content;
  max-width: 180px;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}

.watch-metric-cell strong {
  color: #64748b;
  font-size: 14px;
  line-height: 1.2;
}

.watch-metric-cell span {
  color: #94a3b8;
  font-size: 11px;
  line-height: 1.3;
}

.watch-metric-cell--primary {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.watch-metric-cell--primary strong {
  color: #1d4ed8;
}

.watch-metric-cell--flow {
  border-color: #86efac;
  background: #f0fdf4;
}

.watch-metric-cell--flow strong {
  color: #047857;
}

.watch-metric-cell--flow span {
  color: #15803d;
}

.flow-hover-panel {
  display: none;
  position: absolute;
  z-index: 80;
  top: calc(100% + 6px);
  left: 0;
  min-width: 220px;
  max-width: 300px;
  padding: 10px;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.16);
  color: #0f172a;
  line-height: 1.4;
  white-space: normal;
}

.flow-hover-panel > strong {
  display: block;
  margin-bottom: 6px;
  color: #047857;
  font-size: 12px;
}

.flow-hover-panel div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 3px 0;
  border-top: 1px solid #f1f5f9;
}

.flow-hover-panel div:first-of-type {
  border-top: 0;
}

.flow-hover-panel span {
  min-width: 0;
  color: #475569;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.flow-hover-panel em {
  color: #0f172a;
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  white-space: nowrap;
}

.flow-hover-panel small {
  display: block;
  margin-top: 6px;
  color: #64748b;
  font-size: 11px;
}

.product-hover-panel {
  min-width: 320px;
  max-width: 460px;
}

.product-hover-panel .product-hover-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  justify-content: initial;
  gap: 9px;
  padding: 7px 0;
}

.product-hover-panel .product-hover-thumb {
  display: flex;
  width: 40px;
  height: 40px;
  min-width: 40px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #f8fafc;
  color: #94a3b8;
  font-size: 11px;
}

.product-hover-panel .product-hover-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-hover-panel .product-hover-content {
  min-width: 0;
  color: #0f172a;
}

.product-hover-panel .product-hover-name {
  display: block;
  color: #0f172a;
  font-weight: 700;
}

.product-hover-panel .product-hover-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 3px;
}

.product-hover-panel .product-hover-meta em {
  color: #475569;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.watch-metric-cell:hover .flow-hover-panel,
.watch-metric-cell:focus-within .flow-hover-panel,
.stat-card:hover > .flow-hover-panel,
.stat-card:focus-within > .flow-hover-panel,
.metric-row:hover > .flow-hover-panel,
.metric-row:focus-within > .flow-hover-panel {
  display: block;
}

.wide-table {
  overflow-x: auto;
}

.wide-table .data-table {
  min-width: 1760px;
}

.actions-cell {
  min-width: 260px;
}

.actions-cell .inline-form {
  display: inline-block;
  margin: 2px 0;
}

.detail-grid,
.live-sync-policy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.detail-grid > div,
.live-sync-policy-grid > div {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-muted);
}

.detail-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.detail-grid strong {
  overflow-wrap: anywhere;
}

.technical-details {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 12px;
}

.technical-details > summary {
  cursor: pointer;
  color: #475569;
  list-style: none;
  user-select: none;
}

.technical-details > summary::-webkit-details-marker {
  display: none;
}

.technical-details > summary::marker {
  content: "";
}

.technical-details__body {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 6px;
  line-height: 1.5;
}

.technical-details code {
  max-width: 100%;
  padding: 1px 5px;
  border-radius: 4px;
  background: #f1f5f9;
  color: #334155;
  overflow-wrap: anywhere;
  white-space: normal;
}

.technical-details.compact-tech {
  margin-top: 4px;
}

.technical-details.compact-tech > summary {
  font-size: 11px;
}

.pagination-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding-top: 12px;
}

.xs-button.disabled,
span.xs-button.disabled {
  color: var(--text-muted);
  background: #f8fafc;
  border-color: var(--border);
  cursor: not-allowed;
  opacity: 0.62;
}

/* ---- more-menu (基于 details) -------------------------------------------- */
.more-menu {
  position: relative;
  display: inline-block;
}

.more-menu > summary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface-solid);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: all var(--transition);
}

.more-menu > summary::-webkit-details-marker { display: none; }
.more-menu > summary::after {
  content: "▾";
  font-size: 9px;
  margin-left: 2px;
  opacity: 0.7;
}

.more-menu > summary:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.more-menu[open] > summary {
  border-color: var(--brand);
  color: var(--brand);
}

.more-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 30;
  min-width: 144px;
  padding: 4px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-pop);
  display: grid;
  gap: 2px;
}

.more-menu-panel a,
.more-menu-panel button {
  display: flex;
  align-items: center;
  width: 100%;
  height: 30px;
  padding: 0 10px;
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  color: var(--text);
  font-size: 13px;
  font-weight: 400;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  justify-content: flex-start;
  min-width: auto;
  box-shadow: none;
}

.more-menu-panel a:hover,
.more-menu-panel button:hover {
  background: var(--surface-hover);
  color: var(--brand);
  border: none;
}

.more-menu-panel form {
  margin: 0;
}

/* ---- status-pill (柔和填充 + 圆点) --------------------------------------- */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-xs);
  background: var(--surface-muted);
  color: var(--text-muted);
  white-space: nowrap;
}

.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
}

.status-pill.success {
  background: var(--success-soft);
  color: var(--success);
}

.status-pill.warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.status-pill.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.status-pill.info {
  background: var(--brand-soft);
  color: var(--brand);
}

.multi-qianchuan-badge {
  justify-content: center;
  min-width: 24px;
  padding: 0 6px;
  font-weight: 700;
}

.multi-qianchuan-badge::before {
  display: none;
}

/* ---- page-intro (轻量页面引导，替代 hero-card) --------------------------- */
.page-intro {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
}

.page-intro-copy {
  flex: 1;
  min-width: 240px;
}

.page-intro-copy strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.page-intro-copy span {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.page-intro-side {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* ---- 表格内的 entity-cell 紧凑变体 --------------------------------------- */
.row-actions.compact {
  gap: 6px;
  min-width: auto;
  flex-wrap: nowrap;
}

.attribution-editor {
  position: relative;
}

.attribution-editor[open] {
  z-index: 3;
}

.attribution-editor summary {
  list-style: none;
}

.attribution-editor summary::-webkit-details-marker {
  display: none;
}

.compact-form {
  display: grid;
  gap: 8px;
  min-width: 240px;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  box-shadow: var(--shadow-md);
}

.compact-form label {
  display: grid;
  gap: 4px;
  color: var(--text-muted);
  font-size: 12px;
}

.compact-form select,
.compact-form input {
  width: 100%;
  min-width: 0;
}

/* ---- 表格行 hover 加强 -------------------------------------------------- */
.table-wrap table tbody tr:hover td {
  background: #fafbfc;
}

.table-wrap table tbody tr.is-highlighted td {
  background: #f0f6ff;
  border-top-color: rgba(51, 112, 255, 0.2);
  border-bottom-color: rgba(51, 112, 255, 0.2);
}

/* ---- 响应式补丁 --------------------------------------------------------- */
@media (max-width: 720px) {
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-bar .filter-actions {
    margin-left: 0;
    justify-content: flex-end;
  }
  .filter-bar .field,
  .filter-bar .field.compact {
    min-width: 0;
    width: 100%;
  }
  .step-mini {
    grid-template-columns: 1fr;
  }
}

/* ---- 官方开播数据工作台 ---------------------------------------------------- */
.sync-toolbar {
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 18px;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.05);
}

.view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 999px;
  background: #f8fafc;
}

.view-toggle a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.view-toggle a.active {
  color: #1d4ed8;
  background: #fff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.14);
}

.live-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.live-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  padding: 18px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.06);
}

.live-card__header,
.live-card__actions,
.live-card__attribution {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.live-card__title {
  min-width: 0;
}

.live-card__title strong {
  display: block;
  max-width: 420px;
  overflow: hidden;
  color: #0f172a;
  font-size: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-card__title span,
.live-card__time span,
.metric-row span,
.metric-summary-card span {
  color: #64748b;
  font-size: 12px;
}

.live-card__time {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.live-card__time div,
.metric-row,
.metric-summary-card {
  min-width: 0;
  padding: 12px;
  border-radius: 14px;
  background: #f8fafc;
}

.live-card__time strong {
  display: block;
  margin-top: 4px;
  color: #0f172a;
  font-size: 15px;
  white-space: nowrap;
}

.live-card__attribution {
  flex-wrap: wrap;
  justify-content: flex-start;
  padding: 12px;
  border-radius: 16px;
  background: #f8fbff;
}

.live-card__attribution > div {
  min-width: 140px;
}

.live-card__attribution strong {
  display: block;
  color: #0f172a;
}

.live-card__anchors {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.live-card__metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.metric-row strong {
  display: block;
  margin: 6px 0 2px;
  color: #0f172a;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.metric-row--value strong {
  color: #1d4ed8;
}

.metric-row--extension-value {
  position: relative;
  border: 1px solid #86efac;
  background: #f0fdf4;
}

.metric-row--extension-value strong {
  color: #047857;
}

.metric-row--extension-value small {
  color: #15803d;
}

.metric-row small {
  color: #94a3b8;
  font-size: 11px;
}

.metric-row--not_synced strong,
.metric-row--missing strong,
.metric-row--unit_pending strong,
.metric-row--permission_denied strong,
.metric-row--token_expired strong,
.metric-row--error strong {
  color: #94a3b8;
  font-size: 16px;
}

.metric-row--permission_denied,
.metric-row--token_expired,
.metric-row--error {
  background: #fff1f2;
}

.metric-row--unit_pending {
  background: #fffbeb;
}

.attribution-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  color: #1d4ed8;
  background: #eff6ff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.metrics-workbench {
  display: grid;
  gap: 16px;
}

.metric-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.metric-summary-card {
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.05);
}

.metric-summary-card strong {
  display: block;
  margin: 8px 0;
  color: #0f172a;
  font-size: 26px;
  letter-spacing: -0.03em;
}

.metric-summary-card small {
  color: #64748b;
}

.ellipsis-cell {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.official-live-table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.official-live-table th,
.official-live-table td {
  vertical-align: middle;
}

.official-live-table .num-cell {
  min-width: 108px;
}

@media (max-width: 1180px) {
  .live-card-grid,
  .metric-summary-grid {
    grid-template-columns: 1fr;
  }

  .live-card__metrics,
  .live-card__time {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .view-toggle {
    width: 100%;
    justify-content: space-between;
  }

  .view-toggle a {
    flex: 1;
    padding: 0 8px;
  }

  .live-card__header,
  .live-card__actions {
    align-items: flex-start;
    flex-direction: column;
  }
}

.official-business-panel,
.official-live-table-wrap,
.metrics-workbench {
  max-width: 100%;
}

.official-kpi-strip {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.official-live-filter {
  align-items: end;
  gap: 12px;
}

.live-card-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr));
}

.live-card--compact {
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
}

.live-card--compact .live-card__header {
  gap: 10px;
}

.live-card--compact .avatar-upload.avatar-upload--md .avatar-upload__trigger,
.live-card--compact .avatar-upload.avatar-upload--md .avatar-upload__image,
.live-card--compact .avatar-upload.avatar-upload--md .avatar-upload__placeholder {
  width: 42px;
  height: 42px;
  min-width: 42px;
}

.live-card--compact .live-card__title strong {
  display: block;
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-card--compact .live-card__time {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.live-card--compact .live-card__time div,
.live-card--compact .metric-row {
  min-width: 0;
  padding: 7px 8px;
}

.live-card--compact .live-card__metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.live-card--compact .metric-row strong {
  font-size: 1rem;
}

.live-card--compact .live-card__actions {
  gap: 6px;
}

.live-card-detail {
  display: grid;
  gap: 12px;
  max-width: min(760px, calc(100vw - 64px));
  padding: 10px 0 4px;
}

.live-card-detail section {
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 14px;
  background: #f8fafc;
  padding: 12px;
}

.live-card-detail h4 {
  margin: 0 0 10px;
  font-size: 0.95rem;
}

.metric-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}

.metric-detail-grid > div {
  min-width: 0;
  border-radius: 10px;
  background: #fff;
  padding: 8px 10px;
}

.metric-detail-grid span {
  display: block;
  color: #64748b;
  font-size: 0.78rem;
  margin-bottom: 3px;
}

.metric-detail-grid strong {
  overflow-wrap: anywhere;
}

.official-session-detail {
  max-width: 1180px;
  margin: 0 auto;
}

.official-session-detail .live-card-detail {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.diagnostic-json {
  margin: 12px 0 0;
  padding: 12px;
  border-radius: 10px;
  background: #0f172a;
  color: #e2e8f0;
  overflow: auto;
  max-height: 360px;
  font-size: 12px;
  line-height: 1.6;
}

@media (max-width: 720px) {
  .live-card--compact .live-card__time,
  .live-card--compact .live-card__metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.business-id {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.9em;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.qianchuan-source-list {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.qianchuan-source-list li {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle, #e5e7eb);
  border-radius: 12px;
  background: var(--surface-muted, #f8fafc);
}

.qianchuan-source-list li span,
.qianchuan-source-list li em {
  color: var(--text-muted, #64748b);
  font-size: 12px;
  font-style: normal;
}

.native-search-select {
  position: relative;
  width: 100%;
  overflow: visible;
}

.native-search-select__native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-width: 1px !important;
  min-height: 1px !important;
  margin: 0 !important;
  padding: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  inset: auto auto 0 0;
}

.native-search-select__input {
  width: 100%;
  height: 32px;
  min-width: 0;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px;
  padding: 0 32px 0 12px;
  font: inherit;
  color: var(--text, #111827);
  background-color: #fff;
  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='none' stroke='%234E5969' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.3' d='m3 4.5 3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  box-sizing: border-box;
}

.native-search-select__input::-webkit-search-cancel-button {
  appearance: none;
}

.native-search-select__input:focus {
  outline: none;
  border-color: var(--brand, #2563eb);
  box-shadow: 0 0 0 3px var(--brand-ring, rgba(37, 99, 235, 0.16));
}

.native-search-select__menu {
  position: absolute;
  z-index: 3000;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: min(320px, 50vh);
  margin: 0;
  padding: 4px;
  overflow-y: auto;
  list-style: none;
  background: #fff;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
}

.native-search-select__option,
.native-search-select__empty {
  min-height: 30px;
  padding: 7px 9px;
  border-radius: 4px;
  color: var(--text, #111827);
  font-size: 13px;
  line-height: 1.35;
}

.native-search-select__option {
  cursor: pointer;
}

.native-search-select__option:hover,
.native-search-select__option.is-active {
  background: #eff6ff;
}

.native-search-select__option.is-selected {
  font-weight: 600;
}

.native-search-select__option[aria-disabled="true"] {
  color: var(--text-disabled, #9ca3af);
  cursor: not-allowed;
}

.native-search-select__empty {
  color: var(--text-muted, #64748b);
}

.native-search-select.is-disabled .native-search-select__input,
.native-search-select.is-locked .native-search-select__input {
  background-color: var(--surface-muted, #f3f4f6);
  color: var(--text-disabled, #6b7280);
  border-color: var(--border, #e5e7eb);
  cursor: not-allowed;
}

.live-card__source {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  padding: 10px 0;
  border-top: 1px dashed var(--border-subtle, #e5e7eb);
  border-bottom: 1px dashed var(--border-subtle, #e5e7eb);
}

.live-card__source > div {
  min-width: 0;
}

.live-card__source span {
  display: block;
  margin-bottom: 3px;
  color: var(--text-muted, #64748b);
  font-size: 12px;
}

.live-card__source strong {
  display: block;
  line-height: 1.45;
}

.live-card__source details {
  grid-column: 1 / -1;
}

.live-card__metric-empty {
  grid-column: 1 / -1;
}

.sync-form {
  align-items: stretch;
}

.sync-form__section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  width: 100%;
  padding: 14px;
  border: 1px solid var(--border-subtle, #e5e7eb);
  border-radius: 16px;
  background: var(--surface, #fff);
}

.sync-form__section-title {
  grid-column: 1 / -1;
  font-weight: 700;
  color: var(--text-strong, #111827);
}

.sync-form__section--actions {
  grid-template-columns: 1fr;
}

.sync-action-help {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: var(--text-muted, #64748b);
  font-size: 13px;
  line-height: 1.5;
}

.sync-submit--split {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.sync-submit--split button {
  white-space: nowrap;
}

@media (max-width: 760px) {
  .live-card__source {
    grid-template-columns: 1fr;
  }

  .sync-form__section {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   千川数据中控台 v2 — 同步工作区 / 候选千川户 / 场次卡片
   ============================================================ */

[x-cloak] { display: none !important; }

.full-width { width: 100%; }

.sync-workspace .workspace-step {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px dashed #eee;
}
.sync-workspace .workspace-step:last-child { border-bottom: none; }

.workspace-step .step-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.workspace-step .step-header .step-num {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  background: #1e88e5;
  color: white;
  border-radius: 50%;
  font-weight: 600;
  font-size: 14px;
}
.workspace-step .step-header strong {
  font-size: 15px;
  color: #222;
}
.workspace-step .step-header .step-hint {
  color: #666;
  font-size: 12px;
}
.workspace-step .step-body { min-width: 0; }

.candidate-panel {
  background: #f5f9ff;
  border: 1px solid #d6e4f5;
  border-radius: 6px;
  padding: 12px 16px;
}
.candidate-panel__title {
  margin-bottom: 10px;
  color: #333;
  font-size: 13px;
}
.candidate-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.candidate-item label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.candidate-item label:hover { border-color: #1e88e5; }
.candidate-item.is-selected label {
  border-color: #1e88e5;
  background: #e3f2fd;
}
.candidate-item input[type="radio"] { margin-top: 4px; flex-shrink: 0; }
.candidate-meta { flex: 1; min-width: 0; }
.candidate-meta .business-id {
  margin-left: 8px;
  font-family: monospace;
  font-size: 11px;
  color: #666;
}
.candidate-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.candidate-tags .role-chip {
  font-size: 11px;
  padding: 2px 8px;
  background: #f0f0f0;
  color: #555;
  border-radius: 3px;
  white-space: nowrap;
}

.time-range-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.time-range-row .field { flex: 1; min-width: 200px; }

.time-quick-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.sync-action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.sync-action-row button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.status-pills-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===== 场次卡片 ===== */

.session-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 14px;
}

.session-card {
  background: white;
  border: 1px solid #e3e3e3;
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.session-card__header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.session-card__title { flex: 1; min-width: 0; }
.session-card__title strong {
  display: block;
  font-size: 15px;
  color: #222;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.session-card__sub {
  margin: 4px 0 0 0;
  color: #666;
  font-size: 12px;
}

.session-card__times,
.session-card__attribution {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 6px 12px;
  font-size: 12px;
  padding-top: 8px;
  border-top: 1px dashed #eee;
}
.session-card__times > div,
.session-card__attribution > div {
  display: flex;
  flex-direction: column;
}
.session-card__times span,
.session-card__attribution span {
  color: #888;
  font-size: 11px;
}
.session-card__times strong,
.session-card__attribution strong {
  color: #222;
  font-size: 13px;
  font-weight: 500;
}

.session-card__metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 6px;
  padding-top: 8px;
  border-top: 1px dashed #eee;
}
.session-card__metrics .metric-row {
  display: flex;
  flex-direction: column;
  padding: 6px 8px;
  background: #fafafa;
  border-radius: 4px;
  font-size: 12px;
}
.session-card__metrics .metric-row span { color: #888; font-size: 11px; }
.session-card__metrics .metric-row strong { font-size: 14px; color: #1d4ed8; }
.session-card__metrics .metric-row small { color: #aaa; font-size: 10px; }
.session-card__metrics .metric-row--value { background: #f0f9ff; border-color: #bbdefb; }
.session-card__metrics .metric-row--value small { color: #1a73e8; }
.session-card__metrics .metric-row--extension-value {
  position: relative;
  border: 1px solid #86efac;
  background: #f0fdf4;
}
.session-card__metrics .metric-row--extension-value strong { color: #047857; }
.session-card__metrics .metric-row--extension-value small { color: #15803d; }
.session-card__sync-time {
  font-size: 11px;
  color: #5f6368;
  padding: 4px 8px;
  background: #f8f9fa;
  border-radius: 4px;
  margin-top: 6px;
  display: inline-block;
}

/* ===== 详情页：业务 ID 行、改归属、诊断矩阵、扩展数据 ===== */

.biz-id-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px dashed #eee;
}

.reattribution-section {
  border: 1px solid #ffe082;
  border-radius: 6px;
  padding: 12px 16px;
  background: #fffdf6;
}
.reattribution-summary {
  cursor: pointer;
  font-weight: 600;
  color: #e65100;
  list-style: none;
  user-select: none;
}
.reattribution-summary::-webkit-details-marker { display: none; }

/* 归属变更历史列表（详情页） */
.attribution-history-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.attribution-history-item {
  border-left: 3px solid #ffb74d;
  padding: 8px 12px;
  background: #fff;
  border-radius: 0 4px 4px 0;
}
.attribution-history-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: #555;
  margin-bottom: 4px;
}
.attribution-history-head strong {
  color: #333;
}
.attribution-history-body {
  font-size: 13px;
  line-height: 1.6;
  color: #333;
}
.attribution-history-body .muted-small {
  font-size: 11px;
  color: #888;
}
.attribution-history-reason {
  margin-top: 4px;
  padding: 4px 8px;
  background: #fff8e1;
  border-radius: 3px;
  color: #5d4037;
  font-size: 12px;
}
.tag-warning {
  display: inline-block;
  padding: 1px 6px;
  background: #fff3e0;
  color: #e65100;
  border-radius: 3px;
  font-size: 11px;
}

/* 同步诊断矩阵 */
.diagnostic-matrix {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.diagnostic-row {
  display: grid;
  grid-template-columns: 200px 200px 80px 1fr;
  gap: 12px;
  align-items: start;
  padding: 10px 12px;
  background: #fafafa;
  border-left: 3px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
}
.diagnostic-row--success { border-left-color: #43a047; background: #f1f8e9; }
.diagnostic-row--permission_denied { border-left-color: #c62828; background: #ffebee; }
.diagnostic-row--token_expired { border-left-color: #ef6c00; background: #fff3e0; }
.diagnostic-row--rate_limited { border-left-color: #ef6c00; background: #fff3e0; }
.diagnostic-row--failed { border-left-color: #c62828; background: #ffebee; }
.diagnostic-row--not_synced { border-left-color: #9e9e9e; }

.diagnostic-label strong { display: block; }
.diagnostic-label code { font-size: 10px; color: #666; word-break: break-all; }
.diagnostic-status { display: flex; flex-direction: column; gap: 4px; }
.diagnostic-status small { color: #666; font-size: 11px; }
.diagnostic-action { text-align: right; }
.diagnostic-next { color: #555; font-size: 12px; }
.diagnostic-raw { margin-top: 6px; }
.diagnostic-raw summary { cursor: pointer; font-size: 11px; color: #c62828; list-style: none; user-select: none; }
.diagnostic-raw summary::-webkit-details-marker { display: none; }
.diagnostic-raw code {
  display: block;
  margin-top: 4px;
  padding: 6px 8px;
  background: #fff;
  border: 1px solid #ffcdd2;
  border-radius: 3px;
  font-size: 11px;
  word-break: break-all;
  color: #5d4037;
}

/* 扩展数据按维度分组 */
.dimension-block {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 8px 12px;
}
.dimension-block summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.dimension-block summary::-webkit-details-marker { display: none; }
.dimension-block .dim-count {
  background: #eef2f7;
  color: #555;
  padding: 1px 8px;
  border-radius: 3px;
  font-size: 11px;
}
.dimension-block summary::before {
  content: '▶ ';
  font-size: 10px;
  color: #888;
  margin-right: 6px;
}
.dimension-block[open] summary::before {
  content: '▼ ';
}

.diagnostic-json {
  background: #f5f5f5;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 11px;
  font-family: 'SF Mono', Consolas, Menlo, monospace;
  max-height: 400px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

@media (max-width: 760px) {
  .diagnostic-row {
    grid-template-columns: 1fr;
  }
}

.session-card__error {
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 12px;
}
.session-card__error > summary {
  cursor: pointer;
  color: #e65100;
  font-weight: 500;
  list-style: none;
  user-select: none;
}
.session-card__error > summary::-webkit-details-marker { display: none; }
.session-card__error > summary::before {
  content: '▶ ';
  font-size: 10px;
  margin-right: 4px;
  color: #e65100;
}
.session-card__error[open] > summary::before {
  content: '▼ ';
}
.session-card__error .error-msg {
  margin: 6px 0 0 0;
  color: #5d4037;
  font-family: monospace;
  font-size: 11px;
  word-break: break-all;
}

.session-card__footer {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid #eee;
}

.session-card__ids {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding-top: 6px;
}
.business-id-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  background: #f5f5f5;
  font-size: 11px;
  color: #666;
  border-radius: 3px;
}
.business-id-tag code {
  background: transparent;
  font-family: monospace;
  color: #333;
  padding: 0;
}

/* 紧凑业务 ID：浅色标签 + 等宽 ID */
.biz-id {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px 1px 0;
  font-size: 11px;
  white-space: nowrap;
}
.biz-id em {
  display: inline-block;
  padding: 1px 5px;
  background: #eef2f7;
  color: #6b7280;
  font-style: normal;
  font-weight: 500;
  border-radius: 3px;
  line-height: 1.4;
}
.biz-id code {
  background: transparent;
  color: #1f2937;
  font-family: 'SF Mono', Consolas, Menlo, monospace;
  font-size: 11px;
  padding: 0;
  user-select: all;
}

.biz-id--source {
  gap: 6px;
  max-width: 100%;
  white-space: normal;
}

.biz-id--source strong {
  color: #1f2937;
  overflow-wrap: anywhere;
}

.source-details-panel {
  display: block;
}

.source-details-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.source-details-summary::-webkit-details-marker {
  display: none;
}

.source-details-summary::marker {
  content: "";
}

.source-details-summary span {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  min-width: 0;
}

.source-details-summary em {
  color: #64748b;
  font-style: normal;
  font-size: 12px;
}

.source-details-summary strong {
  color: #0f172a;
  overflow-wrap: anywhere;
}

.source-details-summary small {
  color: #64748b;
  font-size: 12px;
}

.source-details-body {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed #e2e8f0;
}

.product-thumb-link,
.product-thumb-placeholder {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  background: #f8fafc;
}

.product-thumb-link {
  display: inline-flex;
  overflow: hidden;
}

.product-thumb-link.small {
  width: 38px;
  height: 38px;
}

.product-thumb-link img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-thumb-link:hover {
  border-color: var(--brand);
}

.product-thumb-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 11px;
}

.product-link-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin-top: 5px;
}

.strong-link {
  font-weight: 700;
}

/* ===== 折叠面板：高级操作 / 诊断 ===== */

.advanced-ops > summary,
.diagnostics-panel > summary {
  cursor: pointer;
  padding: 12px 16px;
  background: #f7f7f7;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  list-style: none;
  user-select: none;
  font-size: 14px;
}
.advanced-ops > summary::before,
.diagnostics-panel > summary::before {
  content: '▶ ';
  color: #888;
  font-size: 11px;
  margin-right: 6px;
}
.advanced-ops[open] > summary::before,
.diagnostics-panel[open] > summary::before {
  content: '▼ ';
}

/* "更多筛选" 折叠在主筛选条里的样式 */
.filter-more {
  width: 100%;             /* 强制独占一行，不被 flex 挤变形 */
  margin-top: 4px;
}
.filter-more > summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
  font-size: 13px;
  color: #1e88e5;
  padding: 4px 0;
  display: inline-block;
}
.filter-more > summary::-webkit-details-marker { display: none; }
.filter-more > summary::marker { content: ''; }   /* 现代浏览器隐藏默认三角 */
.filter-more > summary::before {
  content: '▶ ';
  color: #888;
  font-size: 11px;
  margin-right: 4px;
}
.filter-more[open] > summary::before { content: '▼ '; }
.filter-more-body {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  padding: 12px;
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  align-items: end;
}
.filter-more-body label.field {
  flex: 0 0 auto;
}

/* 工具栏里的紧凑下拉、批量同步表单 */
.compact-select {
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  margin-right: 4px;
}
.batch-sync-form {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.batch-sync-form .batch-range-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}
.batch-sync-form .batch-range-field--readonly {
  max-width: min(100%, 360px);
  padding: 4px 8px;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #f8fafc;
  color: #1f2a44;
}
.batch-sync-form .batch-range-field--readonly strong,
.batch-sync-form .batch-range-field--readonly small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.batch-sync-form .batch-range-field--readonly small {
  color: #64748b;
}
.batch-custom-range {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.batch-custom-range[hidden] {
  display: none !important;
}
.batch-sync-form .batch-label {
  font-size: 12px;
  color: #5f6368;
  white-space: nowrap;
}
.batch-sync-form .batch-sep {
  font-size: 12px;
  color: #888;
  padding: 0 2px;
}
.batch-sync-form input[type="date"] {
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  width: 140px;
  max-width: 140px;
  background: #fff;
}
.sync-progress {
  width: 110px;
  height: 8px;
  border-radius: 999px;
  background: #edf1f7;
  overflow: hidden;
  margin-bottom: 4px;
}
.sync-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4f7cff, #18b7a7);
  transition: width 0.25s ease;
}

/* 新工具栏：紧凑三行布局 */
.ops-toolbar-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0 12px 0;
  border-bottom: 1px solid #f0f0f0;
  margin-bottom: 12px;
  gap: 16px;
}
.ops-toolbar-title strong {
  font-size: 15px;
  color: #222;
}
.ops-toolbar-title small {
  display: block;
  font-size: 11px;
  color: #888;
  margin-top: 2px;
}
.ops-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 紧凑视图切换：取消大椭圆 */
.view-toggle.compact-toggle {
  padding: 2px;
  border-radius: 6px;
  border: 1px solid #d0d7de;
  background: #f6f8fa;
}
.view-toggle.compact-toggle a {
  min-height: 26px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 4px;
}
.view-toggle.compact-toggle a.active {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  background: #fff;
}

/* 主筛选条：去掉背景框 */
.ops-filter-row {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  margin-bottom: 8px;
  row-gap: 8px;
}

/* 主筛选条字段：比通用 filter-bar 略窄，让 1280-1366 屏可一行容下 6 个 field */
.ops-filter-row .field { min-width: 140px; }
.ops-filter-row .field.compact { min-width: 120px; }
.ops-filter-row .searchable-select { min-width: 180px; }
.ops-filter-row .filter-actions {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  margin-left: auto;
  flex-wrap: wrap;
}

/* 卡片底部 attribution 候选户的"详情页查看清单"次行 hint */
.session-card__attribution small.muted-small {
  margin-top: 2px;
  font-size: 11px;
  color: #9aa0a6;
  font-weight: 400;
}

/* 详情页：业务区"关联千川户"表格 —— "本场来源"高亮行 + 等宽 advertiser_id */
.candidate-table tr.is-current td {
  background: #e3f2fd;
}
.candidate-table tr.is-current td:first-child {
  border-left: 3px solid #1a73e8;
}
.candidate-table code {
  font-family: 'SF Mono', Consolas, Menlo, monospace;
  font-size: 12px;
  color: #1f2937;
  background: transparent;
  padding: 0;
  user-select: all;
}
.candidate-table th { white-space: nowrap; }

/* panel-title 旁边的小注：候选 N 个 · 来源 */
.panel-title small.muted-small {
  margin-left: 8px;
  font-size: 12px;
  color: #6b7280;
  font-weight: 400;
}

/* operations_anchors / 详情页：表单字段下方的辅助说明 small.muted-small */
.field > small.muted-small {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: #6b7280;
  line-height: 1.5;
}
.field > small.muted-small strong { color: #4E5969; }

/* 操作按钮行 */
.ops-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: #f8f9fa;
  border: 1px solid #e8eaed;
  border-radius: 6px;
  margin-top: 4px;
}

.ops-actions-row .batch-sync-inline-hint {
  color: #6b7280;
  font-size: 12px;
  line-height: 1.45;
  max-width: 100%;
}

/* 诊断矩阵：无独立刷新入口的提示 */
.diagnostic-hint {
  font-size: 11px;
  color: #9aa0a6;
  font-style: italic;
}

/* 顶部页面操作下拉菜单 */
.action-dropdown {
  position: relative;
  display: inline-block;
}
.action-dropdown > summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.action-dropdown > summary::-webkit-details-marker { display: none; }
.action-dropdown > summary::marker { content: ''; }
.action-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 160px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  padding: 6px 0;
  z-index: 100;
}
.action-dropdown-menu a {
  display: block;
  padding: 8px 16px;
  color: #333;
  text-decoration: none;
  font-size: 13px;
}
.action-dropdown-menu a:hover {
  background: #f5f5f5;
  color: #1a73e8;
}

/* 分页控件 */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  margin-top: 12px;
  border-top: 1px solid #f0f0f0;
}
.pagination .page-link {
  padding: 6px 12px;
  border: 1px solid #d0d7de;
  border-radius: 4px;
  color: #1a73e8;
  text-decoration: none;
  font-size: 13px;
  background: #fff;
}
.pagination .page-link:hover {
  background: #f5f5f5;
}
.pagination .page-link.disabled {
  color: #bbb;
  pointer-events: none;
  background: #f8f9fa;
}
.pagination .page-info {
  font-size: 13px;
  color: #5f6368;
  padding: 0 8px;
}

.pagination.mini-pagination {
  display: inline-flex;
  padding: 0;
  margin: 0;
  border-top: 0;
  gap: 4px;
}

.pagination.mini-pagination .page-link {
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pagination .page-link.current {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
  pointer-events: none;
}

.ops-pagination-block {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(180px, 1fr);
  align-items: center;
  gap: 14px;
  padding: 18px 0 4px;
  border-top: 1px solid var(--border-subtle, #edf2f7);
}

.ops-pagination-summary {
  justify-self: start;
}

.ops-pagination-controls {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.ops-pagination-size {
  justify-self: end;
}

.ops-pagination-size .inline-form {
  align-items: center;
}

.ops-pagination-size .pagination-size-field {
  min-width: 128px;
  margin: 0;
}

@media (max-width: 900px) {
  .ops-pagination-block {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .ops-pagination-summary,
  .ops-pagination-controls,
  .ops-pagination-size {
    justify-self: center;
  }
}

.sub-title {
  font-size: 14px;
  color: #333;
  margin: 16px 0 8px 0;
  padding-bottom: 6px;
  border-bottom: 1px solid #eee;
}

.text-link {
  color: #1e88e5;
  text-decoration: underline;
  font-weight: 500;
}
.text-link:hover { color: #1565c0; }

.empty-hint {
  padding: 24px;
  text-align: center;
  color: #888;
  background: #fafafa;
  border-radius: 6px;
}

.muted-small {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

/* ============================================================
   页面说明折叠（低调不抢眼，hover 才感知）
   ============================================================ */
.page-help-block {
  margin-bottom: 12px;
}
.page-help-block > summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
  font-size: 12px;
  color: #9ca3af;
  padding: 6px 12px;
  background: transparent;
  border: 1px dashed #e5e7eb;
  border-radius: 6px;
  transition: all 0.15s;
  display: inline-block;
}
.page-help-block > summary::-webkit-details-marker { display: none; }
.page-help-block > summary::marker { content: ''; }
.page-help-block > summary:hover {
  color: #1d4ed8;
  border-color: #93c5fd;
  background: #eff6ff;
}
.page-help-block[open] > summary {
  color: #1d4ed8;
  border-color: #93c5fd;
  background: #eff6ff;
  margin-bottom: 8px;
}
.page-help-content {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px 20px;
  font-size: 13px;
  line-height: 1.7;
  color: #334155;
}
.page-help-content p { margin: 0 0 8px 0; }
.page-help-content p strong { color: #0f172a; }
.page-help-list {
  margin: 4px 0 12px 0;
  padding-left: 22px;
}
.page-help-list li { margin-bottom: 4px; }
.page-help-list li strong { color: #0f172a; }
.page-help-list li em { color: #dc2626; font-style: normal; font-weight: 500; }
.page-help-content code {
  background: #e2e8f0;
  padding: 1px 6px;
  border-radius: 3px;
  font-family: monospace;
  font-size: 12px;
  color: #475569;
}
.page-help-footer {
  border-top: 1px solid #e2e8f0;
  padding-top: 8px;
  margin-top: 12px !important;
}

/* ============================================================
   消息中心
   ============================================================ */
.notification-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.notification-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
}

.notification-tab strong {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text);
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}

.notification-tab:hover,
.notification-tab.active {
  color: var(--brand);
  border-color: rgba(51, 112, 255, 0.3);
  background: var(--brand-soft);
}

.notification-list {
  display: grid;
  gap: 10px;
}

.notification-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
}

.notification-row.is-unread {
  border-color: rgba(51, 112, 255, 0.32);
  background: rgba(51, 112, 255, 0.05);
}

.notification-row.priority-critical {
  border-left: 3px solid var(--danger);
}

.notification-row.priority-high {
  border-left: 3px solid var(--warning);
}

.notification-row__mark {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}

.notification-row__body {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.notification-row__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.notification-row__head strong {
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
}

.notification-row__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  color: var(--text-faint);
  font-size: 12px;
}

.notification-row__body p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

.notification-row__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.notification-row__actions form {
  margin: 0;
}

.notification-unread-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 3px rgba(51, 112, 255, 0.16);
}

@media (max-width: 760px) {
  .notification-row {
    grid-template-columns: 30px minmax(0, 1fr);
  }
  .notification-row__actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

/* ============================================================
   千川授权用户：紧凑卡片网格
   ============================================================ */
.auth-kpi-panel { padding: 16px; }
.auth-kpi-strip { gap: 10px; }
.auth-kpi-strip .kpi-card { padding: 10px 14px; min-width: 100px; }
.auth-kpi-strip .kpi-card.success { background: #ecfdf5; border-color: #a7f3d0; }
.auth-kpi-strip .kpi-card.danger { background: #fef2f2; border-color: #fecaca; }
.auth-kpi-strip .kpi-card.success .kpi-value { color: #047857; }
.auth-kpi-strip .kpi-card.danger .kpi-value { color: #dc2626; }
.auth-help { margin-top: 12px; }
.auth-help summary {
  cursor: pointer;
  font-size: 13px;
  color: #1d4ed8;
  list-style: none;
  user-select: none;
}
.auth-help summary::-webkit-details-marker { display: none; }
.auth-help summary::before { content: '▶ '; color: #888; font-size: 11px; margin-right: 4px; }
.auth-help[open] summary::before { content: '▼ '; }
.auth-help p { margin: 8px 0 0 0; }

/* 状态色点：替代大块 status-pill */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9ca3af;
  vertical-align: middle;
}
.status-dot--success { background: #10b981; box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.18); }
.status-dot--info    { background: #3b82f6; }
.status-dot--warning { background: #f59e0b; box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.18); }
.status-dot--danger  { background: #ef4444; box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.18); }
.status-dot--muted   { background: #94a3b8; }

/* 卡片网格：响应式 — 宽度不足时自动退回单列，避免文字被挤成竖排 */
.auth-user-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: 16px;
  margin-top: 12px;
  min-width: 0;
}

/* 单卡片 */
.auth-user-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  overflow: hidden;
  transition: box-shadow 0.15s;
}
.auth-user-card:hover { box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06); }
.auth-user-card--success { border-left: 3px solid #10b981; }
.auth-user-card--danger { border-left: 3px solid #ef4444; }
.auth-user-card--warning { border-left: 3px solid #f59e0b; }
.auth-user-card--muted { border-left: 3px solid #cbd5e1; }

/* 卡片头 */
.auc-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid #f3f4f6;
  padding-bottom: 10px;
}
.auc-id { display: flex; align-items: center; gap: 8px; min-width: 0; }
.auc-id strong { font-size: 14px; color: #111827; }
.auc-status-text {
  flex: 1 1 160px;
  min-width: 0;
  font-size: 12px;
  line-height: 1.45;
  color: #6b7280;
  text-align: right;
  word-break: normal;
  overflow-wrap: break-word;
}

.auc-note {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
}
.auc-note--empty {
  border-color: #fed7aa;
  background: #fff7ed;
}
.auc-note__display {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  color: #1e3a8a;
  font-size: 13px;
  line-height: 1.45;
}
.auc-note--empty .auc-note__display { color: #9a3412; }
.auc-note__label {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 700;
}
.auc-note--empty .auc-note__label {
  background: #ffedd5;
  color: #c2410c;
}
.auc-note__display strong {
  font-size: 14px;
  color: inherit;
}
.auc-note__display span:not(.auc-note__label) {
  color: #9a3412;
  font-size: 12px;
}
.auc-note__form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}
.auc-note__form input[type="text"] {
  width: 100%;
  min-width: 0;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  padding: 7px 9px;
  font-size: 13px;
  background: #fff;
}
.auc-note__form .xs-button { white-space: nowrap; }

/* 卡片主体 3 行指标 */
.auc-body { display: flex; flex-direction: column; gap: 6px; }
.auc-health {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.45;
  background: #f8fafc;
  color: #475569;
  word-break: normal;
  overflow-wrap: break-word;
}
.auc-health strong { color: #1f2937; font-size: 12px; }
.auc-health--success { background: #ecfdf5; color: #047857; }
.auc-health--success strong { color: #047857; }
.auc-health--warning { background: #fffbeb; color: #92400e; }
.auc-health--warning strong { color: #92400e; }
.auc-health--danger { background: #fef2f2; color: #b91c1c; }
.auc-health--danger strong { color: #b91c1c; }
.auc-health--muted { background: #f1f5f9; color: #64748b; }
.auc-health--muted strong { color: #475569; }
.auc-row {
  display: grid;
  grid-template-columns: minmax(82px, max-content) minmax(0, 1fr);
  align-items: start;
  gap: 3px 10px;
  font-size: 13px;
  min-width: 0;
}
.auc-row-label { color: #6b7280; font-size: 12px; white-space: nowrap; }
.auc-row-value {
  min-width: 0;
  color: #111827;
  font-weight: 600;
  word-break: normal;
  overflow-wrap: break-word;
}
.auc-row-extra {
  grid-column: 2;
  min-width: 0;
  color: #9ca3af;
  font-size: 11px;
  line-height: 1.45;
  word-break: normal;
  overflow-wrap: break-word;
}
.auc-token--success { color: #047857; }
.auc-token--danger { color: #dc2626; }
.auc-token--warning { color: #b45309; }

.auc-error {
  background: #fef2f2;
  color: #b91c1c;
  font-size: 12px;
  line-height: 1.45;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #fecaca;
  word-break: normal;
  overflow-wrap: break-word;
}

/* 折叠：账号明细 */
.auc-detail {
  border-top: 1px solid #f3f4f6;
  padding-top: 8px;
  min-width: 0;
}
.auc-detail summary {
  cursor: pointer;
  font-size: 12px;
  color: #1d4ed8;
  list-style: none;
  user-select: none;
  padding: 4px 0;
  word-break: normal;
  overflow-wrap: break-word;
}
.auc-detail summary::-webkit-details-marker { display: none; }
.auc-detail summary::before { content: '▶ '; color: #9ca3af; font-size: 10px; margin-right: 3px; }
.auc-detail[open] summary::before { content: '▼ '; }
.auc-account-list {
  list-style: none;
  margin: 8px 0 0 0;
  padding: 0;
  max-height: 200px;
  overflow-y: auto;
  min-width: 0;
}
.auc-account-item {
  padding: 8px;
  background: #f9fafb;
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 12px;
  min-width: 0;
}
.auc-account-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  min-width: 0;
}
.auc-account-name strong { color: #111827; font-size: 13px; }
.auc-account-role {
  font-size: 10px;
  padding: 1px 6px;
  background: #eef2ff;
  color: #4338ca;
  border-radius: 3px;
}
.auc-account-meta { display: flex; align-items: center; gap: 4px; color: #6b7280; font-size: 11px; }
.auc-account-meta code { background: #f3f4f6; padding: 1px 4px; border-radius: 3px; font-family: monospace; }

/* 账号明细完整字段（codex P2 #4 修复） */
.auc-account-item--full { padding: 10px 12px; border-bottom: 1px solid #f3f4f6; }
.auc-account-item--full:last-child { border-bottom: none; }
.auc-account-status-text { font-size: 11px; color: #6b7280; }
.auc-account-covered {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4338ca;
  font-size: 10px;
  white-space: nowrap;
}
.auc-account-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 4px 12px;
  margin: 6px 0 0 0;
  padding: 0;
  min-width: 0;
}
.auc-account-field { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.auc-account-field dt { color: #6b7280; font-size: 11px; flex-shrink: 0; min-width: 70px; margin: 0; }
.auc-account-field dd {
  color: #1f2937;
  font-size: 12px;
  margin: 0;
  word-break: normal;
  overflow-wrap: break-word;
  min-width: 0;
}
.auc-account-field code { background: #f3f4f6; padding: 1px 4px; border-radius: 3px; font-family: monospace; font-size: 11px; }
.auc-account-field code,
.auc-account-name code,
.auc-aweme-detail code {
  overflow-wrap: anywhere;
}
.auc-detail-hint,
.auc-action-note {
  display: block;
  margin: 6px 0 0;
  color: #64748b;
  font-size: 12px;
  line-height: 1.45;
}
.auc-account-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* 卡片底 */
.auc-foot {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid #f3f4f6;
  min-width: 0;
}
.auc-foot .xs-button { padding: 4px 12px; font-size: 12px; }
.auc-foot .xs-button.primary { background: #3b82f6; color: #fff; }
.auc-foot .xs-button.primary:hover { background: #2563eb; }
.auc-foot__hint {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  line-height: 1.45;
  word-break: normal;
  overflow-wrap: break-word;
}
.auc-foot__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.auc-foot__actions .inline-form,
.auc-account-actions .inline-form {
  display: inline-flex;
  min-width: 0;
}
.auc-uid {
  font-family: monospace;
  font-size: 10px;
  color: #9ca3af;
  cursor: help;
  overflow-wrap: anywhere;
}

.page-header:has(.qianchuan-page-action) {
  align-items: flex-start;
  flex-wrap: wrap;
}
.page-header:has(.qianchuan-page-action) .page-heading {
  flex: 1 1 260px;
}
.page-header:has(.qianchuan-page-action) .page-copy h2 {
  white-space: nowrap;
  word-break: keep-all;
  overflow-wrap: normal;
}
.page-header:has(.qianchuan-page-action) .page-toolbar {
  flex: 1 1 520px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}

.qc-auth-overview,
.qc-subject-group {
  min-width: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
}
.qc-auth-overview__head,
.qc-subject-group__head,
.qc-account-card__head,
.qc-account-actions,
.qc-auth-action-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}
.qc-auth-overview__head,
.qc-subject-group__head,
.qc-account-card__head {
  flex-wrap: wrap;
}
.qc-auth-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
  gap: 10px;
  margin-top: 14px;
}
.qc-auth-stat {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}
.qc-auth-stat span,
.qc-account-facts span,
.qc-section-label,
.qc-decision-title {
  display: block;
  color: #64748b;
  font-size: 12px;
  line-height: 1.35;
}
.qc-auth-stat strong {
  display: block;
  margin-top: 4px;
  color: #111827;
  font-size: 22px;
  line-height: 1.1;
}
.qc-auth-stat.is-warning {
  border-color: #fcd34d;
  background: #fffbeb;
}
.qc-auth-meta-grid,
.qc-account-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr));
  gap: 10px 14px;
  min-width: 0;
}
.qc-auth-meta-grid {
  margin-top: 14px;
}
.qc-auth-meta-grid div,
.qc-account-facts div {
  min-width: 0;
}
.qc-auth-meta-grid dt,
.qc-auth-meta-grid dd {
  margin: 0;
}
.qc-auth-meta-grid dt {
  color: #64748b;
  font-size: 12px;
}
.qc-auth-meta-grid dd,
.qc-account-facts strong {
  display: block;
  margin-top: 3px;
  color: #111827;
  font-size: 13px;
  line-height: 1.45;
  word-break: normal;
  overflow-wrap: break-word;
}
.qc-auth-meta-grid code,
.qc-account-facts code,
.qc-aweme-item code,
.qc-tech-details code {
  overflow-wrap: anywhere;
}
.qc-auth-action-bar,
.qc-account-actions {
  flex-wrap: wrap;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #eff6ff;
}
.qc-account-actions {
  margin-top: 12px;
}
.qc-action-copy {
  min-width: min(100%, 240px);
  flex: 1 1 260px;
  color: #1e3a8a;
  font-size: 12px;
  line-height: 1.45;
  word-break: normal;
  overflow-wrap: break-word;
}
.qc-action-copy strong,
.qc-action-copy span {
  display: block;
}
.qc-action-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}
.qc-action-buttons .inline-form {
  display: inline-flex;
  min-width: 0;
}
.qc-action-buttons .xs-button[disabled] {
  cursor: not-allowed;
  border-color: #cbd5e1;
  background: #e2e8f0;
  color: #64748b;
}
.qc-action-note {
  flex: 1 1 100%;
  color: #64748b;
  font-size: 12px;
  line-height: 1.45;
}
.qc-subject-groups {
  display: grid;
  gap: 16px;
  margin-top: 16px;
  min-width: 0;
}
.qc-subject-group__head strong {
  color: #111827;
  font-size: 16px;
}
.qc-subject-group__stats,
.qc-subject-group__metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}
.qc-subject-group__stats span,
.qc-subject-group__metrics span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  line-height: 1.3;
  white-space: normal;
}
.qc-subject-group__metrics {
  margin-top: 10px;
}
.qc-account-stack {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  min-width: 0;
}
.qc-account-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}
.qc-account-title {
  min-width: min(100%, 240px);
}
.qc-account-title strong {
  display: block;
  color: #111827;
  font-size: 15px;
  line-height: 1.35;
  word-break: normal;
  overflow-wrap: break-word;
}
.qc-account-badges,
.qc-decision-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.qc-official-preview {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 12px;
  line-height: 1.45;
  word-break: normal;
  overflow-wrap: break-word;
}
.qc-official-preview strong {
  display: block;
  margin-bottom: 3px;
  color: #1d4ed8;
}
.qc-account-facts {
  margin-top: 12px;
}
.qc-account-facts small {
  display: block;
  margin-top: 2px;
  color: #64748b;
  font-size: 11px;
  overflow-wrap: anywhere;
}
.qc-decision-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px 12px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #e2e8f0;
}
.qc-decision-title {
  flex: 0 0 auto;
  padding-top: 3px;
  font-weight: 700;
}
.qc-aweme-section {
  margin-top: 12px;
  min-width: 0;
}
.qc-section-label {
  margin-bottom: 8px;
  font-weight: 700;
}
.qc-aweme-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 10px;
  min-width: 0;
}
.qc-aweme-item {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
}
.qc-aweme-main strong {
  display: block;
  color: #111827;
  font-size: 13px;
  line-height: 1.35;
  word-break: normal;
  overflow-wrap: break-word;
}
.qc-aweme-main span {
  display: block;
  margin-top: 2px;
}
.qc-aweme-facts {
  display: grid;
  gap: 3px;
  margin-top: 8px;
  color: #475569;
  font-size: 12px;
  line-height: 1.4;
}
.qc-aweme-binding {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #e2e8f0;
  color: #1f2937;
  font-size: 12px;
  line-height: 1.45;
  word-break: normal;
  overflow-wrap: break-word;
}
.qc-tech-details {
  margin-top: 10px;
  border-top: 1px solid #e2e8f0;
  padding-top: 8px;
}
.qc-tech-details summary {
  cursor: pointer;
  color: #64748b;
  font-size: 12px;
}
.qc-tech-details dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  gap: 8px 12px;
  margin: 8px 0 0;
}
.qc-tech-details dt,
.qc-tech-details dd {
  margin: 0;
  font-size: 12px;
}
.qc-tech-details dt {
  color: #64748b;
}
.qc-tech-details dd {
  color: #111827;
  overflow-wrap: break-word;
}

@media (max-width: 760px) {
  .auth-user-grid {
    grid-template-columns: 1fr;
  }
  .auc-status-text {
    flex-basis: 100%;
    text-align: left;
  }
  .auc-note__form {
    grid-template-columns: 1fr;
  }
  .auc-row {
    grid-template-columns: 1fr;
  }
  .auc-row-extra {
    grid-column: 1;
  }
  .auc-foot__actions .xs-button,
  .auc-foot__actions .inline-form,
  .auc-foot__actions .inline-form .xs-button,
  .auc-account-actions .xs-button,
  .auc-account-actions .inline-form,
  .auc-account-actions .inline-form .xs-button {
    width: 100%;
    justify-content: center;
  }
  .sync-workspace .workspace-step {
    grid-template-columns: 1fr;
  }
  .session-cards {
    grid-template-columns: 1fr;
  }
  .qc-auth-overview,
  .qc-subject-group {
    padding: 12px;
  }
  .page-header:has(.qianchuan-page-action) .page-copy h2 {
    white-space: normal;
  }
  .qc-auth-overview__head,
  .qc-subject-group__head,
  .qc-account-card__head,
  .qc-auth-action-bar,
  .qc-account-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .qc-action-buttons,
  .qc-action-buttons .inline-form,
  .qc-action-buttons .xs-button {
    width: 100%;
    justify-content: center;
  }
  .qc-subject-group__stats span,
  .qc-subject-group__metrics span {
    flex: 1 1 130px;
    justify-content: center;
  }
}

.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.filter-tab {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid #d9dde7;
  border-radius: 6px;
  background: #fff;
  color: #4e5969;
  text-decoration: none;
  font-size: 13px;
}
.filter-tab.active {
  color: #245bdb;
  border-color: #3370ff;
  background: #ebf0ff;
  font-weight: 700;
}
.approval-user-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 6px;
  max-height: 220px;
  overflow: auto;
}
.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
  font-size: 13px;
}
.approval-user-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px;
  border: 1px solid #e5e6eb;
  border-radius: 6px;
  background: #fff;
}
.approval-user-option small {
  display: block;
  margin-top: 2px;
  color: #86909c;
  font-size: 11px;
}
.approval-status--pending { background: #fff7e8; color: #b7791f; border-color: #fbd38d; }
.approval-status--executed { background: #e8fff3; color: #087443; border-color: #8ee5b7; }
.approval-status--rejected,
.approval-status--failed { background: #fff1f0; color: #c02727; border-color: #ffb3ad; }
.approval-status--expired { background: #f2f3f5; color: #4e5969; border-color: #d9dde7; }
.approval-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 12px 0;
}
.field-label {
  display: block;
  color: #86909c;
  font-size: 12px;
  margin-bottom: 2px;
}
.approval-action-grid {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(260px, 1fr);
  gap: 16px;
}
.approval-action-grid textarea {
  width: 100%;
}
.danger-text {
  color: #c02727;
}
.warning-text {
  color: #b45309;
  font-weight: 600;
}

.field-title-with-help {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.info-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: help;
}

.info-tip__bubble {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 80;
  display: none;
  width: min(320px, 72vw);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: #111827;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.65;
  text-align: left;
  box-shadow: var(--shadow-lg);
}

.info-tip__bubble::after {
  content: "";
  position: absolute;
  right: 8px;
  top: 100%;
  border: 6px solid transparent;
  border-top-color: #111827;
}

.info-tip:hover .info-tip__bubble,
.info-tip:focus .info-tip__bubble {
  display: block;
}

.temp-rate-field {
  position: relative;
}

.temp-rate-warning {
  display: block;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  background: #fef2f2;
  color: #dc2626;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}

/* Cost / profit coverage selectors */
.coverage-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 8px;
}
.coverage-toolbar strong {
  color: var(--text);
  font-size: 14px;
  margin-right: auto;
}
.coverage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 8px;
  background: var(--surface-muted);
}
.coverage-card {
  display: grid;
  grid-template-columns: auto 34px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 8px;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
}
.coverage-card[hidden] {
  display: none !important;
}
.coverage-card:hover {
  border-color: rgba(51, 112, 255, 0.35);
  background: rgba(51, 112, 255, 0.04);
}
.coverage-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  background: #eef2ff;
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.coverage-card__body {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.coverage-card__body strong,
.coverage-card__body small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.coverage-card__body small {
  color: var(--text-muted);
  font-size: 12px;
}
.coverage-card__body .warning-text {
  color: #b45309;
}
@media (max-width: 760px) {
  .approval-action-grid {
    grid-template-columns: 1fr;
  }
  .coverage-grid {
    grid-template-columns: 1fr;
  }
  .coverage-search {
    flex-basis: 100%;
    width: 100%;
  }
}

/* -------------------------------------------------------------------------
   inline-help — 行内字段说明（基于原生 <details>，CSS 失效也不裸奔）
   用法：
     <details class="inline-help">
       <summary aria-label="...">{SVG i 图标}</summary>
       <div class="inline-help__body">说明文字</div>
     </details>
   ------------------------------------------------------------------------- */
.inline-help {
  display: inline-block;
  position: relative;
  vertical-align: middle;
  margin-left: 4px;
}
.inline-help > summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--brand-soft, #e8efff);
  color: var(--brand, #2e6cef);
  cursor: help;
  list-style: none;
  user-select: none;
  outline: none;
}
.inline-help > summary::-webkit-details-marker { display: none; }
.inline-help > summary::marker { content: ""; }
.inline-help[open] > summary,
.inline-help:hover > summary,
.inline-help:focus-within > summary {
  background: var(--brand, #2e6cef);
  color: #fff;
}
.inline-help > summary:focus-visible {
  outline: 2px solid var(--brand-ring, #93c5fd);
  outline-offset: 2px;
}
.inline-help__body {
  position: absolute;
  z-index: 80;
  top: calc(100% + 6px);
  right: 0;
  width: min(320px, calc(100vw - 32px));
  padding: 10px 12px;
  border-radius: 6px;
  background: #111827;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.65;
  text-align: left;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}
.inline-help__body::before {
  content: "";
  position: absolute;
  right: 6px;
  bottom: 100%;
  border: 6px solid transparent;
  border-bottom-color: #111827;
}

/* -------------------------------------------------------------------------
   coverage-search — coverage-toolbar 内的搜索框 + 计数器
   ------------------------------------------------------------------------- */
.coverage-search {
  flex: 0 0 220px;
  width: 220px;
  min-width: 0;
  max-width: 100%;
  height: 30px;
  padding: 4px 10px;
  border: 1px solid var(--border, #d4d8e0);
  border-radius: var(--radius-sm, 4px);
  font-size: 13px;
  background: #fff;
  color: var(--text, #1f2937);
}
.coverage-search:focus {
  outline: none;
  border-color: var(--brand, #2e6cef);
  box-shadow: 0 0 0 2px var(--brand-soft, rgba(46, 108, 239, 0.15));
}
.coverage-counter {
  color: var(--text-muted, #6b7280);
  font-size: 12px;
  white-space: nowrap;
}

/* 开播记录编辑页：单条记录操作时间线 */
.ops-workflow-history {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}
.ops-workflow-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  align-items: flex-start;
}
.ops-workflow-dot {
  width: 10px;
  height: 10px;
  margin: 10px 0 0 4px;
  border-radius: 999px;
  background: var(--brand, #2e6cef);
  box-shadow: 0 0 0 4px rgba(46, 108, 239, 0.12);
}
.ops-workflow-card {
  border: 1px solid var(--border-soft, #e5e7eb);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
}
.ops-workflow-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  color: var(--text-muted, #6b7280);
  font-size: 12px;
}
.ops-workflow-head strong {
  color: var(--text, #111827);
  font-size: 14px;
}
.ops-workflow-body {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  color: var(--text, #111827);
  font-size: 13px;
  line-height: 1.6;
}
.ops-workflow-status {
  color: #1d4ed8;
}
.ops-workflow-note {
  padding: 6px 8px;
  border-radius: 6px;
  background: #f8fafc;
  color: #334155;
}
.ops-workflow-rate {
  padding: 6px 8px;
  border-radius: 6px;
  background: #fff7ed;
  color: #c2410c;
  font-weight: 600;
}
.ops-workflow-rate span {
  display: block;
  margin-top: 2px;
  font-weight: 500;
}
.ops-edited-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 6px;
  padding: 2px 7px;
  border: 1px solid #f59e0b;
  border-radius: 999px;
  background: #fffbeb;
  color: #b45309;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}
.ops-edited-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  margin-right: 5px;
  border-radius: 999px;
  background: #f59e0b;
}

/* -------------------------------------------------------------------------
   transfer-dialog — 更换主播弹窗（基于原生 <dialog>，CSS 失效也能用）
   ------------------------------------------------------------------------- */
.transfer-dialog {
  width: min(480px, 92vw);
  padding: 0;
  border: 0;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
  background: #fff;
}
.transfer-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}
.transfer-dialog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border, #e5e7eb);
  font-size: 15px;
}
.transfer-dialog__close {
  width: 28px;
  height: 28px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-muted, #6b7280);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.transfer-dialog__close:hover {
  color: var(--text, #1f2937);
  background: var(--surface-hover, #f2f3f5);
  border-radius: 4px;
}
.transfer-dialog__body {
  display: grid;
  gap: 12px;
  padding: 16px;
}
.transfer-dialog__summary {
  margin: 0;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--brand-soft, #e8efff);
  color: var(--text, #1f2937);
  font-size: 13px;
  line-height: 1.6;
}
.transfer-dialog__foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border, #e5e7eb);
}

/* -------------------------------------------------------------------------
   workspace — 主播-账号工作台（左右两栏 master-detail 布局）
   ------------------------------------------------------------------------- */
.workspace-layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  gap: 12px;
  margin-top: 12px;
}
.workspace-master {
  background: #fff;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 220px);
}
.workspace-master-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border, #e5e7eb);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.workspace-search {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px;
  font-size: 13px;
}
.workspace-search:focus {
  outline: none;
  border-color: var(--brand, #2e6cef);
  box-shadow: 0 0 0 2px var(--brand-soft, rgba(46, 108, 239, 0.15));
}
.workspace-master-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
}
.workspace-master-list li + li {
  border-top: 1px solid var(--border-soft, #f2f3f5);
}
.workspace-master-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  text-decoration: none;
  color: var(--text, #1f2937);
  border-left: 3px solid transparent;
  transition: background 0.12s;
}
.workspace-master-item:hover {
  background: var(--surface-hover, #f7f8fa);
}
.workspace-master-item.is-active {
  background: var(--brand-soft, #e8efff);
  border-left-color: var(--brand, #2e6cef);
}
.workspace-master-item__main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.workspace-master-item__main strong {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.workspace-master-item__main small {
  color: var(--text-muted, #6b7280);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.workspace-master-item__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-end;
  flex-shrink: 0;
}
.workspace-master-item__meta small {
  color: var(--text-faint, #86909c);
  font-size: 11px;
}
.workspace-detail {
  background: #fff;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  padding: 16px 20px;
  min-height: 360px;
}
.workspace-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-soft, #f2f3f5);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

/* binding-card — 绑定关系卡片 */
.binding-card {
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: #fff;
}
.binding-card.is-default {
  border-color: var(--brand, #2e6cef);
  box-shadow: 0 0 0 1px var(--brand-soft, rgba(46, 108, 239, 0.18));
}
.binding-card__head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.binding-card__time {
  font-size: 13px;
  color: var(--text-muted, #6b7280);
  margin-bottom: 4px;
}
.binding-card__notes {
  font-size: 12px;
  color: var(--text-muted, #6b7280);
  padding: 6px 10px;
  background: var(--surface-muted, #f7f8fa);
  border-radius: 4px;
  margin: 6px 0;
  white-space: pre-wrap;
}
.binding-card__actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

/* timeline-list — 时间线视图 */
.timeline-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.timeline-item {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft, #f2f3f5);
}
.timeline-item__time {
  color: var(--text-muted, #6b7280);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.timeline-item__head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.timeline-item__meta {
  font-size: 12px;
  color: var(--text-muted, #6b7280);
}
.timeline-item__notes {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted, #6b7280);
  padding: 4px 8px;
  background: var(--surface-muted, #f7f8fa);
  border-radius: 4px;
  white-space: pre-wrap;
}
.timeline-item--create .timeline-item__head { color: var(--text, #1f2937); }
.timeline-item--transferred { background: rgba(46, 108, 239, 0.03); }
.timeline-item--ended { background: rgba(0, 0, 0, 0.02); }

@media (max-width: 920px) {
  .workspace-layout {
    grid-template-columns: 1fr;
  }
  .workspace-master {
    max-height: 360px;
  }
  .timeline-item {
    grid-template-columns: 1fr;
  }
}

/* =========================================================================
   主播-账号管理工作台 v2 (ws-*) — 按设计图实现
   ========================================================================= */

/* Tab 条 */
.ws-tabs {
  display: flex;
  gap: 8px;
  padding: 0;
  margin-top: 8px;
  border-bottom: 1px solid var(--border, #e5e6eb);
}
.ws-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  text-decoration: none;
  color: var(--text-muted, #4e5969);
  font-size: 14px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.12s, border-color 0.12s;
}
.ws-tab:hover { color: var(--text, #1f2329); }
.ws-tab.is-active {
  color: var(--brand, #3370ff);
  border-bottom-color: var(--brand, #3370ff);
}
.ws-tab svg { color: currentColor; }

/* 主布局（master-detail）*/
.ws-layout {
  display: grid;
  grid-template-columns: minmax(280px, 320px) 1fr;
  gap: 14px;
  margin-top: 14px;
  align-items: start;
}
.ws-master,
.ws-detail,
.ws-card {
  background: #fff;
  border: 1px solid var(--border, #e5e6eb);
  border-radius: 10px;
}
.ws-master { display: flex; flex-direction: column; max-height: calc(100vh - 240px); overflow: hidden; }
.ws-detail { display: flex; flex-direction: column; gap: 14px; padding: 0; background: transparent; border: 0; }
.ws-card { padding: 16px 20px; }

/* 左侧列表 */
.ws-master__head {
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--border-soft, #f2f3f5);
}
.ws-master__title {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
}
.ws-master__title strong { font-size: 14px; }
.ws-master__filters {
  display: flex; gap: 6px;
}
.ws-search {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border, #e5e6eb);
  border-radius: 6px;
  font-size: 13px;
}
.ws-search:focus {
  outline: none;
  border-color: var(--brand, #3370ff);
  box-shadow: 0 0 0 2px rgba(51, 112, 255, 0.15);
}
.ws-platform-filter {
  width: 80px;
  padding: 6px 8px;
  border: 1px solid var(--border, #e5e6eb);
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
}
.ws-list {
  list-style: none; margin: 0; padding: 0;
  overflow-y: auto;
}
.ws-list li + li { border-top: 1px solid var(--border-soft, #f2f3f5); }
.ws-list-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 14px;
  text-decoration: none;
  color: var(--text, #1f2329);
  border-left: 3px solid transparent;
  transition: background 0.12s;
}
.ws-list-item:hover { background: var(--surface-hover, #f7f8fa); }
.ws-list-item.is-active {
  background: rgba(51, 112, 255, 0.08);
  border-left-color: var(--brand, #3370ff);
}
.ws-list-item__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ws-list-item__title {
  display: flex; align-items: flex-start; gap: 6px;
  flex-wrap: wrap;
  font-size: 14px;
  line-height: 1.35;
}
.ws-list-item__title strong {
  display: -webkit-box;
  flex: 1 1 120px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.ws-list-item__title .platform-chip {
  flex: 0 0 auto;
  margin-top: 1px;
}
.ws-list-item__sub {
  display: block;
  width: 100%;
  overflow-wrap: anywhere;
  word-break: break-all;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
}
.ws-list-item__meta {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
  min-width: 0;
}
.ws-list-item__flag {
  color: #b45309;
  line-height: 1.4;
}
.ws-list-item__history { color: var(--text-faint, #86909c); font-size: 11px; flex-shrink: 0; }

/* 缩略图（账号 / 主播）*/
.ws-thumb {
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px;
  font-weight: 600;
  color: #fff;
  user-select: none;
}
.ws-thumb--xs { width: 22px; height: 22px; font-size: 11px; border-radius: 5px; }
.ws-thumb--sm { width: 32px; height: 32px; font-size: 13px; }
.ws-thumb--lg { width: 56px; height: 56px; font-size: 22px; border-radius: 12px; }

/* 平台缩略图配色 */
.ws-thumb--douyin    { background: linear-gradient(135deg, #4a4a4a, #1a1a1a); }
.ws-thumb--kuaishou  { background: linear-gradient(135deg, #ff6e00, #ff9800); }
.ws-thumb--shipinhao { background: linear-gradient(135deg, #07c160, #00a854); }
.ws-thumb--wechat_video { background: linear-gradient(135deg, #07c160, #00a854); }
.ws-thumb--other     { background: linear-gradient(135deg, #6b7280, #4b5563); }

/* 主播缩略图配色（6 色循环）*/
.ws-thumb--anchor-0 { background: linear-gradient(135deg, #ef4444, #dc2626); }
.ws-thumb--anchor-1 { background: linear-gradient(135deg, #10b981, #059669); }
.ws-thumb--anchor-2 { background: linear-gradient(135deg, #f59e0b, #d97706); }
.ws-thumb--anchor-3 { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.ws-thumb--anchor-4 { background: linear-gradient(135deg, #f97316, #ea580c); }
.ws-thumb--anchor-5 { background: linear-gradient(135deg, #a855f7, #9333ea); }

/* 平台 chip */
.ws-platform-chip {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  border: 1px solid transparent;
}
.ws-platform-chip--douyin    { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.ws-platform-chip--kuaishou  { background: #fff7ed; color: #ea580c; border-color: #fed7aa; }
.ws-platform-chip--shipinhao { background: #f0fdf4; color: #059669; border-color: #bbf7d0; }
.ws-platform-chip--wechat_video { background: #f0fdf4; color: #059669; border-color: #bbf7d0; }
.ws-platform-chip--other     { background: #f3f4f6; color: #4b5563; border-color: #d1d5db; }

/* 通用 pill */
.ws-pill {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  background: #f3f4f6; color: #4b5563;
  border: 1px solid #e5e7eb;
}
.ws-pill--wrap {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: left;
}
.ws-pill--success { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.ws-pill--warning { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.ws-pill--info    { background: rgba(51, 112, 255, 0.1); color: #2c5fdf; border-color: rgba(51, 112, 255, 0.25); }

/* 卡片标题行 */
.ws-card-title-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
}
.ws-title-hint { margin-left: auto; }
.ws-title-info-tip {
  margin-left: auto;
}

/* 账号 / 主播 资料卡 */
.ws-account-profile__head {
  display: flex; gap: 16px; align-items: flex-start;
}
.ws-account-profile__title {
  flex: 1; min-width: 0;
}
.ws-account-profile__title > div:first-child {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
}
.anchor-profile-source-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 12px;
}
.anchor-profile-source-row span {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-muted, #f7f8fa);
  color: var(--text-muted, #4e5969);
  line-height: 1.5;
  white-space: normal;
  overflow-wrap: anywhere;
}
.ws-account-profile__actions {
  display: flex; gap: 6px; flex-shrink: 0;
}
.ws-meta-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px 24px;
  margin: 0;
}
.ws-meta-row > div {
  display: flex; flex-direction: column; gap: 2px;
  min-width: 0;
}
.ws-meta-row dt {
  color: var(--text-faint, #86909c);
  font-size: 11px;
  font-weight: 400;
}
.ws-meta-row dd {
  margin: 0;
  font-size: 13px;
  color: var(--text, #1f2329);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 当前归属：横排卡片 */
.ws-binding-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
}
.ws-binding-card {
  position: relative;
  border: 1px solid var(--border, #e5e6eb);
  border-radius: 8px;
  padding: 14px 16px 12px;
  background: #fff;
}
.ws-binding-card.is-default {
  border-left: 4px solid var(--brand, #3370ff);
  padding-left: 13px;
}
.ws-binding-card__head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
}
.ws-binding-card__name {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 2px;
}
.ws-binding-card__name strong { font-size: 14px; }
.ws-binding-card__time {
  font-size: 13px;
  color: var(--text-muted, #4e5969);
  margin-bottom: 6px;
}
.ws-binding-card__notes {
  font-size: 12px;
  color: var(--text-muted, #4e5969);
  padding: 6px 10px;
  background: var(--surface-muted, #f7f8fa);
  border-radius: 4px;
  margin: 6px 0 8px;
  white-space: pre-wrap;
}
.ws-binding-card__actions {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft, #f2f3f5);
  margin-top: 10px;
}

/* 历史折叠 */
.ws-history-summary {
  cursor: pointer; font-weight: 600; padding: 6px 0;
  display: flex; align-items: center; gap: 10px;
}
.ws-history-table {
  width: 100%; margin-top: 12px; font-size: 13px;
}
.ws-history-table th {
  text-align: left; font-weight: 500; color: var(--text-muted, #4e5969);
  padding: 8px 10px;
  background: var(--surface-muted, #f7f8fa);
  font-size: 12px;
}
.ws-history-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border-soft, #f2f3f5);
}

/* 按主播看：名下账号表格 */
.ws-anchor-table {
  width: 100%; font-size: 13px;
}
.ws-anchor-table thead th {
  text-align: left; font-weight: 500;
  color: var(--text-muted, #4e5969);
  padding: 10px 12px;
  background: var(--surface-muted, #f7f8fa);
  font-size: 12px;
  border-bottom: 1px solid var(--border, #e5e6eb);
}
.ws-anchor-table tbody td {
  padding: 12px;
  border-bottom: 1px solid var(--border-soft, #f2f3f5);
  vertical-align: middle;
}
.ws-anchor-table__account {
  display: flex; align-items: center; gap: 8px;
}

/* 底部 grid: 离职 + 最近变更 */
.ws-bottom-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 14px;
}
.ws-danger-card {
  border-color: #fecaca;
  background: #fef2f2;
}
.ws-recent-list {
  list-style: none; margin: 12px 0 0; padding: 0;
}
.ws-recent-list li {
  display: grid;
  grid-template-columns: 40px 12px 1fr;
  gap: 8px;
  padding: 8px 0;
  align-items: start;
}
.ws-recent-date {
  font-size: 12px; color: var(--text-muted, #4e5969);
  font-variant-numeric: tabular-nums;
}
.ws-recent-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--brand, #3370ff);
  margin-top: 4px;
}
.ws-recent-body { font-size: 13px; line-height: 1.6; }
.ws-recent-body strong { display: inline; }

/* 时间线 */
.ws-timeline {
  list-style: none; margin: 0; padding: 0;
}
.ws-timeline-item {
  display: grid;
  grid-template-columns: 160px 12px 1fr;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft, #f2f3f5);
  align-items: start;
}
.ws-timeline-time {
  color: var(--text-muted, #4e5969);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.ws-timeline-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--brand, #3370ff);
  margin-top: 6px;
}
.ws-timeline-item--create .ws-timeline-dot { background: #15803d; }
.ws-timeline-item--ended .ws-timeline-dot { background: #b45309; }
.ws-timeline-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Empty state */
.ws-empty {
  background: #fff;
  border: 1px dashed var(--border, #e5e6eb);
  border-radius: 10px;
  padding: 60px 20px;
  text-align: center;
}

/* 弹窗内的 mini chip + 信息卡 / 警告卡 */
.ws-mini-chip {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  margin: 0 2px;
}
.ws-mini-chip--account { background: rgba(51, 112, 255, 0.1); color: #2c5fdf; }
.ws-mini-chip--anchor { background: #fef2f2; color: #dc2626; }
.ws-info-card {
  display: flex; gap: 8px;
  padding: 10px 12px;
  background: rgba(51, 112, 255, 0.08);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text, #1f2329);
  line-height: 1.6;
}
.ws-info-card svg { flex-shrink: 0; color: var(--brand, #3370ff); margin-top: 2px; }
.ws-warning-card {
  padding: 10px 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 6px;
  color: #b45309;
  font-size: 13px;
}
.ws-warning-card ul {
  margin: 6px 0 0; padding-left: 20px; line-height: 1.7;
}
.ws-confirm-field {
  background: #fef9c3;
  padding: 10px;
  border-radius: 6px;
}

/* 参与场景 6 维度网格 */
.ws-visibility-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}
.ws-visibility-item {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border, #e5e6eb);
  border-radius: 6px;
  font-size: 13px;
  cursor: help;
}
.ws-visibility-item--on {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #15803d;
}
.ws-visibility-item--off {
  background: #f9fafb;
  border-color: #e5e7eb;
  color: #9ca3af;
  text-decoration: line-through;
}
.ws-visibility-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ws-visibility-item--on .ws-visibility-dot { background: #15803d; }
.ws-visibility-item--off .ws-visibility-dot { background: #d1d5db; }

/* 规则中心 */
.rules-center-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.rules-center-flow span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #f3f6ff;
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 600;
}

.rules-center-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.rules-center-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.rules-center-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: #eef4ff;
  color: #2563eb;
  font-size: 15px;
  font-weight: 700;
}

.rules-center-card--legacy .rules-center-card__icon {
  background: #f7f8fa;
  color: #4e5969;
}

.rules-center-card__body h3 {
  margin: 0 0 6px;
  color: var(--text);
  font-size: 16px;
}

.rules-center-card__body p {
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

.rules-center-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rules-center-inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  margin: 8px 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfcff;
}

/* 头像 img 形态 */
.ws-thumb--img {
  background: #f3f4f6;
  object-fit: cover;
  color: transparent;
  border: 1px solid var(--border-soft, #f2f3f5);
}

/* platform fallback 用 SVG（codex 的 platform_labels.py 标准 SVG）*/
.ws-thumb--platform svg {
  width: 60%;
  height: 60%;
  display: block;
}
.ws-thumb--platform.ws-thumb--xs svg { width: 65%; height: 65%; }
.ws-thumb--platform.ws-thumb--lg svg { width: 55%; height: 55%; }

/* 主播 / 账号详情页通用 4 列字段网格 */
.ws-form-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.anchor-field-label-with-help {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.anchor-field-label-with-help .info-tip {
  margin-left: 2px;
}
.anchor-rate-info-tip .info-tip__bubble,
.ws-title-info-tip .info-tip__bubble {
  width: min(340px, calc(100vw - 32px));
}
@media (max-width: 1100px) { .ws-form-grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px)  { .ws-form-grid-4 { grid-template-columns: 1fr; } }

.ws-readonly-strip {
  margin-top: 14px;
  padding: 8px 12px;
  background: var(--surface-muted, #f7f8fa);
  border-radius: 6px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.ws-anchor-avatar-hint {
  margin-top: 6px;
  text-align: center;
}

/* 主播端可见性 toggle 卡片 */
.ws-toggle-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (max-width: 700px) { .ws-toggle-grid { grid-template-columns: 1fr; } }
.ws-toggle-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid var(--border, #e5e6eb);
  border-radius: 8px;
  cursor: pointer;
  background: #fff;
  transition: border-color 0.12s, background 0.12s;
}
.ws-toggle-card:hover { border-color: var(--brand, #3370ff); }
.ws-toggle-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.ws-toggle-card__head strong { flex: 1; font-size: 14px; }
.ws-toggle-card small { color: var(--text-muted, #4e5969); font-size: 12px; line-height: 1.6; }

/* 自定义 toggle 开关 */
.ws-toggle-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.ws-toggle-state {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  border-radius: 10px;
  background: #d1d5db;
  transition: background 0.18s;
  flex-shrink: 0;
}
.ws-toggle-state::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  transition: left 0.18s, transform 0.18s;
}
.ws-toggle-input:checked ~ .ws-toggle-state {
  background: var(--brand, #3370ff);
}
.ws-toggle-input:checked ~ .ws-toggle-state::before {
  left: 18px;
}

/* 主播 / 账号详情顶部 ws-account-profile__head 第一列（头像区）固定宽度 */
.anchor-edit-form .ws-account-profile__head > div:first-child,
.account-edit-form .ws-account-profile__head > div:first-child {
  flex-shrink: 0;
  width: 96px;
  text-align: center;
}

/* 账号缩略图 + "官"角标（官方同步标记）*/
.ws-account-thumb-wrap {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
}
.ws-account-thumb-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--brand, #3370ff);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  line-height: 1;
}

/* 账号管理页 mono 字体 */
.account-edit-form .mono,
.ws-history-table .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
}

/* 弹窗里的 select 视觉锁定 (替代 disabled, 因 disabled 字段不会被表单提交) */
select[data-locked],
input[data-locked] {
  background: #f3f4f6;
  color: #6b7280;
  pointer-events: none;
  cursor: not-allowed;
  border-color: #e5e7eb;
}

/* =========================================================================
   主播端展示配置 + 主播奖金规则 (ah-* 命名空间) + 通用 segmented control
   ========================================================================= */

.ws-segmented {
  display: inline-flex;
  border: 1px solid var(--border, #e5e6eb);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.ws-segment {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  background: transparent;
  border: 0;
  border-right: 1px solid var(--border, #e5e6eb);
  color: var(--text-muted, #4e5969);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.ws-segment:last-child { border-right: 0; }
.ws-segment:hover { background: var(--surface-hover, #f2f3f5); color: var(--text, #1f2329); }
.ws-segment.is-active {
  background: var(--brand-soft, rgba(51, 112, 255, 0.1));
  color: var(--brand, #3370ff);
  font-weight: 500;
}

.ah-scope-banner {
  background: linear-gradient(135deg, #ebf0ff 0%, #f7f8fa 100%);
  border: 1px solid #d6e1ff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.ah-scope-banner__main { flex: 1; min-width: 240px; }
.ah-scope-banner__title { display: block; font-size: 18px; margin: 4px 0 6px; }
.ah-scope-banner__hint { font-size: 12px; line-height: 1.6; }
.ah-scope-segmented { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ah-scope-select {
  padding: 8px 12px;
  border: 1px solid var(--border, #e5e6eb);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  min-width: 180px;
}

.ah-field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}
.ah-field-card {
  display: flex; flex-direction: column; gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--border, #e5e6eb);
  border-radius: 8px;
  cursor: pointer;
  background: #fff;
  transition: border-color 0.12s, background 0.12s;
}
.ah-field-card:hover { border-color: var(--brand, #3370ff); }
.ah-field-card.is-off {
  background: var(--surface-muted, #f7f8fa);
  opacity: 0.7;
}
.ah-field-card.is-off strong {
  color: var(--text-muted, #4e5969);
}
.ah-field-card__head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.ah-field-card__head strong { flex: 1; font-size: 13px; }

.ah-source-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  line-height: 1.4;
  align-self: flex-start;
}
.ah-source-tag--default { background: #f3f4f6; color: #6b7280; }
.ah-source-tag--anchor { background: #fef3c7; color: #92400e; }
.ah-source-tag--live_account { background: #dbeafe; color: #1e40af; }

.ah-coverage-search-bar {
  display: flex; gap: 8px;
  margin-bottom: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.ah-coverage-search-bar input[type="search"] {
  flex: 1; min-width: 180px;
  padding: 8px 12px;
  border: 1px solid var(--border, #e5e6eb);
  border-radius: 6px;
  font-size: 13px;
}
.ah-coverage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--border-soft, #f2f3f5);
  border-radius: 8px;
  background: var(--surface-muted, #f7f8fa);
}
.ah-coverage-card {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.ah-coverage-card:hover { border-color: var(--brand, #3370ff); }
.ah-coverage-card input[type="checkbox"]:checked ~ span {
  color: var(--brand, #3370ff);
  font-weight: 500;
}
.ah-coverage-card span small {
  display: block;
  color: var(--text-muted, #4e5969);
  font-size: 11px;
  font-weight: normal;
}

.ah-warn-strip {
  padding: 10px 12px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 6px;
  color: #b45309;
  font-size: 12px;
  line-height: 1.6;
}

@media (max-width: 920px) {
  .ws-layout { grid-template-columns: 1fr; }
  .ws-master { max-height: 360px; }
  .ws-bottom-grid { grid-template-columns: 1fr; }
  .ws-timeline-item { grid-template-columns: 1fr; }
  .ws-account-profile__head { flex-direction: column; }
  .ws-account-profile__actions { width: 100%; flex-wrap: wrap; }
}

/* -------------------------------------------------------------------------
   售灯（lamp sales）— list / detail / inventory polish
   ------------------------------------------------------------------------- */
.lamp-task-table th.num,
.lamp-task-table td.num,
.lamp-inventory-table th.num,
.lamp-inventory-table td.num,
.lamp-movement-table th.num,
.lamp-movement-table td.num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.lamp-task-table .cell-strong,
.lamp-inventory-table .cell-strong {
  font-weight: 600;
  color: var(--text-strong, #1d2129);
  line-height: 1.4;
}

.lamp-task-table .cell-sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-muted, #4e5969);
  line-height: 1.4;
}

.lamp-task-table tbody tr:hover {
  background: var(--surface-muted, #f7f8fa);
}

.lamp-detail-summary .stats-grid {
  gap: 12px;
}

.lamp-stat-value {
  font-size: 22px !important;
  line-height: 1.3;
  word-break: break-all;
}

.lamp-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.lamp-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px 24px;
}

.lamp-detail-grid > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 12px;
  border-radius: var(--radius-xs, 4px);
  background: var(--surface-muted, #f7f8fa);
}

.lamp-detail-grid > div span.muted {
  font-size: 12px;
}

.lamp-detail-grid > div strong {
  font-weight: 500;
  color: var(--text-strong, #1d2129);
  word-break: break-all;
}

.lamp-photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.lamp-photo-card {
  border: 1px solid var(--border-soft, #e5e6eb);
  border-radius: var(--radius-sm, 6px);
  background: var(--surface, #ffffff);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.lamp-photo-card__media {
  aspect-ratio: 4 / 3;
  background: var(--surface-muted, #f7f8fa);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.lamp-photo-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lamp-photo-card__placeholder {
  color: var(--text-muted, #4e5969);
  font-size: 12px;
}

.lamp-photo-card__body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}

.lamp-photo-card__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.lamp-photo-card__desc {
  margin: 0;
  color: var(--text-strong, #1d2129);
  line-height: 1.5;
  word-break: break-word;
}

.lamp-photo-card__url {
  margin: 0;
}

.lamp-inventory-table tbody tr.row-warning {
  background: var(--warning-soft, #fff7e6);
}

.lamp-inventory-form {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.lamp-inventory-form select,
.lamp-inventory-form input[type="number"],
.lamp-inventory-form input[type="text"],
.lamp-inventory-form input:not([type]) {
  height: 30px;
  padding: 0 8px;
  font-size: 12px;
}

.lamp-inventory-form input[type="number"] {
  width: 110px;
}

.lamp-inventory-form input[name="remark"] {
  width: 140px;
}

.lamp-inventory-form button {
  height: 30px;
  padding: 0 12px;
  font-size: 12px;
}

.lamp-inventory-adjust-form {
  max-width: 420px;
}

.lamp-inventory-help,
.lamp-delete-reasons {
  flex-basis: 100%;
  color: var(--text-muted, #4e5969);
  font-size: 12px;
  line-height: 1.5;
}

.lamp-delete-reasons {
  margin-top: 4px;
}

.lamp-delete-reasons strong {
  color: var(--text-strong, #1d2129);
}

.lamp-delete-reasons span {
  display: inline-flex;
  align-items: center;
  margin: 2px 4px 2px 0;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--surface-muted, #f2f3f5);
  color: var(--text-muted, #4e5969);
}

.lamp-movement-table td.delta-up {
  color: var(--success, #00b42a);
  font-weight: 600;
}

.lamp-movement-table td.delta-down {
  color: var(--danger, #f53f3f);
  font-weight: 600;
}

@media (max-width: 720px) {
  .lamp-detail-grid {
    grid-template-columns: 1fr;
  }
  .lamp-photo-gallery {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
  .lamp-inventory-form {
    flex-direction: column;
    align-items: stretch;
  }
  .lamp-inventory-form input[type="number"],
  .lamp-inventory-form input[name="remark"] {
    width: 100%;
  }
}

/* =========================================================================
   demo-readiness UI polish — 追加段（按 PR base 文件末尾的 LF 风格）
   --------------------------------------------------------------------------
   说明：
   - 本段只追加新样式或用相同选择器在末尾覆盖少量已有规则（CSS 后定义优先）。
   - 不修改 PR base 中既有的规则文本，保证 diff 只在文件末尾。
   - 命名空间：domain-* / lamp-* / qianchuan-* / login-* / demo-account-*
   ========================================================================= */

/* ---- 登录页：演示账号面板视觉增强 -------------------------------------- */
.demo-account-panel {
  border-color: rgba(51, 112, 255, 0.18);
  background: linear-gradient(180deg, rgba(51, 112, 255, 0.05), rgba(51, 112, 255, 0.02));
  padding: 14px 14px 12px;
}

.demo-account-head {
  margin-bottom: 6px;
}

.demo-account-head-copy {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.demo-account-tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--brand);
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.demo-account-pass {
  font-size: 12px;
  color: var(--text-muted);
}

.demo-account-tip {
  margin: 0 0 10px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.55;
}

.demo-account-button {
  min-height: 64px;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
}

.demo-account-button .demo-account-role {
  font-size: 11px;
  font-weight: 600;
  color: var(--brand);
  letter-spacing: 0.02em;
}

.demo-account-button strong {
  color: var(--text);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.demo-account-note {
  font-style: normal;
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-faint);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.demo-account-button:hover {
  transform: translateY(-1px);
}

.demo-account-button:focus-visible {
  outline: 2px solid var(--brand-ring);
  outline-offset: 1px;
}

/* ---- 登录页：左侧 feature tag ----------------------------------------- */
.login-feature-item {
  gap: 4px;
}

.login-feature-item .login-feature-tag {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  width: fit-content;
}

/* ---- 登录页：分隔线 + 主播登录入口双行 -------------------------------- */
.login-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 0;
  color: var(--text-faint);
  font-size: 11px;
}

.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-soft);
}

.login-divider span {
  padding: 0 4px;
  letter-spacing: 0.06em;
}

.login-anchor-entry {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-height: 44px;
  padding: 6px 10px;
}

.login-anchor-entry__main {
  font-size: 14px;
  font-weight: 600;
  color: #245bdb;
}

.login-anchor-entry__hint {
  font-size: 11px;
  color: var(--text-muted);
}

/* ---- 登录页：440px 窄屏单列演示账号 ----------------------------------- */
@media (max-width: 440px) {
  .demo-account-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .demo-account-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}

/* ---- dashboard 业务域徽章 --------------------------------------------- */
.domain-panel {
  position: relative;
}

.domain-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  background: var(--brand);
}

.domain-panel.domain-live::before    { background: var(--brand); }
.domain-panel.domain-lamp::before    { background: #16a34a; }
.domain-panel.domain-salary::before  { background: #f59e0b; }
.domain-panel.domain-system::before  { background: #6b7280; }

.domain-panel > .table-toolbar {
  padding-left: 6px;
}

.domain-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  margin-right: 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--brand-soft);
  color: var(--brand-strong);
  border: 1px solid rgba(51, 112, 255, 0.18);
}

.domain-badge--live   { background: rgba(51, 112, 255, 0.10); color: #245bdb; border-color: rgba(51, 112, 255, 0.22); }
.domain-badge--lamp   { background: rgba(22, 163, 74, 0.10); color: #15803d;  border-color: rgba(22, 163, 74, 0.22); }
.domain-badge--salary { background: rgba(245, 158, 11, 0.12); color: #b45309; border-color: rgba(245, 158, 11, 0.28); }
.domain-badge--system { background: rgba(107, 114, 128, 0.10); color: #374151; border-color: rgba(107, 114, 128, 0.22); }

.panel-title:has(.domain-badge) {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.domain-jump {
  position: relative;
  padding-left: 22px;
}

.domain-jump::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--brand);
}

.domain-jump--live::before   { background: var(--brand); }
.domain-jump--lamp::before   { background: #16a34a; }
.domain-jump--salary::before { background: #f59e0b; }
.domain-jump--system::before { background: #6b7280; }

/* ---- 售灯订单列表：状态流转条 + 筛选条 + 状态 chip + 分组标签 ----------- */
.lamp-workflow-steps {
  list-style: none;
  margin: 4px 0 12px;
  padding: 10px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  background: var(--surface-muted);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-muted);
}

.lamp-workflow-steps li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.lamp-workflow-steps li:not(.lamp-workflow-branch):not(:last-child)::after {
  content: "→";
  margin-left: 10px;
  color: var(--text-faint);
  font-size: 11px;
}

.lamp-workflow-steps li:not(.lamp-workflow-branch):nth-child(4)::after {
  content: "";
}

.lamp-workflow-branch {
  margin-left: 6px;
  padding-left: 10px;
  border-left: 1px dashed var(--border-strong);
  color: var(--text-muted);
}

.lamp-workflow-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--text-faint);
}

.lamp-workflow-dot--pending    { background: #94a3b8; }
.lamp-workflow-dot--accepted   { background: var(--brand); }
.lamp-workflow-dot--processing { background: #245bdb; }
.lamp-workflow-dot--active     { background: #0f766e; }
.lamp-workflow-dot--completed  { background: #16a34a; }
.lamp-workflow-dot--due        { background: var(--warning); }
.lamp-workflow-dot--expiry     { background: #f59e0b; }
.lamp-workflow-dot--exception  { background: var(--danger); }

.lamp-filter-bar {
  gap: 6px;
}

.lamp-source-filter {
  display: flex;
  align-items: center;
  min-width: 190px;
  margin-left: auto;
}

.lamp-source-filter label {
  display: grid;
  gap: 4px;
  width: 100%;
  color: var(--text-muted);
  font-size: 12px;
}

.lamp-source-filter select {
  min-height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--text);
}

.lamp-filter-chip {
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--text-muted);
  transition: all var(--transition);
}

.lamp-filter-chip:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
  color: var(--text);
}

.lamp-filter-chip.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
}

.lamp-filter-chip--pending.is-active    { background: #475569;       border-color: #475569; }
.lamp-filter-chip--accepted.is-active   { background: var(--brand);  border-color: var(--brand); }
.lamp-filter-chip--processing.is-active { background: #245bdb;       border-color: #245bdb; }
.lamp-filter-chip--active.is-active     { background: #0f766e;       border-color: #0f766e; }
.lamp-filter-chip--due.is-active        { background: var(--warning);border-color: var(--warning); }
.lamp-filter-chip--expiry.is-active     { background: #f59e0b;       border-color: #f59e0b; }
.lamp-filter-chip--exception.is-active  { background: var(--danger); border-color: var(--danger); }
.lamp-filter-chip--completed.is-active  { background: #16a34a;       border-color: #16a34a; }

.lamp-channel-list {
  display: grid;
  gap: 10px;
}

.lamp-channel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
}

.lamp-channel-row.is-archived {
  opacity: 0.72;
  background: var(--surface-muted);
}

.lamp-workbench-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.lamp-workbench-card {
  display: grid;
  gap: 4px;
  min-height: 112px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-left: 4px solid #16a34a;
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  color: var(--text);
  text-decoration: none;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}

.lamp-workbench-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
  transform: translateY(-1px);
}

.lamp-workbench-card span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

.lamp-workbench-card strong {
  font-size: 28px;
  line-height: 1.15;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.lamp-workbench-card em {
  align-self: end;
  font-style: normal;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.lamp-workbench-card--pending { border-left-color: #475569; }
.lamp-workbench-card--accepted { border-left-color: var(--brand); }
.lamp-workbench-card--processing { border-left-color: #245bdb; }
.lamp-workbench-card--active { border-left-color: #0f766e; }
.lamp-workbench-card--due { border-left-color: var(--warning); }
.lamp-workbench-card--expiry { border-left-color: #f59e0b; }
.lamp-workbench-card--exception { border-left-color: var(--danger); }
.lamp-workbench-card--photo { border-left-color: #7c3aed; }
.lamp-workbench-card--completed { border-left-color: #16a34a; }
.lamp-workbench-card--remark { border-left-color: #db2777; }
.lamp-workbench-card--modified { border-left-color: #6b7280; }
.lamp-workbench-card--stock { border-left-color: #f97316; }

.lamp-status-chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: var(--surface-muted);
  color: var(--text-muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.lamp-status-chip--pending    { background: #f1f5f9;                       color: #475569;  border-color: #cbd5e1; }
.lamp-status-chip--accepted   { background: rgba(51, 112, 255, 0.10);      color: #245bdb;  border-color: rgba(51, 112, 255, 0.28); }
.lamp-status-chip--processing { background: rgba(36, 91, 219, 0.12);       color: #1f3fa5;  border-color: rgba(36, 91, 219, 0.30); }
.lamp-status-chip--active     { background: rgba(15, 118, 110, 0.12);      color: #0f766e;  border-color: rgba(15, 118, 110, 0.28); }
.lamp-status-chip--completed  { background: rgba(22, 163, 74, 0.12);       color: #15803d;  border-color: rgba(22, 163, 74, 0.28); }
.lamp-status-chip--exception  { background: rgba(245, 63, 63, 0.10);       color: #b91c1c;  border-color: rgba(245, 63, 63, 0.28); }

.lamp-status-chip--lg {
  height: 24px;
  padding: 0 12px;
  font-size: 13px;
}

.lamp-task-row--exception > td { background: rgba(245, 63, 63, 0.04); }
.lamp-task-row--completed > td { color: var(--text-muted); }

.lamp-group-tag {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 2px 10px;
  border-radius: var(--radius-xs);
  background: rgba(51, 112, 255, 0.08);
  color: #245bdb;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  word-break: break-all;
}

.lamp-progress {
  display: inline-block;
  font-variant-numeric: tabular-nums;
}

.lamp-progress strong {
  color: var(--text);
  font-weight: 600;
}

.lamp-remark-inline {
  display: grid;
  gap: 2px;
  margin-top: 6px;
}

.lamp-remark-inline small {
  color: var(--text-muted);
  line-height: 1.45;
  word-break: break-word;
}

.lamp-remark-badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(219, 39, 119, 0.10);
  color: #be185d;
  border: 1px solid rgba(219, 39, 119, 0.24);
  font-size: 11px;
  font-weight: 600;
}

.lamp-remark-panel {
  border-left: 4px solid #db2777;
  background: linear-gradient(180deg, rgba(219, 39, 119, 0.04), var(--surface-solid));
}

.lamp-remark-panel p {
  margin: 8px 0 0;
  line-height: 1.65;
  color: var(--text);
  word-break: break-word;
}

/* ---- 售灯列表表格：表头 / 行 hover 增强 ------------------------------- */
.lamp-task-table thead th {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.lamp-task-table tbody tr:hover {
  background: rgba(51, 112, 255, 0.04);
}

.lamp-task-table tbody tr.lamp-task-row--exception:hover { background: rgba(245, 63, 63, 0.06); }
.lamp-task-table tbody tr.lamp-task-row--completed:hover { background: rgba(22, 163, 74, 0.04); }

.lamp-task-table td { vertical-align: middle; }

/* ---- 售灯详情：状态 hero ---------------------------------------------- */
.lamp-detail-hero {
  border-top: 4px solid #16a34a;
  padding: 22px 24px 20px;
  background: linear-gradient(180deg, rgba(22, 163, 74, 0.05), rgba(255, 255, 255, 0)) , var(--surface-solid);
}

.lamp-detail-hero--exception  { border-top-color: var(--danger); background: linear-gradient(180deg, rgba(245, 63, 63, 0.05), rgba(255, 255, 255, 0)) , var(--surface-solid); }
.lamp-detail-hero--completed  { border-top-color: #16a34a; }
.lamp-detail-hero--processing { border-top-color: #245bdb; background: linear-gradient(180deg, rgba(36, 91, 219, 0.05), rgba(255, 255, 255, 0)) , var(--surface-solid); }
.lamp-detail-hero--accepted   { border-top-color: var(--brand); background: linear-gradient(180deg, rgba(51, 112, 255, 0.05), rgba(255, 255, 255, 0)) , var(--surface-solid); }
.lamp-detail-hero--pending    { border-top-color: #94a3b8; background: linear-gradient(180deg, rgba(148, 163, 184, 0.06), rgba(255, 255, 255, 0)) , var(--surface-solid); }

.lamp-detail-hero__head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 16px;
}

.lamp-detail-hero__title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.lamp-detail-hero__title h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}

.lamp-detail-hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  font-size: 12px;
  color: var(--text-muted);
}

.lamp-detail-hero__meta strong {
  color: var(--text);
  font-weight: 600;
}

.lamp-detail-hero__metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px 24px;
}

.lamp-hero-metric {
  display: grid;
  gap: 4px;
}

.lamp-hero-metric__label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}

.lamp-hero-metric__value {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.lamp-hero-metric__value em {
  font-style: normal;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 2px;
}

.lamp-hero-metric__value--text {
  font-size: 17px;
  line-height: 1.35;
  word-break: break-all;
}

.lamp-hero-metric__note {
  font-size: 12px;
  color: var(--text-faint);
  line-height: 1.5;
}

.lamp-progress-bar {
  position: relative;
  height: 6px;
  margin-top: 4px;
  border-radius: 999px;
  background: var(--surface-muted);
  overflow: hidden;
}

.lamp-progress-bar__fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #16a34a, #22c55e);
  transition: width 0.3s ease;
}

/* ---- 售灯详情：流程操作分主次 ----------------------------------------- */
.lamp-action-intro {
  background: linear-gradient(180deg, rgba(51, 112, 255, 0.05), var(--surface-solid));
  border-color: rgba(51, 112, 255, 0.18);
}

.lamp-action-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  margin-right: 8px;
  border-radius: 999px;
  background: var(--brand);
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.lamp-action-card {
  border-color: var(--border);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.lamp-action-card--primary {
  border-left: 3px solid var(--brand);
  background: linear-gradient(180deg, rgba(51, 112, 255, 0.04), var(--surface-solid));
}

.lamp-action-card--exception {
  border-left: 3px solid var(--danger);
  background: linear-gradient(180deg, rgba(245, 63, 63, 0.03), var(--surface-solid));
}

.lamp-action-card:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--border-strong);
}

.lamp-recommendation-callout {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  padding: 10px 12px;
  border: 1px solid rgba(37, 99, 235, 0.24);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.10), rgba(22, 163, 74, 0.08));
  color: var(--text);
}

.lamp-recommendation-callout strong {
  color: #1d4ed8;
  font-weight: 800;
}

.lamp-recommendation-callout span:not(.lamp-recommendation-badge) {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.lamp-recommendation-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 2px 10px;
  border-radius: 999px;
  background: #2563eb;
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.03em;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.20);
  white-space: nowrap;
}

.lamp-recommendation-inline {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(37, 99, 235, 0.08);
  color: var(--text);
}

.lamp-recommendation-inline strong {
  color: #1d4ed8;
  font-weight: 800;
}

.lamp-recommendation-inline--mobile {
  display: flex;
  width: fit-content;
  max-width: 100%;
}

.lamp-action-step {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 8px;
  margin-right: 6px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.lamp-action-step--exception { background: rgba(245, 63, 63, 0.10); color: var(--danger); }
.lamp-action-step--renew     { background: rgba(245, 158, 11, 0.14); color: #b45309; }

.lamp-primary-action {
  background: var(--brand);
  color: #ffffff;
  border: 1px solid var(--brand);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.lamp-primary-action:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
}

/* ---- 售灯详情：已完成 / 异常只读 banner -------------------------------- */
.lamp-readonly-banner {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 18px 22px;
  border-left: 3px solid var(--text-faint);
  background: var(--surface-muted);
}

.lamp-readonly-banner--success   { border-left-color: #16a34a;       background: rgba(22, 163, 74, 0.05); }
.lamp-readonly-banner--exception { border-left-color: var(--danger); background: rgba(245, 63, 63, 0.04); }

.lamp-readonly-banner__icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.lamp-readonly-banner--success   .lamp-readonly-banner__icon { color: #16a34a;       border-color: rgba(22, 163, 74, 0.4); }
.lamp-readonly-banner--exception .lamp-readonly-banner__icon { color: var(--danger); border-color: rgba(245, 63, 63, 0.4); }

.lamp-readonly-banner__body {
  flex: 1;
  min-width: 0;
}

.lamp-readonly-banner__body strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.lamp-readonly-banner__body p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
}

.lamp-readonly-banner__note {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  background: var(--surface-solid);
  border: 1px solid var(--border-soft);
  color: var(--text);
  font-size: 12px;
  line-height: 1.55;
  word-break: break-word;
}

/* ---- 库存页：概览统计条 / 分组徽章 / 行突出 ---------------------------- */
.lamp-inventory-summary {
  padding-top: 16px;
}

.lamp-inventory-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 14px;
  padding: 8px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.lamp-inventory-tab {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 30px;
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  border: 1px solid transparent;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}

.lamp-inventory-tab strong {
  font-size: 13px;
  line-height: 1.2;
  color: inherit;
}

.lamp-inventory-tab small {
  font-size: 11px;
  line-height: 1.25;
  color: var(--text-subtle);
}

.lamp-inventory-tab:hover {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface-solid);
}

.lamp-inventory-tab.is-active {
  color: #15803d;
  border-color: rgba(22, 163, 74, 0.28);
  background: #ffffff;
}

.lamp-inventory-current-view {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid rgba(59, 130, 246, 0.18);
  border-radius: var(--radius-xs);
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 13px;
}

.lamp-inventory-current-view strong {
  white-space: nowrap;
  color: #1d4ed8;
}

.lamp-inventory-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 4px;
}

.lamp-inventory-stat {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  display: grid;
  gap: 2px;
}

.lamp-inventory-stat span { color: var(--text-muted); font-size: 12px; }

.lamp-inventory-stat strong {
  font-size: 22px;
  line-height: 1.2;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.lamp-inventory-stat em {
  font-style: normal;
  font-size: 11px;
  color: var(--text-faint);
}

.lamp-inventory-stat--warn {
  border-color: rgba(255, 125, 0, 0.28);
  background: rgba(255, 125, 0, 0.05);
}

.lamp-inventory-stat--warn strong { color: var(--warning); }

.lamp-section-badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 10px;
  margin-right: 8px;
  border-radius: 999px;
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  border: 1px solid rgba(22, 163, 74, 0.22);
}

.lamp-section-badge--movement {
  background: rgba(51, 112, 255, 0.10);
  color: #245bdb;
  border-color: rgba(51, 112, 255, 0.22);
}

.lamp-spec-days {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.lamp-stock-num {
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.lamp-stock-num--low { color: var(--warning); }

.lamp-inventory-row--low > td { background: rgba(255, 125, 0, 0.06); }

.lamp-inventory-section--movements {
  border-top: 3px solid rgba(51, 112, 255, 0.18);
}

.lamp-inventory-form-panel {
  border-color: var(--border);
  background: linear-gradient(180deg, rgba(22, 163, 74, 0.03), var(--surface-solid));
}

.lamp-inventory-guide {
  border-left: 4px solid rgba(22, 163, 74, 0.45);
}

.lamp-inventory-guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.lamp-inventory-guide-grid > div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.lamp-inventory-guide-grid strong {
  color: var(--text);
  font-size: 13px;
}

.lamp-inventory-guide-grid span {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.55;
}

.lamp-inventory-table thead th {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border);
}

/* ---- 千川配置页：演示保护 banner / 状态色 ----------------------------- */
.qianchuan-demo-banner {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(255, 125, 0, 0.06), rgba(255, 125, 0, 0.02));
  border: 1px solid rgba(255, 125, 0, 0.30);
  border-left: 4px solid var(--warning);
}

.qianchuan-demo-banner__icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  color: var(--warning);
  border: 1px solid rgba(255, 125, 0, 0.4);
}

.qianchuan-demo-banner__body {
  flex: 1;
  min-width: 0;
}

.qianchuan-demo-banner__head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.qianchuan-demo-banner__head strong {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.qianchuan-demo-pill {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--warning);
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.qianchuan-demo-banner__body p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

.qianchuan-hero {
  background: linear-gradient(180deg, rgba(51, 112, 255, 0.04), var(--surface-solid));
  border-color: rgba(51, 112, 255, 0.18);
}

.qianchuan-status-strip { gap: 10px; }

.qianchuan-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 16px !important;
  font-weight: 600;
  line-height: 1.3;
}

.qianchuan-status::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
}

.qianchuan-status--ok     { color: #059669; }
.qianchuan-status--demo   { color: var(--warning); }
.qianchuan-status--warn   { color: var(--warning); }
.qianchuan-status--danger { color: var(--danger); }

/* ---- 移动端 720px 适配（新组件） -------------------------------------- */
@media (max-width: 720px) {
  /* 详情 hero */
  .lamp-detail-hero { padding: 18px 16px 16px; }
  .lamp-detail-hero__title h3 { font-size: 18px; }
  .lamp-detail-hero__metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .lamp-hero-metric__value { font-size: 18px; }
  .lamp-hero-metric__value--text { font-size: 15px; }

  /* 状态流转条 / 筛选条 */
  .lamp-workflow-steps { font-size: 11px; gap: 4px 10px; padding: 8px 10px; }
  .lamp-workflow-branch { margin-left: 0; padding-left: 0; border-left: 0; }
  .lamp-workbench-grid { grid-template-columns: 1fr; }
  .lamp-workbench-card { min-height: auto; }
  .lamp-filter-bar { gap: 4px; }
  .lamp-source-filter { width: 100%; margin-left: 0; }
  .lamp-channel-row { align-items: flex-start; flex-direction: column; }
  .lamp-filter-chip { font-size: 12px; padding: 0 8px; }
  .lamp-inventory-tabs { gap: 6px; padding: 6px; }
  .lamp-inventory-tab { flex: 1 1 calc(50% - 6px); justify-content: center; font-size: 12px; padding: 8px; }
  .lamp-inventory-tab small { display: none; }
  .lamp-inventory-current-view { align-items: flex-start; flex-direction: column; gap: 4px; }

  /* 表格允许横向滚动 */
  .lamp-task-table,
  .lamp-inventory-table,
  .lamp-movement-table { min-width: 720px; }

  /* 库存统计条 */
  .lamp-inventory-stats { grid-template-columns: 1fr; }

  /* dashboard 业务域跳转按钮 */
  .domain-jump { padding-left: 18px; font-size: 12px; }
  .domain-jump::before { left: 8px; width: 5px; height: 5px; }

  /* 流程操作单列 */
  .lamp-action-grid { grid-template-columns: 1fr; }

  /* 千川 banner */
  .qianchuan-demo-banner { padding: 14px 16px; }
  .qianchuan-demo-banner__icon { width: 32px; height: 32px; }

  /* 业务域 panel 留 padding */
  .domain-panel { padding: 18px 16px 18px 18px; }
}

/* =========================================================================
   demo-readiness UI polish — 720px 移动端横向溢出修复（追加补丁）
   --------------------------------------------------------------------------
   修三个问题：
   1. /operations/lamp-tasks       scrollWidth 757 > 720（.lamp-task-table）
   2. /operations/inventory        scrollWidth 757 > 720（.lamp-inventory-table / .lamp-movement-table）
   3. /qianchuan/settings          scrollWidth 809 > 720（.help-tip__content 右溢出）

   策略：CSS 后定义优先，纯追加，不动 PR base 字节、不动模板。
   - 表格：表格 min-width 收窄到 580px，配合 .table-wrap 内 overflow-x: auto 滚动
   - 帮助气泡：720px 改为 position:fixed 底部 toast 风格，左右各留 16px
   - 兜底：.main-inner 在 720px 加 overflow-x: hidden（不动 body）防止任何
     新组件溢出撑出页面，但保留 .table-wrap / .help-tip 自己的滚动 / fixed
   ========================================================================= */

@media (max-width: 720px) {
  /* ---- 兜底：让 main-inner 不被子元素撑出视口 ------------------------- */
  .main-inner {
    max-width: 100vw;
    overflow-x: hidden;
  }

  /* ---- 表格容器：保证 .table-wrap 横向滚动 --------------------------- */
  .table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* ---- 表格本体：收窄 min-width，让 .table-wrap 内滚动 ---------------- */
  .lamp-task-table,
  .lamp-inventory-table,
  .lamp-movement-table {
    min-width: 580px;
  }

  /* ---- 帮助气泡：移动端固定到屏幕底部 toast，永不右溢出 --------------- */
  .help-tip__content {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    top: auto;
    width: auto;
    max-width: none;
    transform: translateY(8px);
  }

  .help-tip__content::after {
    display: none;
  }

  .help-tip:hover .help-tip__content,
  .help-tip:focus .help-tip__content,
  .help-tip:focus-within .help-tip__content {
    transform: translateY(0);
  }
}

/* =========================================================================
   角色权限 UI 美化 — 追加段（保持 PR base 字节不变，纯 LF 追加）
   ---------------------------------------------------------------------------
   命名空间：
     .role-*                角色 / 权限 / 审批通用
     .role-domain-*         按业务域分组（首页/直播/千川/售灯/薪酬/系统/H5/历史）
     .role-policy-*         敏感操作策略
     .role-approval-*       授权审批
   ========================================================================= */

/* ---- 通用：业务徽章 ----------------------------------------------------- */
.role-section-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  margin-right: 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--brand-soft);
  color: var(--brand-strong);
  border: 1px solid rgba(51, 112, 255, 0.18);
  white-space: nowrap;
}

.role-section-badge--system  { background: rgba(245, 158, 11, 0.12); color: #b45309; border-color: rgba(245, 158, 11, 0.28); }
.role-section-badge--custom  { background: rgba(22, 163, 74, 0.10); color: #15803d; border-color: rgba(22, 163, 74, 0.22); }
.role-section-badge--module  { background: rgba(51, 112, 255, 0.10); color: #245bdb; border-color: rgba(51, 112, 255, 0.22); }
.role-section-badge--confirm { background: rgba(245, 63, 63, 0.08); color: #b91c1c; border-color: rgba(245, 63, 63, 0.28); }
.role-section-badge--policy  { background: rgba(107, 114, 128, 0.10); color: #374151; border-color: rgba(107, 114, 128, 0.22); }
.role-section-badge--approve { background: rgba(245, 158, 11, 0.12); color: #b45309; border-color: rgba(245, 158, 11, 0.28); }

.panel-title:has(.role-section-badge),
.panel-title:has(.role-domain-badge) {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

/* ---- /roles 列表页 ----------------------------------------------------- */
.role-list-panel { position: relative; }

.role-table th {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.role-table th.num,
.role-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.role-row > td { vertical-align: middle; }

.role-row--system > td   { background: rgba(245, 158, 11, 0.03); }
.role-row--archived > td { color: var(--text-muted); }

.role-row:hover > td        { background: rgba(51, 112, 255, 0.04); }
.role-row--system:hover > td { background: rgba(245, 158, 11, 0.06); }

.role-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.role-cell__name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.role-cell__desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  word-break: break-word;
}

.role-cell__key {
  display: inline-block;
  margin-top: 4px;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  background: var(--surface-muted);
  color: var(--text-faint);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 11px;
  width: fit-content;
  word-break: break-all;
}

.role-status-chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text-muted);
}

.role-status-chip--active   { background: rgba(22, 163, 74, 0.12); color: #15803d; border-color: rgba(22, 163, 74, 0.28); }
.role-status-chip--archived { background: rgba(107, 114, 128, 0.10); color: #4b5563; border-color: rgba(107, 114, 128, 0.22); }
.role-status-chip--system   { background: rgba(245, 158, 11, 0.12); color: #b45309; border-color: rgba(245, 158, 11, 0.28); }
.role-status-chip--custom   { background: rgba(22, 163, 74, 0.10); color: #15803d; border-color: rgba(22, 163, 74, 0.22); }

.role-metric {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.role-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.role-action-form {
  display: inline;
  margin: 0;
}

.role-action {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: var(--radius-xs);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
  min-width: 0;
  min-height: 0;
  box-shadow: none;
}

.role-action:hover {
  border-color: var(--brand);
  color: var(--brand-strong);
  background: var(--brand-soft);
}

.role-action--primary {
  background: var(--brand-soft);
  color: var(--brand-strong);
  border-color: rgba(51, 112, 255, 0.28);
  font-weight: 600;
}

.role-action--primary:hover {
  background: var(--brand);
  color: #ffffff;
  border-color: var(--brand);
}

.role-action--ghost { background: transparent; }

/* ---- /roles/<id> 资料页 ------------------------------------------------ */
.role-form-grid { align-items: flex-start; }

.role-form-panel {
  background: linear-gradient(180deg, rgba(51, 112, 255, 0.03), var(--surface-solid));
}

.role-status-panel { background: var(--surface-solid); }

.role-status-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.role-status-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.role-status-stat > span {
  font-size: 12px;
  color: var(--text-muted);
}

.role-status-stat > strong {
  font-size: 14px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 4px;
}

.role-user-section-title {
  margin-top: 8px;
  margin-bottom: 8px;
}

.role-user-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.role-user-chip {
  font-size: 12px;
  word-break: break-all;
}

.role-empty-users { margin-top: 8px; }

/* ---- 模块二级导航 ------------------------------------------------------ */
.role-module-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.role-module-tab {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  color: var(--text);
  text-decoration: none;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
  min-width: 0;
}

.role-module-tab:hover {
  border-color: var(--brand);
  background: rgba(51, 112, 255, 0.04);
  box-shadow: var(--shadow-sm);
}

.role-module-tab.is-active {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: 0 0 0 1px rgba(51, 112, 255, 0.22) inset;
}

.role-module-tab__icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--brand);
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.role-module-tab.is-active .role-module-tab__icon {
  background: var(--brand-strong);
}

.role-module-tab__body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.role-module-tab__body strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.role-module-tab__body small {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.45;
}

.role-module-tab.is-active .role-module-tab__body strong {
  color: var(--brand-strong);
}

.role-relationship-card {
  position: relative;
  border-left: 3px solid var(--brand) !important;
}

.role-relationship-card--perm    { border-left-color: var(--brand) !important; }
.role-relationship-card--policy  { border-left-color: var(--warning) !important; }
.role-relationship-card--approve { border-left-color: #16a34a !important; }

/* ---- /roles/<id>/permissions 高危确认 ------------------------------- */
.role-confirm-panel {
  background: linear-gradient(180deg, rgba(245, 63, 63, 0.03), var(--surface-solid));
  border-color: rgba(245, 63, 63, 0.18);
}

/* ---- 按业务域分组 ----------------------------------------------------- */
.role-domain-panel { position: relative; }

.role-domain-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  background: var(--brand);
}

.role-domain-panel--overview::before  { background: #6b7280; }
.role-domain-panel--live::before      { background: var(--brand); }
.role-domain-panel--qianchuan::before { background: #8b5cf6; }
.role-domain-panel--lamp::before      { background: #16a34a; }
.role-domain-panel--payroll::before   { background: #f59e0b; }
.role-domain-panel--system::before    { background: #6b7280; }
.role-domain-panel--mobile::before    { background: #0ea5e9; }
.role-domain-panel--legacy::before    { background: #9ca3af; }

.role-domain-panel > .table-toolbar { padding-left: 6px; }

.role-domain-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  margin-right: 8px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  border: 1px solid rgba(51, 112, 255, 0.18);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.role-domain-badge--overview  { background: rgba(107, 114, 128, 0.10); color: #374151; border-color: rgba(107, 114, 128, 0.22); }
.role-domain-badge--live      { background: rgba(51, 112, 255, 0.10);  color: #245bdb; border-color: rgba(51, 112, 255, 0.22); }
.role-domain-badge--qianchuan { background: rgba(139, 92, 246, 0.10);  color: #6d28d9; border-color: rgba(139, 92, 246, 0.22); }
.role-domain-badge--lamp      { background: rgba(22, 163, 74, 0.10);   color: #15803d; border-color: rgba(22, 163, 74, 0.22); }
.role-domain-badge--payroll   { background: rgba(245, 158, 11, 0.12);  color: #b45309; border-color: rgba(245, 158, 11, 0.28); }
.role-domain-badge--system    { background: rgba(107, 114, 128, 0.10); color: #374151; border-color: rgba(107, 114, 128, 0.22); }
.role-domain-badge--mobile    { background: rgba(14, 165, 233, 0.10);  color: #0369a1; border-color: rgba(14, 165, 233, 0.22); }
.role-domain-badge--legacy    { background: rgba(156, 163, 175, 0.14); color: #4b5563; border-color: rgba(156, 163, 175, 0.28); }

.role-domain-count {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 13px;
}

.role-resource-stack {
  display: grid;
  gap: 14px;
}

.role-resource-block {
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
}

.role-resource-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border-soft);
}

.role-resource-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.role-resource-key {
  display: inline-block;
  padding: 1px 8px;
  border-radius: var(--radius-xs);
  background: var(--surface-muted);
  color: var(--text-faint);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 11px;
  word-break: break-all;
}

/* 权限卡片：高危醒目但不刺眼 */
.permission-card--high-risk {
  border-color: rgba(245, 63, 63, 0.28);
  background: rgba(245, 63, 63, 0.03);
}

.role-risk-chip {
  font-size: 11px;
  height: 18px;
  padding: 0 8px;
  letter-spacing: 0.02em;
}

/* ---- /security/sensitive-operations 策略页 ---------------------------- */
.role-help-panel {
  background: linear-gradient(180deg, rgba(51, 112, 255, 0.04), var(--surface-solid));
  border-color: rgba(51, 112, 255, 0.18);
}

.role-help-list {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.role-help-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.55;
}

.role-help-tag {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text-muted);
  white-space: nowrap;
}

.role-help-tag--on     { background: rgba(22, 163, 74, 0.10);  color: #15803d; border-color: rgba(22, 163, 74, 0.22); }
.role-help-tag--need   { background: rgba(245, 158, 11, 0.12); color: #b45309; border-color: rgba(245, 158, 11, 0.28); }
.role-help-tag--bypass { background: rgba(51, 112, 255, 0.10); color: #245bdb; border-color: rgba(51, 112, 255, 0.22); }
.role-help-tag--user   { background: rgba(107, 114, 128, 0.10); color: #374151; border-color: rgba(107, 114, 128, 0.22); }

.role-policy-panel { position: relative; }

.role-policy-table thead th {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.role-policy-row > td { vertical-align: top; }

.role-policy-row--off > td {
  background: rgba(107, 114, 128, 0.03);
  color: var(--text-muted);
}

.role-policy-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.role-policy-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.role-policy-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.role-policy-category {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
}

.role-policy-key {
  display: inline-block;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  background: var(--surface-muted);
  color: var(--text-faint);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 11px;
  word-break: break-all;
}

.role-policy-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.55;
}

.role-policy-switches {
  display: grid;
  gap: 6px;
}

.role-policy-switch {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  background: var(--surface-muted);
  font-size: 13px;
  cursor: pointer;
  transition: background var(--transition);
  margin: 0;
}

.role-policy-switch:hover { background: rgba(51, 112, 255, 0.06); }

.role-policy-switch input[type="checkbox"] {
  flex-shrink: 0;
  margin-top: 2px;
}

.role-policy-switch span {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.role-policy-switch strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.role-policy-switch small {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.45;
}

.role-policy-user-grid {
  max-height: 260px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 6px;
  background: var(--surface-solid);
}

.role-policy-actions { margin-top: 16px; }

/* ---- /security/approvals 审批列表 ------------------------------------- */
.role-approval-filter-panel { padding-bottom: 14px; }

.role-approval-tabs { margin-top: 8px; margin-bottom: 0; }

.role-approval-tab { font-weight: 500; }

.role-approval-tab--pending.active   { background: rgba(245, 158, 11, 0.16); border-color: rgba(245, 158, 11, 0.5); color: #b45309; }
.role-approval-tab--executed.active  { background: rgba(22, 163, 74, 0.12);  border-color: rgba(22, 163, 74, 0.45); color: #15803d; }
.role-approval-tab--rejected.active,
.role-approval-tab--failed.active    { background: rgba(245, 63, 63, 0.10);  border-color: rgba(245, 63, 63, 0.45); color: #b91c1c; }
.role-approval-tab--expired.active   { background: rgba(107, 114, 128, 0.10); border-color: rgba(107, 114, 128, 0.4); color: #4b5563; }

.role-approval-list-panel { position: relative; }

.role-approval-table thead th {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.role-approval-row > td { vertical-align: top; }

.role-approval-row--pending > td { background: rgba(245, 158, 11, 0.04); }
.role-approval-row--rejected > td,
.role-approval-row--failed > td  { background: rgba(245, 63, 63, 0.03); }

.role-approval-row:hover > td    { background: rgba(51, 112, 255, 0.04); }
.role-approval-row--pending:hover > td  { background: rgba(245, 158, 11, 0.08); }
.role-approval-row--rejected:hover > td,
.role-approval-row--failed:hover > td   { background: rgba(245, 63, 63, 0.06); }

.role-approval-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.role-approval-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.role-approval-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.role-approval-category {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
}

.role-approval-key {
  display: inline-block;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  background: var(--surface-muted);
  color: var(--text-faint);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 11px;
  word-break: break-all;
}

.role-approval-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.55;
  word-break: break-word;
}

.role-approval-subtle {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-faint);
  line-height: 1.45;
}

.role-approval-time {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.role-approval-action {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: var(--radius-xs);
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid rgba(51, 112, 255, 0.28);
  white-space: nowrap;
}

.role-approval-action:hover {
  background: var(--brand);
  color: #ffffff;
  border-color: var(--brand);
}

/* ---- 审批详情页 ------------------------------------------------------- */
.role-approval-detail-panel {
  border-top: 4px solid var(--text-faint);
  background: linear-gradient(180deg, rgba(107, 114, 128, 0.04), var(--surface-solid));
}

.role-approval-detail-panel--pending   { border-top-color: var(--warning); background: linear-gradient(180deg, rgba(245, 158, 11, 0.05), var(--surface-solid)); }
.role-approval-detail-panel--executed  { border-top-color: #16a34a;       background: linear-gradient(180deg, rgba(22, 163, 74, 0.05), var(--surface-solid)); }
.role-approval-detail-panel--rejected,
.role-approval-detail-panel--failed    { border-top-color: var(--danger); background: linear-gradient(180deg, rgba(245, 63, 63, 0.05), var(--surface-solid)); }
.role-approval-detail-panel--expired   { border-top-color: #94a3b8;       background: linear-gradient(180deg, rgba(148, 163, 184, 0.05), var(--surface-solid)); }

.role-approval-detail-head {
  flex-wrap: wrap;
}

.role-approval-detail-title {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.role-approval-detail-status { flex-shrink: 0; }

.role-approval-detail-grid > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.role-approval-detail-grid strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

.role-approval-summary {
  margin: 12px 0;
  padding: 10px 12px;
  border-left: 3px solid var(--brand);
  background: var(--brand-soft);
  border-radius: var(--radius-xs);
  font-size: 13px;
  color: var(--text);
  line-height: 1.55;
}

.role-approval-note {
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
}

.role-approval-note p {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
}

.role-approval-note--reject { border-left: 3px solid var(--warning); }
.role-approval-note--error  { border-left: 3px solid var(--danger); }

.role-approval-payload { margin-top: 14px; }

.role-approval-payload pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 12px;
  border-radius: var(--radius-sm);
  overflow: auto;
  font-size: 12px;
  line-height: 1.55;
}

.role-approval-action-panel { background: var(--surface-solid); }

.role-approval-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.role-approval-action-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.role-approval-action-form strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.role-approval-action-form--approve {
  border-left: 3px solid #16a34a;
  background: linear-gradient(180deg, rgba(22, 163, 74, 0.04), var(--surface-solid));
}

.role-approval-action-form--reject {
  border-left: 3px solid var(--danger);
  background: linear-gradient(180deg, rgba(245, 63, 63, 0.04), var(--surface-solid));
}

.role-approval-action-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--text);
}

.role-approval-action-form textarea {
  width: 100%;
}

/* ---- 移动端 720px ----------------------------------------------------- */
@media (max-width: 720px) {
  /* /roles 列表：表格滚动 + 操作单列 */
  .role-table { min-width: 600px; }
  .role-actions { flex-direction: column; align-items: stretch; gap: 4px; }
  .role-action { width: 100%; justify-content: center; }
  .role-action-form,
  .role-action-form .role-action { width: 100%; }

  /* /roles/<id> 资料页 */
  .role-status-stats { grid-template-columns: 1fr; }

  /* 模块二级导航 */
  .role-module-nav { grid-template-columns: 1fr; }

  /* 权限页：业务域 panel 留 padding */
  .role-domain-panel { padding-left: 18px; }

  .role-resource-head { gap: 4px; }

  /* 策略表 + 审批表 收窄滚动 */
  .role-policy-table,
  .role-approval-table { min-width: 720px; }

  .role-policy-user-grid {
    grid-template-columns: 1fr;
    max-height: 200px;
  }

  /* 审批详情：双栏改单栏 */
  .role-approval-actions { grid-template-columns: 1fr; }
  .role-approval-detail-head { flex-direction: column; align-items: stretch; }
  .role-approval-detail-status { align-self: flex-start; }

  /* 帮助条 tag 缩小 */
  .role-help-list li { font-size: 12px; }
  .role-help-tag { font-size: 10px; height: 18px; padding: 0 8px; }
}

/* =========================================================================
   角色权限 UI 重做 — redesign 追加段
   ---------------------------------------------------------------------------
   命名空间 .rp-* （role-permission redesign）独立于已有 .role-*
   保持 PR base 字节不变，纯 LF 追加。
   ========================================================================= */

/* ---- 通用按钮 / 标签 / 通知 ------------------------------------------ */
.rp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 32px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
  box-shadow: none;
  min-width: 0;
  min-height: 0;
}

.rp-btn:hover {
  border-color: var(--brand);
  color: var(--brand-strong);
  background: var(--brand-soft);
}

.rp-btn--primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
  font-weight: 600;
}

.rp-btn--primary:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
  color: #ffffff;
}

.rp-btn--ghost {
  background: transparent;
  color: var(--text);
}

.rp-btn--danger-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}

.rp-btn--danger-ghost:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: rgba(245, 63, 63, 0.06);
}

.rp-btn-form {
  display: inline;
  margin: 0;
}

.rp-tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text-muted);
  white-space: nowrap;
}

.rp-tag--system   { background: rgba(245, 158, 11, 0.12); color: #b45309; border-color: rgba(245, 158, 11, 0.28); }
.rp-tag--custom   { background: rgba(22, 163, 74, 0.10);  color: #15803d; border-color: rgba(22, 163, 74, 0.22); }
.rp-tag--active   { background: rgba(22, 163, 74, 0.12);  color: #15803d; border-color: rgba(22, 163, 74, 0.28); }
.rp-tag--archived { background: rgba(107, 114, 128, 0.10); color: #4b5563; border-color: rgba(107, 114, 128, 0.22); }

.rp-notice {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-muted);
}

.rp-notice--info {
  border-color: rgba(51, 112, 255, 0.22);
  background: rgba(51, 112, 255, 0.05);
}

.rp-notice strong {
  display: block;
  color: var(--text);
  font-weight: 600;
  margin-bottom: 4px;
}

.rp-notice p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
}

/* ---- 模块二级导航 segmented control ----------------------------------- */
.rp-nav-panel {
  display: grid;
  gap: 16px;
}

.rp-nav-header__copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rp-nav-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.rp-nav-subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
}

.rp-segmented {
  display: inline-flex;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.rp-segmented__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
  justify-content: center;
}

.rp-segmented__item:hover {
  color: var(--text);
  background: var(--surface-solid);
}

.rp-segmented__item.is-active {
  background: var(--surface-solid);
  color: var(--brand-strong);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 0 0 1px var(--brand) inset;
}

.rp-segmented__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
}

.rp-segmented__label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.rp-relations {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.rp-relation {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-solid);
}

.rp-relation__dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--brand);
}

.rp-relation--perm    .rp-relation__dot { background: var(--brand); }
.rp-relation--policy  .rp-relation__dot { background: var(--warning); }
.rp-relation--approve .rp-relation__dot { background: #16a34a; }

.rp-relation__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.rp-relation__body strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.rp-relation__body span {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.55;
}

/* ---- /roles section --------------------------------------------------- */
.rp-section { position: relative; }

.rp-section__head {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.rp-section__title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.rp-section__title h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.rp-section__badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  border: 1px solid rgba(51, 112, 255, 0.18);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.rp-section__badge--system { background: rgba(245, 158, 11, 0.12); color: #b45309; border-color: rgba(245, 158, 11, 0.28); }
.rp-section__badge--custom { background: rgba(22, 163, 74, 0.10);  color: #15803d; border-color: rgba(22, 163, 74, 0.22); }
.rp-section__badge--module { background: rgba(51, 112, 255, 0.10); color: #245bdb; border-color: rgba(51, 112, 255, 0.22); }

.rp-section__count {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}

.rp-section__note {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
}

.rp-section__action {
  align-self: flex-start;
  margin-top: 4px;
}

.rp-empty-cta {
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
  padding: 32px 20px;
}

.rp-empty-cta strong {
  font-size: 15px;
  color: var(--text);
}

.rp-empty-cta span {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
}

/* ---- 角色卡片网格 ----------------------------------------------------- */
.rp-role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.rp-role-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  min-width: 0;
}

.rp-role-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  background: var(--brand);
}

.rp-role-card--system::before { background: #f59e0b; }
.rp-role-card--custom::before { background: #16a34a; }

.rp-role-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.rp-role-card.is-archived {
  background: var(--surface-muted);
  opacity: 0.85;
}

.rp-role-card__head {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rp-role-card__title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.rp-role-card__title h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  word-break: break-word;
}

.rp-role-card__tags {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.rp-role-card__key {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  background: var(--surface-muted);
  color: var(--text-faint);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 11px;
  width: fit-content;
  word-break: break-all;
}

details.rp-role-card__key {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  font-family: inherit;
}

details.rp-role-card__key code {
  display: inline-block;
  margin-top: 4px;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  background: var(--surface-solid);
  border: 1px solid var(--border-soft);
  color: var(--text-faint);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 11px;
  word-break: break-all;
}

.rp-role-card__desc {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
  min-height: 1.55em;
}

.rp-role-card__desc--empty {
  color: var(--text-faint);
  font-style: italic;
}

.rp-role-card__details,
.rp-role-summary__details,
.rp-role-detail-list {
  display: grid;
  gap: 8px;
  margin: 0;
}

.rp-role-card__details {
  padding: 10px 0 0;
  border-top: 1px dashed var(--border-soft);
}

.rp-role-card__details div,
.rp-role-summary__details div,
.rp-role-detail-list div {
  display: grid;
  gap: 3px;
}

.rp-role-card__details dt,
.rp-role-summary__details dt,
.rp-role-detail-list dt {
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 800;
}

.rp-role-card__details dd,
.rp-role-summary__details dd,
.rp-role-detail-list dd {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.rp-role-card__metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0;
  padding: 10px 0;
  border-top: 1px dashed var(--border-soft);
  border-bottom: 1px dashed var(--border-soft);
}

.rp-role-card__metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rp-role-card__metric dt {
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.02em;
}

.rp-role-card__metric dd {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.rp-role-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.rp-role-card__actions .rp-btn {
  flex: 0 1 auto;
}

.rp-role-card__actions .rp-btn--primary {
  flex: 1 1 100%;
  min-width: 120px;
}

/* ---- /roles/new 表单 + 步骤 ------------------------------------------ */
.rp-form-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 16px;
  align-items: flex-start;
}

.rp-form-card,
.rp-form-aside {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.rp-form-card__head,
.rp-form-aside__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.rp-form-card__head h2,
.rp-form-aside__head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.rp-form-aside__lead {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
}

.rp-form {
  display: grid;
  gap: 14px;
}

.rp-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.rp-field--wide { grid-column: 1 / -1; }

.rp-field__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.rp-field input,
.rp-field textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface-solid);
  transition: border-color var(--transition), box-shadow var(--transition);
  box-sizing: border-box;
}

.rp-field input:focus,
.rp-field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}

.rp-field input[readonly] {
  background: var(--surface-muted);
  color: var(--text-muted);
  cursor: default;
}

.rp-field__hint {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.55;
}

.rp-field__hint code {
  display: inline-block;
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  background: var(--surface-muted);
  border: 1px solid var(--border-soft);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 11px;
}

.rp-form__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.rp-form-aside {
  background: linear-gradient(180deg, rgba(51, 112, 255, 0.04), var(--surface-solid));
}

.rp-form-aside__subtitle {
  margin: 8px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.rp-form-aside__empty {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
}

.rp-form-aside__empty strong {
  color: var(--text);
  font-size: 14px;
}

.rp-form-stats {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.rp-form-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.rp-form-stat dt {
  color: var(--text-muted);
  font-size: 11px;
}

.rp-form-stat dd {
  margin: 0;
  font-size: 14px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 4px;
}

.rp-form-stat__num {
  font-size: 20px !important;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.rp-user-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.rp-user-list__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
}

.rp-user-list__body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.rp-user-list__chip {
  font-size: 12px;
  word-break: break-all;
  width: fit-content;
}

.rp-user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--brand);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
}

.rp-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.rp-steps__item {
  position: relative;
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
}

.rp-steps__item--current {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: 0 0 0 1px rgba(51, 112, 255, 0.12) inset;
}

.rp-steps__num {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--brand);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.rp-steps__item:not(.rp-steps__item--current) .rp-steps__num {
  background: var(--text-faint);
}

.rp-steps__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.rp-steps__body strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.rp-steps__body span {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.55;
}

/* ---- 权限页 ----------------------------------------------------------- */
.rp-perm-form {
  display: grid;
  gap: 16px;
}

.rp-permission-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.rp-permission-toolbar__search {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.rp-permission-toolbar__search input[type="search"] {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface-solid);
  color: var(--text);
  font: inherit;
  box-sizing: border-box;
}

.rp-permission-toolbar__actions,
.rp-template-panel__list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.rp-role-summary {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, .9fr);
  gap: 16px;
  align-items: start;
}

.rp-role-summary__main {
  display: grid;
  gap: 8px;
}

.rp-role-summary__main strong {
  color: var(--text);
  font-size: 18px;
}

.rp-role-summary__main p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.55;
}

.rp-diff-panel {
  border-color: rgba(51, 112, 255, 0.22);
  background: linear-gradient(180deg, rgba(51, 112, 255, 0.04), var(--surface-solid));
}

.rp-diff-panel.has-high-risk-change {
  border-color: rgba(245, 63, 63, 0.30);
  background: linear-gradient(180deg, rgba(245, 63, 63, 0.05), var(--surface-solid));
}

.rp-diff-panel__grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.rp-diff-panel__grid > div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
}

.rp-diff-panel__grid span {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.rp-diff-panel__grid small,
.rp-diff-panel__note,
.rp-template-panel__head span {
  color: var(--text-muted);
  font-size: 12px;
}

.rp-diff-panel__note {
  margin: 10px 0 0;
  line-height: 1.55;
}

.rp-template-panel {
  display: grid;
  gap: 12px;
}

.rp-template-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.rp-template-panel__head h3 {
  margin: 0;
  font-size: 15px;
}

.rp-domain-section__toggle,
.rp-resource__toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  cursor: pointer;
}

.rp-domain-section__toggle input,
.rp-resource__toggle input {
  flex-shrink: 0;
}

.rp-resource__toggle span {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.rp-domain-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  position: sticky;
  top: 12px;
  z-index: 5;
}

.rp-domain-nav__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.rp-domain-nav__list {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.rp-domain-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid var(--border-soft);
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  white-space: nowrap;
}

.rp-domain-chip:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.rp-domain-chip__dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--brand);
}

.rp-domain-chip__count {
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--text-faint);
}

.rp-domain-chip--overview  .rp-domain-chip__dot { background: #6b7280; }
.rp-domain-chip--live      .rp-domain-chip__dot { background: var(--brand); }
.rp-domain-chip--qianchuan .rp-domain-chip__dot { background: #8b5cf6; }
.rp-domain-chip--lamp      .rp-domain-chip__dot { background: #16a34a; }
.rp-domain-chip--payroll   .rp-domain-chip__dot { background: #f59e0b; }
.rp-domain-chip--system    .rp-domain-chip__dot { background: #6b7280; }
.rp-domain-chip--mobile    .rp-domain-chip__dot { background: #0ea5e9; }
.rp-domain-chip--legacy    .rp-domain-chip__dot { background: #9ca3af; }

/* 确认 banner */
.rp-confirm {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.06), var(--surface-solid));
  border-color: rgba(245, 158, 11, 0.28);
}

.rp-confirm__head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.rp-confirm__icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.15);
  color: #b45309;
}

.rp-confirm__copy {
  min-width: 0;
  flex: 1;
}

.rp-confirm__copy strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.rp-confirm__copy p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
}

.rp-confirm__check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  cursor: pointer;
}

.rp-confirm__check span {
  font-size: 13px;
  color: var(--text);
}

.rp-confirm__note {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.55;
}

.rp-confirm__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* 业务域 section */
.rp-domain-section { position: relative; }

.rp-domain-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  background: var(--brand);
}

.rp-domain-section--overview::before  { background: #6b7280; }
.rp-domain-section--live::before      { background: var(--brand); }
.rp-domain-section--qianchuan::before { background: #8b5cf6; }
.rp-domain-section--lamp::before      { background: #16a34a; }
.rp-domain-section--payroll::before   { background: #f59e0b; }
.rp-domain-section--system::before    { background: #6b7280; }
.rp-domain-section--mobile::before    { background: #0ea5e9; }
.rp-domain-section--legacy::before    { background: #9ca3af; }

.rp-domain-section__head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}

.rp-domain-section__title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.rp-domain-section__title h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.rp-domain-section__badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text-muted);
  white-space: nowrap;
}

.rp-domain-section__badge--overview  { background: rgba(107, 114, 128, 0.10); color: #374151; border-color: rgba(107, 114, 128, 0.22); }
.rp-domain-section__badge--live      { background: rgba(51, 112, 255, 0.10);  color: #245bdb; border-color: rgba(51, 112, 255, 0.22); }
.rp-domain-section__badge--qianchuan { background: rgba(139, 92, 246, 0.10);  color: #6d28d9; border-color: rgba(139, 92, 246, 0.22); }
.rp-domain-section__badge--lamp      { background: rgba(22, 163, 74, 0.10);   color: #15803d; border-color: rgba(22, 163, 74, 0.22); }
.rp-domain-section__badge--payroll   { background: rgba(245, 158, 11, 0.12);  color: #b45309; border-color: rgba(245, 158, 11, 0.28); }
.rp-domain-section__badge--system    { background: rgba(107, 114, 128, 0.10); color: #374151; border-color: rgba(107, 114, 128, 0.22); }
.rp-domain-section__badge--mobile    { background: rgba(14, 165, 233, 0.10);  color: #0369a1; border-color: rgba(14, 165, 233, 0.22); }
.rp-domain-section__badge--legacy    { background: rgba(156, 163, 175, 0.14); color: #4b5563; border-color: rgba(156, 163, 175, 0.28); }

.rp-domain-section__count {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}

.rp-domain-section__note {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
}

.rp-resource-stack {
  display: grid;
  gap: 12px;
}

.rp-resource {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  overflow: hidden;
}

.rp-resource__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border-soft);
}

.rp-resource__title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.rp-resource__title h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.rp-resource__key {
  display: inline-block;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  background: var(--surface-solid);
  border: 1px solid var(--border-soft);
  color: var(--text-faint);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 11px;
  word-break: break-all;
}

.rp-tech-key {
  color: var(--text-faint);
  font-size: 11px;
}

.rp-tech-key > summary {
  cursor: pointer;
  list-style: none;
  font-weight: 600;
}

.rp-tech-key > summary::-webkit-details-marker { display: none; }

.rp-tech-key code {
  display: inline-block;
  margin-top: 3px;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  background: var(--surface-solid);
  border: 1px solid var(--border-soft);
  color: var(--text-faint);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 11px;
  word-break: break-all;
}

.rp-tech-key--permission {
  margin-top: 2px;
}

.rp-resource__count {
  color: var(--text-muted);
  font-size: 12px;
}

/* 动作行 */
.rp-action-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.rp-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 240px);
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  border-top: 1px solid var(--border-soft);
  transition: background var(--transition);
}

.rp-action:first-child { border-top: 0; }

.rp-action:hover {
  background: rgba(51, 112, 255, 0.03);
}

.rp-action--high-risk {
  background: rgba(245, 63, 63, 0.02);
}

.rp-action--high-risk:hover {
  background: rgba(245, 63, 63, 0.05);
}

.rp-action.is-checked {
  background: rgba(51, 112, 255, 0.04);
}

.rp-action.is-checked.rp-action--high-risk {
  background: rgba(245, 63, 63, 0.05);
}

.rp-action__check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  min-width: 0;
}

.rp-action__check input[type="checkbox"] {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-top: 2px;
}

.rp-action__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.rp-action__name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.rp-action__key {
  color: var(--text-faint);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 11px;
  word-break: break-all;
  line-height: 1.45;
}

.rp-risk-pill {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(245, 63, 63, 0.10);
  color: #b91c1c;
  border: 1px solid rgba(245, 63, 63, 0.28);
  font-size: 11px;
  font-weight: 600;
}

.rp-action__scope {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.rp-action__scope-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.rp-action__scope select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 13px;
  color: var(--text);
  background: var(--surface-solid);
  font-family: inherit;
  box-sizing: border-box;
}

.rp-bottom-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  background: linear-gradient(180deg, var(--surface-solid), var(--surface-muted));
}

.rp-bottom-actions small {
  color: var(--text-muted);
  font-size: 12px;
}

.rp-bottom-actions__btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.rp-preview-table-wrap {
  overflow-x: auto;
}

.rp-preview-table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
}

.rp-preview-table th,
.rp-preview-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

.rp-preview-table th {
  color: var(--text-muted);
  font-weight: 600;
  background: var(--surface-muted);
}

.rp-preview-table tr.is-changed td {
  background: rgba(51, 112, 255, 0.035);
}

/* ---- 敏感操作策略 ----------------------------------------------------- */
.rp-helper {
  display: block;
  padding: 0;
  overflow: hidden;
}

.rp-helper__summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border-soft);
  list-style: none;
}

.rp-helper__summary::-webkit-details-marker { display: none; }

.rp-helper__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--brand);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
}

.rp-helper__list {
  margin: 0;
  padding: 14px 18px;
  list-style: none;
  display: grid;
  gap: 8px;
}

.rp-helper__list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
}

.rp-helper__tag {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text-muted);
  white-space: nowrap;
}

.rp-helper__tag--on     { background: rgba(22, 163, 74, 0.10);  color: #15803d; border-color: rgba(22, 163, 74, 0.22); }
.rp-helper__tag--need   { background: rgba(245, 158, 11, 0.12); color: #b45309; border-color: rgba(245, 158, 11, 0.28); }
.rp-helper__tag--bypass { background: rgba(51, 112, 255, 0.10); color: #245bdb; border-color: rgba(51, 112, 255, 0.22); }
.rp-helper__tag--user   { background: rgba(107, 114, 128, 0.10); color: #374151; border-color: rgba(107, 114, 128, 0.22); }

.rp-policy-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.rp-policy-panel__head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rp-policy-panel__title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rp-policy-panel__title h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.rp-policy-panel__count {
  color: var(--text-muted);
  font-size: 13px;
}

.rp-policy-panel__note {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

.rp-policy-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.rp-policy-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rp-policy-item--off {
  background: var(--surface-muted);
  opacity: 0.92;
}

.rp-policy-item__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.rp-policy-item__title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.rp-policy-item__title strong {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.rp-policy-item__category {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
}

.rp-policy-item__key {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  background: var(--surface-muted);
  border: 1px solid var(--border-soft);
  color: var(--text-faint);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 11px;
  word-break: break-all;
}

.rp-policy-item__desc {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.55;
}

.rp-policy-item__body {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(220px, 1.4fr);
  gap: 14px;
}

.rp-policy-switches,
.rp-policy-users {
  margin: 0;
  padding: 0;
  border: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.rp-policy-switches legend,
.rp-policy-users legend {
  margin-bottom: 4px;
  padding: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.rp-policy-switch {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  background: var(--surface-muted);
  cursor: pointer;
  transition: background var(--transition);
}

.rp-policy-switch:hover { background: rgba(51, 112, 255, 0.06); }

.rp-policy-switch input[type="checkbox"] {
  flex-shrink: 0;
  margin-top: 2px;
}

.rp-policy-switch span {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.rp-policy-switch strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.rp-policy-switch small {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.45;
}

.rp-policy-user-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 6px;
  max-height: 220px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xs);
  background: var(--surface-solid);
}

.rp-policy-user {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xs);
  background: var(--surface-muted);
  cursor: pointer;
}

.rp-policy-user input { flex-shrink: 0; margin-top: 2px; }

.rp-policy-user__body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.rp-policy-user__body strong {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.rp-policy-user__body small {
  font-size: 11px;
  color: var(--text-faint);
}

.rp-policy-panel__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 4px;
}

/* ---- 授权审批列表 ----------------------------------------------------- */
.rp-approval-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rp-approval-toolbar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.rp-approval-toolbar__head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.rp-approval-toolbar__count {
  color: var(--text-muted);
  font-size: 13px;
}

.rp-approval-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rp-approval-tab {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid var(--border-soft);
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.rp-approval-tab:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
  color: var(--text);
}

.rp-approval-tab.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
  font-weight: 600;
}

.rp-approval-tab--pending.is-active   { background: var(--warning); border-color: var(--warning); }
.rp-approval-tab--executed.is-active  { background: #16a34a;       border-color: #16a34a; }
.rp-approval-tab--rejected.is-active,
.rp-approval-tab--failed.is-active    { background: var(--danger); border-color: var(--danger); }
.rp-approval-tab--expired.is-active   { background: #6b7280;       border-color: #6b7280; }

.rp-approval-panel { padding: 16px; }

.rp-approval-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.rp-approval-item {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto;
  gap: 14px;
  align-items: flex-start;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  border-left: 3px solid var(--text-faint);
}

.rp-approval-item--pending  { border-left-color: var(--warning); background: rgba(245, 158, 11, 0.03); }
.rp-approval-item--executed { border-left-color: #16a34a; }
.rp-approval-item--rejected,
.rp-approval-item--failed   { border-left-color: var(--danger); background: rgba(245, 63, 63, 0.03); }
.rp-approval-item--expired  { border-left-color: #6b7280; background: rgba(107, 114, 128, 0.04); }

.rp-approval-item__main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.rp-approval-item__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.rp-approval-item__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.rp-approval-item__status { flex-shrink: 0; }

.rp-approval-item__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.rp-approval-item__category {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 11px;
}

.rp-approval-item__key {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  background: var(--surface-muted);
  border: 1px solid var(--border-soft);
  color: var(--text-faint);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 11px;
  word-break: break-all;
}

.rp-approval-item__desc {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
}

.rp-approval-item__warn {
  margin: 0;
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  background: rgba(245, 63, 63, 0.06);
  color: #b91c1c;
  font-size: 12px;
}

.rp-approval-item__facts {
  margin: 0;
  display: grid;
  gap: 10px;
}

.rp-approval-item__facts > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.rp-approval-item__facts dt {
  color: var(--text-muted);
  font-size: 11px;
}

.rp-approval-item__facts dd {
  margin: 0;
  font-size: 13px;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rp-approval-item__facts dd small {
  color: var(--text-faint);
  font-size: 11px;
}

.rp-approval-item__action {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
}

/* ---- 审批详情 --------------------------------------------------------- */
.rp-approval-detail {
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-top: 4px solid var(--text-faint);
  background: linear-gradient(180deg, rgba(107, 114, 128, 0.04), var(--surface-solid));
}

.rp-approval-detail--pending  { border-top-color: var(--warning); background: linear-gradient(180deg, rgba(245, 158, 11, 0.05), var(--surface-solid)); }
.rp-approval-detail--executed { border-top-color: #16a34a;       background: linear-gradient(180deg, rgba(22, 163, 74, 0.05), var(--surface-solid)); }
.rp-approval-detail--rejected,
.rp-approval-detail--failed   { border-top-color: var(--danger); background: linear-gradient(180deg, rgba(245, 63, 63, 0.05), var(--surface-solid)); }
.rp-approval-detail--expired  { border-top-color: #94a3b8;       background: linear-gradient(180deg, rgba(148, 163, 184, 0.05), var(--surface-solid)); }

.rp-approval-detail__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-soft);
}

.rp-approval-detail__title {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.rp-approval-detail__title h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.rp-approval-detail__meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.rp-approval-detail__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin: 0;
}

.rp-approval-detail__grid > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.rp-approval-detail__grid dt {
  color: var(--text-muted);
  font-size: 11px;
}

.rp-approval-detail__grid dd {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

.rp-approval-detail__summary {
  padding: 10px 12px;
  border-left: 3px solid var(--brand);
  background: var(--brand-soft);
  border-radius: var(--radius-xs);
  font-size: 13px;
  color: var(--text);
  line-height: 1.55;
}

.rp-approval-detail__notes {
  display: grid;
  gap: 8px;
}

.rp-approval-detail__note {
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
}

.rp-approval-detail__note strong {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.rp-approval-detail__note p {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
}

.rp-approval-detail__note--warn  { border-left: 3px solid var(--warning); }
.rp-approval-detail__note--error { border-left: 3px solid var(--danger); }

.rp-approval-detail__payload summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--text-muted);
  padding: 6px 0;
}

.rp-approval-detail__payload pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 12px;
  border-radius: var(--radius-sm);
  overflow: auto;
  font-size: 12px;
  line-height: 1.55;
  margin: 0;
}

.rp-approval-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rp-approval-actions__head h3 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.rp-approval-actions__head p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
}

.rp-approval-actions__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.rp-approval-actions__form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
}

.rp-approval-actions__form strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.rp-approval-actions__form small {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.55;
}

.rp-approval-actions__form textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  box-sizing: border-box;
  resize: vertical;
}

.rp-approval-actions__label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.rp-approval-actions__form--approve {
  border-left: 3px solid #16a34a;
  background: linear-gradient(180deg, rgba(22, 163, 74, 0.04), var(--surface-solid));
}

.rp-approval-actions__form--reject {
  border-left: 3px solid var(--danger);
  background: linear-gradient(180deg, rgba(245, 63, 63, 0.04), var(--surface-solid));
}

/* ---- 移动端 720px ----------------------------------------------------- */
@media (max-width: 720px) {
  /* segmented control 在小屏自动 wrap */
  .rp-segmented { width: 100%; }
  .rp-segmented__item {
    flex: 1 1 calc(50% - 4px);
    justify-content: center;
  }
  .rp-relations { grid-template-columns: 1fr; }

  /* /roles 网格单列 */
  .rp-role-grid { grid-template-columns: 1fr; }
  .rp-role-card__title { flex-direction: column; align-items: flex-start; }

  /* form-shell 单列，aside 在下 */
  .rp-form-shell { grid-template-columns: 1fr; }
  .rp-form-stats { grid-template-columns: 1fr; }
  .rp-role-summary { grid-template-columns: 1fr; }

  /* 业务域 nav 不 sticky（防遮挡） */
  .rp-domain-nav { position: static; }

  /* 业务域 section padding 给左侧色带 */
  .rp-domain-section { padding-left: 18px; }

  /* 动作行单列 */
  .rp-action {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  /* 策略项内部双列改单列 */
  .rp-policy-item__body { grid-template-columns: 1fr; }
  .rp-policy-user-grid {
    grid-template-columns: 1fr;
    max-height: 180px;
  }

  /* 审批项三列改纵向 */
  .rp-approval-item { grid-template-columns: 1fr; }
  .rp-approval-item__action { justify-content: stretch; }
  .rp-approval-item__action .rp-btn { width: 100%; }

  /* 审批详情双列改单列 */
  .rp-approval-actions__grid { grid-template-columns: 1fr; }
  .rp-approval-detail__head { flex-direction: column; }

  /* 按钮在小屏卡片内不挤 */
  .rp-role-card__actions { gap: 6px; }
}

/* =========================================================================
   售灯 / 供灯业务 — 移动优先 UI 重构（追加段）
   ---------------------------------------------------------------------------
   命名空间 .lamp-mf-* / .lamp-bp-* / .lamp-inv-mf-* / .lamp-wb2-*
   保持 PR base 字节不变，纯 LF 追加。
   桌面端 ≥768px 走表格 + 现有 .lamp-* 视觉；
   <768px 切换到任务卡 / 错误卡 / 库存卡。
   ========================================================================= */

/* ---- 默认：在大屏（≥768px）隐藏移动卡片，显示表格 ---------------------- */
.lamp-mf-mobile-list,
.lamp-bp-mobile-rows,
.lamp-inv-mf-list,
.lamp-inv-mf-flow {
  display: none;
}

.lamp-mf-desktop-only { display: block; }

/* ---- 工作台 v2：卡片更整齐，移动端 2 列 ------------------------------- */
.lamp-wb2-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 8px;
}

.lamp-wb2-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--text);
  text-decoration: none;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  min-height: 88px;
}

.lamp-wb2-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.lamp-wb2-card__title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.lamp-wb2-card__count {
  font-size: 28px;
  line-height: 1.1;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.lamp-wb2-card__note {
  font-style: normal;
  font-size: 11px;
  color: var(--text-faint);
  line-height: 1.45;
}

.lamp-wb2-card--pending    { border-top: 3px solid #6b7280; }
.lamp-wb2-card--accepted   { border-top: 3px solid var(--brand); }
.lamp-wb2-card--processing { border-top: 3px solid #245bdb; }
.lamp-wb2-card--active     { border-top: 3px solid #16a34a; }
.lamp-wb2-card--due        { border-top: 3px solid var(--warning); }
.lamp-wb2-card--exception  { border-top: 3px solid var(--danger); }
.lamp-wb2-card--photo      { border-top: 3px solid #0ea5e9; }
.lamp-wb2-card--completed  { border-top: 3px solid #16a34a; }
.lamp-wb2-card--remark     { border-top: 3px solid #f59e0b; }
.lamp-wb2-card--modified   { border-top: 3px solid #8b5cf6; }
.lamp-wb2-card--stock      { border-top: 3px solid var(--danger); background: rgba(245, 63, 63, 0.03); }

/* 高亮异常 / 低库存数字 */
.lamp-wb2-card--exception .lamp-wb2-card__count,
.lamp-wb2-card--stock     .lamp-wb2-card__count { color: var(--danger); }
.lamp-wb2-card--due       .lamp-wb2-card__count { color: var(--warning); }
.lamp-wb2-card--active    .lamp-wb2-card__count,
.lamp-wb2-card--completed .lamp-wb2-card__count { color: #16a34a; }

/* 工作台快捷入口 */
.lamp-wb2-quick {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border-soft);
}

.lamp-wb2-quick__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--text);
  text-decoration: none;
  transition: border-color var(--transition), background var(--transition);
  min-height: 56px;
}

.lamp-wb2-quick__item:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.lamp-wb2-quick__item--primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
}

.lamp-wb2-quick__item--primary:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
  color: #ffffff;
}

.lamp-wb2-quick__item--primary .lamp-wb2-quick__body strong,
.lamp-wb2-quick__item--primary .lamp-wb2-quick__body small { color: #ffffff; }

.lamp-wb2-quick__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
}

.lamp-wb2-quick__item--primary .lamp-wb2-quick__icon {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.lamp-wb2-quick__body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.lamp-wb2-quick__body strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.lamp-wb2-quick__body small {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.45;
}

/* ---- 筛选区折叠按钮（桌面隐藏） --------------------------------------- */
.lamp-mf-toggle {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  min-width: 0;
  box-shadow: none;
}

.lamp-mf-toggle:hover {
  border-color: var(--brand);
  color: var(--brand-strong);
}

.lamp-mf-toggle__caret {
  font-size: 10px;
  transition: transform var(--transition);
}

.lamp-mf-toggle[aria-expanded="false"] .lamp-mf-toggle__caret {
  transform: rotate(-90deg);
}

/* ---- 订单任务卡（移动端） ---------------------------------------------- */
/* display 由顶部默认隐藏 + 768px 媒体查询统一控制。 */
.lamp-mf-mobile-list {
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 12px;
}

.lamp-mf-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-solid);
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.lamp-mf-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  border-radius: 12px 0 0 12px;
  background: var(--text-faint);
}

.lamp-mf-card--pending::before     { background: #94a3b8; }
.lamp-mf-card--accepted::before    { background: var(--brand); }
.lamp-mf-card--processing::before  { background: #245bdb; }
.lamp-mf-card--completed::before   { background: #16a34a; }
.lamp-mf-card--exception::before   { background: var(--danger); }
.lamp-mf-card--soon::before        { background: var(--warning); }
.lamp-mf-card--overdue::before     { background: var(--danger); background-image: repeating-linear-gradient(45deg, transparent, transparent 4px, rgba(255,255,255,0.3) 4px, rgba(255,255,255,0.3) 8px); }

.lamp-mf-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.lamp-mf-card__title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.lamp-mf-card__title strong {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
}

.lamp-mf-card__title small {
  font-size: 12px;
  color: var(--text-muted);
}

.lamp-mf-card__status {
  flex-shrink: 0;
}

.lamp-mf-card__address {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  word-break: break-all;
  padding: 8px 10px;
  background: var(--surface-muted);
  border-radius: 6px;
}

.lamp-mf-card__addr-icon {
  flex-shrink: 0;
  color: var(--brand);
  font-size: 14px;
  font-weight: 700;
}

.lamp-mf-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.lamp-mf-card__progress {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  margin: 0;
  padding: 10px 0;
  border-top: 1px dashed var(--border-soft);
  border-bottom: 1px dashed var(--border-soft);
}

.lamp-mf-card__progress > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.lamp-mf-card__progress dt {
  font-size: 11px;
  color: var(--text-muted);
}

.lamp-mf-card__progress dd {
  margin: 0;
  font-size: 13px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.lamp-mf-card__progress dd strong {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.lamp-mf-card__progress div:nth-child(3) { grid-column: 1 / -1; }

.lamp-mf-card__alerts {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lamp-mf-alert {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.55;
  border: 1px solid transparent;
}

.lamp-mf-alert--photo {
  background: rgba(14, 165, 233, 0.08);
  color: #075985;
  border-color: rgba(14, 165, 233, 0.22);
}

.lamp-mf-alert--remark {
  background: rgba(245, 158, 11, 0.08);
  color: #92400e;
  border-color: rgba(245, 158, 11, 0.28);
  flex-direction: column;
  gap: 2px;
}

.lamp-mf-alert--remark strong {
  font-size: 12px;
  font-weight: 700;
}

.lamp-mf-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lamp-mf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
  box-shadow: none;
  min-width: 0;
  flex: 1 1 auto;
}

.lamp-mf-btn:hover {
  border-color: var(--brand);
  color: var(--brand-strong);
  background: var(--brand-soft);
}

.lamp-mf-btn--primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
  font-weight: 600;
}

.lamp-mf-btn--primary:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
  color: #ffffff;
}

.lamp-mf-empty {
  text-align: center;
}

.lamp-mf-empty__actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 12px;
}

/* ---- 新增订单表单分组 -------------------------------------------------- */
.lamp-mf-form-panel { background: linear-gradient(180deg, rgba(51, 112, 255, 0.03), var(--surface-solid)); }

.lamp-mf-form-header {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-soft);
}

.lamp-mf-form-title {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.lamp-mf-form-lead {
  margin: 0;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-muted);
}

.lamp-mf-form-lead strong {
  color: var(--brand-strong);
  font-weight: 600;
}

.lamp-mf-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.lamp-mf-section {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--surface-solid);
}

.lamp-mf-section--customer { border-left: 4px solid var(--brand); }
.lamp-mf-section--plan     { border-left: 4px solid #16a34a; }
.lamp-mf-section--execution{ border-left: 4px solid #f59e0b; }

.lamp-mf-section__title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 10px;
  padding: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.lamp-mf-section__title small {
  width: 100%;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 2px;
}

.lamp-mf-section__step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--brand);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
}

.lamp-mf-section--plan      .lamp-mf-section__step { background: #16a34a; }
.lamp-mf-section--execution .lamp-mf-section__step { background: #f59e0b; }

.lamp-mf-section__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.lamp-mf-section__grid > .field.full { grid-column: 1 / -1; }

.lamp-mf-required {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(245, 63, 63, 0.10);
  color: #b91c1c;
  font-style: normal;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

.lamp-mf-photo-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-direction: column;
  padding: 10px 12px;
  background: var(--surface-muted);
  border-radius: 8px;
  border: 1px solid var(--border-soft);
}

.lamp-mf-photo-check > input[type="checkbox"] + span {
  font-weight: 500;
}

.lamp-mf-advanced {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-soft);
}

.lamp-mf-advanced__summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--surface-muted);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.lamp-mf-advanced__summary::-webkit-details-marker { display: none; }

.lamp-mf-advanced__summary::after {
  content: "▾";
  margin-left: auto;
  font-size: 10px;
  color: var(--text-muted);
  transition: transform var(--transition);
}

.lamp-mf-advanced[open] .lamp-mf-advanced__summary { color: var(--text); }
.lamp-mf-advanced[open] .lamp-mf-advanced__summary::after { transform: rotate(180deg); }

.lamp-mf-advanced__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--surface-solid);
  color: var(--text-muted);
  font-size: 14px;
  border: 1px solid var(--border);
}

.lamp-mf-advanced[open] .lamp-mf-section__grid {
  margin-top: 12px;
}

.lamp-mf-info {
  margin: 0;
}

.lamp-mf-form-actions {
  display: flex;
  justify-content: flex-end;
}

.lamp-mf-submit {
  padding: 0 28px;
  height: 44px;
  font-weight: 600;
  font-size: 15px;
  min-width: 200px;
}

/* ---- 批量预检查页面 ---------------------------------------------------- */
.lamp-bp-hero {
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-top: 4px solid var(--brand);
}

.lamp-bp-hero--ok      { border-top-color: #16a34a; background: linear-gradient(180deg, rgba(22,163,74,0.04), var(--surface-solid)); }
.lamp-bp-hero--danger  { border-top-color: var(--danger); background: linear-gradient(180deg, rgba(245,63,63,0.04), var(--surface-solid)); }

.lamp-bp-hero__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.lamp-bp-hero__eyebrow {
  font-size: 11px;
  color: var(--brand-strong);
  letter-spacing: 0.04em;
  font-weight: 600;
}

.lamp-bp-hero__title {
  margin: 4px 0 6px;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.lamp-bp-hero__sub {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

.lamp-bp-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.lamp-bp-summary__card {
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.lamp-bp-summary__card span {
  font-size: 12px;
  color: var(--text-muted);
}

.lamp-bp-summary__card strong {
  font-size: 32px;
  line-height: 1.1;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.lamp-bp-summary__card em {
  font-style: normal;
  font-size: 11px;
  color: var(--text-faint);
}

.lamp-bp-summary__card--total { border-top: 3px solid var(--brand); }
.lamp-bp-summary__card--ok    { border-top: 3px solid #16a34a; }
.lamp-bp-summary__card--ok strong { color: #15803d; }
.lamp-bp-summary__card--err   { border-top: 3px solid var(--danger); background: rgba(245, 63, 63, 0.04); }
.lamp-bp-summary__card--err strong { color: var(--danger); }
.lamp-bp-summary__card--zero  { border-top: 3px solid var(--border-strong); }
.lamp-bp-summary__card--zero strong { color: var(--text-muted); }

.lamp-bp-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lamp-bp-block--danger { border-color: rgba(245, 63, 63, 0.30); background: rgba(245, 63, 63, 0.04); }
.lamp-bp-block--ok     { border-color: rgba(22, 163, 74, 0.30); background: rgba(22, 163, 74, 0.04); }

.lamp-bp-block__head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.lamp-bp-block__icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  color: #ffffff;
  font-size: 18px;
  font-weight: 700;
}

.lamp-bp-block--danger .lamp-bp-block__icon { background: var(--danger); }
.lamp-bp-block--ok     .lamp-bp-block__icon { background: #16a34a; }

.lamp-bp-block__head h3 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.lamp-bp-block__head p {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.65;
}

.lamp-bp-block__head p strong { color: var(--text); font-weight: 600; }

.lamp-bp-block__form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0;
}

.lamp-bp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 22px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  box-shadow: none;
  min-width: 0;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.lamp-bp-btn:hover {
  border-color: var(--brand);
  color: var(--brand-strong);
}

.lamp-bp-btn--primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
}

.lamp-bp-btn--primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: #ffffff; }

.lamp-bp-btn--danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(245, 63, 63, 0.25);
}

.lamp-bp-btn--danger:hover {
  background: #c92020;
  border-color: #c92020;
  color: #ffffff;
}

.lamp-bp-btn--ghost { background: transparent; }

.lamp-bp-risk-check {
  padding: 12px 14px;
  background: rgba(245, 63, 63, 0.04);
  border: 1px dashed rgba(245, 63, 63, 0.35);
  border-radius: 8px;
}

.lamp-bp-risk-check span { font-weight: 600; color: var(--text); }

.lamp-bp-confirm-actions { gap: 10px; }

.lamp-bp-rows-head {
  margin-bottom: 12px;
}

.lamp-bp-rows-head h3 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.lamp-bp-rows-head p {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.lamp-bp-table tbody tr.lamp-bp-row--err > td { background: rgba(245, 63, 63, 0.04); }
.lamp-bp-table tbody tr.lamp-bp-row--warn > td { background: rgba(245, 158, 11, 0.04); }

/* display 由顶部默认隐藏 + 768px 媒体查询统一控制。 */
.lamp-bp-mobile-rows {
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 10px;
}

.lamp-bp-row-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--surface-solid);
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-left: 4px solid var(--border);
}

.lamp-bp-row-card--err  { border-left-color: var(--danger); background: rgba(245, 63, 63, 0.03); }
.lamp-bp-row-card--warn { border-left-color: var(--warning); background: rgba(245, 158, 11, 0.03); }
.lamp-bp-row-card--ok   { border-left-color: #16a34a; }

.lamp-bp-row-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.lamp-bp-row-card__title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.lamp-bp-row-card__line {
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.lamp-bp-row-card__title strong {
  font-size: 14px;
  color: var(--text);
}

.lamp-bp-row-card__state {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-muted);
  color: var(--text-muted);
}

.lamp-bp-row-card__state--err  { background: rgba(245, 63, 63, 0.12); color: #b91c1c; }
.lamp-bp-row-card__state--warn { background: rgba(245, 158, 11, 0.14); color: #b45309; }
.lamp-bp-row-card__state--ok   { background: rgba(22, 163, 74, 0.12); color: #15803d; }

.lamp-bp-row-card__facts {
  display: grid;
  gap: 6px;
  margin: 0;
}

.lamp-bp-row-card__facts > div {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 8px;
  font-size: 12px;
  align-items: baseline;
}

.lamp-bp-row-card__facts dt { color: var(--text-muted); }

.lamp-bp-row-card__facts dd {
  margin: 0;
  color: var(--text);
  word-break: break-all;
}

.lamp-bp-row-card__facts dd small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-faint);
}

.lamp-bp-row-card__note {
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.55;
}

.lamp-bp-row-card__note--err  { background: rgba(245, 63, 63, 0.08);  border: 1px solid rgba(245, 63, 63, 0.25); }
.lamp-bp-row-card__note--warn { background: rgba(245, 158, 11, 0.08); border: 1px solid rgba(245, 158, 11, 0.25); }

.lamp-bp-row-card__note strong {
  display: block;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.lamp-bp-row-card__note ul {
  margin: 0 0 4px;
  padding-left: 18px;
}

.lamp-bp-row-card__note li {
  margin: 2px 0;
}

.lamp-bp-row-card__hint {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

/* ---- 库存页移动卡片 --------------------------------------------------- */
/* display 由顶部默认隐藏 + 768px 媒体查询统一控制。 */
.lamp-inv-mf-list {
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 12px;
}

.lamp-inv-mf-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-solid);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-left: 4px solid #16a34a;
}

.lamp-inv-mf-card--low      { border-left-color: var(--warning); background: rgba(245, 158, 11, 0.03); }
.lamp-inv-mf-card--archived { border-left-color: var(--text-faint); background: var(--surface-muted); opacity: 0.85; }

.lamp-inv-mf-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.lamp-inv-mf-card__head > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.lamp-inv-mf-card__head strong {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.lamp-inv-mf-card__head small {
  font-size: 11px;
  color: var(--text-muted);
}

.lamp-inv-mf-card__facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0;
}

.lamp-inv-mf-card__facts > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.lamp-inv-mf-card__notes { grid-column: 1 / -1; }

.lamp-inv-mf-card__facts dt {
  font-size: 11px;
  color: var(--text-muted);
}

.lamp-inv-mf-card__facts dd {
  margin: 0;
  font-size: 14px;
  color: var(--text);
}

.lamp-inv-mf-card__facts dd strong {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.lamp-inv-mf-card__low { color: var(--warning) !important; }

.lamp-inv-mf-card__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-soft);
}

.lamp-inv-mf-adjust {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.lamp-inv-mf-adjust select,
.lamp-inv-mf-adjust input {
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  box-sizing: border-box;
}

.lamp-inv-mf-adjust button {
  grid-column: 1 / -1;
  min-height: 40px;
  font-size: 13px;
  font-weight: 600;
}

.lamp-inv-mf-card__row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.lamp-inv-mf-card__row-actions form { margin: 0; flex: 1 1 auto; }

.lamp-inv-mf-card__row-actions button {
  width: 100%;
  min-height: 36px;
  font-size: 12px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
}

.lamp-inv-mf-card__row-actions .lamp-inv-mf-danger {
  background: rgba(245, 63, 63, 0.06);
  border-color: rgba(245, 63, 63, 0.28);
  color: var(--danger);
}

.lamp-inv-mf-card__hint {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.45;
}

/* display 由顶部默认隐藏 + 768px 媒体查询统一控制。 */
.lamp-inv-mf-flow {
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 8px;
}

.lamp-inv-mf-flow__item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--surface-solid);
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-left: 3px solid var(--text-faint);
}

.lamp-inv-mf-flow__item--up   { border-left-color: #16a34a; }
.lamp-inv-mf-flow__item--down { border-left-color: var(--danger); }

.lamp-inv-mf-flow__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.lamp-inv-mf-flow__head small {
  font-size: 11px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.lamp-inv-mf-flow__product {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.lamp-inv-mf-flow__delta {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.lamp-inv-mf-flow__item--up   .lamp-inv-mf-flow__delta { color: #15803d; }
.lamp-inv-mf-flow__item--down .lamp-inv-mf-flow__delta { color: var(--danger); }

.lamp-inv-mf-flow__delta small {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
}

.lamp-inv-mf-flow__remark {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ---- 平板 768px ------------------------------------------------------- */
@media (max-width: 1024px) {
  .lamp-mf-section__grid { grid-template-columns: 1fr; }
  .lamp-bp-summary { grid-template-columns: 1fr 1fr; }
  .lamp-bp-summary__card--err { grid-column: 1 / -1; }
}

/* ---- 手机 768px 切换：隐藏表格，显示卡片 ----------------------------- */
@media (max-width: 768px) {
  .lamp-mf-desktop-only { display: none !important; }
  .lamp-mf-mobile-list,
  .lamp-bp-mobile-rows,
  .lamp-inv-mf-list,
  .lamp-inv-mf-flow {
    display: grid;
  }

  /* 筛选区折叠 */
  .lamp-mf-toggle { display: inline-flex; }
  .lamp-mf-filter-body[aria-hidden="true"] { display: none; }

  /* 工作台卡片在手机上 2 列 */
  .lamp-wb2-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .lamp-wb2-card { min-height: 76px; padding: 10px 12px; }
  .lamp-wb2-card__count { font-size: 22px; }
  .lamp-wb2-quick { grid-template-columns: 1fr; }

  /* 工作流步骤 + 状态筛选 chip 紧凑 */
  .lamp-workflow-steps { font-size: 11px; gap: 4px 10px; padding: 8px 10px; }
  .lamp-filter-bar { gap: 4px; }
  .lamp-filter-chip { font-size: 12px; padding: 0 10px; min-height: 36px; }

  /* 批量预检查摘要 */
  .lamp-bp-summary { grid-template-columns: 1fr; }
  .lamp-bp-summary__card strong { font-size: 28px; }
  .lamp-bp-block__head { flex-direction: column; gap: 8px; }

  /* 新增订单 sticky 提交按钮 */
  .lamp-mf-form-actions {
    position: sticky;
    bottom: 12px;
    z-index: 2;
    background: linear-gradient(180deg, transparent 0%, var(--surface-solid) 30%);
    padding: 16px 0 8px;
    margin-top: 8px;
  }
  .lamp-mf-submit { width: 100%; min-width: 0; }

  /* 库存调整网格 */
  .lamp-inv-mf-adjust { grid-template-columns: 1fr; }

  /* 来源渠道 select 在 mobile 单独成行 */
  .lamp-source-filter { width: 100%; }
  .lamp-source-filter label { display: flex; flex-direction: column; width: 100%; gap: 4px; }
  .lamp-source-filter select { width: 100%; min-height: 40px; }
}

/* ---- 大屏手机 430px ----------------------------------------------------*/
@media (max-width: 430px) {
  .lamp-wb2-grid { grid-template-columns: 1fr 1fr; }
  .lamp-bp-row-card__facts > div { grid-template-columns: 80px minmax(0, 1fr); }
}

/* ---- 小手机 390px ----------------------------------------------------- */
@media (max-width: 390px) {
  /* 让卡片紧凑一点但仍可读 */
  .lamp-mf-card { padding: 12px 12px 10px; }
  .lamp-mf-card__title strong { font-size: 15px; }
  .lamp-mf-card__progress { grid-template-columns: 1fr; }
  .lamp-mf-card__progress div:nth-child(3) { grid-column: 1; }

  .lamp-wb2-card__count { font-size: 20px; }
  .lamp-wb2-card { padding: 10px; min-height: 70px; }

  .lamp-bp-row-card__facts > div { grid-template-columns: 70px minmax(0, 1fr); font-size: 11.5px; }

  /* 售灯详情 hero metrics 改单列 */
  .lamp-detail-hero__metrics { grid-template-columns: 1fr 1fr; gap: 10px 14px; }

  .lamp-mf-section { padding: 12px; }
  .lamp-mf-section__step { width: 22px; height: 22px; font-size: 11px; }
}

/* =========================================================================
   售灯订单表格 — 桌面端列宽修复（防 CJK 字符竖排）
   ---------------------------------------------------------------------------
   问题：1440 桌面侧边栏展开时，main 区可用宽 ~1160px，14 列表格被压缩
        导致 "孙女士" / "厦门市思明区海安路" / 备注文本竖排（每字 1 列宽）。
   方案：表格设最低宽度（小于该宽度由 .table-wrap overflow-x 滚动），
        给关键列加 min-width 让 CJK 文本有足够空间，
        购买人 cell-strong / 状态 chip / 来源 chip 单元用 nowrap。
   ========================================================================= */

/* 整表最低宽度：CJK 14 列正常呈现所需 */
.lamp-task-table {
  min-width: 1280px;
  table-layout: auto;
}

/* 购买人列：包含姓名 + 备注内联，最小给 120 让姓名不竖排 */
.lamp-task-table thead th:nth-child(1),
.lamp-task-table tbody td:nth-child(1) {
  min-width: 120px;
}

/* 地址列：最小给 140 让"厦门市思明区"等 CJK 短地址不竖排，长地址再 break-word */
.lamp-task-table thead th:nth-child(2),
.lamp-task-table tbody td:nth-child(2) {
  min-width: 140px;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* 来源渠道：80（chip 内容） */
.lamp-task-table thead th:nth-child(3),
.lamp-task-table tbody td:nth-child(3) {
  min-width: 88px;
  white-space: nowrap;
}

/* 分组 / 活动：96（chip + 短中文） */
.lamp-task-table thead th:nth-child(4),
.lamp-task-table tbody td:nth-child(4) {
  min-width: 96px;
}

/* 祈愿类型：88（短中文） */
.lamp-task-table thead th:nth-child(5),
.lamp-task-table tbody td:nth-child(5) {
  min-width: 88px;
}

/* 当前轮灯规格：130（"30天莲花灯" + 注释一行） */
.lamp-task-table thead th:nth-child(6),
.lamp-task-table tbody td:nth-child(6) {
  min-width: 130px;
}

/* 数量 num：保持 nowrap */
.lamp-task-table thead th:nth-child(7),
.lamp-task-table tbody td:nth-child(7) {
  min-width: 60px;
}

/* 已完成 / 购买总天数 num */
.lamp-task-table thead th:nth-child(8),
.lamp-task-table tbody td:nth-child(8) {
  min-width: 110px;
}

/* 实际供灯天数 num */
.lamp-task-table thead th:nth-child(9),
.lamp-task-table tbody td:nth-child(9) {
  min-width: 96px;
}

/* 赠送天数 num */
.lamp-task-table thead th:nth-child(10),
.lamp-task-table tbody td:nth-child(10) {
  min-width: 80px;
}

/* 当前轮到期 */
.lamp-task-table thead th:nth-child(11),
.lamp-task-table tbody td:nth-child(11) {
  min-width: 110px;
  white-space: nowrap;
}

/* 执行负责人 */
.lamp-task-table thead th:nth-child(12),
.lamp-task-table tbody td:nth-child(12) {
  min-width: 96px;
}

/* 状态 chip */
.lamp-task-table thead th:nth-child(13),
.lamp-task-table tbody td:nth-child(13) {
  min-width: 80px;
  white-space: nowrap;
}

/* 详情链接 */
.lamp-task-table thead th:nth-child(14),
.lamp-task-table tbody td:nth-child(14) {
  min-width: 64px;
  white-space: nowrap;
}

/* cell-strong（购买人姓名）：不允许竖排 */
.lamp-task-table .cell-strong {
  white-space: nowrap;
}

/* cell-sub（时间戳、灯规格备注）：可换行但不强制按字符断 */
.lamp-task-table .cell-sub {
  word-break: keep-all;
  overflow-wrap: break-word;
}

/* 备注 inline：宽度限制内允许换行（CJK + 标点正常断行） */
.lamp-remark-inline {
  word-break: break-word;
  overflow-wrap: break-word;
}

.lamp-remark-inline small {
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* 已有的 lamp-group-tag 全局 break-all 在表格内不需要：让分组用 keep-all */
.lamp-task-table .lamp-group-tag {
  white-space: nowrap;
  word-break: keep-all;
}

/* 状态 chip 在表格内不要竖排 */
.lamp-task-table .lamp-status-chip,
.lamp-task-table .chip {
  white-space: nowrap;
}

/* 768px 移动端：表格隐藏（已由 .lamp-mf-desktop-only 控制），
   但保险起见把 min-width 重置，避免任何残留 wrap 撑爆。 */
@media (max-width: 768px) {
  .lamp-task-table {
    min-width: 0;
  }
}

/* 香灯照片审核与售香补充页面 */
.photo-grid,
.photo-review-list {
  display: grid;
  gap: 16px;
}

.photo-grid {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.photo-card,
.photo-review-item {
  border: 1px solid var(--line-soft, #e5e7eb);
  border-radius: 12px;
  background: #fff;
}

.photo-card {
  padding: 12px;
}

.photo-card img,
.photo-review-image img {
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid var(--line-soft, #e5e7eb);
}

.photo-review-item {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
  gap: 18px;
  padding: 18px;
}

.photo-review-info h3 {
  font-size: 28px;
  line-height: 1.2;
  margin: 10px 0 14px;
}

.photo-review-image {
  display: grid;
  align-content: start;
  gap: 10px;
}

@media (max-width: 768px) {
  .photo-review-item {
    grid-template-columns: 1fr;
    padding: 14px;
  }
}

/* =========================================================================
   香灯业务 incense-lamp 移动优先 UI 重构 — 追加段
   ---------------------------------------------------------------------------
   命名空间 .il-* （incense-lamp）独立于已有 .lamp-* / .rp-*。
   显示控制：.il-desktop-only 桌面端显示，.il-mobile-list 默认隐藏；
            @media (max-width: 768px) 切换。
   ========================================================================= */

/* ---- 默认显示控制 ----------------------------------------------------- */
.il-desktop-only { display: block; }
.il-mobile-list { display: none; }

/* ---- 通用按钮 / 标签 / 提示 ------------------------------------------ */
.il-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
  box-shadow: none;
  min-width: 0;
}

.il-btn:hover {
  border-color: var(--brand);
  color: var(--brand-strong);
  background: var(--brand-soft);
}

.il-btn--primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
  font-weight: 600;
  min-height: 44px;
  padding: 0 18px;
}

.il-btn--primary:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
  color: #ffffff;
}

.il-btn--ghost {
  background: transparent;
}

.il-submit {
  min-height: 44px;
  padding: 0 24px;
  background: var(--brand);
  color: #ffffff;
  border: 1px solid var(--brand);
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.il-submit:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
}

.il-required {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(245, 63, 63, 0.10);
  color: #b91c1c;
  font-style: normal;
  font-size: 10px;
  font-weight: 600;
}

.il-hint {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.55;
}

.il-order-no {
  display: inline-block;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  background: var(--surface-muted);
  border: 1px solid var(--border-soft);
  color: var(--text-muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12px;
  white-space: nowrap;
}

.il-group-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--radius-xs);
  background: rgba(51, 112, 255, 0.08);
  color: #245bdb;
  font-size: 12px;
  font-weight: 600;
  word-break: break-all;
  max-width: 100%;
}

/* 备注标签：售灯 / 售香统一为同一视觉（粉色 note 强调），避免一个像标签一个像段落 */
.il-remark-pill {
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(219, 39, 119, 0.10);
  color: #be185d;
  border: 1px solid rgba(219, 39, 119, 0.24);
  font-size: 11px;
  font-weight: 600;
}

.il-aliases {
  display: inline-block;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  background: var(--surface-muted);
  color: var(--text-muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 11px;
  word-break: break-all;
}

.il-share-url {
  display: inline-block;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  background: var(--surface-muted);
  color: var(--text-muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 11px;
  word-break: break-all;
  max-width: 100%;
}

.il-share-link-cell {
  display: grid;
  gap: 8px;
  min-width: 220px;
}

.il-share-link-cell .il-share-url {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.il-photo-chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text-muted);
  white-space: nowrap;
}

.il-photo-chip--ok   { background: rgba(22, 163, 74, 0.12);  color: #15803d; border-color: rgba(22, 163, 74, 0.28); }
.il-photo-chip--warn { background: rgba(245, 158, 11, 0.14); color: #b45309; border-color: rgba(245, 158, 11, 0.32); }
.il-photo-chip--off  { background: var(--surface-muted);     color: var(--text-muted); }

/* ---- 售香列表桌面表格增强 ------------------------------------------- */
.il-table {
  width: 100%;
}

.il-table thead th {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.il-table th.num,
.il-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.il-table--incense {
  min-width: 1000px;
}

.il-table--channels {
  min-width: 900px;
}

.il-channel-create-form {
  margin: 16px 0 18px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-solid);
}

.il-channel-actions {
  min-width: 220px;
}

.il-channel-actions,
.il-card__actions .il-inline-edit {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.il-inline-edit {
  min-width: 0;
}

.il-inline-edit summary {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--brand);
  background: var(--surface-solid);
  cursor: pointer;
  font-weight: 600;
  list-style-position: inside;
}

.il-inline-edit[open] {
  flex-basis: 100%;
}

.il-inline-edit[open] summary {
  margin-bottom: 10px;
}

.il-inline-edit .form-grid {
  min-width: min(560px, 100%);
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--surface-muted);
}

.il-row > td { vertical-align: middle; }

.il-row:hover > td { background: rgba(51, 112, 255, 0.04); }
.il-row--exception > td { background: rgba(245, 63, 63, 0.04); }
.il-row--completed > td { color: var(--text-muted); }
.il-row--archived > td { color: var(--text-muted); }

.il-cell-remark {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.il-cell-remark small {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.il-list-filter {
  align-items: center;
  gap: 8px;
}

.il-order-search-bar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto auto auto auto;
  align-items: end;
  gap: 8px;
  margin: 12px 0 10px;
}

.il-order-search-bar__query {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.il-order-search-bar__query input {
  width: 100%;
}

.il-order-filter-body {
  align-items: center;
  padding: 8px 0 0;
}

.il-order-filter-form {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.il-order-filter-form--wide {
  flex: 1 1 100%;
}

.il-order-filter-form label {
  margin: 0;
}

.il-order-filter-form select,
.il-order-filter-form input {
  min-height: 36px;
}

@media (max-width: 768px) {
  .il-order-search-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }

  .il-order-search-bar__query {
    grid-column: 1 / -1;
  }

  .il-order-search-bar .primary-button,
  .il-order-search-bar .ghost-button {
    justify-content: center;
    min-width: 0;
    width: 100%;
  }

  .il-order-filter-form,
  .il-order-filter-form--wide {
    width: 100%;
  }

  .il-order-filter-form .il-list-filter__label,
  .il-order-filter-form label {
    width: 100%;
  }

  .il-order-filter-form select,
  .il-order-filter-form input {
    width: 100%;
  }
}

.il-list-filter__label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.il-list-filter__check {
  margin: 0;
}

.il-list-panel { position: relative; }

/* ---- 售香列表移动卡 ------------------------------------------------- */
.il-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-solid);
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.il-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  border-radius: 12px 0 0 12px;
  background: var(--text-faint);
}

.il-card--pending::before    { background: #94a3b8; }
.il-card--accepted::before   { background: var(--brand); }
.il-card--processing::before { background: #245bdb; }
.il-card--completed::before  { background: #16a34a; }
.il-card--exception::before  { background: var(--danger); }
.il-card--archived::before   { background: #9ca3af; }
.il-card--channel::before    { background: var(--brand); }
.il-card--share::before      { background: #8b5cf6; }
.il-card--archived           { background: var(--surface-muted); }

.il-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.il-card__title {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.il-card__title strong {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
}

.il-card__title small {
  font-size: 12px;
  color: var(--text-muted);
}

.il-card__order {
  align-self: flex-start;
}

.il-card__address {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
  padding: 8px 10px;
  background: var(--surface-muted);
  border-radius: 6px;
  line-height: 1.55;
  word-break: break-all;
}

.il-card__addr-icon {
  flex-shrink: 0;
  color: var(--brand);
  font-size: 14px;
  font-weight: 700;
}

.il-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.il-card__facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  margin: 0;
  padding: 8px 0;
  border-top: 1px dashed var(--border-soft);
}

.il-card__facts > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.il-card__facts-wide { grid-column: 1 / -1; }

.il-card__facts dt {
  font-size: 11px;
  color: var(--text-muted);
}

.il-card__facts dd {
  margin: 0;
  font-size: 13px;
  color: var(--text);
  word-break: break-all;
}

.il-card__alerts {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.il-card__remark {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.28);
  color: #92400e;
  font-size: 12px;
  line-height: 1.55;
}

.il-card__remark strong { font-size: 12px; font-weight: 700; }

.il-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.il-card__actions .il-btn,
.il-card__actions form { flex: 1 1 auto; }
.il-card__actions form button { width: 100%; }

.il-empty { text-align: center; }
.il-empty__actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 12px;
}

/* ---- 新增售香 / 共用表单分组 ---------------------------------------- */
.il-form-panel { background: linear-gradient(180deg, rgba(51, 112, 255, 0.03), var(--surface-solid)); }

.il-form-header {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-soft);
}

.il-form-title {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.il-form-lead {
  margin: 0;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-muted);
}

.il-form-lead strong { color: var(--brand-strong); font-weight: 600; }

.il-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.il-section {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--surface-solid);
}

.il-section--customer  { border-left: 4px solid var(--brand); }
.il-section--plan      { border-left: 4px solid #16a34a; }
.il-section--execution { border-left: 4px solid #f59e0b; }

.il-section__title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 10px;
  padding: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.il-section__title small {
  width: 100%;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.55;
  margin-top: 2px;
}

.il-section__step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--brand);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
}

.il-section--plan      .il-section__step { background: #16a34a; }
.il-section--execution .il-section__step { background: #f59e0b; }

.il-section__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.il-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.il-field > span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.il-field--wide { grid-column: 1 / -1; }

.il-field input,
.il-field select,
.il-field textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface-solid);
  box-sizing: border-box;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.il-field textarea {
  min-height: 80px;
  line-height: 1.55;
  resize: vertical;
}

.il-field input:focus,
.il-field select:focus,
.il-field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}

.il-photo-check {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  background: var(--surface-muted);
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  cursor: pointer;
}

.il-photo-check > input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
}

.il-photo-check > span {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.il-form__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}

/* ---- 售香详情 hero --------------------------------------------------- */
.il-detail-hero {
  border-top: 4px solid var(--brand);
  padding: 20px 22px 18px;
  background: linear-gradient(180deg, rgba(51, 112, 255, 0.05), var(--surface-solid));
}

.il-detail-hero--pending    { border-top-color: #94a3b8;     background: linear-gradient(180deg, rgba(148, 163, 184, 0.06), var(--surface-solid)); }
.il-detail-hero--accepted   { border-top-color: var(--brand); background: linear-gradient(180deg, rgba(51, 112, 255, 0.05), var(--surface-solid)); }
.il-detail-hero--processing { border-top-color: #245bdb;     background: linear-gradient(180deg, rgba(36, 91, 219, 0.05), var(--surface-solid)); }
.il-detail-hero--completed  { border-top-color: #16a34a;     background: linear-gradient(180deg, rgba(22, 163, 74, 0.05), var(--surface-solid)); }
.il-detail-hero--exception  { border-top-color: var(--danger); background: linear-gradient(180deg, rgba(245, 63, 63, 0.05), var(--surface-solid)); }

.il-detail-hero__head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 16px;
}

.il-detail-hero__title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.il-detail-hero__title h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}

.il-detail-hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 12px;
  color: var(--text-muted);
}

.il-detail-hero__meta strong { color: var(--text); font-weight: 600; }

.il-detail-hero__metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px 24px;
}

.il-hero-metric {
  display: grid;
  gap: 4px;
}

.il-hero-metric__label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}

.il-hero-metric__value {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}

.il-hero-metric__value em {
  font-style: normal;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 2px;
}

.il-hero-metric__value--text {
  font-size: 17px;
  line-height: 1.35;
  word-break: break-all;
}

.il-hero-metric__note {
  font-size: 12px;
  color: var(--text-faint);
  line-height: 1.5;
}

.il-remark-panel {
  border-left: 4px solid #db2777;
  background: linear-gradient(180deg, rgba(219, 39, 119, 0.04), var(--surface-solid));
}

.il-remark-panel p {
  margin: 8px 0 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.65;
  word-break: break-word;
}

/* 备注为空时的统一提示（售灯 / 售香共用） */
.order-remark-empty {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

.il-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px 24px;
}

.il-detail-grid > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  background: var(--surface-muted);
}

.il-detail-grid > div > span.muted { font-size: 12px; }
.il-detail-grid > div > strong { font-weight: 500; color: var(--text); word-break: break-all; }

.il-warn-note { margin-top: 8px; }

/* ---- 售香详情：流程操作 ---------------------------------------------- */
.il-action-intro {
  background: linear-gradient(180deg, rgba(51, 112, 255, 0.05), var(--surface-solid));
  border-color: rgba(51, 112, 255, 0.18);
}

.il-action-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  margin-right: 8px;
  border-radius: 999px;
  background: var(--brand);
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.il-action-card { border-color: var(--border); }
.il-action-card--primary {
  border-left: 3px solid var(--brand);
  background: linear-gradient(180deg, rgba(51, 112, 255, 0.04), var(--surface-solid));
}
.il-action-card--exception {
  border-left: 3px solid var(--danger);
  background: linear-gradient(180deg, rgba(245, 63, 63, 0.03), var(--surface-solid));
}

.il-action-step {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 8px;
  margin-right: 6px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 11px;
  font-weight: 600;
}

.il-action-step--exception {
  background: rgba(245, 63, 63, 0.10);
  color: var(--danger);
}

.il-primary-action {
  background: var(--brand);
  color: #ffffff;
  border: 1px solid var(--brand);
  font-weight: 600;
  min-height: 44px;
}

.il-primary-action:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
}

/* ---- 售香详情：照片区 ----------------------------------------------- */
.il-photo-panel {
  background: linear-gradient(180deg, rgba(22, 163, 74, 0.03), var(--surface-solid));
}

.il-photo-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  margin-right: 8px;
  border-radius: 999px;
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(22, 163, 74, 0.22);
}

.il-photo-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--surface-solid);
  margin-bottom: 12px;
}

.il-photo-form__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.il-photo-form__grid > .il-field--wide { grid-column: 1 / -1; }

.il-photo-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.il-photo-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-solid);
  overflow: hidden;
}

.il-photo-card__img {
  display: block;
  aspect-ratio: 4 / 3;
  background: var(--surface-muted);
  overflow: hidden;
}

.il-photo-card__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease;
}

.il-photo-card__img:hover img { transform: scale(1.04); }

.il-photo-card__body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.il-photo-card__row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.il-photo-card__desc {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.55;
  word-break: break-word;
}

/* ---- 批量入口 .il-batch-* ------------------------------------------- */
.il-batch-panel { background: linear-gradient(180deg, rgba(51, 112, 255, 0.03), var(--surface-solid)); }

.il-batch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.il-tool {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-solid);
  min-width: 0;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.il-tool:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.il-tool--export     { border-left: 3px solid #16a34a; }
.il-tool--order      { border-left: 3px solid var(--brand); }
.il-tool--completion { border-left: 3px solid #f59e0b; }

.il-tool__head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.il-tool__icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 18px;
  font-weight: 700;
}

.il-tool--export     .il-tool__icon { background: rgba(22, 163, 74, 0.12);  color: #15803d; }
.il-tool--completion .il-tool__icon { background: rgba(245, 158, 11, 0.14); color: #b45309; }

.il-tool__head h4 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.il-tool__head p {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

.il-tool__file {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface-muted);
  border: 1px dashed var(--border-strong);
}

.il-tool__file-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.il-tool__file input[type="file"] {
  width: 100%;
  padding: 6px 0;
  font-size: 13px;
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--text);
}

.il-tool__file input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 0 12px;
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-solid);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.il-tool__file input[type="file"]::file-selector-button:hover {
  border-color: var(--brand);
  color: var(--brand-strong);
  background: var(--brand-soft);
}

.il-tool__hint {
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(51, 112, 255, 0.06);
  color: var(--text);
  font-size: 12px;
  line-height: 1.55;
  border: 1px solid rgba(51, 112, 255, 0.18);
}

.il-tool__action {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.il-tool__btn {
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: none;
}

.il-tool__btn--primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
}

.il-tool__btn--primary:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
  color: #ffffff;
}

.il-tool__btn--ghost { background: transparent; flex: 0 0 auto; }

/* ---- 照片审核工作台 -------------------------------------------------- */
.il-pr-intro {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.il-pr-tip {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(51, 112, 255, 0.05);
  border: 1px solid rgba(51, 112, 255, 0.22);
}

.il-pr-tip__icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--brand);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
}

.il-pr-tip strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.il-pr-tip p {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
}

.il-pr-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}

.il-pr-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 18px;
  padding: 18px;
  align-items: flex-start;
  scroll-margin-top: 96px;
}

.il-pr-item__info {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.il-pr-item__head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.il-pr-item__head h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
}

.il-pr-item__facts {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
}

.il-pr-item__facts > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.il-pr-item__facts dt {
  font-size: 11px;
  color: var(--text-muted);
}

.il-pr-item__facts dd {
  margin: 0;
  font-size: 13px;
  color: var(--text);
  word-break: break-all;
}

.il-pr-item__remark {
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.28);
  color: #92400e;
  font-size: 13px;
  line-height: 1.55;
}

.il-pr-item__remark strong {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #b45309;
  margin-bottom: 4px;
}

.il-pr-item__remark p { margin: 0; word-break: break-word; }

.il-pr-item__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 4px;
}

.il-pr-action {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  margin: 0;
}

.il-pr-action--approve {
  border-left: 3px solid #16a34a;
  background: linear-gradient(180deg, rgba(22, 163, 74, 0.04), var(--surface-solid));
}

.il-pr-action--reject {
  border-left: 3px solid var(--danger);
  background: linear-gradient(180deg, rgba(245, 63, 63, 0.04), var(--surface-solid));
}

.il-pr-reject-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.il-pr-reject-label input {
  width: 100%;
  min-height: 38px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  box-sizing: border-box;
}

.il-pr-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
  white-space: nowrap;
}

.il-pr-btn--primary {
  background: #16a34a;
  border-color: #16a34a;
  color: #ffffff;
}

.il-pr-btn--primary:hover {
  background: #15803d;
  border-color: #15803d;
}

.il-pr-btn--danger-ghost {
  background: transparent;
  border-color: rgba(245, 63, 63, 0.40);
  color: var(--danger);
}

.il-pr-btn--danger-ghost:hover {
  background: rgba(245, 63, 63, 0.06);
}

.il-pr-item__photo {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.il-pr-photo-link {
  position: relative;
  display: block;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-muted);
  border: 1px solid var(--border);
}

.il-pr-photo-link img {
  width: 100%;
  display: block;
  max-height: 480px;
  object-fit: contain;
  background: #0f172a;
}

.il-pr-photo-zoom {
  position: absolute;
  bottom: 8px;
  right: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.il-pr-photo-hint {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

/* ---- 外部链接管理 panel ---------------------------------------------- */
.il-share-panel { background: linear-gradient(180deg, rgba(139, 92, 246, 0.04), var(--surface-solid)); }

/* ---- 移动端 768 ------------------------------------------------------ */
@media (max-width: 768px) {
  .il-desktop-only { display: none !important; }
  .il-mobile-list { display: grid; gap: 12px; list-style: none; margin: 0; padding: 0; }

  .il-section__grid { grid-template-columns: 1fr; }
  .il-photo-form__grid { grid-template-columns: 1fr; }

  .il-form__actions {
    position: sticky;
    bottom: 12px;
    z-index: 2;
    background: linear-gradient(180deg, transparent 0%, var(--surface-solid) 30%);
    padding: 14px 0 6px;
    margin-top: 4px;
  }

  .il-submit { width: 100%; min-width: 0; }

  .il-list-filter {
    flex-wrap: wrap;
    width: 100%;
  }
  .il-list-filter__label,
  .il-list-filter__check { width: 100%; }
  .il-list-filter__label select { width: 100%; min-height: 40px; }

  /* 售香详情 hero metrics 改 2 列 */
  .il-detail-hero { padding: 16px 14px 14px; }
  .il-detail-hero__title h3 { font-size: 18px; }
  .il-detail-hero__metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .il-hero-metric__value { font-size: 18px; }
  .il-hero-metric__value--text { font-size: 15px; }

  /* 流程操作单列 */
  .il-action-grid { grid-template-columns: 1fr; }

  /* 批量入口工具卡单列 */
  .il-batch-grid { grid-template-columns: 1fr; gap: 10px; }
  .il-tool { padding: 14px; }
  .il-tool__action { flex-direction: column; align-items: stretch; }
  .il-tool__btn { width: 100%; }

  /* 审核对比改单列 */
  .il-pr-item { grid-template-columns: 1fr; gap: 14px; padding: 14px; }
  .il-pr-item__photo { order: -1; }  /* 移动端把照片放上面更直观 */
  .il-pr-item__head h3 { font-size: 16px; }
  .il-pr-photo-link img { max-height: 60vh; }

  /* 详情 grid 单列 */
  .il-detail-grid { grid-template-columns: 1fr; }

  /* 香品 / 渠道表格让 .table-wrap 滚动；卡片由 .il-mobile-list 接管 */
  .il-table--incense,
  .il-table--channels { min-width: 0; }
}

@media (max-width: 430px) {
  .il-batch-grid,
  .il-photo-grid { gap: 10px; }
  .il-photo-grid { grid-template-columns: 1fr 1fr; }
  .il-section { padding: 12px; }
  .il-section__step { width: 22px; height: 22px; font-size: 11px; }
}

@media (max-width: 390px) {
  .il-card { padding: 12px 12px 10px; }
  .il-card__title strong { font-size: 15px; }
  .il-card__facts { grid-template-columns: 1fr; }
  .il-pr-item__facts { grid-template-columns: 1fr; }
  .il-detail-hero__metrics { grid-template-columns: 1fr; }
  .il-photo-grid { grid-template-columns: 1fr; }
}

/* Smart order fill: local text parser preview for lamp/incense creation. */
.lamp-smart-fill {
  display: grid;
  gap: 16px;
  border-left: 4px solid var(--primary);
}

.lamp-smart-fill__header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.lamp-smart-fill__header h3 {
  margin: 0 0 6px;
  font-size: 18px;
}

.lamp-smart-fill__header p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.65;
}

.lamp-smart-fill__badge {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  color: #1d4ed8;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.lamp-smart-fill__input {
  display: grid;
  gap: 8px;
  font-weight: 800;
  color: var(--text-main);
}

.lamp-smart-fill__input textarea {
  min-height: 112px;
  resize: vertical;
  line-height: 1.65;
}

.lamp-smart-fill__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.lamp-smart-fill__actions button {
  min-height: 42px;
}

.lamp-smart-fill__actions small {
  color: var(--text-muted);
}

.lamp-smart-fill__status {
  min-height: 22px;
  color: var(--text-muted);
  font-weight: 700;
}

.lamp-smart-fill__status.is-error { color: #b91c1c; }
.lamp-smart-fill__status.is-success { color: #047857; }
.lamp-smart-fill__status.is-info { color: #1d4ed8; }

.lamp-smart-fill__results {
  display: grid;
  gap: 12px;
}

.lamp-smart-fill__summary {
  padding: 10px 12px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-weight: 800;
}

.lamp-smart-fill__warnings {
  margin: 0;
  padding: 10px 12px 10px 30px;
  border-radius: 10px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  font-weight: 700;
}

.lamp-smart-fill__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.lamp-smart-fill__field {
  padding: 12px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
}

.lamp-smart-fill__field.is-needs_confirm {
  border-color: #f59e0b;
  background: #fffbeb;
}

.lamp-smart-fill__field.is-missing {
  border-color: #e5e7eb;
  background: #f8fafc;
  color: var(--text-muted);
}

.lamp-smart-fill__field-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.lamp-smart-fill__field-head strong {
  font-size: 13px;
}

.lamp-smart-fill__field-head span {
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 800;
  background: #eef2ff;
  color: #4338ca;
  white-space: nowrap;
}

.lamp-smart-fill__field.is-needs_confirm .lamp-smart-fill__field-head span {
  background: #fef3c7;
  color: #92400e;
}

.lamp-smart-fill__field.is-missing .lamp-smart-fill__field-head span {
  background: #e5e7eb;
  color: #4b5563;
}

.lamp-smart-fill__field p {
  margin: 0;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.lamp-smart-fill__field small {
  display: block;
  margin-top: 8px;
  color: var(--text-muted);
  line-height: 1.5;
}

.lamp-smart-fill__results[hidden] {
  display: none;
}

.smart-fill-inline-hint {
  display: block;
  margin-top: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.45;
  font-weight: 700;
  background: #f8fafc;
  color: var(--text-muted);
  border: 1px solid #e2e8f0;
}

.smart-fill-inline-hint.is-high {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

.smart-fill-inline-hint.is-needs_confirm {
  background: #fffbeb;
  color: #92400e;
  border-color: #fcd34d;
}

.smart-fill-inline-hint.is-missing {
  background: #f8fafc;
  color: #475569;
  border-color: #cbd5e1;
}

.field.smart-fill-field-high input,
.field.smart-fill-field-high select,
.field.smart-fill-field-high textarea,
.il-field.smart-fill-field-high input,
.il-field.smart-fill-field-high select,
.il-field.smart-fill-field-high textarea {
  border-color: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.12);
}

.field.smart-fill-field-needs_confirm input,
.field.smart-fill-field-needs_confirm select,
.field.smart-fill-field-needs_confirm textarea,
.il-field.smart-fill-field-needs_confirm input,
.il-field.smart-fill-field-needs_confirm select,
.il-field.smart-fill-field-needs_confirm textarea,
.field.smart-fill-field-missing input,
.field.smart-fill-field-missing select,
.field.smart-fill-field-missing textarea,
.il-field.smart-fill-field-missing input,
.il-field.smart-fill-field-missing select,
.il-field.smart-fill-field-missing textarea {
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.14);
}

@media (max-width: 768px) {
  .lamp-smart-fill__header {
    display: grid;
  }

  .lamp-smart-fill__badge {
    width: max-content;
  }

  .lamp-smart-fill__actions {
    display: grid;
  }

  .lamp-smart-fill__actions button {
    width: 100%;
    min-height: 44px;
  }

  .lamp-smart-fill__grid {
    grid-template-columns: 1fr;
  }
}
.sc-help {
  display: inline-block;
  position: relative;
  margin-left: 6px;
  vertical-align: middle;
}

.sc-help > summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid #bfdbfe;
  color: #2563eb;
  background: #eff6ff;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}

.sc-help > summary::-webkit-details-marker {
  display: none;
}

.sc-help__body {
  position: absolute;
  z-index: 30;
  top: 28px;
  left: 0;
  width: min(320px, 80vw);
  padding: 12px 14px;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.14);
  color: #1f2937;
  line-height: 1.55;
}

.sc-help__body p {
  margin: 6px 0 0;
}

.sc-help__risk {
  color: #b45309;
  font-weight: 700;
}

.external-config-panel .checkbox-row {
  margin-top: 8px;
}

@media (max-width: 768px) {
  .sc-help {
    display: block;
    margin: 6px 0 0;
  }

  .sc-help__body {
    position: static;
    width: 100%;
    margin-top: 8px;
    box-shadow: none;
  }
}

.photo-match-controls {
  display: grid;
  gap: 10px;
  min-width: 220px;
}

.photo-match-controls label {
  display: grid;
  gap: 4px;
  font-size: 13px;
  color: #475569;
}

.photo-match-controls select,
.photo-match-controls input[type="text"],
.photo-match-controls input[inputmode="numeric"],
.photo-match-controls input:not([type]) {
  width: 100%;
  min-height: 38px;
  border: 1px solid #d8dee9;
  border-radius: 10px;
  padding: 8px 10px;
  background: #fff;
}

.photo-match-controls .inline-check {
  display: flex;
  grid-template-columns: none;
  align-items: flex-start;
  gap: 8px;
  min-height: 32px;
}

.photo-match-controls .inline-check input {
  width: auto;
  margin-top: 3px;
}

.photo-match-controls small {
  line-height: 1.45;
}

.photo-upload-choice {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.photo-upload-choice .field {
  margin: 0;
  padding: 14px;
  border: 1px solid #dbeafe;
  border-radius: 14px;
  background: #f8fbff;
}

.label-print-form {
  display: grid;
  gap: 18px;
}

.label-print-form fieldset {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 18px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #ffffff;
}

.label-print-form legend {
  padding: 0 8px;
  color: #0f172a;
  font-size: 16px;
  font-weight: 900;
}

.label-print-form .form-grid.four {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.label-print-form .field.wide {
  grid-column: span 2;
}

.label-print-form select,
.label-print-form input {
  min-height: 42px;
}

.label-print-form .notice-panel {
  margin: 0;
}

.label-print-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.label-print-check input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--brand);
}

.lamp-bulk-mode-hint {
  margin: 12px 0 16px;
}

.lamp-task-table .label-print-check,
.lamp-mf-card .label-print-check {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #f8fafc;
}

@media (max-width: 768px) {
  .photo-upload-choice {
    grid-template-columns: 1fr;
  }

  .label-print-form fieldset {
    padding: 14px;
  }

  .label-print-form .form-grid.four {
    grid-template-columns: 1fr;
  }

  .label-print-form .field.wide {
    grid-column: auto;
  }

  .lamp-mf-card .label-print-check {
    min-height: 44px;
    padding: 10px 12px;
    font-size: 14px;
  }

  .lamp-mf-card .label-print-check input {
    width: 20px;
    height: 20px;
  }
}

/* ---- 标签模板设计器基础能力 ------------------------------------------ */
.label-template-manager tr.is-selected {
  background: #eef6ff;
}

.label-settings-overview {
  display: grid;
  gap: 14px;
}

.label-settings-overview__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.label-settings-actions {
  position: sticky;
  top: 8px;
  z-index: 8;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 8px 18px rgba(15, 23, 42, .08);
}

.ghost-button.is-disabled {
  cursor: not-allowed;
  opacity: .58;
}

.label-settings-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.label-settings-summary-grid > div {
  display: grid;
  gap: 4px;
  min-height: 74px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.label-settings-summary-grid span {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.label-settings-summary-grid strong {
  color: #0f172a;
  font-size: 13px;
  line-height: 1.45;
}

.label-settings-fold {
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #ffffff;
}

.label-settings-fold > summary,
.label-calibration-drawer > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 10px 12px;
  color: #0f172a;
  font-weight: 900;
  cursor: pointer;
  list-style: none;
}

.label-settings-fold > summary::-webkit-details-marker,
.label-calibration-drawer > summary::-webkit-details-marker {
  display: none;
}

.label-settings-fold > summary::after,
.label-calibration-drawer > summary::after {
  content: "展开";
  flex: 0 0 auto;
  min-width: 44px;
  text-align: center;
  color: #2563eb;
  font-size: 12px;
}

.label-settings-fold[open] > summary::after,
.label-calibration-drawer[open] > summary::after {
  content: "收起";
}

.label-settings-fold > summary em,
.label-calibration-drawer > summary em {
  color: #64748b;
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  text-align: right;
}

.label-settings-fold > :not(summary),
.label-calibration-drawer > :not(summary) {
  margin: 0 12px 12px;
}

.label-template-default-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.label-scene-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.label-scene-tabs .ghost-button {
  min-height: 34px;
  padding: 6px 10px;
}

.label-scene-tabs .ghost-button.is-active {
  border-color: #111827;
  background: #111827;
  color: #ffffff;
}

.label-template-default-form,
.label-element-form {
  align-items: end;
  gap: 10px;
}

.label-element-form {
  padding: 12px 0;
  border-top: 1px solid #e5e7eb;
}

.label-element-form:first-of-type {
  border-top: 0;
}

.label-element-form-new {
  margin-top: 14px;
  padding-top: 16px;
}

.label-field-library {
  display: grid;
  gap: 10px;
  margin: 12px 0 16px;
  padding: 12px;
  border: 1px solid #d7e0ea;
  border-radius: 8px;
  background: #f8fafc;
}

.label-field-library__title {
  color: #334155;
  font-size: 13px;
  font-weight: 900;
}

.label-field-library__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.label-field-chip {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #ffffff;
  color: #0f172a;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.label-field-chip:hover,
.label-field-chip:focus-visible {
  border-color: #2563eb;
  color: #1d4ed8;
  outline: none;
}

.label-designer-shell {
  display: grid;
  gap: 8px;
  margin: 12px 0 18px;
}

.label-designer-ruler {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.label-designer-canvas {
  position: relative;
  width: min(100%, calc(var(--label-width-mm) * 3px));
  aspect-ratio: var(--label-width-mm) / var(--label-height-mm);
  min-height: 160px;
  border: 1px dashed #94a3b8;
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
  touch-action: pan-y;
}

.label-template-grid-settings {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #d7e0ea;
  border-radius: 8px;
  background: #f8fafc;
}

.label-template-grid-settings legend {
  padding: 0 6px;
  color: #334155;
  font-size: 13px;
  font-weight: 900;
}

.label-template-grid {
  position: absolute;
  inset: 0;
  z-index: 1;
  box-sizing: border-box;
  border: var(--template-grid-line-width, .2mm) solid var(--template-grid-line-color, #111827);
  pointer-events: none;
}

.label-template-grid--no-outer {
  border: 0;
}

.label-template-grid__line {
  position: absolute;
  display: block;
  box-sizing: border-box;
  pointer-events: none;
}

.label-template-grid__line--h {
  left: 0;
  right: 0;
  top: 50%;
  border-top: var(--template-grid-line-width, .2mm) solid var(--template-grid-line-color, #111827);
}

.label-template-grid__line--v {
  top: 0;
  bottom: 0;
  left: 50%;
  border-left: var(--template-grid-line-width, .2mm) solid var(--template-grid-line-color, #111827);
}

.label-designer-canvas.is-helper-grid-visible {
  background:
    linear-gradient(to right, rgba(148, 163, 184, .16) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148, 163, 184, .16) 1px, transparent 1px),
    #ffffff;
  background-size: 5mm 5mm;
}

.label-calibration-panel .toolbar-note + .toolbar-note {
  margin-top: 4px;
}

.label-calibration-form {
  display: grid;
  gap: 12px;
}

.label-calibration-status-card {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #f8fbff;
  padding: 14px;
}

.label-calibration-status-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.label-calibration-status-card__head strong {
  color: var(--ink);
  font-size: 15px;
}

.label-calibration-status-actions,
.label-calibration-status-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.label-calibration-status-grid > div {
  display: grid;
  gap: 3px;
  min-width: 150px;
  flex: 1 1 150px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #ffffff;
  padding: 10px;
}

.label-calibration-status-grid span {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.label-calibration-status-grid strong {
  color: #0f172a;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.label-background-entry {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(260px, 1.2fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #f8fafc;
  padding: 14px;
}

.label-background-entry strong {
  color: var(--ink);
  font-size: 14px;
}

.label-background-entry .toolbar-note {
  margin: 4px 0 0;
}

.label-background-entry__form,
.label-background-entry__delete {
  display: grid;
  gap: 10px;
}

.label-calibration-help,
.label-calibration-upload,
.label-calibration-advanced,
.label-calibration-drawer {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #ffffff;
  padding: 10px 12px;
}

.label-calibration-help summary,
.label-calibration-upload summary,
.label-calibration-advanced summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--ink);
}

.label-calibration-help p,
.label-calibration-advanced p {
  margin: 8px 0 0;
}

.label-calibration-steps {
  display: grid;
  gap: 12px;
}

.label-calibration-step {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
}

.label-calibration-step--wide {
  display: grid;
  gap: 12px;
}

.label-calibration-step__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.label-calibration-step__head strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 13px;
}

.label-calibration-step__head span {
  font-size: 16px;
  font-weight: 900;
  color: var(--ink);
}

.label-calibration-scenarios,
.label-calibration-control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.label-calibration-scenario,
.label-calibration-control-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
}

.label-calibration-scenario {
  cursor: pointer;
}

.label-calibration-scenario.is-selected {
  border-color: var(--brand);
  background: #eff6ff;
}

.label-calibration-scenario input {
  width: auto;
}

.label-calibration-scenario__title {
  font-weight: 900;
  color: var(--ink);
}

.label-calibration-scenario em,
.label-calibration-control-card p,
.label-calibration-live-preview p {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.label-calibration-actions,
.label-calibration-nudge,
.label-calibration-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.label-calibration-nudge button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  border-radius: 6px;
}

.label-calibration-legend {
  margin-top: 10px;
}

.label-calibration-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 6px;
  background: #f8fafc;
  color: var(--ink);
  font-size: 12px;
}

.label-calibration-legend i {
  display: inline-block;
  width: 18px;
  height: 10px;
}

.legend-paper { border: 2px solid #dc2626; }
.legend-label { border: 2px solid #2563eb; }
.legend-grid {
  background:
    linear-gradient(to right, #cbd5e1 1px, transparent 1px),
    linear-gradient(to bottom, #cbd5e1 1px, transparent 1px);
  background-size: 5px 5px;
}
.legend-cross {
  background:
    linear-gradient(to right, transparent 8px, #111827 8px, #111827 10px, transparent 10px),
    linear-gradient(to bottom, transparent 4px, #111827 4px, #111827 6px, transparent 6px);
}
.legend-field { border: 1px dashed #111827; }
.legend-bg { background: #fee2e2; border: 1px solid #fca5a5; }

.label-calibration-live-preview {
  display: grid;
  gap: 8px;
}

.label-calibration-live-paper {
  position: relative;
  min-height: 160px;
  overflow: hidden;
  border: 2px solid #dc2626;
  border-radius: 8px;
  background:
    linear-gradient(to right, rgba(148, 163, 184, .20) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148, 163, 184, .20) 1px, transparent 1px),
    #ffffff;
  background-size: 12px 12px;
}

.label-calibration-live-paper::before,
.label-calibration-live-paper::after {
  content: "";
  position: absolute;
  background: #111827;
  opacity: .65;
}

.label-calibration-live-paper::before {
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
}

.label-calibration-live-paper::after {
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
}

.label-calibration-live-output {
  position: absolute;
  left: 28px;
  top: 24px;
  width: min(72%, 360px);
  height: 110px;
  border: 2px solid #2563eb;
  border-radius: 6px;
  transform: translate(var(--print-x-offset-preview), var(--print-y-offset-preview)) scale(var(--print-scale-x-preview), var(--print-scale-y-preview));
  transform-origin: top left;
}

.label-calibration-live-bg {
  position: absolute;
  inset: 8px;
  border: 1px solid #fecaca;
  background: #fee2e2;
  color: #991b1b;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.label-calibration-live-text-layer {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 16px;
  transform: translate(var(--text-x-offset-preview), var(--text-y-offset-preview));
  transform-origin: top left;
  color: #111827;
  font-size: 12px;
  font-weight: 800;
}

.label-calibration-background {
  position: absolute;
  box-sizing: border-box;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.label-calibration-background--designer {
  max-width: none;
}

.label-compact-help {
  padding: 10px 12px;
}

.label-print-log-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.label-print-log-pager span {
  color: #475569;
  font-size: 13px;
  font-weight: 800;
}

.label-print-log-pager button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.label-designer-item {
  position: absolute;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  min-width: 10px;
  min-height: 8px;
  padding: 2px 4px;
  border: 1px solid #2563eb;
  border-radius: 4px;
  background: rgba(219, 234, 254, .82);
  color: #0f172a;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  overflow: hidden;
  cursor: grab;
  user-select: none;
}

.label-designer-item:focus-visible,
.label-designer-item.is-selected {
  outline: 2px solid #f59e0b;
  outline-offset: 1px;
}

.label-designer-item.is-dragging {
  cursor: grabbing;
  opacity: .86;
}

.label-designer-item.is-locked {
  border-color: #94a3b8;
  background: rgba(226, 232, 240, .82);
  cursor: default;
}

.label-designer-item--line {
  padding: 0;
  background: transparent;
}

.label-designer-line {
  display: block;
  width: 100%;
  height: 0;
  border-top: 2px solid #111827;
}

.label-designer-line--vertical {
  width: 0;
  height: 100%;
  border-top: 0;
  border-left: 2px solid #111827;
}

.label-template-editor .form-actions,
.label-template-elements .form-actions,
.label-preview-toolbar .form-actions {
  flex-wrap: wrap;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
}

.checkbox-field input {
  width: auto;
}

@media (max-width: 768px) {
  .label-template-default-grid {
    grid-template-columns: 1fr;
  }

  .label-template-default-form,
  .label-element-form {
    align-items: stretch;
  }

  .label-template-editor .form-actions > *,
  .label-template-elements .form-actions > * {
    flex: 1 1 100%;
  }

  .label-field-chip {
    flex: 1 1 calc(50% - 8px);
  }

  .label-designer-canvas {
    width: 100%;
    min-height: 180px;
  }

  .label-preview-toolbar .form-actions > * {
    flex: 1 1 auto;
  }
}

.label-paper-settings {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.label-paper-settings__summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-bottom: 12px;
  color: #475569;
}

.label-paper-settings__summary strong {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  font-size: 16px;
}

.label-novice-guide {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.label-novice-guide__step {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid #d7e0ea;
  border-radius: 8px;
  background: #ffffff;
  color: #334155;
  font-weight: 800;
}

.label-novice-guide__step strong {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #0f766e;
  color: #ffffff;
  font-size: 14px;
}

.label-designer-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 360px);
  grid-template-areas:
    "library panel"
    "canvas panel";
  gap: 14px;
  align-items: start;
  margin-top: 14px;
}

.label-designer-workbench .label-field-library {
  grid-area: library;
  position: static;
  margin: 0;
  align-self: start;
}

.label-field-library__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 240px);
  gap: 10px;
  align-items: end;
}

.label-field-library__head .toolbar-note {
  margin-top: 2px;
}

.label-field-search {
  display: grid;
  gap: 5px;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
}

.label-field-search input {
  min-height: 34px;
}

.label-field-library__section-title {
  color: #64748b;
  font-size: 12px;
  font-weight: 900;
}

.label-field-chip--pinned {
  border-color: #0f766e;
  background: #ecfdf5;
  color: #115e59;
}

.label-field-chip[hidden] {
  display: none;
}

.label-designer-workbench .label-field-library__chips:not(.label-field-library__chips--pinned) {
  max-height: 88px;
  overflow: auto;
  padding-bottom: 2px;
}

.label-designer-shell {
  grid-area: canvas;
  min-width: 0;
}

.label-property-panel {
  grid-area: panel;
}

.label-designer-toolbar,
.label-element-quickbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.label-designer-toolbar {
  padding: 10px 12px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #ffffff;
}

.label-designer-toolbar__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  align-items: center;
}

.label-designer-toolbar__actions .ghost-button,
.label-designer-toolbar__actions button {
  min-height: 34px;
}

.label-designer-toolbar__actions button:disabled {
  cursor: not-allowed;
  opacity: .48;
}

.label-designer-toolbar strong,
.label-property-panel__head strong {
  display: block;
  color: #0f172a;
}

.label-zoom-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #475569;
  font-weight: 800;
}

.label-zoom-control select {
  min-height: 34px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 4px 8px;
  background: #ffffff;
}

.label-element-quickbar {
  justify-content: flex-start;
  min-height: 42px;
  padding: 8px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #f8fbff;
}

.label-element-quickbar[hidden] {
  display: none;
}

.label-element-quickbar button {
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #ffffff;
  color: #0f172a;
  font-size: 12px;
  font-weight: 800;
}

.label-designer-stage {
  min-height: 560px;
  padding: 42px;
  overflow: auto;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(148, 163, 184, .13) 1px, transparent 1px),
    linear-gradient(0deg, rgba(148, 163, 184, .13) 1px, transparent 1px),
    #eef3f8;
  background-size: 24px 24px;
}

.label-designer-canvas-frame {
  position: relative;
  min-width: max-content;
  min-height: max-content;
  margin: 0 auto;
}

.label-designer-canvas {
  width: calc(var(--label-width-mm) * 1mm);
  height: calc(var(--label-height-mm) * 1mm);
  min-height: 0;
  aspect-ratio: auto;
  border: 1px solid #64748b;
  border-radius: 2px;
  background: #ffffff;
  box-shadow: 0 16px 36px rgba(15, 23, 42, .18);
  overflow: hidden;
  transform-origin: top left;
  touch-action: none;
}

.label-designer-canvas .label-template-grid {
  z-index: 1;
}

.label-preview-card .label-template-grid {
  z-index: 1;
}

.label-calibration-background--designer {
  z-index: 0;
}

.label-designer-item {
  display: block;
  min-width: 1mm;
  min-height: 1mm;
  padding: .15mm .35mm;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  font-weight: 400;
  cursor: grab;
}

.label-designer-item > span:not(.label-designer-resize-handle) {
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.label-designer-item--address > span:not(.label-designer-resize-handle) {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
}

.label-designer-item--field {
  background: rgba(255, 255, 255, .08);
}

.label-designer-item--grid_table {
  padding: 0;
  background: rgba(255, 255, 255, .86);
}

.label-designer-grid-table {
  display: grid !important;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: .2mm solid #111827;
  background: #ffffff;
  color: #111827;
  font-size: 6pt;
  line-height: 1.1;
}

.label-designer-grid-table i {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 0;
  padding: .45mm;
  border: .12mm solid #111827;
  font-style: normal;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.label-designer-item:hover {
  border-color: rgba(37, 99, 235, .36);
  background: rgba(239, 246, 255, .45);
}

.label-designer-item:focus-visible,
.label-designer-item.is-selected {
  border-color: #2563eb;
  outline: 1px solid #2563eb;
  outline-offset: 0;
  background: rgba(239, 246, 255, .62);
}

.label-designer-item.is-dragging {
  cursor: grabbing;
}

.label-designer-item.is-locked {
  border-color: rgba(148, 163, 184, .7);
  background: rgba(226, 232, 240, .28);
}

.label-designer-resize-handle {
  position: absolute;
  right: -4px;
  bottom: -4px;
  display: none;
  width: 8px;
  height: 8px;
  border: 1px solid #ffffff;
  border-radius: 50%;
  background: #2563eb;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .28);
  cursor: nwse-resize;
}

.label-designer-item.is-selected .label-designer-resize-handle {
  display: block;
}

.label-property-panel {
  position: sticky;
  top: 12px;
  display: grid;
  gap: 12px;
  max-height: calc(100vh - 120px);
  overflow: auto;
  padding: 12px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #ffffff;
}

.label-property-panel__head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.label-property-panel__head span {
  color: #64748b;
  font-size: 12px;
}

.label-font-note {
  margin: -4px 0 0;
}

.label-property-form {
  display: none;
  padding-top: 0;
  border-top: 0;
}

.label-property-form.is-active {
  display: block;
}

.label-property-main-grid {
  padding-bottom: 4px;
}

.label-property-section-title {
  margin-bottom: 8px;
  color: #334155;
  font-size: 13px;
  font-weight: 900;
}

.label-grid-table-settings,
.label-grid-table-add {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #f8fafc;
}

.label-grid-table-add summary {
  cursor: pointer;
  color: #334155;
  font-size: 13px;
  font-weight: 900;
}

.label-grid-cell-editor {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.label-grid-cell-editor__row {
  display: grid;
  grid-template-columns: minmax(48px, .45fr) repeat(4, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
  padding: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #ffffff;
}

.label-grid-cell-editor__pos {
  align-self: center;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.label-address-property-hint {
  margin: 0 0 10px;
  padding: 10px 12px;
}

.label-property-main-actions {
  margin: 8px 0 10px;
}

.label-property-advanced {
  border-top: 1px dashed #dbe3ef;
  padding-top: 10px;
}

.label-property-advanced summary,
.label-manual-add summary {
  cursor: pointer;
  color: #334155;
  font-size: 13px;
  font-weight: 900;
}

.label-property-advanced[open] summary {
  margin-bottom: 10px;
}

.label-property-panel .form-grid.four {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.label-property-panel .field.wide {
  grid-column: 1 / -1;
}

.label-property-panel .label-element-form-new {
  display: block;
  margin-top: 0;
  padding-top: 12px;
  border-top: 1px dashed #dbe3ef;
}

.label-manual-add {
  margin-top: 2px;
  padding-top: 12px;
  border-top: 1px dashed #dbe3ef;
}

@media (max-width: 1180px) {
  .label-designer-workbench {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "library"
      "canvas"
      "panel";
  }

  .label-designer-workbench .label-field-library,
  .label-property-panel {
    position: static;
    max-height: none;
  }
}

@media (max-width: 768px) {
  .label-settings-overview__head,
  .label-settings-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .label-settings-actions {
    position: static;
  }

  .label-settings-fold > summary,
  .label-calibration-drawer > summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .label-settings-fold > summary em,
  .label-calibration-drawer > summary em {
    text-align: left;
  }

  .label-novice-guide {
    grid-template-columns: 1fr;
  }

  .label-field-library__head {
    grid-template-columns: 1fr;
  }

  .label-designer-stage {
    min-height: 320px;
    padding: 22px;
  }

  .label-property-panel .form-grid.four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .label-grid-cell-editor__row {
    grid-template-columns: 1fr;
  }

  .label-calibration-scenarios,
  .label-calibration-control-grid {
    grid-template-columns: 1fr;
  }

  .label-background-entry {
    grid-template-columns: 1fr;
  }

  .label-calibration-actions > *,
  .label-calibration-nudge button {
    width: 100%;
  }
}

@media print {
  .label-calibration-background {
    display: none !important;
  }
}
/* Incense-lamp photo review manual binding */
.il-pr-manual-bind {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed #dbe3ef;
}

.il-pr-bind-search {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.il-pr-bind-search label {
  display: grid;
  gap: 6px;
  color: #475569;
  font-weight: 700;
}

.il-pr-bind-search input,
.il-pr-bind-result input[type="text"],
.il-pr-bind-result input:not([type]) {
  min-height: 40px;
  border: 1px solid #d9e2ef;
  border-radius: 10px;
  padding: 8px 10px;
}

.il-pr-bind-results {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.il-pr-bind-result {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(160px, 220px) minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid #dbeafe;
  border-radius: 14px;
  background: #f8fbff;
}

.il-pr-bind-result strong,
.il-pr-bind-result small {
  display: block;
}

.il-pr-bind-result small {
  margin-top: 4px;
  color: #64748b;
  line-height: 1.45;
}

.il-pr-bind-confirm {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  color: #475569;
  font-weight: 700;
}

@media (max-width: 768px) {
  .il-pr-bind-search,
  .il-pr-bind-result {
    grid-template-columns: 1fr;
  }
}

/* Photo upload auto-match review workbench */
.photo-upload-review {
  display: grid;
  gap: 20px;
}

.photo-upload-review__list {
  display: grid;
  gap: 18px;
}

.photo-upload-review__card {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

.photo-upload-review__card.is-warning {
  border-color: #f59e0b;
  box-shadow: 0 18px 45px rgba(245, 158, 11, 0.12);
}

.photo-upload-review__card.is-caution {
  border-color: #facc15;
}

.photo-upload-review__card.is-confidence-high {
  border-color: #22c55e;
  box-shadow: 0 18px 45px rgba(34, 197, 94, 0.12);
}

.photo-upload-review__card.is-confidence-medium {
  border-color: #f59e0b;
  box-shadow: 0 18px 45px rgba(245, 158, 11, 0.1);
}

.photo-upload-review__card.is-confidence-low {
  border-color: #ef4444;
  box-shadow: 0 18px 45px rgba(239, 68, 68, 0.12);
}

.photo-upload-review__card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  border-bottom: 1px solid #e5e7eb;
}

.photo-upload-review__card-head strong {
  display: block;
  font-size: 18px;
  color: #0f172a;
}

.photo-upload-review__card-head p {
  margin: 4px 0 0;
  color: #64748b;
}

.photo-upload-review__compare {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
  gap: 20px;
  padding: 20px;
}

.photo-upload-review__left,
.photo-upload-review__right {
  min-width: 0;
  display: grid;
  gap: 16px;
  align-content: start;
}

.photo-upload-review__order,
.photo-upload-review__manual,
.photo-upload-review__candidates,
.photo-upload-review__image,
.photo-upload-review__ocr,
.photo-upload-review__controls {
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #fff;
  padding: 16px;
}

.photo-upload-review__eyebrow {
  margin-bottom: 8px;
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
}

.photo-upload-review__order-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.photo-upload-review__order-head strong {
  font-size: 24px;
  color: #111827;
}

.photo-upload-review__facts,
.photo-upload-review__meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.photo-upload-review__facts div,
.photo-upload-review__meta div {
  min-width: 0;
}

.photo-upload-review__facts .is-wide,
.photo-upload-review__meta .is-wide {
  grid-column: 1 / -1;
}

.photo-upload-review__facts dt,
.photo-upload-review__meta dt {
  margin-bottom: 4px;
  color: #64748b;
  font-size: 13px;
}

.photo-upload-review__facts dd,
.photo-upload-review__meta dd {
  margin: 0;
  color: #0f172a;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.photo-upload-review__empty {
  border-radius: 12px;
  background: #fff7ed;
  padding: 14px;
  color: #9a3412;
}

.photo-upload-review__empty p {
  margin: 6px 0 0;
}

.photo-upload-review__candidate-list,
.photo-upload-review__search-results {
  display: grid;
  gap: 10px;
}

.photo-upload-review__candidate {
  justify-content: flex-start;
  height: auto;
  min-height: 48px;
  padding: 10px 12px;
  text-align: left;
  white-space: normal;
}

.photo-upload-review__candidate.is-recommended {
  border-color: #93c5fd;
  background: #eff6ff;
}

.photo-upload-review__candidate span,
.photo-upload-review__candidate small {
  display: block;
}

.photo-upload-review__candidate small {
  margin-top: 2px;
  color: #64748b;
}

.photo-upload-review__more-candidates {
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
  padding: 10px;
}

.photo-upload-review__more-candidates > summary {
  cursor: pointer;
  min-height: 40px;
  color: #2563eb;
  font-weight: 700;
}

.photo-upload-review__more-candidates > .photo-upload-review__candidate-list {
  margin-top: 10px;
}

.photo-upload-review__search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 10px;
}

.photo-upload-review__search input {
  min-height: 44px;
}

.photo-upload-review__image {
  margin: 0;
}

.photo-upload-review__image a {
  display: block;
  border-radius: 14px;
  background: #f8fafc;
  overflow: hidden;
}

.photo-upload-review__image img {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: contain;
}

.photo-upload-review__image figcaption {
  margin-top: 8px;
  color: #64748b;
  font-size: 13px;
}

.photo-upload-review__ocr summary {
  cursor: pointer;
  font-weight: 700;
}

.photo-upload-review__ocr pre {
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border-radius: 12px;
  background: #0f172a;
  color: #e2e8f0;
  padding: 12px;
}

.photo-upload-review__controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 0 20px 20px;
  background: #f8fafc;
}

.photo-upload-review__controls label {
  min-width: 0;
}

.photo-upload-review__controls .inline-check,
.photo-upload-review__controls .warning-text,
.photo-upload-review__controls .toolbar-note {
  grid-column: 1 / -1;
}

@media (max-width: 900px) {
  .photo-upload-review__compare {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .photo-upload-review__card-head,
  .photo-upload-review__order-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .photo-upload-review__compare,
  .photo-upload-review__controls {
    padding: 14px;
    margin: 0;
  }

  .photo-upload-review__facts,
  .photo-upload-review__meta,
  .photo-upload-review__controls,
  .photo-upload-review__search {
    grid-template-columns: 1fr;
  }

  .photo-upload-review__image img {
    max-height: 420px;
  }
}

/* 当前页照片放大查看器：用于照片审核、上传预检、售灯/售香详情 */
.photo-lightbox-open {
  overflow: hidden;
}

.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
  padding: 20px;
}

.photo-lightbox.is-open {
  display: grid;
  place-items: center;
}

.photo-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(4px);
}

.photo-lightbox__panel {
  position: relative;
  z-index: 1;
  width: min(1080px, 96vw);
  height: min(820px, 92dvh);
  max-height: calc(100vh - 32px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border-radius: 16px;
  background: #0f172a;
  color: #ffffff;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.42);
  overflow: hidden;
}

.photo-lightbox__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(15, 23, 42, 0.96);
}

.photo-lightbox__title {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
}

.photo-lightbox__hint {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
}

.photo-lightbox__hint::after {
  content: " 默认已适应屏幕。";
}

.photo-lightbox__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.photo-lightbox__actions button,
.photo-lightbox__original {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.photo-lightbox__actions button:hover,
.photo-lightbox__original:hover,
.photo-lightbox__actions button:focus-visible,
.photo-lightbox__original:focus-visible {
  background: rgba(255, 255, 255, 0.16);
  outline: 2px solid rgba(96, 165, 250, 0.85);
  outline-offset: 2px;
}

.photo-lightbox__stage {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: contain;
  padding: 16px;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.04) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.04) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.04) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.04) 75%);
  background-size: 22px 22px;
  background-position: 0 0, 0 11px, 11px -11px, -11px 0;
}

.photo-lightbox__image {
  position: absolute;
  left: 50%;
  top: 50%;
  display: block;
  max-width: none;
  max-height: none;
  width: auto;
  height: auto;
  object-fit: contain;
  cursor: grab;
  touch-action: none;
  user-select: none;
  transform-origin: center center;
  transition: transform 0.08s ease-out;
}

.photo-lightbox__image[hidden] {
  display: none;
}

.photo-lightbox__image.is-dragging {
  cursor: grabbing;
  transition: none;
}

.photo-lightbox__loading,
.photo-lightbox__error {
  padding: 16px 18px;
  border-radius: 12px;
  font-weight: 700;
  text-align: center;
}

.photo-lightbox__loading {
  background: rgba(59, 130, 246, 0.14);
  border: 1px solid rgba(96, 165, 250, 0.45);
  color: #dbeafe;
}

.photo-lightbox__error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.45);
  color: #fecaca;
}

[data-photo-lightbox],
[data-il-photo-open] {
  cursor: zoom-in;
}

@media (max-width: 768px) {
  .photo-lightbox {
    padding: 0;
  }

  .photo-lightbox__panel {
    width: 100dvw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .photo-lightbox__toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .photo-lightbox__actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
  }

  .photo-lightbox__actions button,
  .photo-lightbox__original {
    min-height: 44px;
    padding: 0 8px;
    font-size: 12px;
    justify-content: center;
    display: inline-flex;
    align-items: center;
  }

  .photo-lightbox__hint {
    font-size: 11px;
  }

  .photo-lightbox__stage {
    padding: 10px;
  }
}

.mini-pagination button.page-link {
  border: 1px solid #d9e2ef;
  background: #fff;
  cursor: pointer;
}

.mini-pagination button.page-link.current {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
  cursor: default;
}

/* 售灯页顶部批量工具：默认收起，避免把订单页撑成表格工具页 */
.lamp-compact-tool-panel {
  overflow: hidden;
  padding: 0;
}

.lamp-compact-tools {
  display: block;
}

.lamp-compact-tools__summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  gap: 10px;
  list-style: none;
  min-height: 58px;
  padding: 14px 18px;
}

.lamp-compact-tools__summary::-webkit-details-marker {
  display: none;
}

.lamp-compact-tools__summary::after {
  background: #f8fafc;
  border: 1px solid #d9e2ef;
  border-radius: 999px;
  color: #37516d;
  content: "展开";
  font-size: 12px;
  font-weight: 700;
  margin-left: auto;
  padding: 5px 12px;
}

.lamp-compact-tools[open] .lamp-compact-tools__summary::after {
  content: "收起";
}

.lamp-compact-tools__title {
  color: #111827;
  font-weight: 800;
}

.lamp-compact-tools__summary small {
  color: #64748b;
  font-size: 13px;
  line-height: 1.45;
}

.lamp-compact-tools__body {
  border-top: 1px solid #e5edf6;
  display: grid;
  gap: 14px;
  padding: 16px 18px 18px;
}

.lamp-compact-tools__body .filter-grid,
.lamp-compact-tools__body .il-tool {
  margin: 0;
}

@media (max-width: 768px) {
  .lamp-compact-tools__summary {
    align-items: flex-start;
    flex-direction: column;
    min-height: 0;
  }

  .lamp-compact-tools__summary::after {
    margin-left: 0;
  }

  .lamp-compact-tools__body {
    padding: 14px 12px 16px;
  }
}
/* 香灯来源渠道选择器：替代 datalist，保证手机端可点选、不可输入未知渠道 */
.source-channel-picker-field {
  position: relative;
  min-width: 0;
}

.source-channel-picker {
  position: relative;
  max-width: 100%;
  min-width: 0;
  width: 100%;
}

.source-channel-picker__button {
  align-items: center;
  background: #fff;
  border: 1px solid #d9e2ef;
  border-radius: 10px;
  color: #1f2937;
  cursor: pointer;
  display: flex;
  font: inherit;
  justify-content: space-between;
  min-height: 44px;
  padding: 10px 12px;
  text-align: left;
  width: 100%;
}

.source-channel-picker__button span,
.source-channel-picker__option span,
.source-channel-picker__option small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.source-channel-picker__button:focus,
.source-channel-picker__search:focus {
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.16);
  outline: none;
}

.source-channel-picker__panel {
  background: #fff;
  border: 1px solid #d9e2ef;
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
  left: 0;
  margin-top: 8px;
  max-height: min(360px, 56vh);
  overflow: auto;
  padding: 10px;
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 50;
}

.source-channel-picker__search {
  border: 1px solid #d9e2ef;
  border-radius: 10px;
  font: inherit;
  min-height: 44px;
  padding: 10px 12px;
  width: 100%;
}

.source-channel-picker__options {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.source-channel-picker__option {
  align-items: flex-start;
  background: #f8fafc;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #1f2937;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  font: inherit;
  gap: 3px;
  justify-content: center;
  min-height: 44px;
  padding: 9px 10px;
  text-align: left;
}

.source-channel-picker__option:hover,
.source-channel-picker__option:focus {
  background: #eff6ff;
  border-color: #bfdbfe;
  outline: none;
}

.source-channel-picker__option small {
  color: #64748b;
  font-size: 12px;
}

.source-channel-picker__empty {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 10px;
  color: #9a3412;
  font-size: 13px;
  margin-top: 8px;
  padding: 10px 12px;
}

.source-channel-picker__legacy {
  color: #9a3412;
}

@media (max-width: 768px) {
  .source-channel-picker__panel {
    max-width: calc(100vw - 28px);
    max-height: 46vh;
    position: fixed;
    left: 14px;
    right: 14px;
    top: auto;
    bottom: 16px;
  }

  .photo-upload-history-wrap {
    max-width: 100%;
    overflow-x: hidden;
  }

  .photo-upload-history-wrap table {
    min-width: 0;
    width: 100%;
  }

  .photo-upload-history-wrap td {
    grid-template-columns: minmax(76px, 32%) minmax(0, 1fr);
  }

  .photo-upload-history-wrap td,
  .photo-upload-history-wrap td > * {
    min-width: 0;
    overflow-wrap: anywhere;
  }
}

.is-disabled-like,
.is-disabled-like:hover {
  opacity: 0.55;
  cursor: not-allowed;
  border-style: dashed;
}

tr.is-muted {
  color: #6b7280;
  background: #f9fafb;
}

.lamp-danger-details {
  border: 1px solid #fecaca;
  border-radius: 12px;
  padding: 12px;
  background: #fff7f7;
}

.lamp-danger-details > summary {
  cursor: pointer;
  font-weight: 700;
  color: #991b1b;
}
.lamp-wb2-card__split {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
}

.lamp-wb2-card__split span,
.lamp-wb2-card__split a {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(71, 105, 246, 0.08);
}

.lamp-wb2-card__split a {
  color: var(--brand);
  font-weight: 700;
  text-decoration: none;
}

.lamp-wb2-card__split a:hover,
.lamp-wb2-card__split a:focus-visible {
  background: rgba(71, 105, 246, 0.14);
  text-decoration: underline;
}

.il-channel-section + .il-channel-section,
.il-channels-panel + .il-channels-panel {
  margin-top: 28px;
}

.il-channel-section .il-channel-create-form,
.il-channels-panel .il-channel-create-form {
  margin-top: 16px;
}

.photo-upload-progress {
  border: 1px solid #cfe0ff;
  border-radius: 10px;
  background: #f6f9ff;
  padding: 12px;
}

.photo-upload-progress__bar {
  height: 10px;
  border-radius: 999px;
  background: #e7eefc;
  overflow: hidden;
}

.photo-upload-progress__bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3b82f6, #22c55e);
  transition: width 0.2s ease;
}

.photo-upload-progress p {
  margin: 8px 0 0;
  color: #334155;
  font-size: 0.92rem;
}

.photo-upload-batch-results {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.photo-upload-batch-result {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  background: #eff6ff;
  color: #1e3a8a;
}

.photo-upload-batch-result strong {
  color: #172554;
}

.photo-upload-batch-result span {
  color: #334155;
  font-size: 0.92rem;
}

.photo-upload-batch-result.is-error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.photo-workbench-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.photo-workbench-card {
  border: 1px solid #dbe5f2;
  border-radius: 10px;
  background: #ffffff;
  display: grid;
  gap: 10px;
  min-height: 168px;
  padding: 14px;
}

.photo-workbench-card__head {
  align-items: flex-start;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  min-width: 0;
}

.photo-workbench-card__head strong {
  color: #0f172a;
  font-size: 15px;
  line-height: 1.35;
  min-width: 0;
  overflow-wrap: anywhere;
}

.photo-workbench-card__count {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  color: #1d4ed8;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 5px 8px;
  white-space: nowrap;
}

.photo-workbench-card p {
  color: #475569;
  font-size: 13px;
  line-height: 1.55;
  margin: 0;
}

.photo-workbench-card__button {
  align-self: end;
  justify-self: start;
  margin-top: auto;
}

@media (max-width: 1180px) {
  .photo-workbench-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .photo-workbench-grid {
    grid-template-columns: 1fr;
  }

  .photo-workbench-card {
    min-height: 0;
  }
}
/* Unified incense/lamp task execution page */
.lamp-batch-service-switch {
  display: inline-flex;
  gap: 6px;
  padding: 6px;
  margin: 12px 0 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fafc;
}

.segmented-control__item {
  min-height: 40px;
  padding: 9px 18px;
  border-radius: 9px;
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
}

.segmented-control__item.is-active {
  color: #ffffff;
  background: #2563eb;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
}

.lamp-batch-inline-upload {
  margin-top: 14px;
}

.lamp-workflow-details {
  margin: 0.75rem 0 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #f8fafc;
  padding: 0.75rem 1rem;
}

.lamp-workflow-details summary {
  cursor: pointer;
  font-weight: 700;
  color: #2563eb;
  min-height: 36px;
  display: flex;
  align-items: center;
}

.lamp-workflow-details[open] summary {
  margin-bottom: 0.5rem;
}

@media (max-width: 768px) {
  .lamp-batch-service-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .segmented-control__item {
    text-align: center;
  }
}

.test-server-notice-link {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 700;
  text-decoration: none;
}

.test-server-notice-link:hover,
.test-server-notice-link:focus-visible {
  border-color: #93c5fd;
  background: #dbeafe;
}

.test-server-notice-panel {
  border-color: #bfdbfe;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.test-server-notice-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.test-server-notice-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid #d7e4f7;
  border-radius: 8px;
  background: #ffffff;
}

.test-server-notice-card__head {
  display: grid;
  gap: 4px;
}

.test-server-notice-card__head strong {
  color: #111827;
  font-size: 15px;
}

.test-server-notice-card__head span {
  color: #475569;
  font-size: 12px;
  font-weight: 700;
}

.test-server-notice-card p {
  margin: 0;
  color: #334155;
  font-size: 13px;
  line-height: 1.55;
}

.test-server-notice-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.test-server-notice-meta div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f9fafb;
}

.test-server-notice-meta span {
  display: block;
  color: #64748b;
  font-size: 12px;
}

.test-server-notice-meta strong {
  display: block;
  margin-top: 4px;
  color: #0f172a;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.test-server-notice-warnings {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.test-server-notice-warnings span {
  padding: 6px 10px;
  border-radius: 8px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 1180px) {
  .test-server-notice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .test-server-notice-grid,
  .test-server-notice-meta {
    grid-template-columns: 1fr;
  }
}

/* ===================================================================== */
/* 标签模板设置（label-designer）：顶部三步引导 + 高级折叠 + 预览缩放 / 底图 */
/* ===================================================================== */
.label-stepper {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0 4px;
  padding: 0;
  list-style: none;
}

.label-stepper__item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
}

.label-stepper__no {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--brand);
  color: #ffffff;
  font-weight: 700;
}

.label-stepper__body { display: grid; gap: 2px; min-width: 0; }
.label-stepper__body strong { font-size: 14px; }
.label-stepper__body em { font-style: normal; font-size: 12px; color: var(--text-muted); line-height: 1.5; }

.label-advanced {
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  background: var(--surface-muted);
}

.label-advanced > summary {
  cursor: pointer;
  padding: 10px 0;
  font-weight: 600;
  list-style: none;
}

.label-advanced > summary::-webkit-details-marker { display: none; }
.label-advanced > summary::before { content: "▸ "; color: var(--text-muted); }
.label-advanced[open] > summary::before { content: "▾ "; }
.label-advanced > .form-grid { padding-bottom: 14px; }
.label-advanced > .toolbar-note { margin-top: 0; }

/* 预览页：缩放 + 底图控制条 */
.label-preview-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.label-preview-controls__group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.label-preview-controls__group label { font-weight: 600; color: var(--text); }

.label-print-calibration-workbench {
  display: grid;
  gap: 12px;
}

.label-print-calibration-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.label-print-calibration-summary > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  border: 1px solid #dbeafe;
  border-radius: var(--radius-sm);
  background: #f8fbff;
  padding: 10px 12px;
}

.label-print-calibration-summary span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.label-print-calibration-summary strong {
  color: var(--text);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.label-zoom-btn {
  min-width: 34px;
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface-solid);
  color: var(--text);
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

.label-zoom-btn:hover,
.label-zoom-btn:focus-visible {
  background: var(--surface-muted);
  border-color: var(--border-strong);
  color: var(--text);
}
.label-zoom-value { min-width: 48px; text-align: center; font-variant-numeric: tabular-nums; }

@media (max-width: 768px) {
  .label-stepper { grid-template-columns: 1fr; }
  .label-preview-controls { gap: 10px; }
  .label-calibration-status-card__head {
    align-items: stretch;
    flex-direction: column;
  }
  .label-calibration-status-actions > * {
    flex: 1 1 150px;
  }
}

/* Photo match review workbench */
.pmw-intro {
  display: grid;
  gap: 14px;
}

.pmw-status-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pmw-status-chip {
  cursor: pointer;
  text-decoration: none;
}

.pmw-status-chip.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
}

.photo-workbench {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  align-items: start;
  max-width: 100%;
  overflow-x: clip;
}

.pmw-queue {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 8px;
  min-width: 0;
  max-height: calc(100vh - 112px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  overflow: hidden;
}

.pmw-queue__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--border-soft);
  font-weight: 700;
}

.pmw-queue__list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 8px;
  max-height: calc(100vh - 176px);
  overflow-y: auto;
  overflow-x: hidden;
  list-style: none;
}

.pmw-queue__item {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  width: 100%;
  min-height: 72px;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 8px;
  text-align: left;
}

.pmw-queue__item:hover {
  background: var(--surface-muted);
}

.pmw-queue__item.is-active {
  background: var(--brand-soft);
  border-color: var(--brand-ring);
}

.pmw-queue__thumb {
  position: relative;
  display: grid;
  width: 56px;
  height: 56px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  overflow: hidden;
  place-items: center;
}

.pmw-queue__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pmw-queue__thumb-empty {
  display: grid;
  height: 100%;
  place-items: center;
  color: var(--text-muted);
  font-size: 12px;
}

.pmw-queue__body,
.pmw-queue__meta {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.pmw-queue__name {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text);
  font-weight: 600;
  text-overflow: ellipsis;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.pmw-queue__sub {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.3;
}

.pmw-queue__sub span {
  max-width: 100%;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-muted);
  padding: 2px 6px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pmw-queue__flag {
  border-radius: 999px;
  background: var(--warning-soft);
  color: #b45309;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 6px;
}

.pmw-stage {
  min-width: 0;
}

.pmw-detail {
  display: none;
}

.pmw-detail.is-active {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(420px, 1fr) minmax(360px, 480px);
  align-items: start;
}

.pmw-preview,
.pmw-actions,
.pmw-section,
.pmw-candidate,
.pmw-duplicate {
  min-width: 0;
}

.pmw-preview {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 12px;
  max-height: calc(100vh - 32px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  padding: 14px;
}

.pmw-preview__head,
.pmw-preview__sub,
.pmw-preview__tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.pmw-preview__head strong {
  overflow-wrap: anywhere;
}

.pmw-preview__sub {
  color: var(--text-muted);
  font-size: 13px;
}

.pmw-preview__image {
  display: grid;
  min-height: clamp(220px, 42vh, 460px);
  max-height: min(62vh, 560px);
  margin: 0;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  place-items: center;
}

.pmw-preview__image a {
  display: grid;
  width: 100%;
  place-items: center;
}

.pmw-preview__image img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: min(56vh, 520px);
  object-fit: contain;
}

.pmw-preview__noimg {
  display: grid;
  min-height: 220px;
  color: var(--text-muted);
  place-items: center;
}

.pmw-photo-fallback {
  display: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
}

.is-photo-missing .pmw-photo-fallback {
  display: grid;
  place-items: center;
}

.pmw-queue__thumb .pmw-photo-fallback {
  padding: 4px;
}

.pmw-preview__image .pmw-photo-fallback {
  min-height: 220px;
  max-width: 320px;
  padding: 18px;
}

.pmw-ocr {
  display: grid;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
}

.pmw-ocr > summary {
  cursor: pointer;
  font-weight: 700;
  padding: 10px 0;
}

.pmw-ocr__facts,
.pmw-candidate__facts,
.pmw-duplicate__facts {
  display: grid;
  gap: 8px 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}

.pmw-ocr__facts div,
.pmw-candidate__facts div,
.pmw-duplicate__facts div {
  min-width: 0;
}

.pmw-ocr__facts dt,
.pmw-candidate__facts dt,
.pmw-duplicate__facts dt {
  color: var(--text-muted);
  font-size: 12px;
}

.pmw-ocr__facts dd,
.pmw-candidate__facts dd,
.pmw-duplicate__facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.pmw-ocr__text {
  max-height: 180px;
  margin: 0 0 12px;
  overflow: auto;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  padding: 10px;
  white-space: pre-wrap;
  word-break: break-word;
}

.pmw-actions {
  display: grid;
  gap: 14px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding-right: 2px;
}

.pmw-action-guide {
  order: 0;
}

.pmw-search {
  order: 1;
}

.pmw-duplicate {
  order: 2;
}

.pmw-section:not(.pmw-search) {
  order: 3;
}

.pmw-section,
.pmw-candidate,
.pmw-duplicate {
  display: grid;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  padding: 12px;
}

.pmw-action-guide {
  display: grid;
  gap: 4px;
  border: 1px solid rgba(51, 112, 255, 0.18);
  border-radius: var(--radius-md);
  background: var(--info-soft);
  padding: 10px 12px;
}

.pmw-action-guide strong {
  color: var(--brand-strong);
  font-size: 13px;
}

.pmw-action-guide span {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.pmw-section__title {
  font-weight: 700;
}

.pmw-candidate-list {
  display: grid;
  gap: 10px;
}

.pmw-candidate.is-compact {
  background: var(--surface-muted);
}

.pmw-candidate.is-recommended {
  border-color: var(--brand-ring);
  background: #f7fbff;
}

.pmw-candidate__head,
.pmw-candidate__actions,
.pmw-duplicate__actions,
.pmw-bind-form,
.pmw-inline-form,
.pmw-search__form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.pmw-candidate__actions {
  justify-content: space-between;
}

.pmw-bind-form {
  flex: 1 1 260px;
  justify-content: flex-end;
}

.pmw-candidate__head strong {
  overflow-wrap: anywhere;
}

.pmw-tag {
  border-radius: 999px;
  background: var(--brand);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
}

.pmw-confidence {
  color: var(--text-muted);
  font-size: 12px;
}

.pmw-candidate__facts .is-wide,
.pmw-duplicate__facts .is-wide {
  grid-column: 1 / -1;
}

.pmw-candidate__warn {
  margin: 0;
  border-radius: var(--radius-sm);
  background: var(--warning-soft);
  color: #b45309;
  font-weight: 600;
  padding: 8px 10px;
}

.pmw-bind-form input[name="reuse_reason"] {
  min-height: 38px;
  min-width: min(260px, 100%);
}

.pmw-btn {
  min-height: 38px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  padding: 8px 12px;
}

.pmw-btn--primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
  min-width: 150px;
}

.pmw-btn--danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #ffffff;
}

.pmw-search__form input[name="bind_q"] {
  flex: 1 1 220px;
  min-height: 38px;
}

.pmw-inline-form {
  flex: 1 1 280px;
}

.pmw-inline-form input[name="ignore_reason"] {
  flex: 1 1 220px;
  min-height: 38px;
}

.pmw-duplicate {
  border-color: rgba(255, 125, 0, 0.26);
  background: var(--warning-soft);
}

.pmw-duplicate--compact {
  gap: 8px;
}

.pmw-duplicate__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pmw-batches-panel {
  margin-top: 16px;
}

.pmw-batches {
  display: grid;
  gap: 12px;
}

.pmw-batches > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
}

.pmw-batches > summary span {
  font-weight: 700;
}

.pmw-batches > summary small {
  color: var(--text-muted);
}

.pmw-batch-actions {
  display: grid;
  gap: 4px;
  min-width: 120px;
}

.pmw-upload {
  display: grid;
  gap: 14px;
}

.pmw-upload__form {
  margin-top: 0;
}

@media (max-width: 1180px) {
  .photo-workbench {
    grid-template-columns: 1fr;
  }

  .pmw-stage {
    order: 1;
  }

  .pmw-queue,
  .pmw-preview {
    position: static;
    max-height: none;
  }

  .pmw-queue {
    order: 2;
  }

  .pmw-detail.is-active {
    grid-template-columns: minmax(0, 1fr);
  }

  .pmw-actions {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }
}

@media (max-width: 768px) {
  .pmw-status-filter,
  .pmw-candidate__actions,
  .pmw-duplicate__actions,
  .pmw-bind-form,
  .pmw-inline-form,
  .pmw-search__form {
    align-items: stretch;
    flex-direction: column;
  }

  .pmw-status-chip,
  .pmw-btn,
  .pmw-search__form input[name="bind_q"],
  .pmw-inline-form input[name="ignore_reason"],
  .pmw-bind-form input[name="reuse_reason"] {
    width: 100%;
  }

  .pmw-ocr__facts,
  .pmw-candidate__facts,
  .pmw-duplicate__facts {
    grid-template-columns: 1fr;
  }

  .pmw-queue {
    order: 2;
  }

  .pmw-queue__item {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .pmw-queue__thumb {
    width: 52px;
    height: 52px;
  }

  .pmw-queue__flag {
    grid-column: 2;
    justify-self: start;
  }

  .pmw-preview__image {
    min-height: 220px;
    max-height: none;
  }

  .pmw-preview__image img {
    max-height: 56vh;
  }
}

/* ERP product gallery */
.erp-product-thumb-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  cursor: zoom-in;
  overflow: hidden;
}

.erp-product-thumb-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.erp-product-image-manager {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.erp-product-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 12px;
}

.erp-product-image-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.erp-product-image-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.erp-product-gallery-modal[hidden] {
  display: none;
}

.erp-product-gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
}

.erp-product-gallery-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
}

.erp-product-gallery-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(920px, 96vw);
  max-height: 94vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  padding: 16px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.28);
}

.erp-product-gallery-modal__header,
.erp-product-gallery-modal__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.erp-product-gallery-modal__stage {
  min-height: 260px;
  max-height: 70vh;
  display: grid;
  place-items: center;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.erp-product-gallery-modal__stage img {
  max-width: 100%;
  max-height: 68vh;
  object-fit: contain;
  transform-origin: center center;
  transition: transform 0.12s ease;
}

/* =========================================================================
   global navigation and login ritual refresh
   ========================================================================= */
:root {
  --sidebar-width: 248px;
}

.brand {
  padding: 4px 8px 12px;
}

.brand-header {
  margin-bottom: 0;
}

.brand-title-row {
  gap: 10px;
}

.brand-identity {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.brand-mark,
.login-mark,
.login-seal {
  background: linear-gradient(135deg, #0f766e 0%, #1f8a70 58%, #b42318 100%);
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.18);
}

.brand h1 {
  margin: 0;
  color: #111827;
  font-size: 15px;
  line-height: 1.25;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand p,
.brand-meta,
.nav-link small,
.nav-group__count,
.sidebar-note {
  display: none;
}

.nav-group__summary {
  grid-template-columns: 24px minmax(0, 1fr) auto auto;
}

.nav-link > span:not(.nav-badge) {
  min-width: 0;
}

body.login-page {
  padding: 24px;
  min-height: 100vh;
  align-items: center;
  background:
    linear-gradient(90deg, rgba(70, 58, 39, 0.055) 1px, transparent 1px),
    linear-gradient(180deg, #fbf6ea 0%, #f4ead8 48%, #eef5f2 100%);
  background-size: 34px 34px, auto;
}

.login-shell {
  width: min(980px, calc(100vw - 48px));
  min-height: 620px;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 430px);
  border-radius: 8px;
  border-color: rgba(120, 91, 54, 0.26);
  background: #fffaf0;
  box-shadow: 0 22px 60px rgba(83, 63, 37, 0.18);
}

.login-aside {
  min-height: 620px;
  padding: 42px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(135deg, #1f4538 0%, #2f5d4b 54%, #203934 100%);
  background-size: 30px 100%, auto;
}

.login-aside::before {
  background:
    linear-gradient(120deg, transparent 0 24%, rgba(220, 205, 168, 0.2) 24% 25%, transparent 25% 100%),
    linear-gradient(180deg, rgba(255, 250, 240, 0.14), transparent 34%, rgba(128, 27, 18, 0.14));
}

.login-aside-card {
  min-height: 100%;
  align-content: space-between;
  gap: 28px;
}

.login-aside-card::before {
  content: "仁  义  礼  智  信";
  position: absolute;
  z-index: 1;
  top: 132px;
  right: 26px;
  writing-mode: vertical-rl;
  color: rgba(255, 250, 240, 0.18);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5em;
  pointer-events: none;
}

.login-aside-topline {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: rgba(255, 255, 255, 0.74);
  font-size: 12px;
  font-weight: 700;
}

.login-aside-topline span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.login-seal {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 74px;
  height: 74px;
  border-radius: 6px;
  background: #a83224;
  color: #ffffff;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0.08em;
  border: 2px solid rgba(255, 250, 240, 0.44);
  box-shadow: 0 10px 24px rgba(64, 24, 18, 0.24);
}

.login-aside h1 {
  position: relative;
  z-index: 1;
  width: min(360px, 100%);
  color: #ffffff;
  font-size: 36px;
  line-height: 1.18;
  font-weight: 800;
  letter-spacing: 0;
}

.login-analects {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 18px 20px 16px 22px;
  border: 1px solid rgba(220, 205, 168, 0.36);
  border-left: 4px solid rgba(220, 205, 168, 0.68);
  background: rgba(255, 250, 240, 0.08);
}

.login-analects::before {
  content: "论语";
  position: absolute;
  top: -13px;
  left: 18px;
  padding: 2px 8px;
  border-radius: 4px;
  background: #a83224;
  color: #fffaf0;
  font-size: 12px;
  font-weight: 800;
}

.login-analects blockquote {
  margin: 0;
  color: #ffffff;
  font-size: 20px;
  line-height: 1.7;
  font-weight: 700;
}

.login-analects figcaption {
  color: rgba(255, 250, 240, 0.72);
  font-size: 13px;
  font-weight: 600;
}

.login-analects-explain {
  margin: 0;
  color: rgba(255, 250, 240, 0.78);
  font-size: 13px;
  line-height: 1.75;
}

.login-ritual-lines {
  position: absolute;
  inset: auto 32px 30px auto;
  width: 150px;
  height: 150px;
  opacity: 0.58;
  pointer-events: none;
}

.login-ritual-lines span {
  position: absolute;
  bottom: 0;
  width: 3px;
  height: 112px;
  background: linear-gradient(180deg, transparent, rgba(220, 205, 168, 0.72), transparent);
  animation: ritualLineFloat 6s ease-in-out infinite;
}

.login-ritual-lines span:nth-child(1) { left: 16px; animation-delay: 0s; }
.login-ritual-lines span:nth-child(2) { left: 52px; height: 142px; animation-delay: 0.7s; }
.login-ritual-lines span:nth-child(3) { left: 88px; height: 98px; animation-delay: 1.4s; }
.login-ritual-lines span:nth-child(4) { left: 124px; height: 128px; animation-delay: 2.1s; }

@keyframes ritualLineFloat {
  0%, 100% { transform: translateY(0); opacity: 0.38; }
  50% { transform: translateY(-14px); opacity: 0.86; }
}

.login-card {
  padding: 46px 44px;
  justify-content: center;
  background:
    linear-gradient(180deg, rgba(255, 250, 240, 0.98), rgba(250, 246, 237, 0.98)),
    repeating-linear-gradient(0deg, transparent 0 29px, rgba(120, 91, 54, 0.055) 29px 30px);
  border-left: 1px solid rgba(120, 91, 54, 0.18);
}

.login-card-header {
  align-items: flex-start;
}

.login-mark {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background: #a83224;
  font-size: 17px;
  font-weight: 800;
}

.login-card-header h2 {
  font-size: 22px;
  line-height: 1.25;
  font-weight: 800;
}

.login-card-header p {
  color: #475569;
  font-weight: 600;
}

.login-submit {
  height: 42px;
  border-color: #0f766e;
  background: #0f766e;
  font-weight: 700;
}

.login-submit:hover {
  background: #115e59;
  border-color: #115e59;
}

.login-anchor-entry {
  border-color: rgba(15, 118, 110, 0.24);
  background: rgba(15, 118, 110, 0.07);
}

.login-anchor-entry:hover {
  border-color: rgba(15, 118, 110, 0.42);
  background: rgba(15, 118, 110, 0.12);
}

.login-anchor-entry__main {
  color: #0f766e;
}

.login-footer-note {
  border-top-color: rgba(15, 118, 110, 0.12);
}

@media (max-width: 840px) {
  body.login-page {
    padding: 16px;
    align-items: flex-start;
  }

  .login-shell {
    width: min(480px, calc(100vw - 32px));
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
  }

  .login-aside {
    min-height: 300px;
    padding: 30px 26px;
  }

  .login-aside-card {
    gap: 18px;
  }

  .login-aside-card::before {
    display: none;
  }

  .login-seal {
    width: 56px;
    height: 56px;
    font-size: 24px;
  }

  .login-aside h1 {
    font-size: 28px;
  }

  .login-analects blockquote {
    font-size: 16px;
  }

  .login-ritual-lines {
    display: none;
  }

  .login-card {
    padding: 30px 24px;
  }
}

/* =========================================================================
   Academy ledger navigation SVG system
   ========================================================================= */
:root {
  --sidebar-width: 272px;
  --sidebar-collapsed: 72px;
  --academy-paper: #fbf6e8;
  --academy-paper-deep: #efe6d3;
  --academy-ink: #1f2f28;
  --academy-muted: #776f61;
  --academy-jade: #2f6b59;
  --academy-jade-soft: rgba(47, 107, 89, 0.10);
  --academy-cinnabar: #a83224;
  --academy-line: rgba(101, 82, 56, 0.20);
}

.sidebar {
  background:
    linear-gradient(90deg, #17382f 0 14px, var(--academy-paper) 14px 100%);
  border-right: 1px solid var(--academy-line);
  box-shadow: inset -1px 0 rgba(70, 58, 39, 0.08);
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.58), transparent 28%, rgba(47, 107, 89, 0.06)),
    repeating-linear-gradient(0deg, transparent 0 35px, rgba(101, 82, 56, 0.055) 35px 36px);
}

.sidebar-inner {
  position: relative;
  z-index: 1;
  padding: 18px 12px 14px 22px;
}

.brand {
  padding: 8px 8px 18px 12px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--academy-line);
}

.brand-header {
  align-items: flex-start;
}

.brand-title-row {
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  background: #f7efe0;
  color: var(--academy-cinnabar);
  border: 1px solid rgba(168, 50, 36, 0.28);
  box-shadow: 0 8px 18px rgba(82, 60, 36, 0.13);
}

.brand-mark .nav-icon {
  width: 28px;
  height: 28px;
}

.brand h1 {
  color: var(--academy-ink);
  font-size: 17px;
  line-height: 1.25;
  font-weight: 800;
}

.brand-kicker {
  color: var(--academy-muted);
  font-weight: 700;
}

.sidebar-toggle {
  color: var(--academy-jade);
  border-color: transparent;
}

.sidebar-toggle:hover {
  background: rgba(47, 107, 89, 0.08);
  border-color: rgba(47, 107, 89, 0.16);
}

.nav {
  gap: 6px;
}

.nav-section {
  padding: 5px 0;
}

.nav-section + .nav-section {
  border-top: 1px solid rgba(101, 82, 56, 0.13);
}

.nav-group {
  border-color: transparent;
  border-radius: 8px;
}

.nav-group[open],
.nav-group.is-active {
  background: rgba(47, 107, 89, 0.045);
  border-color: rgba(47, 107, 89, 0.12);
}

.nav-group__summary {
  min-height: 44px;
  grid-template-columns: 34px minmax(0, 1fr) auto auto;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--academy-ink);
  font-size: 14px;
  font-weight: 800;
}

.nav-group__summary:hover {
  background: rgba(47, 107, 89, 0.07);
  color: var(--academy-ink);
}

.nav-group.is-active > .nav-group__summary,
.nav-group[open] > .nav-group__summary {
  background: rgba(239, 232, 212, 0.78);
  box-shadow: inset 4px 0 var(--academy-cinnabar);
}

.nav-group__mark {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 8px;
  background: #f7efe0;
  color: var(--academy-jade);
  border: 1px solid rgba(47, 107, 89, 0.16);
  font-size: 0;
}

.nav-group.is-active > .nav-group__summary .nav-group__mark,
.nav-group[open] > .nav-group__summary .nav-group__mark {
  background: #e8efdf;
  color: var(--academy-jade);
  border-color: rgba(47, 107, 89, 0.25);
}

.nav-group__summary::after,
.nav-subgroup__summary::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  color: #8a7d67;
  transform: rotate(-45deg);
}

.nav-group[open] > .nav-group__summary::after,
.nav-subgroup[open] > .nav-subgroup__summary::after {
  transform: rotate(45deg);
}

.nav-group__items {
  gap: 2px;
  padding: 4px 0 3px;
}

.nav-subgroup__summary {
  color: #706858;
  font-size: 12px;
  padding-left: 14px;
}

.nav-link {
  min-height: 36px;
  gap: 10px;
  padding: 5px 10px 5px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #4a554e;
  font-size: 13px;
}

.nav-link__icon {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 8px;
  background: rgba(255, 251, 241, 0.86);
  color: var(--academy-jade);
  border: 1px solid rgba(101, 82, 56, 0.15);
}

.nav-link__icon .nav-icon {
  width: 17px;
  height: 17px;
}

.nav-link__text {
  font-weight: 650;
  color: inherit;
}

.nav-link:hover {
  background: rgba(47, 107, 89, 0.075);
  color: var(--academy-ink);
}

.nav-link:hover .nav-link__icon {
  color: var(--academy-jade);
  background: #f9f2e3;
  border-color: rgba(47, 107, 89, 0.22);
}

.nav-link.active {
  background: linear-gradient(90deg, rgba(168, 50, 36, 0.13), rgba(47, 107, 89, 0.075));
  color: #7d2a20;
  border-color: rgba(168, 50, 36, 0.18);
  box-shadow: inset 4px 0 var(--academy-cinnabar);
}

.nav-link.active .nav-link__icon {
  background: #fff7e8;
  color: var(--academy-cinnabar);
  border-color: rgba(168, 50, 36, 0.28);
}

.nav-link.active .nav-link__text {
  color: #7d2a20;
  font-weight: 800;
}

.nav-badge {
  background: #fff7e8;
  color: var(--academy-cinnabar);
  border: 1px solid rgba(168, 50, 36, 0.16);
}

.shell.sidebar-collapsed .sidebar-inner {
  padding: 16px 10px 12px 18px;
}

.shell.sidebar-collapsed .brand {
  padding: 6px 0 14px;
}

.shell.sidebar-collapsed .brand-header {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.shell.sidebar-collapsed .brand-title-row {
  justify-content: center;
  gap: 0;
}

.shell.sidebar-collapsed .nav-group__summary {
  min-height: 42px;
  padding: 6px 0;
  grid-template-columns: 1fr;
  border-radius: 8px;
}

.shell.sidebar-collapsed .nav-link {
  justify-content: center;
  padding: 6px 0;
}

.shell.sidebar-collapsed .nav-link__icon {
  margin: 0;
}

@media (max-width: 960px) {
  .shell.mobile-open .sidebar {
    width: min(292px, 84vw);
  }

  .sidebar-inner {
    padding: 18px 12px 14px 22px;
  }
}

/* =========================================================================
   Navigation skin switcher and classic restoration
   ========================================================================= */
.shell.nav-skin-classic .sidebar {
  background: var(--surface-solid);
  border-right: 1px solid var(--border);
  box-shadow: none;
}

.shell.nav-skin-classic .sidebar::before {
  display: none;
}

.shell.nav-skin-classic .sidebar-inner {
  padding: 16px 12px 12px;
}

.shell.nav-skin-classic .brand {
  padding: 4px 8px 16px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border-soft);
}

.shell.nav-skin-classic .brand-header {
  align-items: center;
}

.shell.nav-skin-classic .brand-title-row {
  gap: 8px;
}

.shell.nav-skin-classic .brand-mark {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #3370ff, #5b8cff);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(51, 112, 255, 0.25);
}

.shell.nav-skin-classic .brand-mark .nav-icon {
  width: 20px;
  height: 20px;
}

.shell.nav-skin-classic .brand h1 {
  color: var(--text);
  font-size: 15px;
  line-height: 1.3;
  font-weight: 600;
}

.shell.nav-skin-classic .brand-kicker {
  color: var(--text-faint);
  font-weight: 500;
}

.shell.nav-skin-classic .sidebar-toggle {
  color: var(--text-muted);
  border-color: transparent;
}

.shell.nav-skin-classic .sidebar-toggle:hover {
  background: var(--surface-hover);
  border-color: var(--border);
  color: var(--text);
}

.shell.nav-skin-classic .nav {
  gap: 4px;
}

.shell.nav-skin-classic .nav-section {
  padding: 6px 0;
}

.shell.nav-skin-classic .nav-section + .nav-section {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
}

.shell.nav-skin-classic .nav-group {
  border-radius: var(--radius-md);
}

.shell.nav-skin-classic .nav-group[open],
.shell.nav-skin-classic .nav-group.is-active {
  background: rgba(51, 112, 255, 0.035);
  border-color: rgba(51, 112, 255, 0.14);
}

.shell.nav-skin-classic .nav-group__summary {
  min-height: 38px;
  grid-template-columns: 24px minmax(0, 1fr) auto auto;
  gap: 8px;
  padding: 7px 9px 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.shell.nav-skin-classic .nav-group__summary:hover,
.shell.nav-skin-classic .nav-group.is-active > .nav-group__summary {
  background: var(--surface-muted);
  color: var(--brand-strong);
}

.shell.nav-skin-classic .nav-group[open] > .nav-group__summary,
.shell.nav-skin-classic .nav-group.is-active > .nav-group__summary {
  box-shadow: none;
}

.shell.nav-skin-classic .nav-group__mark {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border: 0;
  border-radius: var(--radius-xs);
  background: var(--surface-muted);
  color: var(--text-muted);
}

.shell.nav-skin-classic .nav-group[open] > .nav-group__summary .nav-group__mark,
.shell.nav-skin-classic .nav-group.is-active > .nav-group__summary .nav-group__mark {
  background: var(--brand-soft-strong);
  color: var(--brand-strong);
  border-color: transparent;
}

.shell.nav-skin-classic .nav-group__items {
  gap: 3px;
  margin-top: 2px;
  padding: 0;
}

.shell.nav-skin-classic .nav-subgroup__summary {
  min-height: 32px;
  padding: 6px 10px 6px 12px;
  color: var(--text-muted);
  font-size: 12px;
}

.shell.nav-skin-classic .nav-link {
  min-height: 0;
  gap: 10px;
  padding: 7px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13px;
  box-shadow: none;
}

.shell.nav-skin-classic .nav-link__icon {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border: 0;
  border-radius: var(--radius-xs);
  background: var(--surface-muted);
  color: var(--text-muted);
}

.shell.nav-skin-classic .nav-link__icon .nav-icon {
  width: 16px;
  height: 16px;
}

.shell.nav-skin-classic .nav-link__text {
  font-weight: 500;
}

.shell.nav-skin-classic .nav-link:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.shell.nav-skin-classic .nav-link:hover .nav-link__icon {
  background: var(--brand-soft);
  color: var(--brand);
}

.shell.nav-skin-classic .nav-link.active {
  background: var(--brand-soft);
  color: var(--brand);
  border-color: transparent;
  box-shadow: none;
}

.shell.nav-skin-classic .nav-link.active .nav-link__icon {
  background: var(--brand);
  color: #ffffff;
  border-color: transparent;
}

.shell.nav-skin-classic .nav-link.active .nav-link__text {
  color: var(--brand);
  font-weight: 500;
}

.shell.nav-skin-classic .nav-badge {
  background: var(--surface-muted);
  color: var(--text-muted);
  border: 0;
}

.shell.nav-skin-classic.sidebar-collapsed .sidebar-inner {
  padding: 16px 8px 12px;
}

.shell.nav-skin-classic.sidebar-collapsed .brand {
  padding: 4px 0 12px;
}

.shell.nav-skin-classic.sidebar-collapsed .nav-group__summary {
  min-height: 34px;
  padding: 7px 0;
}

.shell.nav-skin-classic.sidebar-collapsed .nav-link {
  padding: 7px 0;
}

/* =========================================================================
   Academy book-page refinement
   ========================================================================= */
.shell.nav-skin-academy {
  --sidebar-width: 310px;
  --sidebar-collapsed: 88px;
}

.shell.nav-skin-classic {
  --sidebar-width: 248px;
  --sidebar-collapsed: 64px;
}

.shell.nav-skin-academy .sidebar {
  background: #17372e;
  border-right: 1px solid rgba(23, 55, 46, 0.72);
  box-shadow: inset -1px 0 rgba(15, 32, 28, 0.34);
}

.shell.nav-skin-academy .sidebar::before {
  display: block;
  inset: 0 auto 0 0;
  width: 36px;
  background:
    linear-gradient(90deg, rgba(6, 20, 17, 0.28), transparent 42%, rgba(255, 250, 240, 0.10) 52%, transparent 64%),
    linear-gradient(180deg, #18382f, #123028);
}

.shell.nav-skin-academy .sidebar::after {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 10px;
  width: 16px;
  pointer-events: none;
  border-left: 2px solid rgba(229, 215, 178, 0.46);
  border-right: 2px solid rgba(12, 28, 23, 0.46);
  background:
    radial-gradient(circle at 50% 32px, rgba(245, 238, 211, 0.90) 0 3px, rgba(35, 59, 50, 0.72) 4px 7px, transparent 8px) 0 0 / 100% 86px repeat-y,
    linear-gradient(90deg, transparent 0 42%, rgba(238, 225, 188, 0.45) 42% 58%, transparent 58% 100%);
}

.shell.nav-skin-academy .sidebar-inner {
  height: calc(100vh - 32px);
  margin: 16px 10px 16px 32px;
  padding: 22px 14px 24px 18px;
  overflow-y: auto;
  overflow-x: visible;
  border: 1px solid rgba(82, 70, 48, 0.34);
  border-left-color: rgba(238, 225, 188, 0.52);
  border-radius: 8px 14px 14px 8px;
  background:
    linear-gradient(90deg, rgba(86, 112, 92, 0.13) 0 4px, transparent 4px 100%),
    radial-gradient(120px 70px at 64px calc(100% - 58px), rgba(47, 107, 89, 0.16), transparent 72%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), transparent 24%, rgba(47, 107, 89, 0.05)),
    repeating-linear-gradient(0deg, transparent 0 39px, rgba(101, 82, 56, 0.055) 39px 40px),
    var(--academy-paper);
  box-shadow:
    12px 0 24px rgba(14, 35, 30, 0.22),
    inset 1px 0 rgba(255, 255, 255, 0.58),
    inset -8px 0 18px rgba(108, 88, 55, 0.10);
}

.shell.nav-skin-academy .sidebar-inner::after {
  content: "";
  position: absolute;
  left: 34px;
  right: 30px;
  bottom: 26px;
  height: 78px;
  pointer-events: none;
  opacity: 0.22;
  background:
    radial-gradient(80px 34px at 28px 64px, transparent 45%, #2f6b59 47% 50%, transparent 52%),
    radial-gradient(92px 42px at 90px 64px, transparent 45%, #2f6b59 47% 50%, transparent 52%),
    linear-gradient(145deg, transparent 0 36%, #2f6b59 37% 39%, transparent 40%),
    linear-gradient(20deg, transparent 0 50%, #2f6b59 51% 53%, transparent 54%);
}

.shell.nav-skin-academy .brand {
  position: relative;
  z-index: 1;
  padding: 12px 10px 22px 12px;
  margin: 0 0 14px;
  border-bottom: 1px solid rgba(101, 82, 56, 0.24);
}

.shell.nav-skin-academy .brand-header {
  align-items: flex-start;
  gap: 8px;
}

.shell.nav-skin-academy .brand-title-row {
  align-items: center;
  gap: 13px;
}

.shell.nav-skin-academy .brand-mark {
  width: 46px;
  height: 46px;
  background: #fff7e8;
  color: var(--academy-cinnabar);
  border: 1px solid rgba(168, 50, 36, 0.35);
  border-radius: 4px;
  box-shadow: 0 8px 18px rgba(78, 56, 34, 0.13);
}

.shell.nav-skin-academy .brand h1 {
  max-width: 172px;
  color: #172f29;
  font-size: 23px;
  line-height: 1.12;
  font-weight: 800;
  white-space: normal;
}

.shell.nav-skin-academy .brand-kicker {
  margin-bottom: 3px;
  color: #7b6751;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}

.shell.nav-skin-academy .sidebar-toggle {
  margin-top: 4px;
  color: #2f6b59;
}

.shell.nav-skin-academy .nav {
  position: relative;
  z-index: 1;
  gap: 0;
  margin-top: 2px;
  padding-bottom: 94px;
}

.shell.nav-skin-academy .nav-section {
  padding: 0;
}

.shell.nav-skin-academy .nav-section + .nav-section {
  margin-top: 0;
  padding-top: 0;
  border-top: 1px solid rgba(101, 82, 56, 0.18);
}

.shell.nav-skin-academy .nav-group {
  position: relative;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.shell.nav-skin-academy .nav-group[open],
.shell.nav-skin-academy .nav-group.is-active {
  border-color: transparent;
  background: transparent;
}

.shell.nav-skin-academy .nav-group__summary {
  position: relative;
  min-height: 58px;
  grid-template-columns: 52px minmax(0, 1fr) auto auto;
  gap: 10px;
  padding: 0 14px 0 18px;
  border-radius: 0;
  color: #1e352e;
  font-size: 18px;
  font-weight: 800;
}

.shell.nav-skin-academy .nav-group__summary:hover {
  background: rgba(47, 107, 89, 0.055);
  color: #17372e;
}

.shell.nav-skin-academy .nav-group[open] > .nav-group__summary,
.shell.nav-skin-academy .nav-group.is-active > .nav-group__summary {
  margin-right: -24px;
  padding-right: 34px;
  border: 1px solid rgba(89, 102, 75, 0.30);
  border-left: 0;
  border-radius: 0 30px 30px 0;
  background:
    linear-gradient(90deg, rgba(222, 226, 211, 0.96), rgba(239, 238, 222, 0.94));
  color: #102b24;
  box-shadow:
    9px 8px 18px rgba(55, 50, 34, 0.13),
    inset 0 1px rgba(255, 255, 255, 0.68);
}

.shell.nav-skin-academy .nav-group[open] > .nav-group__summary::before,
.shell.nav-skin-academy .nav-group.is-active > .nav-group__summary::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 10px;
  bottom: 10px;
  width: 6px;
  border-radius: 999px;
  background: #a83224;
  box-shadow: 0 0 0 1px rgba(255, 250, 240, 0.45);
}

.shell.nav-skin-academy .nav-group__mark {
  width: 46px;
  height: 46px;
  flex-basis: 46px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #2f6b59;
}

.shell.nav-skin-academy .nav-group__mark .nav-icon {
  width: 32px;
  height: 32px;
  stroke-width: 1.6;
}

.shell.nav-skin-academy .nav-group[open] > .nav-group__summary .nav-group__mark,
.shell.nav-skin-academy .nav-group.is-active > .nav-group__summary .nav-group__mark {
  background: transparent;
  color: #214f42;
  border-color: transparent;
}

.shell.nav-skin-academy .nav-group__summary::after {
  margin-left: 2px;
  color: rgba(47, 70, 58, 0.58);
}

.shell.nav-skin-academy .nav-group__items {
  gap: 4px;
  padding: 6px 4px 10px 52px;
}

.shell.nav-skin-academy .nav-subgroup__summary {
  min-height: 32px;
  padding: 5px 8px;
  color: #786b59;
}

.shell.nav-skin-academy .nav-subgroup__items .nav-link {
  margin-left: 0;
}

.shell.nav-skin-academy .nav-link {
  min-height: 36px;
  gap: 8px;
  padding: 5px 10px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: #4c554d;
  font-size: 14px;
}

.shell.nav-skin-academy .nav-link__icon {
  width: 27px;
  height: 27px;
  flex-basis: 27px;
  border: 0;
  background: transparent;
  color: #2f6b59;
}

.shell.nav-skin-academy .nav-link__icon .nav-icon {
  width: 20px;
  height: 20px;
}

.shell.nav-skin-academy .nav-link:hover {
  background: rgba(47, 107, 89, 0.08);
  color: #17372e;
}

.shell.nav-skin-academy .nav-link:hover .nav-link__icon {
  background: transparent;
  color: #214f42;
  border-color: transparent;
}

.shell.nav-skin-academy .nav-link.active {
  background: rgba(168, 50, 36, 0.10);
  color: #7d2a20;
  box-shadow: inset 3px 0 #a83224;
}

.shell.nav-skin-academy .nav-link.active .nav-link__icon {
  background: transparent;
  color: #a83224;
  border-color: transparent;
}

.theme-menu {
  position: relative;
  flex: 0 0 auto;
}

.theme-menu__summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(100, 116, 139, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.90);
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  list-style: none;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.theme-menu__summary::-webkit-details-marker {
  display: none;
}

.theme-menu__summary::after {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
  opacity: 0.72;
}

.theme-menu[open] .theme-menu__summary,
.theme-menu__summary:hover {
  background: rgba(47, 107, 89, 0.08);
  border-color: rgba(47, 107, 89, 0.18);
  color: #17372e;
}

.theme-menu__panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 80;
  display: grid;
  gap: 6px;
  width: 184px;
  padding: 10px;
  border: 1px solid rgba(100, 116, 139, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.14);
}

.theme-menu__title {
  padding: 0 2px 4px;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.theme-menu__option,
.theme-menu__default {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #475569;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.theme-menu__option:hover,
.theme-menu__default:hover {
  background: rgba(47, 107, 89, 0.08);
  color: #17372e;
}

.theme-menu__option.is-active {
  background: #eef4ed;
  border-color: rgba(47, 107, 89, 0.18);
  color: #2f6b59;
}

.theme-menu__default {
  justify-content: center;
  margin-top: 4px;
  color: #a83224;
}

.theme-menu__default.is-default {
  background: #fff7e8;
  border-color: rgba(168, 50, 36, 0.20);
}

.shell.nav-skin-classic .theme-menu__option.is-active {
  background: var(--brand-soft);
  border-color: rgba(51, 112, 255, 0.18);
  color: var(--brand);
}

.shell.nav-skin-classic .theme-menu__default {
  color: var(--brand);
}

.shell.nav-skin-classic .theme-menu__default.is-default {
  background: rgba(51, 112, 255, 0.08);
  border-color: rgba(51, 112, 255, 0.18);
}

.shell.sidebar-collapsed.nav-skin-academy .sidebar-inner {
  margin: 12px 8px 12px 30px;
  padding: 14px 6px;
  height: calc(100vh - 24px);
}

.shell.sidebar-collapsed.nav-skin-academy .brand {
  padding: 6px 0 12px;
}

.shell.sidebar-collapsed.nav-skin-academy .brand-mark {
  width: 40px;
  height: 40px;
}

.shell.sidebar-collapsed.nav-skin-academy .nav-group__summary {
  min-height: 52px;
  padding: 4px 0;
  grid-template-columns: 1fr;
}

.shell.sidebar-collapsed.nav-skin-academy .nav-group[open] > .nav-group__summary,
.shell.sidebar-collapsed.nav-skin-academy .nav-group.is-active > .nav-group__summary {
  margin-right: -12px;
  padding-right: 0;
  border-radius: 0 22px 22px 0;
}

.shell.sidebar-collapsed.nav-skin-academy .nav-link {
  padding: 5px 0;
}

@media (max-width: 960px) {
  .shell.mobile-open.nav-skin-academy .sidebar {
    width: min(330px, 88vw);
  }

  .shell.nav-skin-academy .sidebar-inner {
    margin: 12px 10px 12px 32px;
    height: calc(100vh - 24px);
  }
}

/* =========================================================================
   Legacy template guard
   -------------------------------------------------------------------------
   If a running preview process still serves the old sidebar HTML, avoid the
   academy SVG-only rules hiding its first-character marks.
   ========================================================================= */
#appShell:not(.nav-skin-academy):not(.nav-skin-classic) .sidebar {
  background: var(--surface-solid);
  border-right: 1px solid var(--border);
  box-shadow: none;
}

#appShell:not(.nav-skin-academy):not(.nav-skin-classic) .sidebar::before,
#appShell:not(.nav-skin-academy):not(.nav-skin-classic) .sidebar::after {
  display: none;
}

#appShell:not(.nav-skin-academy):not(.nav-skin-classic) .sidebar-inner {
  margin: 0;
  height: 100%;
  padding: 16px 12px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#appShell:not(.nav-skin-academy):not(.nav-skin-classic) .brand {
  padding: 4px 8px 16px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border-soft);
}

#appShell:not(.nav-skin-academy):not(.nav-skin-classic) .brand-mark {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #3370ff, #5b8cff);
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
}

#appShell:not(.nav-skin-academy):not(.nav-skin-classic) .nav-group__mark {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border: 0;
  border-radius: var(--radius-xs);
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

/* =========================================================================
   香灯工作台 v3 — 现代中式经营台（顶部总览 + 待办队列 + 右侧侧栏）
   ---------------------------------------------------------------------------
   命名空间 .lamp-wb3-* / .lamp-wb3__* ，仅作用于 ?view=workbench 工作台区。
   基调：飞书中性底 + domain-lamp 绿主轴 + 克制暖烛色（仅用于点灯/到期强调）。
   纯追加，不引入全站泛选择器、不改任何既有规则。
   ========================================================================= */
.lamp-wb3 {
  padding-top: 16px;
}

/* ---- 顶部条：火苗 + 标题 + 售灯/售香入口 ------------------------------- */
.lamp-wb3__bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 18px;
  flex-wrap: wrap;
  padding-left: 6px;
}

.lamp-wb3__bar-lead {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.lamp-wb3__flame {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 10px;
  background: radial-gradient(circle at 50% 78%, rgba(245, 158, 11, 0.18), rgba(245, 158, 11, 0.04) 70%);
  border: 1px solid rgba(217, 119, 6, 0.18);
}

.lamp-wb3__flame svg {
  animation: lampWb3Flicker 2.6s ease-in-out infinite;
  transform-origin: 50% 92%;
}

@keyframes lampWb3Flicker {
  0%, 100% { opacity: 0.9; transform: translateY(0) scale(1); }
  50%      { opacity: 1;   transform: translateY(-0.5px) scale(1.05); }
}

@media (prefers-reduced-motion: reduce) {
  .lamp-wb3__flame svg { animation: none; }
}

.lamp-wb3__bar-text { min-width: 0; }
.lamp-wb3__bar-text .toolbar-note { margin-top: 2px; }

/* ---- 主体布局：左主区 + 右侧栏 --------------------------------------- */
.lamp-wb3__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 268px;
  gap: 16px;
  margin-top: 14px;
}

.lamp-wb3__main {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

/* ---- 今日总览条：暖烛色 hero + 关键指标 ------------------------------ */
.lamp-wb3__overview {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(180deg, #fdf7ee 0%, var(--surface-solid) 64%);
}

.lamp-wb3-hero {
  display: flex;
  flex-direction: column;
  gap: 2px;
  justify-content: center;
  padding: 12px 14px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  background: linear-gradient(135deg, #b9601a 0%, #8c3b14 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: transform var(--transition), box-shadow var(--transition);
}

.lamp-wb3-hero:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.lamp-wb3-hero__label { font-size: 12px; font-weight: 600; color: rgba(255, 244, 230, 0.92); letter-spacing: 0.03em; }
.lamp-wb3-hero__num   { font-size: 32px; line-height: 1.05; font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; }
.lamp-wb3-hero__sub   { font-size: 12px; color: rgba(255, 240, 224, 0.86); }

.lamp-wb3-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
  justify-content: center;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-solid);
}

.lamp-wb3-metric > span   { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.lamp-wb3-metric > strong { font-size: 24px; line-height: 1.1; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.lamp-wb3-metric > small  { font-size: 11px; color: var(--text-faint); }
.lamp-wb3-metric--active > strong { color: #b9601a; }
.lamp-wb3-metric--warn   { border-color: rgba(255, 125, 0, 0.30); background: var(--warning-soft); }
.lamp-wb3-metric--warn > strong { color: #c2410c; }

/* ---- 待办队列：3 组语义分区 ------------------------------------------ */
.lamp-wb3__queues {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(232px, 1fr));
  gap: 12px;
}

.lamp-wb3-queue {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-muted);
}

.lamp-wb3-queue__head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 0 2px 8px;
  border-bottom: 1px dashed var(--border-strong);
}

.lamp-wb3-queue__label { font-size: 13px; font-weight: 700; color: var(--text); }
.lamp-wb3-queue__head small { font-size: 11px; color: var(--text-faint); }

.lamp-wb3-queue__cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ---- 队列卡片：顶部色条按业务状态区分 -------------------------------- */
.lamp-wb3-card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "main split" "note note";
  align-items: center;
  gap: 2px 10px;
  padding: 12px 14px 11px;
  border: 1px solid var(--border);
  border-top: 3px solid var(--text-faint);
  border-radius: 10px;
  background: var(--surface-solid);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.lamp-wb3-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.lamp-wb3-card__main {
  grid-area: main;
  display: flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  min-width: 0;
}

.lamp-wb3-card__title { font-size: 13px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.lamp-wb3-card__count { font-size: 26px; line-height: 1; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }

.lamp-wb3-card__split {
  grid-area: split;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  justify-content: flex-end;
}

.lamp-wb3-card__split a {
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.lamp-wb3-card__split a:hover { color: var(--brand-strong); border-color: var(--brand); background: var(--brand-soft); }

.lamp-wb3-card__note {
  grid-area: note;
  font-style: normal;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-faint);
  margin-top: 2px;
}

.lamp-wb3-card--pending    { border-top-color: #64748b; }
.lamp-wb3-card--processing { border-top-color: #245bdb; }
.lamp-wb3-card--active     { border-top-color: #d97706; }
.lamp-wb3-card--due        { border-top-color: var(--warning); }
.lamp-wb3-card--expiry     { border-top-color: #dc2626; }
.lamp-wb3-card--exception  { border-top-color: var(--danger); }
.lamp-wb3-card--completed  { border-top-color: #16a34a; }

.lamp-wb3-card--active     .lamp-wb3-card__count { color: #b9601a; }
.lamp-wb3-card--due        .lamp-wb3-card__count { color: #c2410c; }
.lamp-wb3-card--expiry     .lamp-wb3-card__count,
.lamp-wb3-card--exception  .lamp-wb3-card__count { color: var(--danger); }
.lamp-wb3-card--completed  .lamp-wb3-card__count { color: #15803d; }

/* 异常 / 续灯逾期：极淡底色提示，不抢读 */
.lamp-wb3-card--exception { background: rgba(245, 63, 63, 0.035); }
.lamp-wb3-card--expiry    { background: rgba(220, 38, 38, 0.03); }

/* ---- 右侧栏：快捷操作 / 提醒 / 配置 ---------------------------------- */
.lamp-wb3__rail {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.lamp-wb3-rail-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-solid);
}

.lamp-wb3-rail-group__title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-soft);
}

.lamp-wb3-action {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--text);
  font-size: 13px;
  text-decoration: none;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
}

.lamp-wb3-action:hover { border-color: var(--brand); color: var(--brand-strong); background: var(--brand-soft); }

.lamp-wb3-action--primary {
  background: #15803d;
  border-color: #15803d;
  color: #fff;
  font-weight: 600;
}

.lamp-wb3-action--primary:hover { background: #166534; border-color: #166534; color: #fff; }

.lamp-wb3-action__ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.2);
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
}

.lamp-wb3-reminder {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text);
  text-decoration: none;
  transition: border-color var(--transition), background var(--transition);
}

.lamp-wb3-reminder:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.lamp-wb3-reminder__label { font-size: 13px; color: var(--text-muted); }
.lamp-wb3-reminder__num {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  min-width: 24px;
  text-align: right;
}

.lamp-wb3-reminder.is-warn { border-color: rgba(255, 125, 0, 0.34); background: var(--warning-soft); }
.lamp-wb3-reminder.is-warn .lamp-wb3-reminder__num { color: #c2410c; }

/* ---- 响应式：侧栏下沉 / 队列堆叠 ------------------------------------- */
@media (max-width: 1080px) {
  .lamp-wb3__layout { grid-template-columns: minmax(0, 1fr); }
  .lamp-wb3__rail { flex-direction: row; flex-wrap: wrap; }
  .lamp-wb3-rail-group { flex: 1 1 240px; }
}

@media (max-width: 720px) {
  .lamp-wb3__overview { grid-template-columns: 1fr 1fr; }
  .lamp-wb3-hero { grid-column: 1 / -1; }
  .lamp-wb3__rail { flex-direction: column; }
  .lamp-wb3-card { grid-template-columns: 1fr; grid-template-areas: "main" "split" "note"; }
  .lamp-wb3-card__split { justify-content: flex-start; }
}

.lamp-task-table .task-name-link,
.lamp-mf-card .task-name-link,
.il-table .task-name-link,
.il-card .task-name-link {
  color: inherit;
  text-decoration: none;
}

.lamp-task-table .task-name-link:hover,
.lamp-mf-card .task-name-link:hover,
.il-table .task-name-link:hover,
.il-card .task-name-link:hover {
  color: var(--brand-strong);
  text-decoration: underline;
}

/* =========================================================================
   香灯业务板块 — 统一页头 + 共享工作流件（阶段二）
   ---------------------------------------------------------------------------
   命名空间 .page-header--lamp / .lamp-board-* ，仅作用于 kicker=香灯业务 的页面，
   或显式带类的香灯场景。不引入全站泛选择器，不影响非香灯页。
   基调：暖宣纸页头 + domain-lamp 绿主轴 + 克制灯火点。
   ========================================================================= */
.page-header--lamp {
  background: linear-gradient(90deg, #fdf8f0 0%, var(--surface-solid) 46%);
  border-bottom-color: rgba(194, 118, 26, 0.22);
}

.page-header--lamp .page-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #b9601a;
  font-weight: 600;
}

.page-header--lamp .page-kicker::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: radial-gradient(circle at 50% 32%, #f7b733 0%, #c2410c 100%);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.16);
  flex-shrink: 0;
}

/* ---- 工作流引导条：替代叠放 hint 卡，统一"今天处理什么 + 快捷动作" ------- */
.lamp-board-intro {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  padding: 11px 14px;
  margin: 0 0 12px;
  border: 1px solid var(--border);
  border-top: 3px solid #c2761a;
  border-radius: 10px;
  background: linear-gradient(180deg, #fdf8f0 0%, var(--surface-solid) 60%);
}

.lamp-board-intro__lead {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.lamp-board-intro__lead strong {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.lamp-board-intro__lead small {
  font-size: 12px;
  color: var(--text-faint);
}

.lamp-board-intro__metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: baseline;
}

.lamp-board-intro__metric {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
}

.lamp-board-intro__metric strong {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.lamp-board-intro__metric--warn strong { color: #c2410c; }
.lamp-board-intro__metric--ok strong { color: #15803d; }

.lamp-board-intro__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}

/* 工作流引导条内的小动作链接 */
.lamp-board-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-solid);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
}

.lamp-board-chip:hover { border-color: #c2761a; color: #b9601a; background: #fdf6ec; }
.lamp-board-chip--primary { background: #15803d; border-color: #15803d; color: #fff; }
.lamp-board-chip--primary:hover { background: #166534; border-color: #166534; color: #fff; }

/* ---- 香灯面板小节标题：统一各页 panel 头部观感 ------------------------ */
.domain-panel.domain-lamp > .table-toolbar .panel-title { letter-spacing: 0.01em; }

@media (max-width: 720px) {
  .lamp-board-intro { gap: 8px 12px; }
  .lamp-board-intro__actions { margin-left: 0; width: 100%; }
}

/* =========================================================================
   香灯业务板块 — 跨页视觉收口（阶段二补充）
   仅增强香灯既有局部类，无全站泛选择器，不影响非香灯页。
   ========================================================================= */
/* 售灯详情：点灯中状态补一个暖烛色 hero 变体，呼应工作台 */
.lamp-detail-hero--active {
  border-top-color: #d97706;
  background: linear-gradient(180deg, rgba(217, 119, 6, 0.06), rgba(255, 255, 255, 0)), var(--surface-solid);
}

/* 照片工作台卡片：从蓝色收口到香灯绿主轴 + 暖顶，让照片中心也属于香灯板块 */
.photo-workbench-card {
  border-color: var(--border);
  border-top: 3px solid #c2761a;
}

.photo-workbench-card__head strong { color: var(--text); }

.photo-workbench-card__count {
  background: rgba(22, 163, 74, 0.10);
  border-color: rgba(22, 163, 74, 0.24);
  color: #15803d;
}

.photo-workbench-card p { color: var(--text-muted); }

/* =========================================================================
   香灯业务经营台 —— 统一视觉系统（自研，2026-06-27）
   目标：舒服、专业、像真正可用的后台工作台。
   作用域统一收在 .main--lamp（仅香灯一级菜单下页面），不影响其它业务。
   设计语言：中性优先 + 单一沉静青绿主色（身份/交互/强调）；
            语义色只用于状态；点灯中用克制暖琥珀（灯火含义）。
   本块位于文件末尾且选择器带 .main--lamp 前缀，特异性更高，
   稳定覆盖上方的暖色/厚重旧样式。纯视觉，不改任何结构与字段。
   ========================================================================= */
.main--lamp {
  --lamp: #0f766e;            /* 主色 teal-700 */
  --lamp-bright: #0d9488;     /* teal-600 */
  --lamp-hover: #115e57;
  --lamp-soft: rgba(13, 148, 136, 0.08);
  --lamp-soft-2: rgba(13, 148, 136, 0.14);
  --lamp-line: rgba(13, 148, 136, 0.22);
  --lamp-ring: rgba(13, 148, 136, 0.20);
  --ember: #d97706;          /* 点灯中=灯火暖琥珀（仅状态用） */
  --ember-soft: rgba(217, 119, 6, 0.10);
}

/* ---------- 页头：去暖宣纸，清爽白底 + 青绿细下线 + 极简标识 ---------- */
.main--lamp.page-header--lamp,
.main--lamp .page-header--lamp,
.page-header--lamp {
  background: var(--surface-solid);
  border-bottom-color: var(--border);
  box-shadow: inset 0 -2px 0 0 #0f766e;
}
.page-header--lamp .page-kicker {
  display: inline-flex; align-items: center; gap: 6px;
  color: #0f766e; font-weight: 600;
}
.page-header--lamp .page-kicker::before {
  content: ""; width: 6px; height: 6px; border-radius: 2px;
  background: #0f766e; box-shadow: none; flex: 0 0 auto;
}

/* ---------- 面板 / 域标识：青绿左条、去厚重阴影 ---------- */
.main--lamp .domain-panel.domain-lamp::before { background: var(--lamp); }
.main--lamp .domain-panel.domain-lamp { box-shadow: none; }
.main--lamp .domain-badge--lamp {
  background: var(--lamp-soft); color: var(--lamp);
  border-color: var(--lamp-line); font-weight: 600;
}

/* ---------- 按钮：主=青绿，次=描边，危险=红，文本=链接（层级清晰） ---------- */
.main--lamp .primary-button,
.main--lamp .il-btn--primary,
.main--lamp .il-tool__btn--primary {
  background: var(--lamp); border-color: var(--lamp); color: #fff;
}
.main--lamp .primary-button:hover,
.main--lamp .il-btn--primary:hover,
.main--lamp .il-tool__btn--primary:hover {
  background: var(--lamp-hover); border-color: var(--lamp-hover);
}
.main--lamp .stack-form > .actions button[type="submit"],
.main--lamp .form-actions button[type="submit"]:not(.ghost-button):not(.danger-button),
.main--lamp .lamp-inventory-form button[type="submit"]:not(.danger-button) {
  background: var(--lamp); border-color: var(--lamp); color: #fff;
}
.main--lamp .stack-form > .actions button[type="submit"]:hover,
.main--lamp .form-actions button[type="submit"]:not(.ghost-button):not(.danger-button):hover,
.main--lamp .lamp-inventory-form button[type="submit"]:not(.danger-button):hover {
  background: var(--lamp-hover); border-color: var(--lamp-hover);
}
.main--lamp input:focus,
.main--lamp select:focus,
.main--lamp textarea:focus {
  border-color: var(--lamp); box-shadow: 0 0 0 3px var(--lamp-ring);
}

/* ---------- 筛选 chip：选中=青绿实心，未选=中性描边 ---------- */
.main--lamp .lamp-filter-chip {
  border-radius: 999px; font-weight: 500;
}
.main--lamp .lamp-filter-chip.is-active {
  background: var(--lamp); border-color: var(--lamp); color: #fff;
}

/* ---------- 工作台“今日总览”：棕色块 → 清爽青绿强调卡 ---------- */
.main--lamp .lamp-wb3__overview {
  background: var(--surface-solid);
  border-color: var(--border);
}
.main--lamp .lamp-wb3-hero {
  background: var(--lamp-soft);
  border: 1px solid var(--lamp-line);
  box-shadow: none;
  color: var(--text);
}
.main--lamp .lamp-wb3-hero:hover {
  background: var(--lamp-soft-2);
  box-shadow: none;
  transform: none;
}
.main--lamp .lamp-wb3-hero__label { color: var(--lamp); font-weight: 600; }
.main--lamp .lamp-wb3-hero__num   { color: var(--lamp); }
.main--lamp .lamp-wb3-hero__sub   { color: var(--text-muted); }

/* 点灯中指标：暖琥珀（灯火），其余指标中性 */
.main--lamp .lamp-wb3-metric--active > strong { color: var(--ember); }
.main--lamp .lamp-wb3-metric--warn { border-color: rgba(217,119,6,0.30); background: var(--ember-soft); }
.main--lamp .lamp-wb3-metric--warn > strong { color: var(--ember); }

/* 工作台 7 张状态卡：左条用状态色，标题清晰，数字 tabular */
.main--lamp .lamp-wb3-card { box-shadow: none; }
.main--lamp .lamp-wb3-card--active .lamp-wb3-card__count { color: var(--ember); }

/* ---------- 详情 hero 顶条：青绿基线（状态变体保留语义色） ---------- */
.main--lamp .lamp-detail-hero { border-top-color: var(--lamp); }
.main--lamp .il-detail-hero   { border-top-color: var(--lamp); }

/* ---------- 工作流引导条 / 照片工作台卡 / 库存：暖色 → 青绿/中性 ---------- */
.main--lamp .lamp-board-intro { border-top-color: var(--lamp); background: var(--surface-solid); }
.main--lamp .lamp-board-chip:hover { border-color: var(--lamp); color: var(--lamp); background: var(--lamp-soft); }
.main--lamp .lamp-board-chip--primary { background: var(--lamp); border-color: var(--lamp); color: #fff; }
.main--lamp .lamp-board-chip--primary:hover { background: var(--lamp-hover); border-color: var(--lamp-hover); }
.main--lamp .photo-workbench-card { border-color: var(--border); }
.main--lamp .photo-workbench-card__count {
  background: var(--lamp-soft); border-color: var(--lamp-line); color: var(--lamp);
}
.main--lamp .lamp-inventory-tab.is-active { border-color: var(--lamp); color: var(--lamp); }

/* =========================================================================
   配置开关 .lamp-switch —— 原 checkbox → 清楚的滑动开关
   仅视觉：保留 input name/value/checked/form action/CSRF，无 JS。
   作用域 .main--lamp，覆盖所有香灯配置页（含 settings-panel 等非 domain-lamp 面板）。
   ========================================================================= */
.main--lamp .field.inline-check.lamp-switch { align-items: flex-start; gap: 10px; }
.main--lamp .lamp-switch { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.main--lamp .lamp-switch > input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  position: relative; flex: 0 0 auto;
  width: 34px; height: 18px; min-height: 18px; margin: 0; padding: 0;
  border: none; border-radius: 999px; background: #d7dde8; cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition);
}
.main--lamp .lamp-switch > input[type="checkbox"]::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.22);
  transition: transform var(--transition);
}
.main--lamp .lamp-switch > input[type="checkbox"]::before {
  content: none;
}
.main--lamp .lamp-switch > input[type="checkbox"]:checked { background: var(--brand); }
.main--lamp .lamp-switch > input[type="checkbox"]:checked::after { transform: translateX(16px); }
.main--lamp .lamp-switch > input[type="checkbox"]:focus-visible { outline: 2px solid rgba(51, 112, 255, 0.22); outline-offset: 2px; }
.main--lamp .lamp-switch > input[type="checkbox"]:disabled { opacity: 0.55; cursor: not-allowed; }
.main--lamp .lamp-switch > input[type="checkbox"]:disabled:checked { background: #8fabff; }
.main--lamp .lamp-switch > span { line-height: 1.5; }

/* 香灯页所有主提交按钮统一青绿（危险=红、次=描边、小按钮 不变），消除蓝绿混用 */
.main--lamp button[type="submit"]:not(.danger-button):not(.ghost-button):not(.xs-button) {
  background: var(--lamp);
  border-color: var(--lamp);
  color: #fff;
}
.main--lamp button[type="submit"]:not(.danger-button):not(.ghost-button):not(.xs-button):hover {
  background: var(--lamp-hover);
  border-color: var(--lamp-hover);
}

/* =========================================================================
   香灯工作台 —— 控制台结构（KPI 指标条 + 优先级待办队列 + 只读区 + 操作栏）
   作用域 .main--lamp，配合 lamp-console DOM；纯视觉，不改数据与链接。
   ========================================================================= */
.main--lamp .lamp-console { padding: 0; overflow: hidden; }
.main--lamp .lamp-console > * { padding-left: 18px; padding-right: 18px; }

.main--lamp .lamp-console__bar {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding-top: 16px; padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.main--lamp .lamp-console__id { display: flex; gap: 12px; align-items: center; min-width: 0; }
.main--lamp .lamp-console__flame { flex: 0 0 auto; display: inline-flex; align-self: flex-start; }
.main--lamp .lamp-console__title { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 700; color: var(--text); }
.main--lamp .lamp-console__hint { margin: 5px 0 0; font-size: 12px; color: var(--text-muted); max-width: 64ch; line-height: 1.55; }
.main--lamp .lamp-console__cta { display: flex; gap: 8px; flex-wrap: wrap; }

/* KPI 指标条 */
.main--lamp .lamp-kpi {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px;
  padding-top: 14px; padding-bottom: 14px;
}
.main--lamp .lamp-kpi__tile {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-solid); text-decoration: none; color: var(--text);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.main--lamp .lamp-kpi__tile:hover { border-color: var(--lamp-line); box-shadow: var(--shadow-xs); transform: translateY(-1px); }
.main--lamp .lamp-kpi__label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.main--lamp .lamp-kpi__num { font-size: 24px; line-height: 1.1; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.main--lamp .lamp-kpi__sub { font-size: 11px; color: var(--text-faint); }
.main--lamp .lamp-kpi__links {
  display: flex; flex-wrap: wrap; gap: 4px;
  margin-top: 6px;
}
.main--lamp .lamp-kpi__links a {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 22px; padding: 0 7px;
  border: 1px solid var(--lamp-line); border-radius: 999px;
  background: #fff; color: var(--lamp);
  font-size: 11px; font-weight: 700; text-decoration: none;
}
.main--lamp .lamp-kpi__links a:hover { background: var(--lamp-soft); border-color: var(--lamp); }
.main--lamp .lamp-kpi__tile--hero { background: var(--lamp-soft); border-color: var(--lamp-line); }
.main--lamp .lamp-kpi__tile--hero .lamp-kpi__num { color: var(--lamp); font-size: 30px; }
.main--lamp .lamp-kpi__tile--hero .lamp-kpi__label { color: var(--lamp); }
.main--lamp .lamp-kpi__tile--active .lamp-kpi__num { color: #b45309; }
.main--lamp .lamp-kpi__tile--warn .lamp-kpi__num { color: #c2410c; }
.main--lamp .lamp-kpi__tile--danger .lamp-kpi__num { color: var(--danger); }

/* 工作区 2 栏：左待办 / 右操作栏 */
.main--lamp .lamp-console__body {
  display: grid; grid-template-columns: minmax(0, 1fr) 282px; gap: 18px;
  padding-top: 16px; padding-bottom: 18px; align-items: start;
}
.main--lamp .lamp-console__main { min-width: 0; }
.main--lamp .lamp-console__rail { display: flex; flex-direction: column; gap: 12px; }

.main--lamp .lamp-queue__head { display: flex; align-items: baseline; gap: 10px; margin: 0 0 10px; }
.main--lamp .lamp-queue__head--sub { margin-top: 18px; }
.main--lamp .lamp-queue__label { font-size: 13px; font-weight: 700; color: var(--text); }
.main--lamp .lamp-queue__head small { font-size: 12px; color: var(--text-faint); }

/* 待办 action 大行 */
.main--lamp .lamp-actionlist { display: grid; gap: 8px; }
.main--lamp .lamp-action {
  display: grid; grid-template-columns: 4px 58px minmax(0,1fr) auto auto;
  align-items: center; gap: 0 14px;
  padding: 12px 16px 12px 0; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-solid); text-decoration: none; color: var(--text);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.main--lamp .lamp-action:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.main--lamp .lamp-action__bar { align-self: stretch; border-radius: 10px 0 0 10px; background: #94a3b8; }
.main--lamp .lamp-action__count { font-size: 30px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; line-height: 1; }
.main--lamp .lamp-action__body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.main--lamp .lamp-action__title { font-size: 15px; font-weight: 700; }
.main--lamp .lamp-action__note { font-size: 12px; color: var(--text-muted); }
.main--lamp .lamp-action__split { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--text-muted); text-align: right; }
.main--lamp .lamp-action__split-item[href] {
  display: inline-flex; align-items: center; justify-content: flex-end; gap: 4px;
  color: var(--lamp); text-decoration: none; font-weight: 700;
}
.main--lamp .lamp-action__split-item[href]:hover { text-decoration: underline; }
.main--lamp .lamp-action__split b { color: var(--text); font-variant-numeric: tabular-nums; }
.main--lamp .lamp-action__go { font-size: 13px; font-weight: 600; color: var(--lamp); white-space: nowrap; }
.main--lamp .lamp-action--pending   .lamp-action__bar { background: #64748b; }
.main--lamp .lamp-action--pending   .lamp-action__count { color: #475569; }
.main--lamp .lamp-action--exception .lamp-action__bar { background: var(--danger); }
.main--lamp .lamp-action--exception .lamp-action__count { color: var(--danger); }
.main--lamp .lamp-action--due       .lamp-action__bar { background: #d97706; }
.main--lamp .lamp-action--due       .lamp-action__count { color: #b45309; }
.main--lamp .lamp-action--expiry    .lamp-action__bar { background: #dc2626; }
.main--lamp .lamp-action--expiry    .lamp-action__count { color: #dc2626; }

/* 只读跟踪 ref */
.main--lamp .lamp-reflist { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.main--lamp .lamp-ref {
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "title count" "note count";
  align-items: center; gap: 0 10px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-muted); text-decoration: none; color: var(--text);
}
.main--lamp .lamp-ref:hover { border-color: var(--border-strong); }
.main--lamp .lamp-ref__title { grid-area: title; font-size: 13px; font-weight: 700; }
.main--lamp .lamp-ref__count { grid-area: count; justify-self: end; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text-muted); }
.main--lamp .lamp-ref__note { grid-area: note; font-size: 11px; color: var(--text-faint); }
.main--lamp .lamp-ref--active .lamp-ref__count { color: #b45309; }

@media (max-width: 1100px) {
  .main--lamp .lamp-kpi { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .main--lamp .lamp-console__body { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .main--lamp .lamp-kpi { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .main--lamp .lamp-action { grid-template-columns: 4px 46px minmax(0,1fr); }
  .main--lamp .lamp-action__split { grid-column: 3; flex-direction: row; flex-wrap: wrap; gap: 6px; text-align: left; }
  .main--lamp .lamp-action__split-item[href] { justify-content: flex-start; }
  .main--lamp .lamp-action__go { display: none; }
  .main--lamp .lamp-reflist { grid-template-columns: 1fr; }
}

/* 任务执行台：① 左筛选下载 / ② 右上传回传（双栏） */
.main--lamp .lamp-exec { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.main--lamp .lamp-exec__col { padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-solid); }
.main--lamp .lamp-exec__col--upload { background: var(--surface-muted); }
.main--lamp .lamp-exec__step { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 14px; font-weight: 700; color: var(--text); }
.main--lamp .lamp-exec__num { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: var(--lamp); color: #fff; font-size: 12px; font-weight: 700; flex: 0 0 auto; }
.main--lamp .lamp-batch-service-switch .segmented-control__item.is-active {
  background: var(--lamp);
  border-color: var(--lamp);
  color: #fff;
}
.main--lamp .lamp-batch-service-switch .segmented-control__item:not(.is-active):hover {
  color: var(--lamp);
  border-color: var(--lamp-line);
}
@media (max-width: 980px) { .main--lamp .lamp-exec { grid-template-columns: 1fr; } }

/* 香灯业务配置：多区改 2 栏卡片网格（规则开关首屏左上） */
.main--lamp .lamp-settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.main--lamp .lamp-settings-grid > .settings-panel { margin: 0; }
@media (max-width: 900px) { .main--lamp .lamp-settings-grid { grid-template-columns: 1fr; } }

/* 顶部“更多操作”下拉（原生 details，无 JS；与 theme-menu 同模式） */
.main--lamp .lamp-more { position: relative; display: inline-block; }
.main--lamp .lamp-more__summary {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface-solid); color: var(--text); font-weight: 500; font-size: 13px;
  cursor: pointer; list-style: none; white-space: nowrap;
}
.main--lamp .lamp-more__summary::-webkit-details-marker { display: none; }
.main--lamp .lamp-more__summary:hover { border-color: var(--lamp); color: var(--lamp); }
.main--lamp .lamp-more[open] .lamp-more__summary { border-color: var(--lamp); color: var(--lamp); }
.main--lamp .lamp-more__menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30;
  min-width: 184px; display: flex; flex-direction: column; gap: 2px;
  padding: 6px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-solid); box-shadow: var(--shadow-md);
}
.main--lamp .lamp-more__menu a { display: block; padding: 8px 10px; border-radius: 6px; font-size: 13px; color: var(--text); text-decoration: none; white-space: nowrap; }
.main--lamp .lamp-more__menu a:hover { background: var(--lamp-soft); color: var(--lamp); }

/* 列表表格区标题旁的次级说明（filter_label 内联，省一行） */
.main--lamp .lamp-toolbar-sub { font-size: 12px; font-weight: 400; color: var(--text-faint); }

/* =========================================================================
   #4 香灯业务配置：每项为“设置行”（左标题/说明，右控件），开关右对齐
   纯 CSS 排版，不动 checkbox / input 的 name/value/checked。
   ========================================================================= */
.main--lamp .settings-panel .form-grid { display: block; }
.main--lamp .settings-panel .form-grid .field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 18px;
  row-gap: 2px;
  margin: 0;
  padding: 11px 0;
  border-top: 1px solid var(--border-soft);
}
.main--lamp .settings-panel .form-grid .field:first-child { border-top: none; }
.main--lamp .settings-panel .form-grid .field > span {
  grid-column: 1; align-self: center;
  font-size: 13px; font-weight: 500; color: var(--text); line-height: 1.5;
}
.main--lamp .settings-panel .form-grid .field > small,
.main--lamp .settings-panel .form-grid .field > .il-hint {
  grid-column: 1; grid-row: 2; align-self: start;
  font-size: 12px; color: var(--text-faint); margin: 0;
}
.main--lamp .settings-panel .form-grid .field > input,
.main--lamp .settings-panel .form-grid .field > select {
  grid-column: 2; grid-row: 1; justify-self: end;
  width: auto; min-width: 150px; max-width: 220px;
}
/* 开关行：标题左、开关右对齐 */
.main--lamp .settings-panel .form-grid .field.inline-check.lamp-switch { align-items: center; column-gap: 18px; }
.main--lamp .settings-panel .form-grid .field.lamp-switch > span { order: 1; grid-column: 1; }
.main--lamp .settings-panel .form-grid .field.lamp-switch > input[type="checkbox"] {
  order: 2; grid-column: 2; grid-row: 1; justify-self: end;
  width: 34px; min-width: 34px; max-width: 34px;
  height: 18px; min-height: 18px;
}
/* 整行控件（备注 textarea 等）占满整行 */
.main--lamp .settings-panel .form-grid .field.full { grid-template-columns: 1fr; }
.main--lamp .settings-panel .form-grid .field.full > span { grid-column: 1; }
.main--lamp .settings-panel .form-grid .field.full > textarea,
.main--lamp .settings-panel .form-grid .field.full > input {
  grid-column: 1; grid-row: auto; justify-self: stretch; width: 100%; min-width: 0; max-width: none;
}

.main--lamp .lamp-inline-help {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  white-space: nowrap;
}

/* 新版香灯首次进入引导：只在香灯页注入，localStorage 关闭一次后不再出现 */
.lamp-first-guide {
  position: fixed;
  inset: 0;
  z-index: 1400;
  pointer-events: none;
}
.lamp-first-guide[hidden] { display: none; }
.lamp-first-guide::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(31, 35, 41, 0);
  transition: background var(--transition);
}
.lamp-first-guide.is-visible::before { background: rgba(31, 35, 41, 0.38); }
.lamp-first-guide__spotlight {
  position: fixed;
  z-index: 1401;
  border: 2px solid var(--lamp, #0f766e);
  border-radius: 14px;
  box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.16), 0 14px 38px rgba(15, 23, 42, 0.18);
  pointer-events: none;
  transition: top var(--transition), left var(--transition), width var(--transition), height var(--transition);
}
.lamp-first-guide__panel {
  position: absolute;
  z-index: 1402;
  width: min(420px, calc(100vw - 32px));
  padding: 18px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--lamp, #0f766e);
  border-radius: var(--radius-xl);
  background: var(--surface-solid);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--transition), transform var(--transition), top var(--transition), left var(--transition);
}
.lamp-first-guide.is-visible .lamp-first-guide__panel {
  opacity: 1;
  transform: translateY(0);
}
.lamp-first-guide__close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-solid);
  color: var(--text-muted);
  cursor: pointer;
}
.lamp-first-guide__kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 32px 6px 0;
  color: var(--lamp, #0f766e);
  font-size: 12px;
  font-weight: 700;
}
.lamp-first-guide__kicker [data-lamp-guide-progress] {
  color: var(--text-faint);
  font-weight: 600;
}
.lamp-first-guide h2 {
  margin: 0 32px 12px 0;
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: 0;
}
.lamp-first-guide__copy {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}
.lamp-first-guide__dots {
  display: flex;
  gap: 6px;
  margin-top: 14px;
}
.lamp-first-guide__dot {
  width: 18px;
  height: 4px;
  border-radius: 999px;
  background: var(--border);
}
.lamp-first-guide__dot.is-active {
  background: var(--lamp, #0f766e);
}
.lamp-first-guide__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 14px;
}
.lamp-first-guide__actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.lamp-guide-target {
  position: relative;
  z-index: 1;
}
@media (max-width: 720px) {
  .lamp-first-guide__panel {
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto;
    max-height: calc(100vh - 24px);
    overflow: auto;
  }
}
@media (prefers-reduced-motion: reduce) {
  .lamp-first-guide::before,
  .lamp-first-guide__panel,
  .lamp-first-guide__spotlight {
    transition: none;
  }
}

/* 香灯业务最终调色：布局不动，业务身份色从青绿切回飞书蓝 */
.main--lamp {
  --lamp: var(--brand);
  --lamp-bright: var(--brand);
  --lamp-hover: var(--brand-hover);
  --lamp-soft: var(--brand-soft);
  --lamp-soft-2: var(--brand-soft-strong);
  --lamp-line: rgba(51, 112, 255, 0.22);
  --lamp-ring: var(--brand-ring);
}
.page-header--lamp {
  box-shadow: inset 0 -2px 0 0 var(--brand);
}
.page-header--lamp .page-kicker {
  color: var(--brand);
}
.page-header--lamp .page-kicker::before,
.main--lamp .domain-panel.domain-lamp::before,
.main--lamp .lamp-exec__num,
.main--lamp .lamp-batch-service-switch .segmented-control__item.is-active,
.main--lamp .lamp-wb3-action--primary,
.main--lamp .lamp-board-chip--primary {
  background: var(--brand);
}
.main--lamp .lamp-batch-service-switch .segmented-control__item.is-active,
.main--lamp .lamp-wb3-action--primary,
.main--lamp .lamp-board-chip--primary {
  border-color: var(--brand);
}
.main--lamp .primary-button,
.main--lamp .il-btn--primary,
.main--lamp .il-tool__btn--primary,
.main--lamp button[type="submit"]:not(.danger-button):not(.ghost-button):not(.xs-button),
.main--lamp .stack-form > .actions button[type="submit"],
.main--lamp .form-actions button[type="submit"]:not(.ghost-button):not(.danger-button),
.main--lamp .lamp-inventory-form button[type="submit"]:not(.danger-button),
.main--lamp .lamp-filter-chip.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.main--lamp .primary-button:hover,
.main--lamp .il-btn--primary:hover,
.main--lamp .il-tool__btn--primary:hover,
.main--lamp button[type="submit"]:not(.danger-button):not(.ghost-button):not(.xs-button):hover,
.main--lamp .stack-form > .actions button[type="submit"]:hover,
.main--lamp .form-actions button[type="submit"]:not(.ghost-button):not(.danger-button):hover,
.main--lamp .lamp-inventory-form button[type="submit"]:not(.danger-button):hover,
.main--lamp .lamp-wb3-action--primary:hover,
.main--lamp .lamp-board-chip--primary:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
  color: #fff;
}
.main--lamp .domain-badge--lamp,
.main--lamp .photo-workbench-card__count {
  background: var(--brand-soft);
  border-color: var(--lamp-line);
  color: var(--brand);
}
.main--lamp input:focus,
.main--lamp select:focus,
.main--lamp textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}
.main--lamp .lamp-kpi__links a,
.main--lamp .lamp-action__split-item[href],
.main--lamp .lamp-action__go,
.main--lamp .lamp-wb3-hero__label,
.main--lamp .lamp-wb3-hero__num,
.main--lamp .lamp-kpi__tile--hero .lamp-kpi__num,
.main--lamp .lamp-kpi__tile--hero .lamp-kpi__label,
.main--lamp .lamp-more__summary:hover,
.main--lamp .lamp-more[open] .lamp-more__summary,
.main--lamp .lamp-more__menu a:hover,
.main--lamp .lamp-batch-service-switch .segmented-control__item:not(.is-active):hover,
.main--lamp .lamp-inventory-tab.is-active {
  color: var(--brand);
}
.main--lamp .lamp-kpi__links a:hover,
.main--lamp .lamp-more__menu a:hover {
  background: var(--brand-soft);
}
.main--lamp .lamp-kpi__tile:hover,
.main--lamp .lamp-kpi__links a,
.main--lamp .lamp-kpi__links a:hover,
.main--lamp .lamp-more__summary:hover,
.main--lamp .lamp-more[open] .lamp-more__summary,
.main--lamp .lamp-batch-service-switch .segmented-control__item:not(.is-active):hover,
.main--lamp .lamp-inventory-tab.is-active,
.main--lamp .lamp-wb3-hero,
.main--lamp .lamp-board-chip:hover {
  border-color: var(--lamp-line);
}
.main--lamp .lamp-wb3-hero,
.main--lamp .lamp-kpi__tile--hero,
.main--lamp .lamp-board-chip:hover {
  background: var(--brand-soft);
}
.main--lamp .lamp-wb3-hero:hover {
  background: var(--brand-soft-strong);
}
.main--lamp .lamp-detail-hero,
.main--lamp .il-detail-hero,
.main--lamp .lamp-board-intro {
  border-top-color: var(--brand);
}
.lamp-first-guide__spotlight {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-ring), 0 14px 38px rgba(15, 23, 42, 0.18);
}
.lamp-first-guide__panel {
  border-left-color: var(--brand);
}
.lamp-first-guide__kicker {
  color: var(--brand);
}
.lamp-first-guide__dot.is-active,
.lamp-first-guide__actions .primary-button {
  background: var(--brand);
}

/* 香灯工作台局部修正：新增订单 CTA 沿用原深绿色，今日待办用提醒色突出优先级。 */
.main--lamp .lamp-console__cta .primary-button,
.main--lamp .lamp-wb3-action--primary {
  background: #15803d;
  border-color: #15803d;
  color: #fff;
  box-shadow: 0 8px 18px rgba(21, 128, 61, 0.18);
}
.main--lamp .lamp-console__cta .primary-button:hover,
.main--lamp .lamp-wb3-action--primary:hover {
  background: #166534;
  border-color: #166534;
  color: #fff;
  box-shadow: 0 10px 22px rgba(21, 128, 61, 0.22);
}
.main--lamp .lamp-wb3-action--primary .lamp-wb3-action__ico {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}
.main--lamp .lamp-kpi__tile--hero {
  background: linear-gradient(135deg, #fff7e6 0%, #fffdf7 100%);
  border-color: rgba(245, 158, 11, 0.42);
  box-shadow: inset 4px 0 0 #f59e0b, 0 8px 20px rgba(245, 158, 11, 0.12);
}
.main--lamp .lamp-kpi__tile--hero:hover {
  border-color: rgba(245, 158, 11, 0.58);
  box-shadow: inset 4px 0 0 #f59e0b, 0 10px 24px rgba(245, 158, 11, 0.16);
}
.main--lamp .lamp-kpi__tile--hero .lamp-kpi__label,
.main--lamp .lamp-kpi__tile--hero .lamp-kpi__num {
  color: #b45309;
}
.main--lamp .lamp-kpi__tile--hero .lamp-kpi__links a {
  background: #fff;
  border-color: rgba(245, 158, 11, 0.30);
  color: #92400e;
}
.ai-portal-body {
  min-height: 100vh;
  background: #f6f8fb;
  color: #172033;
}

.ai-portal-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.ai-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 28px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid #e2e8f0;
  backdrop-filter: blur(12px);
}

.ai-brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-weight: 700;
  color: #172033;
  text-decoration: none;
}

.ai-brand small,
.ai-topbar small,
.ai-chat-list small,
.muted-small {
  color: #64748b;
}

.ai-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ai-nav a,
.ai-nav button,
.ai-compose button,
.ai-new-chat button,
.ai-panel button,
.ai-chat-panel button {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #172033;
  padding: 8px 12px;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
}

.ai-nav a:hover,
.ai-nav button:hover,
.ai-compose button:hover,
.ai-new-chat button:hover,
.ai-panel button:hover,
.ai-chat-panel button:hover {
  border-color: #2563eb;
  color: #1d4ed8;
}

.ai-main {
  flex: 1;
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.ai-workbench {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  gap: 20px;
  min-height: calc(100vh - 112px);
}

.ai-sidebar,
.ai-panel,
.ai-chat-panel,
.ai-auth-card,
.settings-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

.settings-card--primary {
  border-color: #bfd3ff;
  background: linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
}

.ai-key-form--quick {
  margin-top: 12px;
}

.ai-config-hint {
  margin: 10px 0 0;
  color: #64748b;
  font-size: 13px;
  line-height: 1.6;
}

.ai-settings-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, auto) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.ai-model-search-form {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.ai-model-search-form input {
  min-width: min(420px, 100%);
}

.ai-model-catalog-form {
  flex-wrap: wrap;
}

.ai-model-config-table td:first-child {
  width: 220px;
  word-break: break-all;
}

.ai-provider-advanced {
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px 12px;
}

.ai-provider-advanced > summary {
  cursor: pointer;
  color: #334155;
  font-weight: 700;
  list-style: none;
  user-select: none;
}

.ai-provider-advanced > summary::-webkit-details-marker {
  display: none;
}

.ai-provider-advanced > summary::after {
  content: "展开";
  float: right;
  color: #64748b;
  font-size: 12px;
  font-weight: 650;
}

.ai-provider-advanced[open] > summary::after {
  content: "收起";
}

.ai-provider-advanced .form-grid {
  margin-top: 12px;
}

.ai-sidebar {
  padding: 18px;
}

.ai-panel,
.ai-chat-panel,
.ai-auth-card {
  padding: 22px;
}

.ai-auth-card {
  width: min(440px, 100%);
  margin: 8vh auto 0;
}

.ai-new-chat,
.ai-compose,
.ai-table-form {
  display: flex;
  gap: 10px;
  align-items: center;
}

.ai-new-chat {
  flex-direction: column;
  align-items: stretch;
}

.ai-chat-list {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-chat-list li a {
  display: block;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  color: #172033;
  text-decoration: none;
  background: #f8fafc;
}

.ai-quota-grid,
.ai-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.ai-quota-grid > div {
  padding: 16px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.ai-quota-grid span,
.ai-quota-grid strong {
  display: block;
}

.ai-quota-grid strong {
  margin-top: 6px;
  font-size: 24px;
}

.ai-chat-page {
  max-width: 980px;
  margin: 0 auto;
}

.ai-chat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e2e8f0;
}

.ai-message-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 0;
}

.ai-message {
  max-width: 82%;
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  white-space: pre-wrap;
}

.ai-message--user {
  align-self: flex-end;
  background: #eef6ff;
  border-color: #bfdbfe;
}

.ai-message--assistant {
  align-self: flex-start;
}

.ai-compose {
  align-items: stretch;
  border-top: 1px solid #e2e8f0;
  padding-top: 16px;
}

.ai-compose textarea {
  flex: 1;
  min-height: 96px;
  resize: vertical;
}

.ai-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.ai-image-card {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

.ai-image-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
  background: #f1f5f9;
}

.settings-card {
  padding: 18px;
}

.ai-plan-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.ai-plan-card h3 {
  margin-top: 0;
}

.ai-table-form select {
  min-width: 120px;
}

.ai-key-form {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #e2e8f0;
}

.ai-model-row-form {
  flex-wrap: wrap;
  align-items: flex-end;
}

.ai-model-row-form input,
.ai-model-row-form select {
  min-width: 130px;
  max-width: 220px;
}

.ai-model-row-form .muted-small {
  align-self: center;
  min-width: 72px;
}

@media (max-width: 820px) {
  .ai-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .ai-main {
    padding: 16px;
  }

  .ai-workbench {
    grid-template-columns: 1fr;
  }

  .ai-compose {
    flex-direction: column;
  }

  .ai-message {
    max-width: 100%;
  }

  .ai-settings-toolbar {
    grid-template-columns: 1fr;
  }

  .ai-model-config-table td:first-child {
    width: auto;
  }
}

/* AI 门户新版界面 */
.ai-portal-body {
  min-height: 100vh;
  margin: 0;
  background: #f7f6f2;
  color: #111827;
  font-family: "Inter", "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  letter-spacing: 0;
}

.ai-portal-body * {
  box-sizing: border-box;
}

.ai-portal-body input,
.ai-portal-body textarea,
.ai-portal-body select,
.ai-portal-body button {
  font: inherit;
  letter-spacing: 0;
}

.ai-portal-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.ai-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
  background: rgba(247, 246, 242, 0.94);
  border-bottom: 1px solid #dfddd4;
  backdrop-filter: blur(14px);
}

.ai-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #111827;
  text-decoration: none;
  min-width: 180px;
}

.ai-brand-mark {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #111827;
  color: #ffffff;
  font-weight: 800;
}

.ai-brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.2;
}

.ai-brand-text strong {
  font-size: 15px;
}

.ai-brand-text small {
  color: #6b7280;
  font-size: 12px;
}

.ai-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.ai-nav a,
.ai-nav button {
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #374151;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}

.ai-nav a:hover,
.ai-nav button:hover,
.ai-nav a.active {
  background: #ffffff;
  border-color: #d6d3c8;
  color: #0f766e;
}

.ai-main {
  flex: 1;
  width: min(1600px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.ai-flash-stack {
  width: min(980px, calc(100% - 36px));
  margin: 12px auto 0;
  display: grid;
  gap: 8px;
}

.ai-flash {
  border-radius: 8px;
  border: 1px solid #c9d8d5;
  background: #edf8f5;
  color: #134e4a;
  padding: 10px 12px;
  font-weight: 650;
}

.ai-flash--error {
  border-color: #f5c2c7;
  background: #fff1f2;
  color: #9f1239;
}

.ai-app {
  min-height: calc(100vh - 94px);
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
}

.ai-app--chat {
  align-items: stretch;
}

.ai-sidebar {
  min-height: calc(100vh - 94px);
  padding: 14px;
  border: 1px solid #dfddd4;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: none;
  overflow: hidden;
}

.ai-new-chat {
  display: grid;
  gap: 8px;
  padding-bottom: 14px;
  border-bottom: 1px solid #ebe8df;
}

.ai-new-chat input,
.ai-new-chat select,
.ai-start-actions select,
.ai-compose select,
.ai-image-form select,
.stack-form input,
.stack-form select,
.stack-form textarea {
  width: 100%;
  border: 1px solid #d6d3c8;
  border-radius: 8px;
  background: #ffffff;
  color: #111827;
  padding: 10px 12px;
  outline: none;
}

.ai-new-chat input:focus,
.ai-new-chat select:focus,
.ai-start-box textarea:focus,
.ai-start-actions select:focus,
.ai-compose textarea:focus,
.ai-compose select:focus,
.ai-image-form textarea:focus,
.ai-image-form select:focus,
.stack-form input:focus,
.stack-form textarea:focus {
  border-color: #0f766e;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.ai-primary-button,
.ai-send-button,
.ai-compose button,
.ai-image-form button,
.stack-form button {
  border: 1px solid #0f766e;
  border-radius: 8px;
  background: #0f766e;
  color: #ffffff;
  padding: 10px 14px;
  font-weight: 750;
  cursor: pointer;
}

.ai-primary-button:hover,
.ai-send-button:hover,
.ai-compose button:hover,
.ai-image-form button:hover,
.stack-form button:hover {
  background: #115e59;
  border-color: #115e59;
}

.ai-compose button:disabled,
.ai-image-form button:disabled,
.ai-compose textarea:disabled,
.ai-compose select:disabled,
.ai-image-form textarea:disabled,
.ai-image-form select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ai-sidebar-section {
  margin-top: 14px;
  min-height: 0;
}

.ai-sidebar-title {
  padding: 0 4px 8px;
  color: #6b7280;
  font-size: 13px;
  font-weight: 750;
}

.ai-chat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  max-height: calc(100vh - 250px);
  overflow: auto;
}

.ai-chat-list li {
  margin: 0;
}

.ai-chat-link,
.ai-chat-list li a {
  display: grid;
  gap: 4px;
  padding: 10px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #111827;
  text-decoration: none;
}

.ai-chat-link:hover,
.ai-chat-link.active,
.ai-chat-list li a:hover {
  background: #f2f4f1;
  border-color: #dfddd4;
}

.ai-chat-link span,
.ai-chat-list li a span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 650;
}

.ai-chat-link small,
.ai-chat-list small,
.muted-small {
  color: #6b7280;
  font-size: 12px;
}

.ai-chat-list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: stretch;
}

.ai-chat-list-item .ai-chat-link {
  min-width: 0;
}

.ai-chat-delete-form {
  display: flex;
  align-items: stretch;
  margin: 0;
}

.ai-chat-delete-button {
  min-width: 44px;
  min-height: 100%;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #8b3a31;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.ai-chat-delete-button:hover,
.ai-chat-delete-button:focus-visible {
  border-color: #f0c8c0;
  background: #fff2ef;
  color: #6f241d;
  outline: none;
}

.ai-empty-row {
  color: #6b7280;
  padding: 12px;
  border: 1px dashed #d6d3c8;
  border-radius: 8px;
  background: #faf9f5;
}

.ai-start {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 94px);
  padding: 24px;
}

.ai-start-inner {
  width: min(820px, 100%);
  display: grid;
  gap: 16px;
}

.ai-start-badge {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  border: 1px solid #b9d6d0;
  border-radius: 999px;
  background: #edf8f5;
  color: #0f766e;
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 750;
}

.ai-start h1,
.ai-auth-side h1,
.ai-studio-head h1,
.ai-panel h1 {
  margin: 0;
  color: #111827;
  font-size: 34px;
  line-height: 1.18;
  letter-spacing: 0;
}

.ai-start p,
.ai-auth-side p {
  margin: -4px 0 0;
  color: #4b5563;
}

.ai-start-box {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #d6d3c8;
  border-radius: 8px;
  background: #ffffff;
}

.ai-start-box textarea,
.ai-compose textarea,
.ai-image-form textarea {
  width: 100%;
  min-height: 112px;
  border: 0;
  border-radius: 8px;
  background: #fafafa;
  color: #111827;
  padding: 12px;
  resize: vertical;
  outline: none;
}

.ai-start-actions,
.ai-compose-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-start-actions select,
.ai-compose-row select {
  flex: 1;
}

.ai-start-actions button,
.ai-compose-row button {
  min-width: 92px;
}

.ai-quota-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.ai-quota-strip div {
  min-height: 72px;
  display: grid;
  align-content: center;
  gap: 4px;
  border: 1px solid #dfddd4;
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.ai-quota-strip span {
  color: #6b7280;
  font-size: 13px;
}

.ai-quota-strip strong {
  color: #111827;
  font-size: 20px;
}

.ai-chat-main {
  min-height: calc(100vh - 94px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  border: 1px solid #dfddd4;
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.ai-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid #ebe8df;
}

.ai-chat-header h1 {
  margin: 0;
  color: #111827;
  font-size: 19px;
  line-height: 1.3;
}

.ai-chat-header span {
  display: block;
  margin-top: 3px;
  color: #6b7280;
  font-size: 13px;
}

.ai-chat-header a,
.ai-studio-head a,
.ai-auth-link {
  color: #0f766e;
  font-weight: 750;
  text-decoration: none;
}

.ai-message-list {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 24px min(64px, 6vw);
  overflow: auto;
  background: #fbfaf7;
}

.ai-message-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.ai-message-row--user {
  grid-template-columns: minmax(0, 1fr) 36px;
}

.ai-message-row--user .ai-message-avatar {
  grid-column: 2;
}

.ai-message-row--user .ai-message-bubble {
  grid-column: 1;
  grid-row: 1;
  justify-self: end;
  background: #eef7ff;
  border-color: #cfe4f7;
}

.ai-message-avatar {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #111827;
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

.ai-message-row--user .ai-message-avatar {
  background: #0f766e;
}

.ai-message-bubble {
  max-width: min(760px, 100%);
  display: grid;
  gap: 8px;
  border: 1px solid #dfddd4;
  border-radius: 8px;
  background: #ffffff;
  padding: 13px 14px;
}

.ai-message-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #6b7280;
  font-size: 12px;
}

.ai-message-meta strong {
  color: #111827;
  font-size: 13px;
}

.ai-message-content {
  white-space: pre-wrap;
  color: #111827;
  line-height: 1.72;
}

.ai-empty-chat {
  width: min(520px, 100%);
  justify-self: center;
  align-self: center;
  display: grid;
  gap: 6px;
  text-align: center;
  color: #6b7280;
  padding: 32px 20px;
}

.ai-empty-chat strong {
  color: #111827;
  font-size: 18px;
}

.ai-compose {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  gap: 12px;
  border-top: 1px solid #ebe8df;
  padding: 14px;
  background: #ffffff;
}

.ai-compose-card {
  display: grid;
  gap: 10px;
  border: 1px solid #dfddd4;
  border-radius: 8px;
  background: #ffffff;
  padding: 10px;
}

.ai-compose-card--image {
  background: #fffaf0;
  border-color: #f0d9a7;
}

.ai-generated-panel {
  border-top: 1px solid #ebe8df;
  padding: 14px 18px 16px;
  background: #ffffff;
}

.ai-section-heading,
.ai-studio-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.ai-section-heading h2 {
  margin: 6px 0 0;
  font-size: 18px;
}

.ai-generated-grid,
.ai-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.ai-generated-card,
.ai-image-card {
  display: grid;
  gap: 10px;
  border: 1px solid #dfddd4;
  border-radius: 8px;
  background: #ffffff;
  padding: 10px;
}

.ai-generated-card img,
.ai-image-card img,
.ai-image-placeholder {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  object-fit: cover;
  background: #f0efea;
}

.ai-image-placeholder {
  display: grid;
  place-items: center;
  color: #6b7280;
  border: 1px dashed #d6d3c8;
}

.ai-generated-card strong,
.ai-image-card strong {
  color: #111827;
}

.ai-generated-card p,
.ai-image-card p {
  margin: 0;
  color: #374151;
  line-height: 1.55;
}

.ai-studio-shell,
.ai-panel {
  width: min(1180px, 100%);
  margin: 0 auto;
  border: 1px solid #dfddd4;
  border-radius: 8px;
  background: #ffffff;
  padding: 22px;
  box-shadow: none;
}

.ai-image-form {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid #dfddd4;
  border-radius: 8px;
  background: #fbfaf7;
}

.field {
  display: grid;
  gap: 6px;
  color: #374151;
  font-weight: 650;
}

.field span {
  font-size: 13px;
  color: #4b5563;
}

.stack-form {
  display: grid;
  gap: 12px;
}

.ai-auth-page {
  min-height: calc(100vh - 120px);
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 420px);
  align-items: center;
  gap: 28px;
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 24px 0;
}

.ai-auth-side {
  display: grid;
  gap: 14px;
}

.ai-auth-card {
  width: 100%;
  margin: 0;
  display: grid;
  gap: 16px;
  border: 1px solid #dfddd4;
  border-radius: 8px;
  background: #ffffff;
  padding: 22px;
  box-shadow: none;
}

.ai-auth-card h2 {
  margin: 0;
  color: #111827;
  font-size: 22px;
}

.ai-memory-panel {
  max-width: 900px;
}

.ai-memory-form {
  margin-bottom: 16px;
}

.ai-memory-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.ai-memory-list li {
  display: grid;
  gap: 6px;
  border: 1px solid #dfddd4;
  border-radius: 8px;
  background: #fbfaf7;
  padding: 12px;
}

.ai-memory-list small {
  color: #6b7280;
}

.field-error {
  color: #b91c1c;
  font-weight: 650;
}

@media (max-width: 980px) {
  .ai-topbar {
    align-items: center;
    flex-direction: row;
  }

  .ai-nav {
    justify-content: flex-end;
  }

  .ai-app,
  .ai-app--chat,
  .ai-auth-page {
    grid-template-columns: 1fr;
  }

  .ai-sidebar {
    min-height: auto;
  }

  .ai-chat-list {
    max-height: 260px;
  }

  .ai-compose,
  .ai-image-form,
  .ai-quota-strip {
    grid-template-columns: 1fr;
  }

  .ai-chat-main {
    min-height: 720px;
  }
}

@media (max-width: 620px) {
  .ai-topbar {
    align-items: stretch;
    flex-direction: column;
    padding: 10px 12px;
  }

  .ai-brand {
    min-width: 0;
  }

  .ai-nav {
    justify-content: flex-start;
  }

  .ai-main {
    padding: 12px;
  }

  .ai-start {
    padding: 10px 0;
  }

  .ai-start h1,
  .ai-auth-side h1,
  .ai-studio-head h1,
  .ai-panel h1 {
    font-size: 28px;
  }

  .ai-message-list {
    padding: 18px 12px;
  }

  .ai-message-row,
  .ai-message-row--user {
    grid-template-columns: 32px minmax(0, 1fr);
  }

  .ai-message-row--user .ai-message-avatar {
    grid-column: 1;
  }

  .ai-message-row--user .ai-message-bubble {
    grid-column: 2;
    justify-self: stretch;
  }

  .ai-message-avatar {
    width: 32px;
    height: 32px;
  }

  .ai-message-bubble {
    max-width: 100%;
  }

  .ai-start-actions,
  .ai-compose-row,
  .ai-chat-header,
  .ai-section-heading,
  .ai-studio-head {
    align-items: stretch;
    flex-direction: column;
  }

  .ai-start-actions button,
  .ai-compose-row button {
    width: 100%;
  }
}

/* Product Design rebuild: AI portal application shell */
.ai-portal-body {
  --ai-bg: #f5f7f4;
  --ai-panel: #ffffff;
  --ai-panel-soft: #f9faf7;
  --ai-ink: #121826;
  --ai-muted: #687184;
  --ai-line: #dde2d8;
  --ai-line-strong: #c8d0c3;
  --ai-accent: #16746b;
  --ai-accent-strong: #0e5f58;
  --ai-accent-soft: #e7f4ef;
  --ai-blue: #245fbe;
  --ai-blue-soft: #eaf1ff;
  --ai-warn-soft: #fff6df;
  --ai-warn-line: #eed08a;
  margin: 0;
  background: var(--ai-bg);
  color: var(--ai-ink);
  font-family: "Inter", "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

.ai-portal-body a {
  color: inherit;
}

.ai-portal-body--app {
  overflow: hidden;
}

.ai-portal-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.ai-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  background: rgba(245, 247, 244, 0.96);
  border-bottom: 1px solid var(--ai-line);
  backdrop-filter: blur(16px);
}

.ai-brand {
  min-width: auto;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  color: var(--ai-ink);
  text-decoration: none;
}

.ai-brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ai-ink);
  color: #fff;
  font-size: 13px;
  font-weight: 850;
}

.ai-brand-text {
  display: grid;
  gap: 1px;
  line-height: 1.15;
}

.ai-brand-text strong {
  font-size: 15px;
}

.ai-brand-text small {
  color: var(--ai-muted);
  font-size: 12px;
}

.ai-nav {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.ai-nav form {
  margin: 0;
}

.ai-nav a,
.ai-nav button {
  height: 34px;
  border: 1px solid transparent;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: #3e4655;
  padding: 0 11px;
  font-size: 14px;
  font-weight: 720;
  text-decoration: none;
  cursor: pointer;
}

.ai-nav a:hover,
.ai-nav button:hover,
.ai-nav a.active {
  border-color: var(--ai-line);
  background: var(--ai-panel);
  color: var(--ai-accent);
}

.ai-main {
  width: 100%;
  min-width: 0;
  min-height: 0;
  padding: 14px;
}

.ai-portal-body--app .ai-main {
  height: calc(100vh - 59px);
  overflow: hidden;
}

.ai-flash-stack {
  position: fixed;
  top: 70px;
  left: 50%;
  z-index: 60;
  width: min(680px, calc(100vw - 28px));
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  margin: 0;
}

.ai-flash {
  border: 1px solid #bdd6d0;
  border-radius: 8px;
  background: #f0fbf7;
  color: #0f5f58;
  padding: 10px 12px;
  box-shadow: 0 10px 26px rgba(18, 24, 38, 0.12);
}

.ai-flash--error {
  border-color: #f1bac1;
  background: #fff3f4;
  color: #9f1239;
}

.ai-kicker,
.ai-start-badge {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  border: 1px solid #b9d8d1;
  border-radius: 999px;
  background: var(--ai-accent-soft);
  color: var(--ai-accent);
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 820;
}

.ai-auth-stage {
  min-height: calc(100vh - 87px);
  width: min(1080px, 100%);
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(360px, 430px);
  align-items: center;
  gap: 34px;
  margin: 0 auto;
  padding: 36px 12px;
}

.ai-auth-copy {
  display: grid;
  gap: 16px;
}

.ai-auth-copy h1 {
  max-width: 560px;
  margin: 0;
  color: var(--ai-ink);
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.05;
  letter-spacing: 0;
}

.ai-auth-copy p {
  max-width: 520px;
  margin: 0;
  color: var(--ai-muted);
  font-size: 16px;
  line-height: 1.75;
}

.ai-auth-proof {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-auth-proof span {
  border: 1px solid var(--ai-line);
  border-radius: 8px;
  background: var(--ai-panel);
  color: #394150;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 740;
}

.ai-auth-card {
  width: 100%;
  display: grid;
  gap: 18px;
  border: 1px solid var(--ai-line);
  border-radius: 8px;
  background: var(--ai-panel);
  padding: 22px;
  box-shadow: 0 22px 55px rgba(18, 24, 38, 0.10);
}

.ai-auth-card--glass {
  background: rgba(255, 255, 255, 0.88);
}

.ai-auth-card-head {
  display: grid;
  gap: 4px;
}

.ai-auth-card-head span,
.ai-auth-card-foot span {
  color: var(--ai-muted);
  font-size: 13px;
  font-weight: 700;
}

.ai-auth-card h2 {
  margin: 0;
  color: var(--ai-ink);
  font-size: 24px;
}

.ai-auth-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--ai-line);
  padding-top: 14px;
}

.ai-auth-link,
.ai-soft-link {
  color: var(--ai-accent);
  font-weight: 800;
  text-decoration: none;
}

.ai-auth-link:hover,
.ai-soft-link:hover {
  color: var(--ai-accent-strong);
}

.ai-portal-body .field {
  display: grid;
  gap: 7px;
  color: #3f4652;
  font-weight: 720;
}

.ai-portal-body .field span,
.ai-rail-new label span {
  color: var(--ai-muted);
  font-size: 13px;
  font-weight: 760;
}

.ai-portal-body input,
.ai-portal-body textarea,
.ai-portal-body select {
  border: 1px solid var(--ai-line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ai-ink);
  outline: none;
}

.ai-portal-body input,
.ai-portal-body select {
  min-height: 40px;
  padding: 0 11px;
}

.ai-portal-body textarea {
  padding: 11px 12px;
  resize: vertical;
}

.ai-portal-body input:focus,
.ai-portal-body textarea:focus,
.ai-portal-body select:focus {
  border-color: var(--ai-accent);
  box-shadow: 0 0 0 3px rgba(22, 116, 107, 0.13);
}

.ai-primary-button,
.ai-send-button,
.ai-auth-card button,
.ai-dock button,
.ai-image-form button,
.stack-form button {
  min-height: 40px;
  border: 1px solid var(--ai-accent);
  border-radius: 8px;
  background: var(--ai-accent);
  color: #fff;
  padding: 0 14px;
  font-weight: 830;
  cursor: pointer;
}

.ai-primary-button:hover,
.ai-send-button:hover,
.ai-auth-card button:hover,
.ai-dock button:hover,
.ai-image-form button:hover,
.stack-form button:hover {
  background: var(--ai-accent-strong);
  border-color: var(--ai-accent-strong);
}

.ai-primary-button:disabled,
.ai-send-button:disabled,
.ai-auth-card button:disabled,
.ai-dock button:disabled,
.ai-image-form button:disabled,
.stack-form button:disabled,
.ai-portal-body textarea:disabled,
.ai-portal-body select:disabled {
  opacity: 0.54;
  cursor: not-allowed;
}

.ai-workspace {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  gap: 14px;
}

.ai-rail {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border: 1px solid var(--ai-line);
  border-radius: 8px;
  background: var(--ai-panel);
  overflow: hidden;
}

.ai-rail-new {
  display: grid;
  gap: 9px;
  border-bottom: 1px solid var(--ai-line);
  padding: 12px;
}

.ai-rail-new label {
  display: grid;
  gap: 6px;
}

.ai-rail-new .ai-primary-button {
  width: 100%;
}

.ai-rail-section {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 12px;
}

.ai-rail-title {
  color: var(--ai-muted);
  font-size: 13px;
  font-weight: 820;
  margin-bottom: 8px;
}

.ai-chat-list {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 6px;
  max-height: none;
  overflow: auto;
  list-style: none;
  margin: 0;
  padding: 0;
}

.ai-chat-link {
  display: grid;
  gap: 4px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--ai-ink);
  padding: 10px;
  text-decoration: none;
}

.ai-chat-link:hover,
.ai-chat-link.active {
  border-color: var(--ai-line);
  background: var(--ai-panel-soft);
}

.ai-chat-link span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 760;
}

.ai-chat-link small {
  color: var(--ai-muted);
  font-size: 12px;
}

.ai-empty-row {
  border: 1px dashed var(--ai-line-strong);
  border-radius: 8px;
  background: var(--ai-panel-soft);
  color: var(--ai-muted);
  padding: 12px;
}

.ai-rail-foot {
  display: grid;
  gap: 3px;
  border-top: 1px solid var(--ai-line);
  padding: 12px;
  background: var(--ai-panel-soft);
}

.ai-rail-foot span {
  color: var(--ai-muted);
  font-size: 12px;
  font-weight: 750;
}

.ai-rail-foot strong {
  color: var(--ai-ink);
  font-size: 14px;
}

.ai-canvas {
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--ai-line);
  border-radius: 8px;
  background: var(--ai-panel);
  overflow: hidden;
}

.ai-canvas--welcome {
  display: grid;
  place-items: center;
  background: var(--ai-panel-soft);
  padding: 24px;
}

.ai-welcome {
  width: min(860px, 100%);
  display: grid;
  gap: 16px;
}

.ai-welcome h1 {
  margin: 0;
  color: var(--ai-ink);
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.05;
  letter-spacing: 0;
}

.ai-welcome p {
  max-width: 660px;
  margin: 0;
  color: var(--ai-muted);
  font-size: 16px;
  line-height: 1.7;
}

.ai-prompt-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.ai-prompt-grid span {
  border: 1px solid var(--ai-line);
  border-radius: 8px;
  background: var(--ai-panel);
  color: #3d4654;
  padding: 12px;
  font-size: 14px;
  font-weight: 760;
}

.ai-hero-composer {
  display: grid;
  gap: 10px;
  border: 1px solid var(--ai-line-strong);
  border-radius: 8px;
  background: var(--ai-panel);
  padding: 12px;
  box-shadow: 0 16px 42px rgba(18, 24, 38, 0.08);
}

.ai-hero-composer textarea,
.ai-dock-card textarea {
  width: 100%;
  min-height: 108px;
  border: 0;
  background: #fbfcfa;
  box-shadow: none;
}

.ai-composer-actions,
.ai-dock-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-composer-actions select,
.ai-dock-row select {
  flex: 1;
}

.ai-composer-actions button,
.ai-dock-row button {
  min-width: 108px;
}

.ai-meter-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.ai-meter-strip div {
  min-height: 70px;
  display: grid;
  align-content: center;
  gap: 4px;
  border: 1px solid var(--ai-line);
  border-radius: 8px;
  background: var(--ai-panel);
  padding: 12px;
}

.ai-meter-strip span {
  color: var(--ai-muted);
  font-size: 13px;
}

.ai-meter-strip strong {
  color: var(--ai-ink);
  font-size: 20px;
}

.ai-chat-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
}

.ai-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--ai-line);
  background: var(--ai-panel);
  padding: 14px 18px;
}

.ai-chat-head h1 {
  margin: 0;
  color: var(--ai-ink);
  font-size: 19px;
  line-height: 1.3;
}

.ai-chat-head span {
  display: block;
  margin-top: 3px;
  color: var(--ai-muted);
  font-size: 13px;
}

.ai-message-list {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 18px;
  overflow: auto;
  background: #fbfcfa;
  padding: 24px min(60px, 5vw);
}

.ai-message-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.ai-message-row--user {
  grid-template-columns: minmax(0, 1fr) 34px;
}

.ai-message-row--user .ai-message-avatar {
  grid-column: 2;
}

.ai-message-row--user .ai-message-bubble {
  grid-column: 1;
  grid-row: 1;
  justify-self: end;
  background: var(--ai-blue-soft);
  border-color: #c9dafc;
}

.ai-message-avatar {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--ai-ink);
  color: #fff;
  font-size: 12px;
  font-weight: 850;
}

.ai-message-row--user .ai-message-avatar {
  background: var(--ai-accent);
}

.ai-message-bubble {
  width: fit-content;
  max-width: min(760px, 100%);
  border: 1px solid var(--ai-line);
  border-radius: 8px;
  background: var(--ai-panel);
  padding: 12px 14px;
}

.ai-message-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
  color: var(--ai-muted);
  font-size: 12px;
}

.ai-message-meta strong {
  color: var(--ai-ink);
  font-size: 13px;
}

.ai-message-content {
  color: var(--ai-ink);
  line-height: 1.72;
  white-space: pre-wrap;
}

.ai-empty-chat {
  align-self: center;
  justify-self: center;
  display: grid;
  gap: 6px;
  text-align: center;
  color: var(--ai-muted);
  padding: 24px;
}

.ai-empty-chat strong {
  color: var(--ai-ink);
  font-size: 20px;
}

.ai-dock {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(300px, 0.88fr);
  gap: 12px;
  border-top: 1px solid var(--ai-line);
  background: var(--ai-panel);
  padding: 12px;
}

.ai-dock-card {
  display: grid;
  gap: 9px;
  border: 1px solid var(--ai-line);
  border-radius: 8px;
  background: var(--ai-panel);
  padding: 10px;
}

.ai-dock-card--image {
  border-color: var(--ai-warn-line);
  background: var(--ai-warn-soft);
}

.ai-dock-row strong {
  min-width: 42px;
  color: var(--ai-ink);
  font-size: 14px;
}

.ai-generated-panel {
  border-top: 1px solid var(--ai-line);
  background: var(--ai-panel);
  padding: 14px;
}

.ai-section-heading,
.ai-studio-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.ai-section-heading h2,
.ai-studio-head h1 {
  margin: 4px 0 0;
  color: var(--ai-ink);
}

.ai-studio-head p {
  margin: 6px 0 0;
  color: var(--ai-muted);
  line-height: 1.6;
}

.ai-generated-grid,
.ai-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.ai-generated-card,
.ai-image-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--ai-line);
  border-radius: 8px;
  background: var(--ai-panel);
  padding: 10px;
}

.ai-generated-card img,
.ai-image-card img,
.ai-image-placeholder {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  object-fit: cover;
  background: #eef1eb;
}

.ai-image-placeholder {
  display: grid;
  place-items: center;
  border: 1px dashed var(--ai-line-strong);
  color: var(--ai-muted);
}

.ai-studio-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 22px;
}

.ai-image-form {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  border: 1px solid var(--ai-line);
  border-radius: 8px;
  background: var(--ai-panel-soft);
  margin: 18px 0;
  padding: 14px;
}

.field-error {
  color: #b42336;
  font-weight: 760;
}

@media (max-width: 900px) {
  .ai-auth-stage {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 24px;
    padding-top: 24px;
  }

  .ai-auth-copy h1 {
    font-size: 40px;
  }
}

@media (max-width: 720px) {
  .ai-portal-body--app {
    overflow: auto;
  }

  .ai-portal-body--app .ai-main {
    height: auto;
    overflow: visible;
  }

  .ai-topbar {
    position: sticky;
    align-items: flex-start;
    flex-direction: column;
  }

  .ai-nav {
    justify-content: flex-start;
  }

  .ai-workspace {
    height: auto;
    grid-template-columns: 1fr;
  }

  .ai-rail {
    max-height: 360px;
  }

  .ai-canvas {
    min-height: 580px;
  }

  .ai-prompt-grid,
  .ai-meter-strip,
  .ai-dock,
  .ai-image-form {
    grid-template-columns: 1fr;
  }

  .ai-composer-actions,
  .ai-dock-row,
  .ai-chat-head,
  .ai-section-heading,
  .ai-studio-head {
    align-items: stretch;
    flex-direction: column;
  }

  .ai-composer-actions button,
  .ai-dock-row button {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .ai-main {
    padding: 10px;
  }

  .ai-auth-stage {
    padding: 18px 0;
  }

  .ai-auth-copy h1,
  .ai-welcome h1 {
    font-size: 32px;
  }

  .ai-auth-card,
  .ai-canvas--welcome,
  .ai-studio-shell {
    padding: 16px;
  }

  .ai-message-list {
    padding: 18px 12px;
  }

  .ai-message-row,
  .ai-message-row--user {
    grid-template-columns: 32px minmax(0, 1fr);
  }

  .ai-message-row--user .ai-message-avatar {
    grid-column: 1;
  }

  .ai-message-row--user .ai-message-bubble {
    grid-column: 2;
    justify-self: stretch;
  }

  .ai-message-avatar {
    width: 32px;
    height: 32px;
  }

  .ai-message-bubble {
    width: 100%;
    max-width: 100%;
  }
}

/* Open-source chat UI inspired composer refinement */
.ai-chat-main {
  grid-template-rows: auto minmax(0, 1fr) auto auto;
}

.ai-chat-main .ai-message-list {
  justify-items: stretch;
}

.ai-dock {
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 9px;
  border-top: 1px solid var(--ai-line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), var(--ai-panel));
  padding: 12px 18px 16px;
}

.ai-dock-card,
.ai-image-drawer {
  width: min(860px, 100%);
}

.ai-dock-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--ai-line-strong);
  border-radius: 8px;
  background: var(--ai-panel);
  padding: 9px;
  box-shadow: 0 12px 34px rgba(18, 24, 38, 0.10);
}

.ai-dock-card--chat textarea {
  min-height: 56px;
  max-height: 180px;
  border: 0;
  background: transparent;
  padding: 8px 10px;
}

.ai-dock-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.ai-dock-row select {
  min-height: 36px;
  background: var(--ai-panel-soft);
}

.ai-dock-row button {
  min-width: 88px;
  min-height: 36px;
}

.ai-image-drawer {
  border: 1px solid var(--ai-line);
  border-radius: 8px;
  background: var(--ai-panel-soft);
  overflow: hidden;
}

.ai-image-drawer summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ai-ink);
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
}

.ai-image-drawer summary::-webkit-details-marker {
  display: none;
}

.ai-image-drawer summary span {
  font-weight: 820;
}

.ai-image-drawer summary small {
  color: var(--ai-muted);
  font-size: 12px;
}

.ai-image-inline-form {
  display: grid;
  gap: 9px;
  border-top: 1px solid var(--ai-line);
  padding: 10px;
}

.ai-image-inline-form textarea {
  min-height: 76px;
  background: var(--ai-panel);
}

@media (max-width: 720px) {
  .ai-dock {
    padding: 10px;
  }

  .ai-dock-row {
    grid-template-columns: 1fr;
  }

  .ai-dock-row button {
    width: 100%;
  }

  .ai-image-drawer summary {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* AI portal title behavior refinements */
.ai-rail-hint {
  color: var(--ai-muted);
  font-size: 12px;
  line-height: 1.5;
}

.ai-title-stack {
  min-width: 0;
}

.ai-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ai-title-row h1 {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-title-menu {
  position: relative;
  flex: 0 0 auto;
}

.ai-title-menu summary {
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--ai-line);
  border-radius: 999px;
  color: var(--ai-muted);
  background: var(--ai-panel);
  cursor: pointer;
  font-size: 12px;
  list-style: none;
}

.ai-title-menu summary::-webkit-details-marker {
  display: none;
}

.ai-title-menu[open] summary,
.ai-title-menu summary:hover {
  color: var(--ai-ink);
  background: var(--ai-panel-soft);
}

.ai-title-form {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  left: 0;
  width: min(360px, calc(100vw - 40px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--ai-line);
  border-radius: 14px;
  background: var(--ai-panel);
  box-shadow: 0 18px 45px rgba(37, 52, 46, 0.16);
}

.ai-title-form input {
  min-width: 0;
  min-height: 36px;
}

.ai-title-form button {
  min-width: 64px;
  min-height: 36px;
}

@media (max-width: 720px) {
  .ai-title-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .ai-title-form {
    left: auto;
    right: 0;
  }
}

/* Xiaolizi chat polish: lighter Doubao/GPT-like surface */
.ai-portal-body {
  --ai-bg: #f7f7f8;
  --ai-panel: #ffffff;
  --ai-panel-soft: #f5f6f8;
  --ai-ink: #1f2329;
  --ai-muted: #6b7280;
  --ai-line: #e6e8ee;
  --ai-line-strong: #d8dce5;
  --ai-accent: #24272f;
  --ai-accent-strong: #101217;
  --ai-accent-soft: #eef0f4;
  --ai-blue: #4f6fdc;
  --ai-blue-soft: #f3f6ff;
}

.ai-topbar {
  background: rgba(255, 255, 255, 0.9);
  border-bottom-color: var(--ai-line);
  box-shadow: none;
}

.ai-brand-mark {
  border-radius: 8px;
  background: var(--ai-accent);
  color: #fff;
}

.ai-nav a.active {
  background: #f0f1f4;
  color: var(--ai-ink);
}

.ai-primary-button,
.ai-send-button,
.ai-auth-card button,
.ai-image-form button,
.stack-form button {
  border-color: var(--ai-accent);
  background: var(--ai-accent);
  color: #fff;
}

.ai-primary-button:hover,
.ai-send-button:hover,
.ai-auth-card button:hover,
.ai-image-form button:hover,
.stack-form button:hover {
  border-color: var(--ai-accent-strong);
  background: var(--ai-accent-strong);
}

.ai-workspace {
  border-color: var(--ai-line);
  background: var(--ai-panel);
  box-shadow: 0 18px 52px rgba(31, 35, 41, 0.08);
}

.ai-rail {
  border-right-color: var(--ai-line);
  background: #f7f7f8;
}

.ai-chat-link {
  border-color: transparent;
  background: transparent;
  border-radius: 8px;
}

.ai-chat-link:hover,
.ai-chat-link.active {
  border-color: var(--ai-line);
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(31, 35, 41, 0.06);
}

.ai-canvas,
.ai-chat-head,
.ai-message-list,
.ai-generated-panel {
  background: #ffffff;
}

.ai-chat-head {
  border-bottom-color: var(--ai-line);
}

.ai-title-menu summary {
  border-color: var(--ai-line);
  background: #f7f7f8;
  color: var(--ai-muted);
}

.ai-message-avatar {
  border: 1px solid var(--ai-line);
  border-radius: 999px;
  background: #f0f1f4;
  color: var(--ai-ink);
}

.ai-message-row--user .ai-message-avatar {
  background: var(--ai-accent);
  color: #fff;
}

.ai-message-bubble {
  border-color: transparent;
  border-radius: 8px;
  background: #f7f7f8;
}

.ai-message-row--user .ai-message-bubble {
  border-color: transparent;
  background: #eef2ff;
}

.ai-dock {
  border-top-color: transparent;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), #ffffff 34%);
  padding-bottom: 20px;
}

.ai-dock-card {
  border-color: var(--ai-line-strong);
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(31, 35, 41, 0.12);
}

.ai-dock-card--chat textarea {
  color: var(--ai-ink);
}

.ai-composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--ai-line);
  padding: 8px 8px 0;
}

.ai-composer-tools,
.ai-composer-submit {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.ai-submit-status {
  min-width: 0;
  color: var(--ai-muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.ai-dock-card.is-submitting,
.ai-hero-composer.is-submitting {
  border-color: rgba(91, 58, 160, 0.45);
  box-shadow: 0 0 0 3px rgba(91, 58, 160, 0.10), 0 16px 42px rgba(31, 35, 41, 0.12);
}

.ai-dock-card.is-submitting select,
.ai-hero-composer.is-submitting select {
  pointer-events: none;
  opacity: 0.72;
}

.ai-dock-card.is-submitting textarea,
.ai-hero-composer.is-submitting textarea {
  opacity: 0.78;
}

.ai-composer-tools {
  flex: 1;
}

.ai-composer-tools select,
.ai-composer-actions select {
  min-width: 0;
  min-height: 34px;
  border-radius: 8px;
  background: #f7f7f8;
  color: var(--ai-ink);
}

.ai-composer-tools select {
  max-width: 230px;
}

.ai-tool-submit {
  min-width: 68px;
  min-height: 36px;
  border: 1px solid var(--ai-line-strong) !important;
  background: #ffffff !important;
  color: var(--ai-ink) !important;
}

.ai-tool-submit:hover {
  background: #f0f1f4 !important;
}

.ai-dock button:disabled,
.ai-tool-submit:disabled {
  border-color: var(--ai-line) !important;
  background: #f4f5f7 !important;
  color: #a1a6b0 !important;
}

.ai-pending-turn {
  display: contents;
}

.ai-message-row--pending-user .ai-message-bubble {
  opacity: 0.82;
}

.ai-thinking-line {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  color: var(--ai-muted);
  font-weight: 800;
}

.ai-thinking-line i {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.35;
  animation: aiThinkingPulse 1s infinite ease-in-out;
}

.ai-thinking-line i:nth-child(2) {
  animation-delay: 0.16s;
}

.ai-thinking-line i:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes aiThinkingPulse {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.28;
  }
  40% {
    transform: translateY(-4px);
    opacity: 0.9;
  }
}

.ai-hero-composer {
  border-radius: 8px;
  box-shadow: 0 14px 38px rgba(31, 35, 41, 0.10);
}

.ai-kicker {
  background: #eef0f4;
  color: var(--ai-ink);
}

.ai-prompt-grid span,
.ai-meter-strip div,
.ai-generated-card,
.ai-image-card {
  border-radius: 8px;
}

@media (max-width: 720px) {
  .ai-composer-toolbar,
  .ai-composer-tools,
  .ai-composer-submit {
    align-items: stretch;
    flex-direction: column;
  }

  .ai-composer-tools select,
  .ai-composer-submit button {
    width: 100%;
    max-width: none;
  }
}

/* Xiaolizi generated avatar asset */
.ai-brand-mark--avatar {
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--ai-line-strong);
  border-radius: 999px;
  background: #f7f7f8;
}

.ai-brand-mark--avatar img,
.ai-message-avatar--xiaolizi img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.ai-message-avatar--xiaolizi {
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--ai-line-strong);
  border-radius: 999px;
  background: #f7f7f8;
  color: transparent;
}

/* Floating Xiaolizi entry for the main business shell */
.ai-floating-launcher {
  position: fixed;
  right: 18px;
  bottom: 92px;
  z-index: 1200;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 7px 12px 7px 8px;
  border: 1px solid rgba(29, 53, 87, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: #1d3557;
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 12px 28px rgba(26, 45, 78, 0.18);
  backdrop-filter: blur(10px);
}

.ai-floating-launcher:hover,
.ai-floating-launcher:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(79, 111, 220, 0.32);
  background: #ffffff;
  color: #172033;
  box-shadow: 0 16px 34px rgba(26, 45, 78, 0.22);
  outline: none;
}

.ai-floating-launcher__avatar {
  width: 30px;
  height: 30px;
  overflow: hidden;
  flex: 0 0 auto;
  border: 1px solid #d8dce5;
  border-radius: 999px;
  background: #f5f6f8;
}

.ai-floating-launcher__avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.ai-floating-launcher__label {
  white-space: nowrap;
}

@media (max-width: 720px) {
  .ai-chat-list-item {
    grid-template-columns: minmax(0, 1fr);
  }

  .ai-chat-delete-button {
    min-height: 32px;
    width: 100%;
  }

  .ai-floating-launcher {
    right: 12px;
    bottom: 78px;
    padding: 7px;
  }

  .ai-floating-launcher__label {
    display: none;
  }
}

/* Xiaolizi tech polish */
@keyframes aiPortalPanelIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes aiPortalLineScan {
  0% {
    transform: translateX(-110%);
    opacity: 0;
  }

  18%,
  72% {
    opacity: 1;
  }

  100% {
    transform: translateX(210%);
    opacity: 0;
  }
}

@keyframes aiPortalFloatScan {
  0%,
  24% {
    transform: translateX(-135%);
  }

  58%,
  100% {
    transform: translateX(135%);
  }
}

@keyframes aiPortalAvatarPulse {
  0%,
  100% {
    box-shadow: 0 0 0 3px rgba(25, 99, 170, 0.06), 0 8px 18px rgba(26, 45, 78, 0.12);
  }

  50% {
    box-shadow: 0 0 0 5px rgba(14, 126, 116, 0.10), 0 12px 24px rgba(26, 45, 78, 0.18);
  }
}

@keyframes aiAuthRingRotate {
  to {
    transform: rotate(360deg);
  }
}

@keyframes aiAuthRingReverse {
  to {
    transform: rotate(-360deg);
  }
}

@keyframes aiAuthScanDrop {
  0% {
    transform: translateY(-115%);
    opacity: 0;
  }

  20%,
  75% {
    opacity: 1;
  }

  100% {
    transform: translateY(115%);
    opacity: 0;
  }
}

@keyframes aiAuthStatusFloat {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-6px);
  }
}

.ai-portal-body {
  --ai-tech-blue: #3157d5;
  --ai-tech-teal: #0b7a75;
  --ai-tech-gold: #b7791f;
  background-color: #f7f9fb;
  background-image:
    linear-gradient(rgba(49, 87, 213, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(11, 122, 117, 0.045) 1px, transparent 1px),
    linear-gradient(180deg, #fbfcff 0%, #f6f8fb 48%, #ffffff 100%);
  background-size: 34px 34px, 34px 34px, 100% 100%;
}

.ai-portal-shell {
  position: relative;
  isolation: isolate;
}

.ai-portal-shell::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  z-index: 60;
  width: 42vw;
  height: 2px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(49, 87, 213, 0.58), rgba(11, 122, 117, 0.50), transparent);
  animation: aiPortalLineScan 5.8s ease-in-out infinite;
}

.ai-topbar {
  position: relative;
  overflow: hidden;
  border-bottom-color: rgba(29, 53, 87, 0.10);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(249, 251, 254, 0.92));
  box-shadow: 0 12px 34px rgba(26, 45, 78, 0.07);
}

.ai-topbar::after {
  content: "";
  position: absolute;
  right: auto;
  bottom: 0;
  left: 0;
  width: 34%;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(49, 87, 213, 0.50), rgba(183, 121, 31, 0.38), transparent);
  animation: aiPortalLineScan 6.4s ease-in-out infinite;
}

.ai-brand-mark--avatar {
  animation: aiPortalAvatarPulse 4.6s ease-in-out infinite;
}

.ai-nav a.active {
  box-shadow: inset 0 -2px 0 rgba(49, 87, 213, 0.50);
}

.ai-workspace,
.ai-auth-stage,
.ai-studio-shell,
.ai-panel {
  position: relative;
  animation: aiPortalPanelIn 0.36s ease-out both;
}

.ai-workspace,
.ai-auth-stage,
.ai-studio-shell {
  border-color: rgba(29, 53, 87, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 253, 0.96));
  box-shadow:
    0 24px 64px rgba(26, 45, 78, 0.10),
    0 0 0 1px rgba(255, 255, 255, 0.72) inset;
}

.ai-workspace::before,
.ai-auth-stage::before,
.ai-studio-shell::before {
  content: "";
  position: absolute;
  top: 0;
  right: 18px;
  left: 18px;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(49, 87, 213, 0.42), rgba(11, 122, 117, 0.34), transparent);
}

.ai-auth-stage {
  overflow: hidden;
  background-image:
    linear-gradient(rgba(49, 87, 213, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(11, 122, 117, 0.04) 1px, transparent 1px),
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(246, 249, 253, 0.94));
  background-size: 30px 30px, 30px 30px, 100% 100%;
}

.ai-auth-stage::after {
  content: "";
  position: absolute;
  top: 58px;
  bottom: 58px;
  left: 28px;
  z-index: 0;
  width: min(440px, 42%);
  border-left: 1px solid rgba(49, 87, 213, 0.16);
  border-right: 1px solid rgba(11, 122, 117, 0.12);
  pointer-events: none;
  opacity: 0.72;
  background:
    repeating-linear-gradient(135deg, rgba(49, 87, 213, 0.06) 0 1px, transparent 1px 18px),
    linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0));
}

.ai-auth-stage > * {
  position: relative;
  z-index: 1;
}

.ai-auth-card {
  border-color: rgba(29, 53, 87, 0.12);
  background: rgba(255, 255, 255, 0.92);
  box-shadow:
    0 24px 62px rgba(26, 45, 78, 0.14),
    0 0 0 1px rgba(255, 255, 255, 0.72) inset;
}

.ai-auth-card--glass {
  backdrop-filter: blur(16px);
}

.ai-auth-proof span {
  border-color: rgba(49, 87, 213, 0.14);
  background: rgba(255, 255, 255, 0.78);
}

.ai-auth-stage--login {
  width: min(1180px, 100%);
  grid-template-columns: minmax(300px, 0.9fr) minmax(220px, 300px) minmax(360px, 430px);
  gap: 28px;
}

.ai-auth-stage--login .ai-auth-copy {
  align-content: center;
}

.ai-auth-stage--login .ai-kicker {
  border-color: rgba(11, 122, 117, 0.22);
  background: rgba(236, 248, 247, 0.86);
  color: #0b6f6b;
}

.ai-auth-stage--login .ai-auth-card-head span {
  color: #3157d5;
}

.ai-auth-stage--login .ai-auth-card button {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border-color: rgba(96, 165, 250, 0.92);
  background:
    radial-gradient(circle at 18% 20%, rgba(147, 197, 253, 0.42), transparent 34%),
    linear-gradient(135deg, #102a68 0%, #1d4ed8 54%, #0ea5e9 100%);
  color: #ffffff;
  text-shadow: 0 1px 8px rgba(8, 47, 73, 0.42);
  box-shadow:
    0 16px 34px rgba(37, 99, 235, 0.26),
    0 0 0 1px rgba(191, 219, 254, 0.48) inset,
    0 0 24px rgba(14, 165, 233, 0.20);
}

.ai-auth-stage--login .ai-auth-card button::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(112deg, transparent 0 26%, rgba(255, 255, 255, 0.36) 44%, transparent 62%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.16), transparent 18% 82%, rgba(255, 255, 255, 0.14));
  transform: translateX(-120%);
  transition: transform 0.34s ease;
}

.ai-auth-stage--login .ai-auth-card button:hover {
  border-color: rgba(125, 211, 252, 0.98);
  background:
    radial-gradient(circle at 18% 20%, rgba(186, 230, 253, 0.50), transparent 34%),
    linear-gradient(135deg, #0f2f7f 0%, #2563eb 52%, #06b6d4 100%);
  box-shadow:
    0 18px 38px rgba(37, 99, 235, 0.34),
    0 0 0 1px rgba(219, 234, 254, 0.62) inset,
    0 0 32px rgba(14, 165, 233, 0.28);
}

.ai-auth-stage--login .ai-auth-card button:hover::after {
  transform: translateX(120%);
}

.ai-auth-visual {
  position: relative;
  min-height: 420px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(29, 53, 87, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(rgba(49, 87, 213, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(11, 122, 117, 0.048) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.66), rgba(244, 248, 253, 0.54));
  background-size: 26px 26px, 26px 26px, 100% 100%;
  box-shadow:
    0 22px 48px rgba(26, 45, 78, 0.08),
    0 0 0 1px rgba(255, 255, 255, 0.62) inset;
}

.ai-auth-visual::before,
.ai-auth-visual::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.ai-auth-visual::before {
  inset: 24px;
  border: 1px solid rgba(49, 87, 213, 0.13);
  border-radius: 8px;
}

.ai-auth-visual::after {
  right: 18px;
  bottom: 18px;
  left: 18px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(49, 87, 213, 0.40), rgba(183, 121, 31, 0.30), transparent);
}

.ai-auth-core {
  position: relative;
  z-index: 2;
  width: 116px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid rgba(49, 87, 213, 0.24);
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.98), rgba(236, 244, 255, 0.86) 58%, rgba(218, 232, 252, 0.70));
  color: #172033;
  font-size: 36px;
  font-weight: 950;
  box-shadow:
    0 24px 44px rgba(26, 45, 78, 0.16),
    0 0 0 10px rgba(255, 255, 255, 0.52),
    0 0 0 18px rgba(49, 87, 213, 0.055);
}

.ai-auth-core span {
  position: relative;
  z-index: 1;
}

.ai-auth-core::before {
  content: "";
  position: absolute;
  inset: 16px;
  border: 1px solid rgba(11, 122, 117, 0.18);
  border-radius: inherit;
}

.ai-auth-ring {
  position: absolute;
  z-index: 1;
  border-radius: 999px;
  pointer-events: none;
}

.ai-auth-ring--outer {
  width: 238px;
  aspect-ratio: 1;
  border: 1px solid rgba(49, 87, 213, 0.14);
  background:
    conic-gradient(from 90deg, transparent 0 22%, rgba(49, 87, 213, 0.46) 28%, transparent 34% 58%, rgba(11, 122, 117, 0.36) 65%, transparent 72% 100%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px));
  animation: aiAuthRingRotate 9s linear infinite;
}

.ai-auth-ring--inner {
  width: 174px;
  aspect-ratio: 1;
  border: 1px dashed rgba(183, 121, 31, 0.28);
  animation: aiAuthRingReverse 12s linear infinite;
}

.ai-auth-scan {
  position: absolute;
  z-index: 1;
  width: 72%;
  height: 42%;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(49, 87, 213, 0.11), transparent);
  animation: aiAuthScanDrop 4.2s ease-in-out infinite;
}

.ai-auth-status {
  position: absolute;
  z-index: 3;
  display: grid;
  gap: 3px;
  min-width: 126px;
  border: 1px solid rgba(29, 53, 87, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  padding: 10px 12px;
  box-shadow: 0 16px 34px rgba(26, 45, 78, 0.11);
  backdrop-filter: blur(12px);
  animation: aiAuthStatusFloat 4.8s ease-in-out infinite;
}

.ai-auth-status--top {
  top: 76px;
  right: 22px;
}

.ai-auth-status--bottom {
  bottom: 76px;
  left: 20px;
  animation-delay: -1.7s;
}

.ai-auth-status span {
  color: #687385;
  font-size: 12px;
  font-weight: 760;
}

.ai-auth-status strong {
  color: #172033;
  font-size: 17px;
}

.ai-chat-link:hover,
.ai-chat-link.active {
  border-color: rgba(49, 87, 213, 0.16);
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.ai-message-row--assistant .ai-message-bubble {
  box-shadow: 0 10px 28px rgba(26, 45, 78, 0.05);
}

.ai-message-row--user .ai-message-bubble {
  background: linear-gradient(180deg, #eef4ff, #f6f9ff);
}

.ai-dock-card {
  background:
    linear-gradient(#ffffff, #ffffff) padding-box,
    linear-gradient(120deg, rgba(49, 87, 213, 0.22), rgba(11, 122, 117, 0.18), rgba(183, 121, 31, 0.12)) border-box;
}

.ai-floating-launcher {
  overflow: hidden;
  isolation: isolate;
  border-color: rgba(49, 87, 213, 0.22);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(246, 249, 255, 0.96));
  box-shadow:
    0 14px 32px rgba(26, 45, 78, 0.18),
    0 0 0 1px rgba(11, 122, 117, 0.06);
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease;
}

.ai-floating-launcher::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(112deg, transparent 0 24%, rgba(49, 87, 213, 0.14) 36%, rgba(11, 122, 117, 0.16) 44%, transparent 58%);
  animation: aiPortalFloatScan 4.2s ease-in-out infinite;
}

.ai-floating-launcher::after {
  content: "";
  position: absolute;
  inset: 2px;
  z-index: 0;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: inherit;
  pointer-events: none;
}

.ai-floating-launcher:hover,
.ai-floating-launcher:focus-visible {
  transform: translateY(-3px);
  border-color: rgba(11, 122, 117, 0.36);
  box-shadow:
    0 20px 42px rgba(26, 45, 78, 0.24),
    0 0 0 1px rgba(49, 87, 213, 0.10);
}

.ai-floating-launcher__avatar,
.ai-floating-launcher__label {
  position: relative;
  z-index: 1;
}

.ai-floating-launcher__avatar {
  border-color: rgba(49, 87, 213, 0.18);
  animation: aiPortalAvatarPulse 4.8s ease-in-out infinite;
}

.ai-floating-launcher__label {
  color: #172033;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.86);
}

@media (max-width: 1060px) {
  .ai-auth-stage--login {
    grid-template-columns: minmax(280px, 1fr) minmax(360px, 430px);
  }

  .ai-auth-visual {
    display: none;
  }
}

@media (max-width: 900px) {
  .ai-auth-stage--login {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ai-portal-shell::before,
  .ai-topbar::after,
  .ai-brand-mark--avatar,
  .ai-workspace,
  .ai-auth-stage,
  .ai-studio-shell,
  .ai-panel,
  .ai-floating-launcher::before,
  .ai-floating-launcher__avatar,
  .ai-auth-ring--outer,
  .ai-auth-ring--inner,
  .ai-auth-scan,
  .ai-auth-status {
    animation: none !important;
  }

  .ai-floating-launcher,
  .ai-floating-launcher:hover,
  .ai-floating-launcher:focus-visible {
    transform: none;
    transition: none;
  }
}

.ai-portal-body--scrollable {
  overflow: auto;
}

.ai-portal-body--scrollable .ai-main {
  height: auto;
  min-height: calc(100vh - 59px);
  overflow: visible;
}

.ai-portal-body--scrollable .ai-panel,
.ai-portal-body--scrollable .ai-studio-shell {
  max-height: none;
}

/* AI settings console rebuild */
.ai-settings-page {
  width: min(100%, calc(100vw - 32px));
  max-width: none;
  margin: 0 auto;
  display: grid;
  gap: 18px;
  justify-self: center;
  min-width: 0;
}

.ai-settings-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 520px);
  gap: 18px;
  align-items: end;
  padding: 22px;
  border: 1px solid rgba(29, 53, 87, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(rgba(49, 87, 213, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(11, 122, 117, 0.04) 1px, transparent 1px),
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 255, 0.94));
  background-size: 28px 28px, 28px 28px, 100% 100%;
  box-shadow:
    0 24px 64px rgba(26, 45, 78, 0.08),
    0 0 0 1px rgba(255, 255, 255, 0.72) inset;
}

.ai-settings-hero h1 {
  margin: 12px 0 8px;
  color: var(--ai-ink);
  font-size: 34px;
  line-height: 1.16;
  letter-spacing: 0;
}

.ai-settings-hero p {
  max-width: 620px;
  margin: 0;
  color: var(--ai-muted);
  line-height: 1.72;
}

.ai-settings-status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.ai-settings-status-strip div {
  min-height: 78px;
  display: grid;
  align-content: center;
  gap: 5px;
  border: 1px solid rgba(49, 87, 213, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  padding: 12px;
}

.ai-settings-status-strip span {
  color: var(--ai-muted);
  font-size: 12px;
  font-weight: 760;
}

.ai-settings-status-strip strong {
  color: #172033;
  font-size: 20px;
}

.ai-settings-layout {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  width: 100%;
  min-width: 0;
}

.ai-settings-rail {
  position: sticky;
  top: 74px;
  display: grid;
  gap: 6px;
  border: 1px solid rgba(29, 53, 87, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.90);
  padding: 10px;
  box-shadow: 0 16px 36px rgba(26, 45, 78, 0.07);
}

.ai-settings-rail a {
  min-height: 38px;
  display: flex;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #344054;
  padding: 0 11px;
  font-size: 14px;
  font-weight: 820;
  text-decoration: none;
}

.ai-settings-rail a:hover,
.ai-settings-rail a:focus-visible {
  border-color: rgba(49, 87, 213, 0.16);
  background: #f8fbff;
  color: #1d4ed8;
  outline: none;
}

.ai-settings-content {
  display: grid;
  gap: 16px;
  width: 100%;
  min-width: 0;
}

.ai-settings-section {
  display: grid;
  gap: 12px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  scroll-margin-top: 86px;
}

.ai-settings-section:target .ai-settings-section-head {
  border-color: rgba(49, 87, 213, 0.26);
  box-shadow: 0 0 0 3px rgba(49, 87, 213, 0.08);
}

.ai-settings-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid rgba(29, 53, 87, 0.10);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 14px 16px;
}

.ai-settings-section-head span {
  color: #3157d5;
  font-size: 13px;
  font-weight: 900;
}

.ai-settings-section-head h2,
.ai-settings-card h3 {
  margin: 0;
  color: var(--ai-ink);
  letter-spacing: 0;
}

.ai-settings-section-head h2 {
  margin-top: 3px;
  font-size: 22px;
}

.ai-settings-section-head p,
.ai-settings-card-head p {
  margin: 4px 0 0;
  color: var(--ai-muted);
  line-height: 1.6;
}

.ai-settings-grid {
  display: grid;
  gap: 12px;
}

.ai-settings-grid--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ai-settings-card {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  border: 1px solid rgba(29, 53, 87, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  padding: 16px;
  box-shadow: 0 18px 44px rgba(26, 45, 78, 0.07);
}

.ai-settings-card--primary {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(242, 247, 255, 0.96));
  border-color: rgba(49, 87, 213, 0.18);
}

.ai-settings-card:target {
  border-color: rgba(49, 87, 213, 0.34);
  box-shadow:
    0 18px 44px rgba(26, 45, 78, 0.08),
    0 0 0 3px rgba(49, 87, 213, 0.09);
}

.ai-settings-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.ai-provider-summary-list {
  display: grid;
  gap: 8px;
}

.ai-provider-summary-list a {
  display: grid;
  gap: 3px;
  border: 1px solid rgba(29, 53, 87, 0.10);
  border-radius: 8px;
  background: #f8fbff;
  padding: 10px 12px;
  text-decoration: none;
}

.ai-provider-summary-list a:hover {
  border-color: rgba(49, 87, 213, 0.22);
}

.ai-provider-summary-list strong {
  color: var(--ai-ink);
}

.ai-provider-summary-list span {
  color: var(--ai-muted);
  font-size: 12px;
}

.ai-provider-stack {
  display: grid;
  gap: 12px;
}

.ai-provider-forms {
  display: grid;
  grid-template-columns: minmax(220px, 0.72fr) minmax(0, 1.28fr);
  gap: 14px;
  align-items: start;
}

.ai-settings-page .form-grid {
  gap: 12px;
}

.ai-settings-page .field > span {
  color: #4b5565;
  font-size: 13px;
  font-weight: 760;
}

.ai-settings-page input,
.ai-settings-page select,
.ai-settings-page textarea {
  min-width: 0;
  min-height: 38px;
  border: 1px solid #d8dde8;
  border-radius: 8px;
  background: #ffffff;
  color: #172033;
}

.ai-settings-page input:focus,
.ai-settings-page select:focus,
.ai-settings-page textarea:focus {
  border-color: #3157d5;
  box-shadow: 0 0 0 3px rgba(49, 87, 213, 0.10);
  outline: none;
}

.ai-settings-page button {
  min-height: 38px;
  border: 1px solid #3157d5;
  border-radius: 8px;
  background: linear-gradient(135deg, #1d4ed8, #0ea5e9);
  color: #ffffff;
  padding: 0 14px;
  font-weight: 850;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.18);
}

.ai-settings-page button:hover {
  border-color: #2563eb;
  background: linear-gradient(135deg, #1e40af, #0284c7);
}

.ai-settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.ai-settings-toolbar {
  display: grid;
  grid-template-columns: minmax(280px, auto) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  min-width: 0;
}

.ai-settings-page .ai-table-form,
.ai-settings-page .ai-model-search-form {
  min-width: 0;
  max-width: 100%;
}

.ai-settings-page .ai-model-search-form input {
  min-width: min(420px, 100%);
}

.ai-endpoint-form {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #e5e9f2;
}

.ai-endpoint-form code {
  color: #1d4ed8;
  font-weight: 750;
}

.ai-settings-table-shell {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: auto;
  overscroll-behavior-x: contain;
}

.ai-settings-table-shell .data-table {
  min-width: 980px;
  max-width: none;
}

.ai-settings-table-shell .data-table th {
  white-space: nowrap;
}

.ai-model-help-card {
  border-color: rgba(49, 87, 213, 0.18);
  background:
    linear-gradient(135deg, rgba(49, 87, 213, 0.08), rgba(2, 132, 199, 0.05)),
    rgba(255, 255, 255, 0.9);
}

.ai-help-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.ai-help-grid div {
  min-width: 0;
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  padding: 12px;
}

.ai-help-grid strong {
  display: block;
  margin-bottom: 6px;
  color: #172033;
  font-size: 14px;
}

.ai-help-grid span {
  display: block;
  color: #5b6678;
  font-size: 13px;
  line-height: 1.55;
}

.field-help {
  display: block;
  margin-top: 6px;
  color: #667085;
  font-size: 12px;
  line-height: 1.45;
}

.ai-table-help-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.ai-table-help-bar span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-radius: 999px;
  background: #f8fbff;
  color: #526071;
  font-size: 13px;
  line-height: 1.4;
  padding: 7px 10px;
}

.ai-table-help-bar strong {
  color: #172033;
}

.ai-model-config-table {
  table-layout: auto;
}

.ai-model-config-heading {
  display: grid;
  grid-template-columns: 210px minmax(1420px, 1fr);
  gap: 0;
  min-width: 1630px;
  margin-bottom: 8px;
  color: #526071;
  font-size: 12px;
  font-weight: 800;
}

.ai-model-config-heading > span,
.ai-model-row-heading span {
  min-height: 34px;
  display: flex;
  align-items: center;
  border: 1px solid #e5e9f2;
  border-right: 0;
  background: #f8fafc;
  padding: 0 10px;
  white-space: nowrap;
}

.ai-model-config-heading > span {
  border-radius: 8px 0 0 8px;
}

.ai-model-row-heading {
  display: grid;
  grid-template-columns:
    minmax(150px, 1fr)
    minmax(150px, 1fr)
    minmax(130px, 0.8fr)
    minmax(180px, 1.2fr)
    minmax(100px, 0.6fr)
    minmax(100px, 0.6fr)
    minmax(78px, 0.45fr)
    minmax(78px, 0.45fr)
    minmax(78px, 0.45fr)
    minmax(78px, 0.45fr)
    minmax(120px, 0.8fr)
    minmax(86px, auto)
    minmax(108px, auto)
    minmax(108px, auto)
    minmax(78px, auto);
}

.ai-model-row-heading span:last-child {
  border-right: 1px solid #e5e9f2;
  border-radius: 0 8px 8px 0;
}

.ai-plan-model-picker {
  align-items: stretch;
  gap: 8px;
}

.ai-plan-model-picker small {
  color: #667085;
  font-size: 12px;
  font-weight: 700;
}

.ai-plan-model-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.ai-plan-model-options label {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(148, 163, 184, 0.26);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  padding: 9px 10px;
}

.ai-plan-model-options span {
  color: #111827;
  font-weight: 800;
}

.ai-plan-model-options em {
  color: #667085;
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.ai-model-config-table td:first-child {
  width: 210px;
  word-break: break-all;
}

.ai-model-config-table tr:target {
  outline: 3px solid rgba(49, 87, 213, 0.14);
  outline-offset: -3px;
}

.ai-model-row-form {
  display: grid;
  grid-template-columns:
    minmax(150px, 1fr)
    minmax(150px, 1fr)
    minmax(130px, 0.8fr)
    minmax(180px, 1.2fr)
    minmax(100px, 0.6fr)
    minmax(100px, 0.6fr)
    minmax(78px, 0.45fr)
    minmax(78px, 0.45fr)
    minmax(78px, 0.45fr)
    minmax(78px, 0.45fr)
    minmax(120px, 0.8fr)
    minmax(86px, auto)
    minmax(108px, auto)
    minmax(108px, auto)
    minmax(78px, auto);
  gap: 8px;
  align-items: center;
  min-width: 1420px;
}

.ai-model-row-form .checkbox-row {
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid #e5e9f2;
  border-radius: 8px;
  background: #f8fafc;
  padding: 0 8px;
}

.ai-row-edit-grid {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(130px, 0.7fr) auto;
  gap: 8px;
  align-items: center;
}

.ai-plan-list--settings {
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
}

.ai-settings-page .ai-provider-advanced {
  border-color: #d8dde8;
  background: #f8fafc;
}

@media (max-width: 1180px) {
  .ai-settings-hero,
  .ai-settings-layout,
  .ai-settings-grid--two,
  .ai-provider-forms {
    grid-template-columns: 1fr;
  }

  .ai-help-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ai-settings-rail {
    position: sticky;
    top: 58px;
    z-index: 20;
    display: flex;
    gap: 8px;
    overflow-x: auto;
  }

  .ai-settings-rail a {
    flex: 0 0 auto;
    white-space: nowrap;
  }
}

@media (max-width: 760px) {
  .ai-settings-hero {
    padding: 16px;
  }

  .ai-settings-status-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ai-settings-card,
  .ai-settings-section-head {
    padding: 12px;
  }

  .ai-settings-toolbar,
  .ai-model-search-form,
  .ai-table-form,
  .ai-row-edit-grid,
  .ai-help-grid {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .ai-settings-actions,
  .ai-settings-page button {
    width: 100%;
  }

  .ai-table-help-bar span {
    width: 100%;
    border-radius: 8px;
  }
}

/* AI compact chat surface */
.ai-portal-body--chat {
  background: #000000;
}

.ai-portal-body--chat .ai-portal-shell {
  background: #000000;
}

.ai-portal-body--chat .ai-topbar {
  border-bottom-color: #1f2027;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(18px);
}

.ai-portal-body--chat .ai-brand-text strong,
.ai-portal-body--chat .ai-nav a {
  color: #f7f7f8;
}

.ai-portal-body--chat .ai-brand-text small,
.ai-portal-body--chat .ai-nav button {
  color: #a6a6ad;
}

.ai-portal-body--chat .ai-nav a.active,
.ai-portal-body--chat .ai-nav a:hover,
.ai-portal-body--chat .ai-nav button:hover {
  color: #ffffff;
  background: #181a20;
}

.ai-portal-body--chat .ai-main {
  background: #000000;
}

.ai-workspace--chat {
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 0;
  border: 0;
  border-radius: 0;
  background: #000000;
  box-shadow: none;
}

.ai-workspace--chat .ai-rail {
  border-right: 1px solid #202127;
  background: #0f1014;
  color: #f7f7f8;
}

.ai-workspace--chat .ai-rail-new {
  border-color: #282a33;
  background: #14161c;
}

.ai-workspace--chat .ai-primary-button {
  border-color: #363a48;
  background: #1b1d26;
  color: #ffffff;
  box-shadow: none;
}

.ai-workspace--chat .ai-primary-button:hover {
  border-color: #6d54c8;
  background: #242132;
}

.ai-workspace--chat .ai-rail label span,
.ai-workspace--chat .ai-rail-title,
.ai-workspace--chat .ai-rail-hint,
.ai-workspace--chat .ai-chat-link small {
  color: #a6a6ad;
}

.ai-workspace--chat .ai-rail select,
.ai-workspace--chat .ai-composer-tools select {
  min-height: 36px;
  border-color: #30333d;
  background-color: #171920;
  color: #f7f7f8;
}

.ai-workspace--chat .ai-chat-list-item {
  gap: 6px;
}

.ai-workspace--chat .ai-chat-link {
  border-color: transparent;
  background: transparent;
  color: #e9e9ed;
}

.ai-workspace--chat .ai-chat-link:hover,
.ai-workspace--chat .ai-chat-link.active {
  border-color: #2b2d36;
  background: #181a20;
}

.ai-workspace--chat .ai-chat-link span {
  color: inherit;
}

.ai-workspace--chat .ai-empty-row {
  border-color: #242630;
  background: #111217;
  color: #a6a6ad;
}

.ai-workspace--chat .ai-chat-delete-button {
  min-width: 44px;
  height: 28px;
  border-color: transparent;
  background: transparent;
  color: #888a93;
  box-shadow: none;
}

.ai-workspace--chat .ai-chat-delete-button:hover {
  border-color: #393b46;
  background: #181a20;
  color: #ffffff;
}

.ai-workspace--chat .ai-chat-main {
  border: 0;
  border-radius: 0;
  background: #000000;
  box-shadow: none;
}

.ai-workspace--chat .ai-chat-head {
  min-height: 64px;
  border-bottom: 1px solid #1f2027;
  background: #000000;
  padding: 10px clamp(18px, 7vw, 118px);
}

.ai-workspace--chat .ai-title-stack h1 {
  color: #f7f7f8;
  font-size: 18px;
}

.ai-workspace--chat .ai-title-stack span,
.ai-workspace--chat .ai-soft-link,
.ai-workspace--chat .ai-title-menu summary {
  color: #a6a6ad;
}

.ai-workspace--chat .ai-title-menu[open] summary,
.ai-workspace--chat .ai-soft-link:hover {
  color: #ffffff;
}

.ai-workspace--chat .ai-title-form {
  border-color: #30333d;
  background: #111217;
}

.ai-workspace--chat .ai-title-form input {
  border-color: #30333d;
  background: #171920;
  color: #f7f7f8;
}

.ai-workspace--chat .ai-message-list {
  gap: 18px;
  background: #000000;
  color: #f7f7f8;
  padding: 24px clamp(18px, 8vw, 132px) 150px;
}

.ai-workspace--chat .ai-message-row,
.ai-workspace--chat .ai-message-row--user {
  display: flex;
  grid-template-columns: none;
  gap: 0;
}

.ai-workspace--chat .ai-message-row--assistant {
  justify-content: flex-start;
}

.ai-workspace--chat .ai-message-row--user {
  justify-content: flex-end;
}

.ai-workspace--chat .ai-message-avatar {
  display: none;
}

.ai-workspace--chat .ai-message-bubble,
.ai-workspace--chat .ai-message-row--assistant .ai-message-bubble {
  max-width: min(920px, 100%);
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #f7f7f8;
  padding: 0;
  box-shadow: none;
}

.ai-workspace--chat .ai-message-row--user .ai-message-bubble {
  max-width: min(560px, 82%);
  border-radius: 24px;
  background: #57339a;
  color: #ffffff;
  padding: 10px 18px;
}

.ai-workspace--chat .ai-message-meta {
  margin-bottom: 6px;
  color: #9b9ca5;
  font-size: 13px;
}

.ai-workspace--chat .ai-message-row--user .ai-message-meta {
  display: none;
}

.ai-workspace--chat .ai-message-content {
  color: inherit;
  font-size: 16px;
  line-height: 1.76;
  white-space: pre-wrap;
}

.ai-workspace--chat .field-error {
  display: block;
  margin-top: 10px;
  border: 1px solid rgba(248, 113, 113, 0.24);
  border-radius: 8px;
  background: rgba(127, 29, 29, 0.28);
  color: #fecaca;
  padding: 8px 10px;
}

.ai-workspace--chat .ai-empty-chat {
  max-width: 720px;
  border-color: #242630;
  background: #111217;
  color: #f7f7f8;
}

.ai-workspace--chat .ai-empty-chat span {
  color: #a6a6ad;
}

.ai-workspace--chat .ai-generated-panel {
  border-top: 1px solid #1f2027;
  background: #050505;
  padding: 18px clamp(18px, 8vw, 132px);
}

.ai-workspace--chat .ai-generated-card {
  border-color: #242630;
  background: #111217;
  color: #f7f7f8;
}

.ai-workspace--chat .ai-dock {
  border-top: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0), #000000 32%);
  padding: 12px 18px 18px;
}

.ai-workspace--chat .ai-dock-card {
  width: min(920px, 100%);
  border-color: #2d2f38;
  border-radius: 20px;
  background: #111217;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.38);
}

.ai-workspace--chat .ai-dock-card--chat textarea {
  min-height: 44px;
  max-height: 160px;
  border: 0;
  background: transparent;
  color: #ffffff;
  padding: 14px 16px 8px;
  resize: none;
}

.ai-workspace--chat .ai-dock-card--chat textarea:focus {
  box-shadow: none;
}

.ai-workspace--chat .ai-dock-card--chat textarea::placeholder {
  color: #858791;
}

.ai-workspace--chat .ai-composer-toolbar {
  border-top: 1px solid #2d2f38;
  padding: 8px;
}

.ai-workspace--chat .ai-tool-submit {
  min-width: 62px;
  border-color: #363a48;
  background: #1b1d26;
  color: #f7f7f8;
  box-shadow: none;
}

.ai-workspace--chat .ai-tool-submit:hover {
  border-color: #5b5f73;
  background: #232632;
}

.ai-workspace--chat .ai-send-button {
  min-width: 72px;
  border-color: #6d54c8;
  background: linear-gradient(135deg, #6f42c1, #56339a);
  color: #ffffff;
  box-shadow: none;
}

.ai-workspace--chat .ai-send-button:hover {
  border-color: #8468df;
  background: linear-gradient(135deg, #7a4bd1, #6040aa);
}

@media (max-width: 900px) {
  .ai-workspace--chat {
    grid-template-columns: 1fr;
  }

  .ai-workspace--chat .ai-rail {
    border-right: 0;
    border-bottom: 1px solid #202127;
  }

  .ai-workspace--chat .ai-message-list {
    padding: 18px 16px 150px;
  }

  .ai-workspace--chat .ai-chat-head {
    padding: 10px 16px;
  }

  .ai-workspace--chat .ai-message-row--user .ai-message-bubble {
    max-width: 90%;
  }
}

@media (min-width: 700px) {
  .ai-workspace--chat {
    grid-template-columns: 248px minmax(0, 1fr);
  }

  .ai-workspace--chat .ai-rail {
    border-right: 1px solid #202127;
    border-bottom: 0;
  }

  .ai-workspace--chat .ai-message-list {
    padding: 22px clamp(18px, 6vw, 92px) 150px;
  }

  .ai-workspace--chat .ai-chat-head {
    padding: 10px clamp(18px, 6vw, 92px);
  }
}

/* AI chat theme, default light with a manual dark toggle */
.ai-portal-body--chat {
  color-scheme: light;
  --ai-chat-page-bg: #f7f7f8;
  --ai-chat-panel: #ffffff;
  --ai-chat-panel-soft: #f3f4f6;
  --ai-chat-panel-raised: #ffffff;
  --ai-chat-border: #e5e7eb;
  --ai-chat-border-strong: #d1d5db;
  --ai-chat-text: #111827;
  --ai-chat-muted: #6b7280;
  --ai-chat-faint: #9ca3af;
  --ai-chat-hover: #eef0f4;
  --ai-chat-user-bg: #5b3aa0;
  --ai-chat-user-hover: #6842b5;
  --ai-chat-danger-bg: #fff1f2;
  --ai-chat-danger-border: #fecdd3;
  --ai-chat-danger-text: #9f1239;
  background: var(--ai-chat-page-bg);
  color: var(--ai-chat-text);
}

html[data-ai-theme="dark"] .ai-portal-body--chat {
  color-scheme: dark;
  --ai-chat-page-bg: #000000;
  --ai-chat-panel: #0f1014;
  --ai-chat-panel-soft: #111217;
  --ai-chat-panel-raised: #171920;
  --ai-chat-border: #202127;
  --ai-chat-border-strong: #30333d;
  --ai-chat-text: #f7f7f8;
  --ai-chat-muted: #a6a6ad;
  --ai-chat-faint: #858791;
  --ai-chat-hover: #181a20;
  --ai-chat-user-bg: #57339a;
  --ai-chat-user-hover: #6040aa;
  --ai-chat-danger-bg: rgba(127, 29, 29, 0.28);
  --ai-chat-danger-border: rgba(248, 113, 113, 0.24);
  --ai-chat-danger-text: #fecaca;
}

.ai-portal-body--chat .ai-portal-shell,
.ai-portal-body--chat .ai-main,
.ai-portal-body--chat .ai-workspace--chat,
.ai-portal-body--chat .ai-chat-main,
.ai-portal-body--chat .ai-chat-head,
.ai-portal-body--chat .ai-message-list {
  background: var(--ai-chat-page-bg);
  color: var(--ai-chat-text);
}

.ai-portal-body--chat .ai-topbar {
  border-bottom-color: var(--ai-chat-border);
  background: var(--ai-chat-page-bg);
}

.ai-portal-body--chat .ai-brand-text strong,
.ai-portal-body--chat .ai-nav a,
.ai-portal-body--chat .ai-title-stack h1,
.ai-portal-body--chat .ai-message-content {
  color: var(--ai-chat-text);
}

.ai-portal-body--chat .ai-brand-text small,
.ai-portal-body--chat .ai-nav button,
.ai-portal-body--chat .ai-title-stack span,
.ai-portal-body--chat .ai-soft-link,
.ai-portal-body--chat .ai-title-menu summary,
.ai-workspace--chat .ai-rail label span,
.ai-workspace--chat .ai-rail-title,
.ai-workspace--chat .ai-rail-hint,
.ai-workspace--chat .ai-chat-link small,
.ai-workspace--chat .ai-message-meta,
.ai-workspace--chat .ai-empty-chat span {
  color: var(--ai-chat-muted);
}

.ai-portal-body--chat .ai-nav a.active,
.ai-portal-body--chat .ai-nav a:hover,
.ai-portal-body--chat .ai-nav button:hover,
.ai-workspace--chat .ai-chat-link:hover,
.ai-workspace--chat .ai-chat-link.active,
.ai-workspace--chat .ai-chat-delete-button:hover {
  background: var(--ai-chat-hover);
  color: var(--ai-chat-text);
}

.ai-workspace--chat .ai-rail,
.ai-workspace--chat .ai-rail-new,
.ai-workspace--chat .ai-empty-row,
.ai-workspace--chat .ai-empty-chat,
.ai-workspace--chat .ai-generated-card,
.ai-workspace--chat .ai-title-form,
.ai-workspace--chat .ai-dock-card,
.ai-workspace--chat .ai-tool-submit {
  border-color: var(--ai-chat-border);
  background: var(--ai-chat-panel);
  color: var(--ai-chat-text);
}

.ai-workspace--chat .ai-rail {
  border-right-color: var(--ai-chat-border);
}

.ai-workspace--chat .ai-chat-head,
.ai-workspace--chat .ai-composer-toolbar,
.ai-workspace--chat .ai-generated-panel {
  border-color: var(--ai-chat-border);
}

.ai-workspace--chat .ai-chat-link,
.ai-workspace--chat .ai-message-bubble,
.ai-workspace--chat .ai-message-row--assistant .ai-message-bubble {
  background: transparent;
  color: var(--ai-chat-text);
}

.ai-workspace--chat .ai-rail select,
.ai-workspace--chat .ai-composer-tools select,
.ai-workspace--chat .ai-title-form input {
  border-color: var(--ai-chat-border-strong);
  background-color: var(--ai-chat-panel-raised);
  color: var(--ai-chat-text);
}

.ai-workspace--chat .ai-dock-card--chat textarea {
  color: var(--ai-chat-text);
}

.ai-workspace--chat .ai-dock-card--chat textarea::placeholder {
  color: var(--ai-chat-faint);
}

.ai-workspace--chat .ai-message-row--user .ai-message-bubble {
  background: var(--ai-chat-user-bg);
  color: #ffffff;
}

.ai-workspace--chat .ai-message-row--user .ai-message-content {
  color: #ffffff;
}

.ai-workspace--chat .field-error {
  border-color: var(--ai-chat-danger-border);
  background: var(--ai-chat-danger-bg);
  color: var(--ai-chat-danger-text);
}

.ai-workspace--chat .ai-dock {
  background: linear-gradient(180deg, transparent, var(--ai-chat-page-bg) 32%);
}

.ai-workspace--chat .ai-primary-button,
.ai-workspace--chat .ai-tool-submit {
  border-color: var(--ai-chat-border-strong);
  background: var(--ai-chat-panel-raised);
  color: var(--ai-chat-text);
  box-shadow: none;
}

.ai-workspace--chat .ai-primary-button:hover,
.ai-workspace--chat .ai-tool-submit:hover {
  border-color: var(--ai-chat-user-bg);
  background: var(--ai-chat-hover);
}

.ai-workspace--chat .ai-send-button {
  border-color: var(--ai-chat-user-bg);
  background: linear-gradient(135deg, var(--ai-chat-user-hover), var(--ai-chat-user-bg));
  color: #ffffff;
}

.ai-theme-toggle {
  min-width: 72px;
  gap: 7px;
  border-color: #d6d3c8;
  background: #ffffff;
  color: #374151;
}

.ai-theme-toggle::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-radius: 50%;
  background: linear-gradient(90deg, currentColor 0 50%, transparent 50% 100%);
  opacity: 0.72;
}

html[data-ai-theme="dark"] .ai-theme-toggle {
  border-color: #30333d;
  background: #171920;
  color: #f7f7f8;
}

html[data-ai-theme="dark"] .ai-theme-toggle::before {
  background: currentColor;
  box-shadow: -4px 0 0 #171920 inset;
}

.ai-portal-body--chat .ai-theme-toggle {
  border-color: var(--ai-chat-border-strong);
  background: var(--ai-chat-panel-raised);
  color: var(--ai-chat-text);
}

/* Xiaolizi internal workspace compact polish */
.ai-internal-context-pill {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(79, 111, 220, 0.22);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(79, 111, 220, 0.12), rgba(14, 165, 233, 0.10));
  color: #3157d5;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 820;
}

.ai-internal-context-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 4px rgba(49, 87, 213, 0.10);
}

.ai-workspace--chat {
  grid-template-columns: 236px minmax(0, 1fr);
}

.ai-workspace--chat .ai-rail-new,
.ai-workspace--chat .ai-rail-section {
  padding: 10px;
}

.ai-workspace--chat .ai-chat-head {
  min-height: 54px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.ai-workspace--chat .ai-title-row h1 {
  font-size: 17px;
}

.ai-workspace--chat .ai-title-stack {
  gap: 3px;
}

.ai-workspace--chat .ai-title-stack > span {
  display: inline-flex;
  margin-right: 8px;
}

.ai-workspace--chat .ai-message-list {
  gap: 14px;
  padding-top: 18px;
}

.ai-workspace--chat .ai-message-bubble,
.ai-workspace--chat .ai-message-row--assistant .ai-message-bubble {
  max-width: min(860px, 100%);
}

.ai-workspace--chat .ai-message-row--user .ai-message-bubble {
  max-width: min(540px, 76%);
  padding: 8px 15px;
}

.ai-workspace--chat .ai-message-content {
  font-size: 15px;
  line-height: 1.68;
}

.ai-workspace--chat .ai-message-meta {
  margin-bottom: 4px;
  font-size: 12px;
}

.ai-workspace--chat .ai-message-actual-model {
  color: var(--ai-chat-muted);
}

.ai-generated-preview {
  position: relative;
  display: block;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  background: #f3f4f6;
  color: inherit;
  text-decoration: none;
}

.ai-generated-preview img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: #f3f4f6;
}

.ai-generated-preview--empty {
  min-height: 220px;
  display: grid;
  place-items: center;
  color: #6b7280;
  border-style: dashed;
}

.ai-generated-card-body {
  display: grid;
  gap: 6px;
}

.ai-generated-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.ai-generated-actions a {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ai-chat-border, #d1d5db);
  border-radius: 8px;
  background: var(--ai-chat-panel-raised, #ffffff);
  color: var(--ai-chat-text, #111827);
  padding: 0 11px;
  font-size: 13px;
  font-weight: 820;
  text-decoration: none;
}

.ai-generated-actions a:hover {
  border-color: var(--ai-chat-user-bg, #5b3aa0);
  background: var(--ai-chat-hover, #eef0f4);
}

.ai-workspace--chat .ai-generated-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 420px));
}

.ai-workspace--chat .ai-generated-card {
  align-content: start;
  padding: 12px;
}

.ai-workspace--chat .ai-generated-preview {
  border-color: var(--ai-chat-border);
  background: var(--ai-chat-panel-raised);
}

.ai-workspace--chat .ai-generated-preview img {
  background: var(--ai-chat-panel-raised);
}

.ai-workspace--chat .ai-dock-card {
  width: min(860px, 100%);
  border-radius: 16px;
}

.ai-workspace--chat .ai-dock-card--chat textarea {
  min-height: 38px;
  padding: 11px 14px 6px;
  font-size: 15px;
}

.ai-workspace--chat .ai-composer-toolbar {
  align-items: center;
  padding: 7px;
}

.ai-workspace--chat .ai-composer-tools {
  min-width: 0;
}

.ai-workspace--chat .ai-submit-status {
  color: var(--ai-chat-muted);
  white-space: nowrap;
}

.ai-workspace--chat .ai-dock-card.is-submitting {
  border-color: rgba(109, 84, 200, 0.72);
  box-shadow:
    0 16px 44px rgba(0, 0, 0, 0.20),
    0 0 0 3px rgba(109, 84, 200, 0.12);
}

html[data-ai-theme="dark"] .ai-internal-context-pill {
  border-color: rgba(132, 104, 223, 0.36);
  background: linear-gradient(135deg, rgba(109, 84, 200, 0.22), rgba(14, 165, 233, 0.12));
  color: #d7ccff;
}

/* GPT-like chat refinements: assistant identity, inline image tool, timing */
.ai-workspace--chat .ai-message-row--assistant {
  gap: 12px;
}

.ai-workspace--chat .ai-message-row--assistant .ai-message-avatar {
  display: inline-flex;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  margin-top: 2px;
}

.ai-workspace--chat .ai-message-row--user .ai-message-avatar {
  display: none;
}

.ai-workspace--chat .ai-message-row--assistant .ai-message-bubble {
  padding-top: 2px;
}

.ai-workspace--chat .ai-message-meta {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.ai-workspace--chat .ai-message-meta span {
  color: var(--ai-chat-muted);
}

.ai-workspace--chat .ai-message-row--image-result {
  margin-top: 4px;
}

.ai-workspace--chat .ai-generated-panel {
  border-top: 0;
  background: transparent;
  padding: 0;
}

.ai-workspace--chat .ai-image-result-bubble {
  display: grid;
  gap: 12px;
  max-width: min(920px, 100%);
}

.ai-workspace--chat .ai-image-result-bubble .ai-generated-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 360px));
}

.ai-workspace--chat .ai-generated-card {
  border-radius: 12px;
  background: var(--ai-chat-panel-raised);
}

.ai-workspace--chat .ai-generated-card--inline {
  width: min(360px, 100%);
  margin-top: 12px;
  padding: 8px;
  border: 1px solid var(--ai-chat-border, #dbe4ff);
  box-shadow: none;
}

.ai-workspace--chat .ai-generated-card--inline .ai-generated-preview {
  overflow: hidden;
  border-radius: 10px;
  background: #f6f9ff;
}

.ai-workspace--chat .ai-generated-card--inline .ai-generated-preview img {
  width: 100%;
  max-height: 320px;
  aspect-ratio: auto;
  object-fit: contain;
  background: #f6f9ff;
}

.ai-workspace--chat .ai-generated-card--inline .ai-generated-card-body {
  padding: 8px 2px 0;
}

.ai-tool-toggle {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--ai-chat-border-strong, #d1d5db);
  border-radius: 999px;
  background: var(--ai-chat-panel-raised, #ffffff);
  color: var(--ai-chat-text, #111827);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
  cursor: pointer;
}

.ai-tool-toggle::before {
  content: "";
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-radius: 4px;
  box-shadow: 5px -5px 0 -3px currentColor;
  opacity: 0.75;
}

.ai-tool-toggle[aria-pressed="true"] {
  border-color: rgba(51, 112, 255, 0.46);
  background: rgba(51, 112, 255, 0.10);
  color: #1d4ed8;
}

.ai-tool-toggle:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.ai-workspace--chat .ai-dock-card:not(.is-image-mode) select[name="image_model_key"],
.ai-workspace--chat .ai-dock-card.is-image-mode select[name="model_key"] {
  display: none;
}

.ai-workspace--chat .ai-dock-card.is-image-mode {
  border-color: rgba(51, 112, 255, 0.50);
  box-shadow:
    0 16px 44px rgba(31, 35, 41, 0.13),
    0 0 0 3px rgba(51, 112, 255, 0.10);
}

.ai-thinking-line em {
  color: var(--ai-chat-muted, #6b7280);
  font-size: 12px;
  font-style: normal;
  font-weight: 760;
}

.ai-message-row--pending-assistant .ai-message-avatar {
  animation: aiPortalAvatarPulse 2.6s ease-in-out infinite;
}

@media (max-width: 720px) {
  .ai-workspace--chat .ai-message-row--assistant .ai-message-avatar {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
  }

  .ai-workspace--chat .ai-image-result-bubble .ai-generated-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 700px) {
  .ai-workspace--chat {
    grid-template-columns: 236px minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .ai-workspace--chat .ai-message-row--user .ai-message-bubble {
    max-width: 88%;
  }
}

/* AI usage audit dashboard */
.ai-usage-dashboard {
  display: grid;
  gap: 18px;
}

.ai-usage-head {
  align-items: flex-start;
  gap: 18px;
}

.ai-usage-head p {
  margin: 6px 0 0;
  color: #667085;
}

.ai-usage-live {
  min-width: 240px;
  display: grid;
  justify-items: end;
  gap: 6px;
  color: #667085;
  font-size: 13px;
}

.ai-usage-live strong {
  color: #175cd3;
}

.ai-usage-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  border: 1px solid #dbe7ff;
  border-radius: 10px;
  background: #f7faff;
  padding: 14px;
}

.ai-usage-filter label {
  display: grid;
  gap: 5px;
  color: #667085;
  font-size: 13px;
  font-weight: 760;
}

.ai-usage-filter input,
.ai-usage-filter select {
  min-height: 36px;
  border: 1px solid #c8d9ff;
  border-radius: 8px;
  background: #ffffff;
  color: #101828;
  padding: 0 10px;
}

.ai-usage-filter button,
.ai-usage-filter a {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #3370ff;
  border-radius: 8px;
  background: #3370ff;
  color: #ffffff;
  padding: 0 14px;
  font-weight: 820;
  text-decoration: none;
}

.ai-usage-filter a {
  border-color: #c8d9ff;
  background: #ffffff;
  color: #175cd3;
}

.ai-usage-live-toggle {
  grid-auto-flow: column;
  align-items: center;
  gap: 7px;
}

.ai-usage-live-toggle input {
  min-height: 0;
}

.ai-usage-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(160px, 1fr));
  gap: 12px;
}

.ai-usage-summary > div {
  display: grid;
  gap: 6px;
  border: 1px solid #dbe7ff;
  border-radius: 10px;
  background: #ffffff;
  padding: 15px;
  box-shadow: 0 10px 28px rgba(16, 24, 40, 0.06);
}

.ai-usage-summary span,
.ai-usage-summary small,
.ai-usage-table small {
  color: #667085;
}

.ai-usage-summary strong {
  color: #101828;
  font-size: 22px;
  line-height: 1.25;
}

.ai-usage-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.ai-usage-card {
  display: grid;
  gap: 12px;
  border: 1px solid #dbe7ff;
  border-radius: 10px;
  background: #ffffff;
  padding: 14px;
}

.ai-usage-card-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.ai-usage-card-head h2 {
  margin: 0;
  color: #101828;
  font-size: 18px;
}

.ai-usage-card-head span {
  color: #667085;
  font-size: 13px;
}

.ai-usage-table-shell {
  width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

.ai-usage-table {
  min-width: 880px;
}

.ai-usage-detail-table {
  min-width: 1280px;
}

.ai-usage-table td,
.ai-usage-table th {
  vertical-align: top;
}

.ai-usage-table td small {
  display: block;
  margin-top: 3px;
  font-size: 12px;
}

@media (max-width: 1100px) {
  .ai-usage-summary,
  .ai-usage-grid {
    grid-template-columns: 1fr;
  }

  .ai-usage-live {
    justify-items: start;
  }
}

/* Feishu-blue chat polish and fixed scroll geometry */
.ai-portal-body--chat {
  --ai-chat-page-bg: #f7faff;
  --ai-chat-panel: #ffffff;
  --ai-chat-panel-soft: #f2f6ff;
  --ai-chat-panel-raised: #ffffff;
  --ai-chat-border: #dbe7ff;
  --ai-chat-border-strong: #c8d9ff;
  --ai-chat-text: #101828;
  --ai-chat-muted: #667085;
  --ai-chat-faint: #98a2b3;
  --ai-chat-hover: #edf4ff;
  --ai-chat-user-bg: #3370ff;
  --ai-chat-user-hover: #1f5eff;
  --ai-chat-accent-soft: rgba(51, 112, 255, 0.10);
  --ai-chat-accent-line: rgba(51, 112, 255, 0.28);
  height: 100vh;
  overflow: hidden;
  background: var(--ai-chat-page-bg);
}

html[data-ai-theme="dark"] .ai-portal-body--chat {
  --ai-chat-page-bg: #08111f;
  --ai-chat-panel: #0f1b2d;
  --ai-chat-panel-soft: #132238;
  --ai-chat-panel-raised: #17263d;
  --ai-chat-border: #24395c;
  --ai-chat-border-strong: #31507d;
  --ai-chat-text: #f4f7fb;
  --ai-chat-muted: #b6c2d5;
  --ai-chat-faint: #8190a8;
  --ai-chat-hover: #172a46;
  --ai-chat-user-bg: #4c8dff;
  --ai-chat-user-hover: #3370ff;
  --ai-chat-accent-soft: rgba(76, 141, 255, 0.16);
  --ai-chat-accent-line: rgba(76, 141, 255, 0.34);
}

.ai-portal-body--chat .ai-portal-shell {
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 0%, rgba(51, 112, 255, 0.10), transparent 30%),
    var(--ai-chat-page-bg);
}

.ai-portal-body--chat .ai-topbar {
  flex: 0 0 auto;
  border-bottom-color: var(--ai-chat-border);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(18px);
}

html[data-ai-theme="dark"] .ai-portal-body--chat .ai-topbar {
  background: rgba(8, 17, 31, 0.88);
}

.ai-portal-body--chat .ai-main {
  height: calc(100vh - 64px);
  min-height: 0;
  overflow: hidden;
  background: transparent;
}

.ai-workspace--chat {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: transparent;
}

.ai-workspace--chat .ai-rail {
  min-height: 0;
  overflow: auto;
  border-right-color: var(--ai-chat-border);
  background: color-mix(in srgb, var(--ai-chat-panel) 92%, var(--ai-chat-page-bg));
}

.ai-workspace--chat .ai-rail-new,
.ai-workspace--chat .ai-empty-row {
  border-color: var(--ai-chat-border);
  background: var(--ai-chat-panel);
}

.ai-workspace--chat .ai-primary-button {
  border-color: var(--ai-chat-user-bg);
  background: linear-gradient(135deg, #4e8cff, var(--ai-chat-user-bg));
  color: #ffffff;
}

.ai-workspace--chat .ai-primary-button:hover {
  border-color: var(--ai-chat-user-hover);
  background: linear-gradient(135deg, #3370ff, var(--ai-chat-user-hover));
}

.ai-workspace--chat .ai-chat-link:hover,
.ai-workspace--chat .ai-chat-link.active {
  border-color: var(--ai-chat-accent-line);
  background: var(--ai-chat-accent-soft);
  color: var(--ai-chat-text);
}

.ai-workspace--chat .ai-chat-delete-button:hover {
  border-color: rgba(240, 68, 56, 0.28);
  background: rgba(240, 68, 56, 0.08);
  color: #d92d20;
}

.ai-workspace--chat .ai-chat-main {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 0;
  background: transparent;
}

.ai-workspace--chat .ai-chat-head {
  min-height: 56px;
  border-bottom-color: var(--ai-chat-border);
  background: rgba(247, 250, 255, 0.82);
  backdrop-filter: blur(14px);
}

html[data-ai-theme="dark"] .ai-workspace--chat .ai-chat-head {
  background: rgba(8, 17, 31, 0.74);
}

.ai-workspace--chat #ai-conversation-thread {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scroll-padding-bottom: 180px;
}

.ai-workspace--chat .ai-message-list {
  min-height: 100%;
  overflow: visible;
  padding-bottom: 48px;
  background: transparent;
}

.ai-workspace--chat .ai-message-row--user .ai-message-bubble {
  background: var(--ai-chat-user-bg);
  color: #ffffff;
  box-shadow: 0 8px 22px rgba(51, 112, 255, 0.20);
}

.ai-workspace--chat .ai-message-row--user .ai-message-content {
  color: #ffffff;
}

.ai-workspace--chat .ai-dock {
  position: relative;
  z-index: 20;
  border-top: 0;
  background: linear-gradient(180deg, rgba(247, 250, 255, 0), var(--ai-chat-page-bg) 24%);
  padding: 14px 18px 18px;
}

.ai-workspace--chat .ai-dock-card {
  width: min(900px, 100%);
  border-color: var(--ai-chat-border-strong);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 50px rgba(16, 24, 40, 0.12);
}

html[data-ai-theme="dark"] .ai-workspace--chat .ai-dock-card {
  background: rgba(15, 27, 45, 0.96);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.26);
}

.ai-workspace--chat .ai-dock-card.is-image-mode {
  border-color: var(--ai-chat-accent-line);
  box-shadow:
    0 18px 50px rgba(16, 24, 40, 0.12),
    0 0 0 3px var(--ai-chat-accent-soft);
}

.ai-tool-toggle {
  min-height: 36px;
  border-color: var(--ai-chat-accent-line);
  background: var(--ai-chat-accent-soft);
  color: var(--ai-chat-user-bg);
}

.ai-tool-toggle::before {
  border-radius: 5px;
  box-shadow: 5px -5px 0 -3px currentColor;
}

.ai-tool-toggle:hover,
.ai-tool-toggle[aria-pressed="true"] {
  border-color: var(--ai-chat-user-bg);
  background: var(--ai-chat-user-bg);
  color: #ffffff;
}

.ai-hero-composer .ai-tool-toggle,
.ai-workspace--chat .ai-tool-toggle,
.ai-workspace--chat .ai-dock button.ai-tool-toggle {
  border-color: rgba(51, 112, 255, 0.28);
  background: rgba(51, 112, 255, 0.10);
  color: #3370ff;
  box-shadow: none;
}

.ai-hero-composer .ai-tool-toggle::before,
.ai-workspace--chat .ai-tool-toggle::before,
.ai-workspace--chat .ai-dock button.ai-tool-toggle::before {
  border-color: #3370ff;
  box-shadow: 5px -5px 0 -3px #3370ff;
  opacity: 1;
}

.ai-hero-composer .ai-tool-toggle:hover,
.ai-hero-composer .ai-tool-toggle[aria-pressed="true"],
.ai-workspace--chat .ai-tool-toggle:hover,
.ai-workspace--chat .ai-tool-toggle[aria-pressed="true"],
.ai-workspace--chat .ai-dock button.ai-tool-toggle:hover,
.ai-workspace--chat .ai-dock button.ai-tool-toggle[aria-pressed="true"] {
  border-color: #3370ff;
  background: #3370ff;
  color: #ffffff;
}

.ai-hero-composer .ai-tool-toggle:hover::before,
.ai-hero-composer .ai-tool-toggle[aria-pressed="true"]::before,
.ai-workspace--chat .ai-tool-toggle:hover::before,
.ai-workspace--chat .ai-tool-toggle[aria-pressed="true"]::before,
.ai-workspace--chat .ai-dock button.ai-tool-toggle:hover::before,
.ai-workspace--chat .ai-dock button.ai-tool-toggle[aria-pressed="true"]::before {
  border-color: #ffffff;
  box-shadow: 5px -5px 0 -3px #ffffff;
}

.ai-hero-composer:not(.is-image-mode) select[name="image_model_key"],
.ai-hero-composer.is-image-mode select[name="model_key"] {
  display: none;
}

.ai-workspace--chat .ai-composer-tools select {
  border-color: var(--ai-chat-border-strong);
  background: var(--ai-chat-panel-raised);
  color: var(--ai-chat-text);
}

.ai-workspace--chat .ai-send-button {
  border-color: var(--ai-chat-user-bg);
  background: linear-gradient(135deg, #4e8cff, var(--ai-chat-user-bg));
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(51, 112, 255, 0.22);
}

.ai-workspace--chat .ai-send-button:hover {
  border-color: var(--ai-chat-user-hover);
  background: linear-gradient(135deg, #3370ff, var(--ai-chat-user-hover));
}

@media (max-width: 900px) {
  .ai-portal-body--chat .ai-main {
    height: calc(100vh - 58px);
  }

  .ai-workspace--chat {
    grid-template-columns: 1fr;
  }

  .ai-workspace--chat .ai-rail {
    max-height: 38vh;
    border-right: 0;
    border-bottom: 1px solid var(--ai-chat-border);
  }

  .ai-workspace--chat .ai-message-list {
    padding-bottom: 34px;
  }
}
