/* =========================================================================
   灵径AI 运营控制台 · 设计令牌与全部样式
   零依赖、无构建；设计令牌严格对齐 ainow-cloud/docs/api-spec.md §7.2
   ========================================================================= */

:root {
  /* 契约令牌 */
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
  --primary: #2f6fed;
  --success: #047857;
  --warning: #b45309;
  --danger: #b91c1c;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);

  /* 扩展令牌 */
  --primary-hover: #2761d8;
  --primary-soft: #eaf1fe;
  --success-soft: #e8f6ef;
  --warning-soft: #fdf4e8;
  --danger-soft: #fdecec;
  --info-soft: #eef4ff;
  --surface-2: #fafbfc;
  --surface-3: #f3f4f6;
  --border-strong: #d1d5db;
  --muted-2: #9ca3af;
  --sidebar: #111827;
  --sidebar-deep: #0b1220;
  --sidebar-text: #c7cdd8;
  --sidebar-muted: #8b95a5;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --shadow-md: 0 4px 14px rgba(16, 24, 40, 0.1);
  --shadow-lg: 0 18px 44px rgba(16, 24, 40, 0.2);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --ring: 0 0 0 3px rgba(47, 111, 237, 0.18);
  --sidebar-width: 240px;
  --topbar-height: 56px;
  --content-max: 1440px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

::selection {
  background: rgba(47, 111, 237, 0.18);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border: 2px solid var(--bg);
  border-radius: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------------------------------------------------------- boot */
.boot-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.boot-mark {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.boot-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.boot-text {
  font-size: 13px;
  letter-spacing: 0.04em;
}

/* -------------------------------------------------------------- layout */
.app-shell {
  min-height: 100vh;
  display: flex;
  width: 100%;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-deep) 100%);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  z-index: 40;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--topbar-height);
  padding: 0 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  flex: none;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  overflow: hidden;
  flex: none;
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-text {
  min-width: 0;
}

.brand-title {
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.brand-sub {
  color: var(--sidebar-muted);
  font-size: 11px;
  white-space: nowrap;
}

.sidebar-nav {
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  overflow-y: auto;
}

.nav-section {
  padding: 14px 10px 6px;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--sidebar-muted);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--sidebar-text);
  font-size: 13.5px;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  text-decoration: none;
}

.nav-item.is-active {
  background: rgba(47, 111, 237, 0.2);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--primary);
}

.nav-item svg {
  flex: none;
  opacity: 0.9;
}

.nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-foot {
  flex: none;
  padding: 12px 16px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 11.5px;
  color: var(--sidebar-muted);
  line-height: 1.6;
}

.sidebar-foot .env-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.env-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.15);
}

.main {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-height);
  flex: none;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: saturate(150%) blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
}

.topbar-left {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}

.menu-toggle {
  display: none;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.breadcrumb .crumb {
  overflow: hidden;
  text-overflow: ellipsis;
}

.breadcrumb .crumb.is-current {
  color: var(--text);
  font-weight: 500;
}

.breadcrumb .sep {
  color: var(--muted-2);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: none;
}

.role-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
  font-size: 12px;
  overflow: hidden;
  border: 1px solid rgba(47, 111, 237, 0.16);
}

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

.avatar-lg {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  font-size: 20px;
}

.avatar-sm {
  width: 24px;
  height: 24px;
  font-size: 10.5px;
}

.content {
  flex: 1;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 24px;
}

/* ---------------------------------------------------------- page head */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.page-title-wrap {
  min-width: 0;
}

