:root {
  --sidebar-w: 232px;
  --bg: #0c0e14;
  --sidebar: #13161f;
  --surface: #ffffff;
  --surface-2: #f3f5f9;
  --surface-3: #fafbfc;
  --border: #e4e9f0;
  --border-soft: #eef1f6;
  --ink: #111827;
  --ink-secondary: #374151;
  --muted: #6b7280;
  --muted-light: #9ca3af;
  --brand: #6d28d9;
  --brand-hover: #5b21b6;
  --brand-2: #8b5cf6;
  --brand-soft: #f3efff;
  --brand-ring: rgba(109, 40, 217, 0.12);
  --ok: #047857;
  --ok-soft: #ecfdf5;
  --ok-border: #a7f3d0;
  --warn: #b45309;
  --warn-soft: #fffbeb;
  --warn-border: #fde68a;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --danger-border: #fecaca;
  --info: #1d4ed8;
  --info-soft: #eff6ff;
  --info-border: #bfdbfe;
  --shadow-xs: 0 1px 2px rgba(17, 24, 39, 0.04);
  --shadow-sm: 0 1px 3px rgba(17, 24, 39, 0.06), 0 1px 2px rgba(17, 24, 39, 0.04);
  --shadow-md: 0 4px 16px rgba(17, 24, 39, 0.06);
  --shadow-lg: 0 12px 40px rgba(17, 24, 39, 0.1);
  --radius: 14px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
  height: 100%;
  margin: 0;
}

body.app {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  overflow: hidden;
  display: flex;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

/* —— 侧栏 —— */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  height: 100vh;
  background: var(--sidebar);
  border-right: 1px solid rgba(255, 255, 255, 0.04);
  display: flex;
  flex-direction: column;
  padding: 22px 16px 18px;
  color: #e5e7eb;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 6px 28px;
}

.sidebar__logo {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(145deg, #7c3aed 0%, #6d28d9 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.03em;
  box-shadow: 0 4px 14px rgba(109, 40, 217, 0.4);
}

.sidebar__name {
  display: block;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #f9fafb;
}

.sidebar__sub {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: #6b7280;
  margin-top: 1px;
  letter-spacing: 0.04em;
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #9ca3af;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.18s var(--ease), color 0.18s var(--ease), border-color 0.18s var(--ease);
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #e5e7eb;
}

.nav-item.is-active {
  background: rgba(109, 40, 217, 0.14);
  border-color: rgba(139, 92, 246, 0.2);
  color: #f3f4f6;
}

.nav-item__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-item__icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.nav-item.is-active .nav-item__icon {
  color: var(--brand-2);
  opacity: 1;
}

.sidebar__foot {
  font-size: 11px;
  font-weight: 500;
  color: #4b5563;
  padding: 14px 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  letter-spacing: 0.02em;
}

/* —— 主区域 —— */
.workspace {
  flex: 1;
  min-width: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(109, 40, 217, 0.06), transparent),
    var(--surface-2);
}

.workspace__head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 8px 24px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
}

.page-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  white-space: nowrap;
}

.page-desc {
  margin: 0;
  padding-left: 10px;
  border-left: 1px solid var(--border);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workspace__body {
  flex: 1;
  min-height: 0;
  padding: 18px 24px 22px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  gap: 14px;
}

.panel.is-active { display: flex; }
.panel[hidden] { display: none !important; }

/* —— 筛选条 —— */
.filter-bar {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.filter-bar .field--inline {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.filter-bar .field__label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.filter-bar .field input,
.filter-bar .field select {
  height: 32px;
  padding: 0 10px;
  font-size: 12.5px;
}

.filter-bar .field--order input { width: 128px; }
.filter-bar .field--amount input { width: 68px; }
.filter-bar .field--date input { width: 132px; }
.filter-bar .field--select select { width: 88px; }
.filter-bar .field--source select { width: 136px; }

.filter-bar > .btn {
  height: 32px;
  padding: 0 12px;
  font-size: 12.5px;
  flex-shrink: 0;
}

/* —— 订单子 Tab —— */
.order-subtabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  width: fit-content;
  flex-shrink: 0;
}

.order-subtab {
  height: 32px;
  padding: 0 16px;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.order-subtab:hover {
  color: var(--ink-secondary);
  background: #f3f4f6;
}

.order-subtab.is-active {
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-xs);
}

.orders-view {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  gap: 14px;
}

.orders-view.is-active {
  display: flex;
}

.orders-view[hidden] {
  display: none !important;
}

/* —— 汇总统计 —— */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  flex-shrink: 0;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-xs);
}

.stat-card--brand {
  border-color: rgba(109, 40, 217, 0.15);
  background: linear-gradient(180deg, #faf8ff 0%, #fff 100%);
}

.stat-card__label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.03em;
  margin-bottom: 6px;
}

.stat-card__value {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.stat-card--brand .stat-card__value {
  color: var(--brand);
}

.stat-card__rate {
  margin-top: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted-light);
}