.page-title {
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.page-desc {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.page-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

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

.section-title {
  font-size: 15px;
  font-weight: 600;
}

.section-desc {
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 2px;
}

/* --------------------------------------------------------------- card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 14.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.card-body {
  padding: 18px;
}

.card-body.is-flush {
  padding: 0;
}

.card-foot {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: var(--surface-2);
  border-radius: 0 0 var(--radius) var(--radius);
}

.card + .card {
  margin-top: 16px;
}

/* 栅格中的卡片由 grid 统一拉伸；避免相邻卡片继承“堆叠卡片”的上外边距。 */
.grid > .card + .card {
  margin-top: 0;
}

.grid > .card {
  display: flex;
  flex-direction: column;
}

.grid > .card > .card-body {
  flex: 1;
}

.grid > .card > .card-body.is-flush {
  display: flex;
  flex-direction: column;
}

.grid > .card > .card-body.is-flush > .plan-list,
.grid > .card > .card-body.is-flush > .mini-list,
.grid > .card > .card-body.is-flush > .table-wrap {
  flex: 1;
}

.grid {
  display: grid;
  gap: 16px;
}

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

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

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

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

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.row.is-between {
  justify-content: space-between;
}

.row.is-end {
  justify-content: flex-end;
}

.mt-8 {
  margin-top: 8px;
}
.mt-12 {
  margin-top: 12px;
}
.mt-16 {
  margin-top: 16px;
}
.mt-20 {
  margin-top: 20px;
}
.mb-12 {
  margin-bottom: 12px;
}
.mb-16 {
  margin-bottom: 16px;
}

.muted {
  color: var(--muted);
}
.small {
  font-size: 12px;
}
.mono {
  font-family: var(--mono);
}
.strong {
  font-weight: 600;
}
.nowrap {
  white-space: nowrap;
}
.text-right {
  text-align: right;
}
.text-center {
  text-align: center;
}

/* ------------------------------------------------------------- button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease,
    color 0.15s ease;
  user-select: none;
}

.btn:hover {
  background: var(--surface-3);
}

.btn:active {
  transform: translateY(0.5px);
}

.btn:disabled,
.btn.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(47, 111, 237, 0.28);
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

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

.btn-danger:hover {
  background: #a01818;
  border-color: #a01818;
}

.btn-danger-ghost {
  color: var(--danger);
  border-color: rgba(185, 28, 28, 0.28);
  background: var(--surface);
}

.btn-danger-ghost:hover {
  background: var(--danger-soft);
}

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

.btn-ghost:hover {
  background: var(--surface-3);
  color: var(--text);
}

.btn-soft {
  background: var(--primary-soft);
  border-color: transparent;
  color: var(--primary);
}

.btn-soft:hover {
  background: #dde9fd;
}

.btn-sm {
  height: 30px;
  padding: 0 10px;
  font-size: 12.5px;
  border-radius: 7px;
}

.btn-xs {
  height: 26px;
  padding: 0 8px;
  font-size: 12px;
  border-radius: 6px;
  gap: 5px;
}

.btn-lg {
  height: 42px;
  padding: 0 20px;
  font-size: 14.5px;
  border-radius: 9px;
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.btn-icon:hover {
  background: var(--surface-3);
  color: var(--text);
}

.btn-block {
  width: 100%;
}

.btn.is-busy {
  pointer-events: none;
  opacity: 0.8;
}

.spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
  animation: spin 0.7s linear infinite;
  flex: none;
}

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

/* --------------------------------------------------------------- form */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 18px;
}

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

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

.field-label {
  font-size: 13px;
  font-weight: 550;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 5px;
}

.field-label .req {
  color: var(--danger);
  font-size: 12px;
}

.field-hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.field-error {
  font-size: 12px;
  color: var(--danger);
  min-height: 0;
  line-height: 1.45;
}

.field-error:empty {
  display: none;
}

.field.has-error .input,
.field.has-error .select,
.field.has-error .textarea {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.1);
}

.input,
.select,
.textarea {
  width: 100%;
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  min-width: 0;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--muted-2);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--ring);
}

.input:disabled,
.select:disabled,
.textarea:disabled {
  background: var(--surface-3);
  color: var(--muted);
  cursor: not-allowed;
}

.select {
  appearance: none;
  padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 15px, calc(100% - 11px) 15px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.textarea {
  height: auto;
  min-height: 84px;
  padding: 9px 11px;
  resize: vertical;
  line-height: 1.55;
}

.input-sm {
  height: 30px;
  font-size: 12.5px;
  padding: 0 9px;
}

.input-mono {
  font-family: var(--mono);
  font-size: 12.5px;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrap .input {
  padding-right: 38px;
}

.input-affix {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
}

.input-group {
  display: flex;
  gap: 8px;
}

.input-group .input {
  flex: 1;
}

.input-suffix {
  display: flex;
  align-items: center;
  padding: 0 10px;
  height: 36px;
  border: 1px solid var(--border-strong);
  border-left: none;
  border-radius: 0 8px 8px 0;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
}

.input-group > .input:first-child {
  border-radius: 8px 0 0 8px;
}

.checkbox,
.radio {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  cursor: pointer;
  user-select: none;
}

.checkbox input,
.radio input {
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
  margin: 0;
  cursor: pointer;
}

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  user-select: none;
  font-size: 13.5px;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: var(--border-strong);
  position: relative;
  transition: background 0.18s ease;
  flex: none;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform 0.18s ease;
}

.switch input:checked + .switch-track {
  background: var(--primary);
}

.switch input:checked + .switch-track::after {
  transform: translateX(16px);
}

.switch input:focus-visible + .switch-track {
  box-shadow: var(--ring);
}

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.form-section-title {
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

/* -------------------------------------------------------------- badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 550;
  white-space: nowrap;
  border: 1px solid transparent;
}

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

.badge-green {
  background: var(--success-soft);
  color: var(--success);
  border-color: rgba(4, 120, 87, 0.16);
}

.badge-amber {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: rgba(180, 83, 9, 0.16);
}

.badge-red {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(185, 28, 28, 0.16);
}

.badge-blue {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: rgba(47, 111, 237, 0.16);
}

.badge-gray {
  background: var(--surface-3);
  color: var(--muted);
  border-color: var(--border);
}

.badge-purple {
  background: #f3ecfe;
  color: #7c3aed;
  border-color: rgba(124, 58, 237, 0.16);
}

.badge-plain {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
}

/* ----------------------------------------------------------- progress */
.progress {
  --pct: 0%;
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
  position: relative;
}

.progress-bar {
  height: 100%;
  width: var(--pct);
  border-radius: 999px;
  background: var(--primary);
  transition: width 0.4s ease;
}

.progress-bar.is-warn {
  background: var(--warning);
}

.progress-bar.is-danger {
  background: var(--danger);
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
  margin-top: 5px;
}

.progress-lg {
  height: 10px;
}

/* -------------------------------------------------------------- table */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: 0 0 var(--radius) var(--radius);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 640px;
}

.table th,
.table td {
  text-align: left;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

.table tbody tr:nth-child(even) {
  background: #fbfcfd;
}

.table tbody tr:hover {
  background: var(--primary-soft);
}

.table tbody tr.is-clickable {
  cursor: pointer;
}

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

.table td.is-actions {
  white-space: nowrap;
  text-align: right;
}

.table .cell-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.table .cell-title {
  font-weight: 550;
  color: var(--text);
}

.table .cell-sub {
  font-size: 11.5px;
  color: var(--muted);
  font-family: var(--mono);
}

.table .cell-num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.table-compact th,
.table-compact td {
  padding: 8px 12px;
}

.table-actions {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.table-empty {
  padding: 0;
}

.row-actions-menu {
  position: relative;
}

/* --------------------------------------------------------- pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.pagination-info {
  font-size: 12.5px;
  color: var(--muted);
}

.pagination-pages {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.page-btn {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 12.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}

.page-btn:hover {
  background: var(--surface-3);
}

.page-btn.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

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

.page-btn.is-ellipsis {
  border-color: transparent;
  background: transparent;
  cursor: default;
}

/* -------------------------------------------------------------- tabs */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
  overflow-x: auto;
}

.tab {
  position: relative;
  padding: 10px 14px;
  font-size: 13.5px;
  color: var(--muted);
  border: none;
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 500;
  border-radius: 8px 8px 0 0;
}

.tab:hover {
  color: var(--text);
  background: var(--surface-3);
}

.tab.is-active {
  color: var(--primary);
  font-weight: 600;
}

.tab.is-active::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
}

/* ------------------------------------------------------------- toolbar */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
}

.toolbar .search {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 340px;
}

.toolbar .search .input {
  padding-left: 34px;
}

.toolbar .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  display: flex;
  pointer-events: none;
}

.toolbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-select {
  width: auto;
  min-width: 120px;
}

/* ------------------------------------------------------------ dropzone */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 22px 16px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.dropzone:hover,
.dropzone:focus-visible,
.dropzone.is-over {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  outline: none;
}

.dropzone-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
}

.dropzone:focus-visible .dropzone-title,
.dropzone.is-over .dropzone-title {
  color: var(--primary);
}

.dropzone-hint {
  font-size: 12px;
  line-height: 1.5;
}

/* -------------------------------------------------------------- empty */
.empty {
  padding: 56px 24px;
  text-align: center;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.empty-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--surface-3);
  color: var(--muted);
  display: grid;
  place-items: center;
  margin-bottom: 4px;
}