.stat-card--brand .stat-card__rate {
  color: var(--brand-2);
}

.summary-chart-card {
  flex: 1;
  min-height: 420px;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.summary-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
}

.summary-chart-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.summary-chart-legend {
  display: flex;
  gap: 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-item::before {
  content: '';
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

.legend-item--bar::before {
  background: linear-gradient(180deg, #c4b5fd, #8b5cf6);
}

.legend-item--line::before {
  width: 16px;
  height: 0;
  border-radius: 0;
  border-top: 2.5px solid #059669;
  background: none;
}

.summary-chart-wrap {
  flex: 1;
  min-height: 380px;
  padding: 4px 12px 12px;
  display: block;
}

#summary-chart {
  display: block;
  width: 100%;
  min-height: 380px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 132px;
}

.field--sm { min-width: 96px; }

.field__label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.field input,
.field select,
.switch-inline input[type="text"],
.switch-inline input[type="url"] {
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-secondary);
  background: var(--surface-3);
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), background 0.18s var(--ease);
}

.field input::placeholder {
  color: var(--muted-light);
  font-weight: 400;
}

.field input:hover,
.field select:hover,
.switch-inline input:hover {
  border-color: #d1d5db;
  background: #fff;
}

.field input:focus,
.field select:focus,
.switch-inline input:focus {
  outline: none;
  border-color: var(--brand-2);
  background: #fff;
  box-shadow: 0 0 0 3px var(--brand-ring);
}

.field select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.field--switch {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

/* —— 开关 —— */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch__track {
  display: block;
  width: 40px;
  height: 22px;
  border-radius: 11px;
  background: #d1d5db;
  transition: background 0.22s var(--ease);
  position: relative;
}

.switch__track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  transition: transform 0.22s var(--ease);
}

.switch input:checked + .switch__track {
  background: var(--brand);
}

.switch input:checked + .switch__track::after {
  transform: translateX(18px);
}

.switch--sm .switch__track { width: 34px; height: 19px; }
.switch--sm .switch__track::after { width: 15px; height: 15px; }
.switch--sm input:checked + .switch__track::after { transform: translateX(15px); }

/* —— 卡片 + 表格 —— */
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card--fill {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.table-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #d1d5db transparent;
}

.table-scroll::-webkit-scrollbar { width: 6px; height: 6px; }
.table-scroll::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 99px;
}
.table-scroll::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 960px;
}

.data-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.data-table th {
  padding: 11px 18px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--surface-3);
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}

.data-table td {
  padding: 13px 18px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
  font-size: 13px;
  color: var(--ink-secondary);
  transition: background 0.15s var(--ease);
}

.data-table tbody tr:nth-child(even) td {
  background: rgba(249, 250, 251, 0.6);
}

.data-table tbody tr:hover td {
  background: #f8f7ff !important;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table code {
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  font-weight: 500;
  background: #f3f4f6;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  color: #374151;
  border: 1px solid var(--border-soft);
  letter-spacing: -0.01em;
}

.data-table td strong {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.col-actions {
  width: 148px;
  text-align: right;
}

.btn-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

.cell-empty {
  text-align: center;
  color: var(--muted);
  font-weight: 500;
  padding: 56px 16px !important;
  background: transparent !important;
}

.card__foot {
  flex-shrink: 0;
  border-top: 1px solid var(--border-soft);
  background: var(--surface-3);
}

/* —— 工具栏 —— */
.toolbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.hint {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
}

.hint code {
  font-size: 11.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--brand-soft);
  color: var(--brand);
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(109, 40, 217, 0.12);
}

/* —— 按钮 —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), color 0.18s var(--ease);
  white-space: nowrap;
  line-height: 1;
  user-select: none;
}

.btn:hover:not(:disabled) {
  background: #f9fafb;
  border-color: #d1d5db;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-xs);
}

.btn--primary:hover:not(:disabled) {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
  box-shadow: 0 2px 8px rgba(109, 40, 217, 0.25);
}

.btn--ghost {
  background: #fff;
  border-color: var(--border);
  color: var(--muted);
}

.btn--ghost:hover:not(:disabled) {
  background: #f9fafb;
  color: var(--ink-secondary);
}

.btn--xs {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: var(--radius-xs);
}

.btn--action { min-width: 84px; }

.btn--danger {
  color: var(--danger);
  border-color: var(--danger-border);
  background: #fff;
}

.btn--danger:hover:not(:disabled) {
  background: var(--danger-soft);
  border-color: #fca5a5;
}

/* 按钮 SVG 图标 */
[class*="btn--icon-"]::before {
  content: '';
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  background: currentColor;
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  opacity: 0.9;
}