.empty-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
}

.empty-desc {
  font-size: 13px;
  max-width: 440px;
  line-height: 1.6;
}

.empty .btn {
  margin-top: 8px;
}

/* ----------------------------------------------------------- skeleton */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--surface-3);
  border-radius: 6px;
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.65), transparent);
  animation: shimmer 1.3s infinite;
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

.sk-line {
  height: 12px;
  margin-bottom: 10px;
}

.sk-line.is-short {
  width: 40%;
}

.sk-line.is-mid {
  width: 65%;
}

.sk-line.is-tall {
  height: 28px;
}

.sk-block {
  height: 120px;
  border-radius: var(--radius);
}

.sk-card {
  height: 118px;
  border-radius: var(--radius);
}

.skeleton-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
}

.skeleton-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

/* ---------------------------------------------------------- stat card */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.stat-label {
  color: var(--muted);
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.stat-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  flex: none;
}

.stat-icon.is-green {
  background: var(--success-soft);
  color: var(--success);
}
.stat-icon.is-amber {
  background: var(--warning-soft);
  color: var(--warning);
}
.stat-icon.is-red {
  background: var(--danger-soft);
  color: var(--danger);
}

.stat-value {
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.stat-value .unit {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin-left: 4px;
}

.stat-sub {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.stat-sub .ok {
  color: var(--success);
}
.stat-sub .warn {
  color: var(--warning);
}
.stat-sub .bad {
  color: var(--danger);
}

/* -------------------------------------------------------------- chart */
.chart-wrap {
  padding: 8px 6px 2px;
}

.chart-svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.chart-legend {
  display: flex;
  gap: 16px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  padding: 0 18px 14px;
}

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

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--primary);
}

.legend-swatch.is-failed {
  background: #f87171;
}

/* --------------------------------------------------------- plan rows */
.plan-list {
  display: flex;
  flex: 1;
  flex-direction: column;
}

.plan-row {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  min-width: 0;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
}

.plan-row:last-child {
  border-bottom: none;
}

.plan-head,
.plan-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.plan-count {
  margin-left: auto;
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.plan-meta {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.plan-percent {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.plan-progress {
  width: 100%;
}

/* --------------------------------------------------------------- list */
.mini-list {
  display: flex;
  flex-direction: column;
}

.mini-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  min-width: 0;
}

.mini-item:last-child {
  border-bottom: none;
}

.mini-item.is-clickable {
  cursor: pointer;
}

.mini-item.is-clickable:hover {
  background: var(--surface-2);
}

.mini-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--muted);
  display: grid;
  place-items: center;
  flex: none;
}

.mini-body {
  flex: 1;
  min-width: 0;
}

.mini-title {
  font-size: 13px;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-desc {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-time {
  font-size: 11.5px;
  color: var(--muted-2);
  white-space: nowrap;
  flex: none;
}

/* --------------------------------------------------------------- info */
.info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px 20px;
}

.info-grid.is-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.info-item {
  min-width: 0;
}

.info-label {
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.02em;
  margin-bottom: 3px;
}

.info-value {
  font-size: 13.5px;
  word-break: break-word;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.info-value.is-mono {
  font-family: var(--mono);
  font-size: 12.5px;
}

/* --------------------------------------------------------------- alert */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 13px;
  line-height: 1.55;
}

.alert + .alert {
  margin-top: 8px;
}

.alert-icon {
  flex: none;
  margin-top: 1px;
}

.alert-body {
  min-width: 0;
  flex: 1;
}

.alert-title {
  font-weight: 600;
  margin-bottom: 2px;
}

.alert-warning {
  background: var(--warning-soft);
  border-color: rgba(180, 83, 9, 0.22);
  color: #7c3d0b;
}

.alert-danger {
  background: var(--danger-soft);
  border-color: rgba(185, 28, 28, 0.22);
  color: #8f1717;
}

.alert-info {
  background: var(--primary-soft);
  border-color: rgba(47, 111, 237, 0.2);
  color: #1e4bb8;
}

.alert-success {
  background: var(--success-soft);
  border-color: rgba(4, 120, 87, 0.2);
  color: #065f46;
}

/* ------------------------------------------------------------ code block */
.code-block {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
  overflow-x: auto;
  white-space: pre;
  position: relative;
  margin: 0;
  border: 1px solid #1e293b;
}

.code-block .code-copy {
  position: absolute;
  top: 8px;
  right: 8px;
  color: #94a3b8;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.24);
}

.code-block .code-copy:hover {
  background: rgba(148, 163, 184, 0.22);
  color: #e2e8f0;
}

.code-inline {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
  word-break: break-all;
}

.copy-field {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 8px 7px 11px;
  min-width: 0;
}

.copy-field code {
  font-family: var(--mono);
  font-size: 12.5px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ------------------------------------------------------------- chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}

.chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.chip.is-selected {
  background: var(--primary-soft);
  border-color: rgba(47, 111, 237, 0.45);
  color: var(--primary);
  font-weight: 550;
}

.chip.is-static {
  cursor: default;
}

.chip .chip-x {
  display: inline-flex;
  color: var(--muted-2);
  cursor: pointer;
}

.chip .chip-x:hover {
  color: var(--danger);
}

/* ------------------------------------------------------------ swatches */
.swatches {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.swatch {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  background: transparent;
  position: relative;
}

.swatch::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 5px;
  background: var(--swatch-color);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.swatch.is-selected {
  border-color: var(--text);
}

.color-input {
  width: 46px;
  height: 32px;
  padding: 2px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface);
  cursor: pointer;
}

/* -------------------------------------------------------------- modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 16px 16px;
  overflow-y: auto;
  animation: fade-in 0.14s ease;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  animation: modal-in 0.16s ease;
  display: flex;
  flex-direction: column;
  max-height: 86vh;
}

.modal.is-sm {
  max-width: 420px;
}

.modal.is-lg {
  max-width: 720px;
}

.modal.is-xl {
  max-width: 880px;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  flex: none;
}

.modal-title {
  font-size: 15.5px;
  font-weight: 650;
  display: flex;
  align-items: center;
  gap: 9px;
}

.modal-desc {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 3px;
}

.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-body.is-flush {
  padding: 0;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  flex: none;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.99);
  }
}

/* -------------------------------------------------------------- toast */
.toast-stack {
  position: fixed;
  top: 70px;
  right: 22px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
  width: calc(100% - 44px);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: 11px 13px;
  font-size: 13px;
  line-height: 1.5;
  animation: toast-in 0.18s ease;
  pointer-events: auto;
}

.toast.is-success {
  border-left-color: var(--success);
}

.toast.is-error {
  border-left-color: var(--danger);
}

.toast.is-warning {
  border-left-color: var(--warning);
}

.toast-icon {
  flex: none;
  margin-top: 1px;
}

.toast.is-success .toast-icon {
  color: var(--success);
}
.toast.is-error .toast-icon {
  color: var(--danger);
}
.toast.is-warning .toast-icon {
  color: var(--warning);
}
.toast.is-info .toast-icon {
  color: var(--primary);
}

.toast-body {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.toast-close {
  border: none;
  background: transparent;
  color: var(--muted-2);
  cursor: pointer;
  padding: 0 2px;
  flex: none;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(14px);
  }
}

/* -------------------------------------------------------------- steps */
.steps {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 4px 4px 22px;
  overflow-x: auto;
}

.step {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: none;
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
}

.step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  border: 1px solid var(--border);
  flex: none;
}

.step.is-active {
  color: var(--text);
  font-weight: 600;
}

.step.is-active .step-num {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(47, 111, 237, 0.14);
}

.step.is-done .step-num {
  background: var(--success-soft);
  border-color: rgba(4, 120, 87, 0.3);
  color: var(--success);
}

.step.is-done {
  color: var(--text);
}

.step-line {
  flex: 1;
  min-width: 20px;
  height: 1px;
  background: var(--border-strong);
  margin: 0 12px;
}

.step-line.is-done {
  background: rgba(4, 120, 87, 0.45);
}

/* ------------------------------------------------------------- wizard */
.wizard {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.wizard-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.wizard-body {
  padding: 22px 24px;
}

.wizard-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius) var(--radius);
  flex-wrap: wrap;
}

.wizard-foot .foot-left {
  font-size: 12.5px;
  color: var(--muted);
}

.wizard-title {
  font-size: 16px;
  font-weight: 650;
  margin-bottom: 3px;
}

.wizard-desc {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 20px;
}

.wizard-side {
  position: sticky;
  top: calc(var(--topbar-height) + 24px);
}