.btn--icon-search::before { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3-3'/%3E%3C/svg%3E"); }
.btn--icon-reset::before { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M3 12a9 9 0 1 0 3-6.7M3 4v5h5'/%3E%3C/svg%3E"); }
.btn--icon-plus::before { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E"); }
.btn--icon-doc::before { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 2v6h6M9 13h6M9 17h4'/%3E%3C/svg%3E"); }
.btn--icon-check::before { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5'%3E%3Cpath d='M5 12l4 4L19 6'/%3E%3C/svg%3E"); }
.btn--icon-trash::before { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M3 6h18M8 6V4h8v2M19 6l-1 14H6L5 6'/%3E%3C/svg%3E"); }

.btn.is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn.is-loading::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.btn--ghost.is-loading::after,
.btn--danger.is-loading::after {
  border-color: rgba(107, 114, 128, 0.2);
  border-top-color: var(--brand);
}

.btn.is-success {
  background: var(--ok) !important;
  border-color: var(--ok) !important;
  color: #fff !important;
}

@keyframes spin { to { transform: rotate(360deg); } }

.row-saved td { animation: rowFlash 1.2s ease; }
@keyframes rowFlash {
  0% { background: var(--ok-soft) !important; }
  100% { background: transparent; }
}

/* —— 标签 —— */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.3;
  border: 1px solid transparent;
  letter-spacing: 0.01em;
}

.tag--paid { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-border); }
.tag--pending { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-border); }
.tag--done { background: var(--info-soft); color: var(--info); border-color: var(--info-border); }
.tag--fail { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }
.tag--warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-border); }

.muted { color: var(--muted); font-weight: 500; }

/* —— 分页 —— */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  flex-wrap: wrap;
}

.pager__info {
  font-size: 12.5px;
  font-weight: 500;
}

.pager__info strong {
  font-weight: 700;
  color: var(--ink);
}

.pager__btns {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pager__nums {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.pager__num {
  min-width: 32px;
  height: 32px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.pager__num:hover {
  background: #f3f4f6;
  color: var(--ink-secondary);
}

.pager__num.is-active {
  background: var(--brand);
  color: #fff;
  cursor: default;
}

.pager__ellipsis {
  min-width: 20px;
  text-align: center;
  color: var(--muted-light);
  font-size: 12px;
}

.pager button[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

/* —— Toast —— */
.toast-root {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  min-width: 200px;
  max-width: 340px;
  padding: 11px 15px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: #374151;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}

.toast.is-show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast--success { background: var(--ok); }
.toast--error { background: var(--danger); }
.toast--info { background: #374151; }

/* —— 客服 iframe —— */
.panel--iframe { min-height: 0; }

.chat-frame-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
}

.chat-frame {
  flex: 1;
  width: 100%;
  min-height: 0;
  border: none;
  background: #fff;
}

/* —— 弹窗 —— */
.modal[hidden] { display: none !important; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
  backdrop-filter: blur(6px);
}

.modal__box {
  position: relative;
  width: min(480px, 100%);
  max-height: calc(100vh - 40px);
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal__box--fullscreen {
  width: calc(100vw - 40px);
  height: calc(100vh - 40px);
  max-height: none;
}

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface-3);
  flex-shrink: 0;
}

.modal__head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.modal__close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  font-size: 20px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s var(--ease);
}

.modal__close:hover {
  background: #e5e7eb;
  color: var(--ink);
}

.modal__body {
  padding: 20px;
  overflow: auto;
  flex: 1;
  min-height: 0;
}

.modal__foot {
  padding: 14px 20px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
  background: var(--surface-3);
}

.status-bar {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 12px;
  padding: 10px 14px;
  background: var(--surface-3);
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-soft);
}

.report-preview {
  padding: 12px;
  background: var(--surface-3);
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-soft);
  min-height: 200px;
}

.report-frame {
  display: block;
  width: 100%;
  min-height: 200px;
  border: none;
  border-radius: var(--radius-xs);
  background: #fff;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-grid .span2 { grid-column: 1 / -1; }

.switch-inline input[type="text"],
.switch-inline input[type="url"] {
  width: 100%;
  min-width: 0;
}

.switch-inline .col-app-name {
  width: 96px;
  max-width: 110px;
}

.switch-inline .switch-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.switch-inline .col-url {
  min-width: 320px;
  width: 38%;
}

.data-table th.col-app-name { width: 96px; }
.data-table th.col-url { min-width: 320px; }

.switch-inline .cell-actions { white-space: nowrap; }

/* —— 响应式 —— */
@media (max-width: 900px) {
  body.app { flex-direction: column; overflow: auto; }
  .sidebar {
    width: 100%;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 12px;
  }
  .sidebar__brand { padding-bottom: 0; }
  .sidebar__nav { flex-direction: row; flex: 1; justify-content: flex-end; }
  .sidebar__foot { display: none; }
  .workspace { height: auto; min-height: calc(100vh - 80px); }
  .workspace__body { overflow: visible; }
  .panel.is-active { min-height: 60vh; }
}

@media (max-width: 1200px) {
  .summary-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span2 { grid-column: auto; }
  .filter-bar .field--inline { flex-wrap: wrap; }
  .filter-bar .field input,
  .filter-bar .field select { width: 100%; min-width: 120px; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
}