/* ----------------------------------------------------- login preview */
.preview-login {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
}

.preview-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 10px;
  background: var(--surface-3);
  border-bottom: 1px solid var(--border);
}

.preview-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d1d5db;
}

.preview-url {
  margin-left: 8px;
  font-size: 10.5px;
  color: var(--muted);
  font-family: var(--mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-stage {
  padding: 34px 22px 30px;
  background: linear-gradient(180deg, var(--accent-soft) 0%, #fff 70%);
  min-height: 292px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.preview-logo {
  width: 58px;
  height: 58px;
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 650;
  overflow: hidden;
  box-shadow: 0 6px 18px var(--accent-shadow);
  margin-bottom: 14px;
  flex: none;
}

.preview-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.preview-product {
  font-size: 17px;
  font-weight: 650;
  margin-bottom: 4px;
  color: var(--text);
  word-break: break-word;
}

.preview-welcome {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 20px;
  word-break: break-word;
}

.preview-form {
  width: 100%;
  max-width: 230px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.preview-input {
  height: 32px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 11.5px;
  color: var(--muted-2);
  display: flex;
  align-items: center;
  padding: 0 10px;
  text-align: left;
}

.preview-btn {
  height: 32px;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 550;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.preview-foot {
  font-size: 10.5px;
  color: var(--muted-2);
  margin-top: 18px;
}

/* -------------------------------------------------------------- plan cards */
.plan-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.plan-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  background: var(--surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  position: relative;
  text-align: left;
  font: inherit;
  color: inherit;
}

.plan-card:hover {
  border-color: rgba(47, 111, 237, 0.45);
}

.plan-card.is-selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.1);
}

.plan-card-name {
  font-size: 13.5px;
  font-weight: 650;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.plan-card-check {
  color: var(--primary);
  display: none;
}

.plan-card.is-selected .plan-card-check {
  display: inline-flex;
}

.plan-card-quota {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.plan-card-desc {
  font-size: 11.5px;
  color: var(--muted-2);
  margin-top: 6px;
  line-height: 1.5;
}

/* --------------------------------------------------------- model editor */
.model-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.model-table th,
.model-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.model-table th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.model-table td .input,
.model-table td .select {
  height: 30px;
  font-size: 12.5px;
  padding: 0 8px;
}

.model-table td .select {
  padding-right: 26px;
  background-position: calc(100% - 14px) 12px, calc(100% - 9px) 12px;
}

.model-table td.is-narrow .input {
  width: 110px;
}

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

/* ------------------------------------------------------------- review */
.review-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
}

.review-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  background: var(--surface-2);
}

.review-section h4 {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 650;
  letter-spacing: 0.03em;
  margin-bottom: 10px;
}

.review-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 5px 0;
  font-size: 13px;
  border-bottom: 1px dashed var(--border);
}

.review-row:last-child {
  border-bottom: none;
}

.review-key {
  color: var(--muted);
  flex: none;
}

.review-val {
  text-align: right;
  word-break: break-word;
  min-width: 0;
  font-weight: 500;
}

.review-val.is-mono {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
}

/* ------------------------------------------------------------- secret */
.secret-box {
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.secret-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.secret-label {
  font-size: 12px;
  color: var(--muted);
  width: 74px;
  flex: none;
}

.secret-value {
  font-family: var(--mono);
  font-size: 13px;
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
  letter-spacing: 0.04em;
  word-break: break-all;
}

.secret-warn {
  font-size: 12px;
  color: var(--warning);
  display: flex;
  gap: 7px;
  align-items: flex-start;
  line-height: 1.5;
}

/* -------------------------------------------------------------- login */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  background: var(--surface);
}

.login-brand {
  position: relative;
  background: radial-gradient(1200px 600px at 12% -10%, #26406f 0%, transparent 60%),
    linear-gradient(155deg, #0b1220 0%, #111827 52%, #16233c 100%);
  color: #e5e9f0;
  padding: 48px 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.login-brand::after {
  content: "";
  position: absolute;
  inset: auto -160px -200px auto;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(47, 111, 237, 0.28), transparent 65%);
  pointer-events: none;
}

.login-brand-head {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.login-brand-head .brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
}

.login-brand-name {
  font-size: 16px;
  font-weight: 650;
  color: #fff;
}

.login-brand-sub {
  font-size: 12px;
  color: var(--sidebar-muted);
}

.login-hero {
  position: relative;
  z-index: 1;
  margin: 40px 0;
}

.login-hero h1 {
  font-size: 30px;
  line-height: 1.3;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
  color: #fff;
}

.login-hero p {
  color: #a8b3c5;
  font-size: 14px;
  line-height: 1.75;
  max-width: 460px;
}

.login-points {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 30px;
}

.login-point {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  font-size: 13px;
  color: #c3ccda;
}

.login-point-icon {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: rgba(47, 111, 237, 0.18);
  border: 1px solid rgba(47, 111, 237, 0.32);
  color: #93b4ff;
  display: grid;
  place-items: center;
  flex: none;
}

.login-brand-foot {
  position: relative;
  z-index: 1;
  font-size: 11.5px;
  color: #6b7688;
  line-height: 1.7;
}

.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 28px;
  background: var(--surface);
}

.login-form {
  width: 100%;
  max-width: 372px;
}

.login-form h2 {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

.login-form .login-sub {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 26px;
}

.login-form .field {
  margin-bottom: 16px;
}

.login-form .btn-lg {
  margin-top: 8px;
}

.login-hint {
  margin-top: 22px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}

.login-hint code {
  font-family: var(--mono);
  font-size: 11.5px;
  background: var(--surface-3);
  border-radius: 4px;
  padding: 1px 4px;
}

.login-error {
  margin-bottom: 16px;
}

/* ----------------------------------------------------------- page misc */
.tenant-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.tenant-logo {
  width: 54px;
  height: 54px;
  border-radius: 13px;
  background: var(--surface-3);
  display: grid;
  place-items: center;
  overflow: hidden;
  font-size: 22px;
  font-weight: 650;
  color: var(--primary);
  border: 1px solid var(--border);
  flex: none;
}

.tenant-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tenant-title {
  font-size: 20px;
  font-weight: 650;
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.tenant-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 5px;
}

.tenant-meta .meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.tenant-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.kv-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.kv-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13px;
}

.kv-row:last-child {
  border-bottom: none;
}

.kv-key {
  color: var(--muted);
  flex: none;
}

.kv-val {
  text-align: right;
  word-break: break-word;
  min-width: 0;
}

.usage-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.usage-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--surface-2);
}

.usage-label {
  font-size: 11.5px;
  color: var(--muted);
}

.usage-value {
  font-size: 17px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

.audit-actor {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.action-tag {
  font-family: var(--mono);
  font-size: 11.5px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
  color: var(--muted);
  white-space: nowrap;
}

.audit-detail {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  margin: 8px 0 2px;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text);
}

.detail-row td {
  background: var(--surface-2) !important;
}

.expand-btn {
  color: var(--muted);
}

.trend-bars {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  height: 160px;
  padding: 8px 18px 0;
}

.trend-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  height: 100%;
  min-width: 0;
}

.trend-stack {
  width: 100%;
  max-width: 30px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 2px;
  flex: 1;
}

.trend-bar {
  width: 100%;
  border-radius: 3px 3px 0 0;
  background: var(--primary);
  min-height: 2px;
}

.trend-bar.is-failed {
  background: #f87171;
  border-radius: 0 0 3px 3px;
}

.trend-label {
  font-size: 10.5px;
  color: var(--muted-2);
  white-space: nowrap;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

.section-gap {
  margin-top: 16px;
}

.list-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.role-tag {
  font-size: 11px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 5px;
  color: var(--muted);
  font-family: var(--mono);
}

.uptime {
  font-variant-numeric: tabular-nums;
}

.load-more {
  display: flex;
  justify-content: center;
  padding: 14px;
}

/* --------------------------------------------------------- responsive */
@media (max-width: 1400px) {
  .stat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1200px) {
  :root {
    --sidebar-width: 72px;
  }
  .sidebar-brand {
    justify-content: center;
    padding: 0;
  }
  .brand-text,
  .nav-label,
  .nav-section,
  .sidebar-foot {
    display: none;
  }
  .sidebar-nav {
    padding: 10px 8px;
    align-items: center;
  }
  .nav-item {
    justify-content: center;
    padding: 0;
    width: 44px;
    height: 42px;
  }
  .nav-item.is-active {
    box-shadow: inset 0 0 0 2px var(--primary);
    border-radius: 10px;
  }
  .content {
    padding: 20px;
  }
  .grid-2-1,
  .grid-1-2 {
    grid-template-columns: minmax(0, 1fr);
  }
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .skeleton-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .plan-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .login-brand {
    padding: 36px;
  }
  .login-hero h1 {
    font-size: 26px;
  }
}

@media (max-width: 900px) {
  .login-page {
    grid-template-columns: minmax(0, 1fr);
  }
  .login-brand {
    display: none;
  }
  .content {
    padding: 16px;
  }
  .topbar {
    padding: 0 14px;
  }
  .role-pill {
    display: none;
  }
  .stat-grid,
  .skeleton-cards {
    grid-template-columns: minmax(0, 1fr);
  }
  .grid-2,
  .grid-3 {
    grid-template-columns: minmax(0, 1fr);
  }
  .review-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .info-grid,
  .info-grid.is-2 {
    grid-template-columns: minmax(0, 1fr);
  }
  .plan-row {
    padding: 12px 14px;
  }
  .plan-row .plan-progress {
    display: none;
  }
  .usage-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .modal-backdrop {
    padding-top: 4vh;
  }
  .toast-stack {
    right: 12px;
    top: 64px;
  }
  .page-actions {
    width: 100%;
  }
  .tenant-actions {
    margin-left: 0;
    width: 100%;
  }
  .wizard-side {
    position: static;
  }
  .steps {
    padding-bottom: 16px;
  }
  .step-label {
    display: none;
  }
  .step-line {
    margin: 0 6px;
  }
}

@media (max-width: 640px) {
  :root {
    --sidebar-width: 0px;
  }
  .sidebar {
    transform: translateX(-100%);
  }
  .main {
    margin-left: 0;
  }
  .menu-toggle {
    display: inline-flex;
  }
  .topbar .breadcrumb {
    display: none;
  }
  .content {
    padding: 12px;
  }
  .page-title {
    font-size: 18px;
  }
  .stat-grid {
    gap: 10px;
  }
  .card-head,
  .card-body,
  .toolbar {
    padding-left: 14px;
    padding-right: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* =========================================================================
   插件目录：插件级卡片（一个插件一条，版本历史可展开）
   ========================================================================= */
.plugin-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.plugin-card {
  display: flex;
  flex-direction: column;
  gap: 11px;
  min-width: 0;
  padding: 15px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.plugin-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.plugin-card-title-wrap {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.plugin-card-title {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
}

.plugin-card-title .mono {
  font-size: 12.5px;
}

.plugin-card-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.plugin-card-desc {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
}

.plugin-shots {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.plugin-shots.is-empty {
  padding: 10px 12px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted-2);
  font-size: 12px;
}

button.plugin-shot {
  flex: none;
  width: 96px;
  height: 64px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-3);
  cursor: zoom-in;
}

button.plugin-shot:hover {
  border-color: var(--primary);
}

button.plugin-shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.plugin-shot-preview {
  display: block;
  max-width: 100%;
  max-height: 72vh;
  margin: 0 auto;
  border-radius: 8px;
}

.plugin-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.plugin-meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.plugin-meta-label {
  color: var(--muted-2);
  font-size: 10.5px;
}

.plugin-meta-value {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--text);
}

.plugin-current-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 4px;
  border-radius: 50%;
  background: var(--success);
  vertical-align: middle;
}

.plugin-rolled-badge {
  display: inline-flex;
  align-items: center;
  padding: 0 6px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--warning) 30%, transparent);
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 10.5px;
  line-height: 1.6;
}

.plugin-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.plugin-history {
  margin-top: 2px;
  padding-top: 4px;
  border-top: 1px dashed var(--border);
  overflow-x: auto;
}

.plugin-history table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.plugin-history th {
  text-align: left;
  padding: 7px 8px;
  color: var(--muted-2);
  font-size: 10.5px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.plugin-history td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.plugin-history tbody tr:last-child td {
  border-bottom: none;
}

.plugin-shots-editor {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.plugin-shot-item {
  position: relative;
  width: 132px;
  height: 88px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-3);
}

.plugin-shot-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.plugin-shot-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(17, 24, 39, 0.72);
  color: #fff;
  font-size: 14px;
  line-height: 20px;
  cursor: pointer;
}

.plugin-shot-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 132px;
  height: 88px;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

.plugin-shot-add:hover {
  border-color: var(--primary);
  color: var(--primary);
}
