/* ============================================================
   柏龄鸟 AI 创作平台 · 精致深色工作室主题
   Design system: deep ink surfaces + sober teal-green brand
   ============================================================ */

:root {
  /* —— Brand · sober teal-green —— */
  --brand: #2fbf95;
  --brand-bright: #41d6a8;
  --brand-deep: #1f9b78;
  --brand-ink: #04130d;
  --brand-soft: rgba(47, 191, 149, .12);
  --brand-soft-2: rgba(47, 191, 149, .18);
  --brand-border: rgba(64, 214, 168, .34);
  --brand-glow: rgba(47, 191, 149, .28);

  /* —— Accent · complementary teal-cyan (used sparingly) —— */
  --accent: #58c6d8;
  --accent-soft: rgba(88, 198, 216, .12);

  /* —— Backgrounds & surfaces (layered elevation) —— */
  --bg: #090d0c;
  --bg-soft: #0c1110;
  --surface: #111817;
  --surface-2: #16201d;
  --surface-3: #1b2723;
  --surface-hover: #1f2c28;

  /* —— Lines & strokes —— */
  --line: rgba(126, 196, 174, .12);
  --line-2: rgba(126, 196, 174, .2);
  --line-strong: var(--brand-border);

  /* —— Text —— */
  --text: #eaf3ef;
  --text-soft: #c4d4cd;
  --muted: #8aa099;
  --dim: #5f746d;

  /* —— Semantic —— */
  --green: #3ddc97;
  --cyan: var(--accent);
  --blue: #5b9bf0;
  --warn: #e6b045;
  --danger: #f0697e;

  /* —— Radius —— */
  --r-xs: 8px;
  --r-sm: 10px;
  --r-md: 13px;
  --r-lg: 18px;
  --r-pill: 999px;

  /* —— Shadows —— */
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, .28);
  --shadow: 0 18px 48px rgba(0, 0, 0, .42);
  --shadow-lg: 0 36px 90px rgba(0, 0, 0, .5);
  --ring: 0 0 0 3px rgba(47, 191, 149, .18);

  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", Inter, system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

.hidden { display: none !important; }

/* —— Scrollbars —— */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(126, 196, 174, .22) transparent;
}
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb {
  background: rgba(126, 196, 174, .2);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: rgba(126, 196, 174, .34); background-clip: padding-box; }

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

/* ============================================================
   Buttons
   ============================================================ */
.primary-btn {
  position: relative;
  border: 0;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, var(--brand-bright), var(--brand) 55%, var(--brand-deep));
  color: var(--brand-ink);
  font-weight: 800;
  letter-spacing: .01em;
  padding: 12px 18px;
  box-shadow: 0 10px 26px -8px var(--brand-glow), inset 0 1px 0 rgba(255, 255, 255, .22);
  transition: transform .16s ease, box-shadow .2s ease, filter .2s ease;
}
.primary-btn:hover { transform: translateY(-1px); box-shadow: 0 16px 34px -8px var(--brand-glow), inset 0 1px 0 rgba(255, 255, 255, .28); filter: brightness(1.04); }
.primary-btn:active { transform: translateY(0); filter: brightness(.97); }
.primary-btn:focus-visible { outline: none; box-shadow: var(--ring), 0 12px 28px -10px var(--brand-glow); }

a.primary-btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.primary-btn.wide { width: 100%; margin-top: 20px; }

.ghost-btn, .text-btn {
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--text-soft);
  border-radius: var(--r-sm);
  padding: 11px 15px;
  font-weight: 600;
  transition: border-color .18s, background .18s, color .18s, transform .16s;
}
.ghost-btn:hover, .text-btn:hover {
  border-color: var(--brand-border);
  background: var(--surface-3);
  color: var(--text);
}
.ghost-btn:active, .text-btn:active { transform: translateY(1px); }
.ghost-btn:focus-visible, .text-btn:focus-visible { outline: none; box-shadow: var(--ring); }

.text-btn {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  padding: 6px 10px;
}
.text-btn:hover { background: var(--brand-soft); color: var(--brand-bright); border-color: transparent; }

.ghost-btn.wide { width: 100%; }

.danger-btn {
  border-color: rgba(240, 105, 126, .32);
  color: #ff9aaa;
  background: rgba(240, 105, 126, .06);
}
.danger-btn:hover { background: rgba(240, 105, 126, .14); border-color: rgba(240, 105, 126, .5); color: #ffb0bd; }

/* ============================================================
   Form controls
   ============================================================ */
label {
  display: block;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .01em;
  margin: 16px 0 7px;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--bg-soft);
  color: var(--text);
  outline: none;
  padding: 11px 13px;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
input::placeholder, textarea::placeholder { color: var(--dim); }
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  background: var(--surface);
  box-shadow: var(--ring);
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238aa099' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  cursor: pointer;
}
select option { background: var(--surface-2); color: var(--text); }

input[type="range"] {
  padding: 0;
  height: 5px;
  accent-color: var(--brand);
  cursor: pointer;
}

input[type="checkbox"] {
  width: auto;
  accent-color: var(--brand);
  cursor: pointer;
}

input[type="file"] {
  padding: 9px 12px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}
input[type="file"]::file-selector-button {
  margin-right: 12px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--text-soft);
  font-weight: 600;
  padding: 7px 12px;
  cursor: pointer;
  transition: background .18s, border-color .18s;
}
input[type="file"]::file-selector-button:hover { background: var(--surface-hover); border-color: var(--brand-border); }

audio { width: 100%; }

.sub-input { margin-top: 8px; }

/* ============================================================
   Brand mark
   ============================================================ */
.brand-mark {
  width: 48px;
  height: 48px;
  border: 1px solid var(--brand-border);
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--brand-bright);
  font-weight: 900;
  font-size: 16px;
  letter-spacing: .02em;
  background: linear-gradient(150deg, var(--brand-soft-2), rgba(47, 191, 149, .04));
  box-shadow: 0 0 30px -4px var(--brand-glow), inset 0 1px 0 rgba(255, 255, 255, .12);
}
.brand-mark.small { width: 42px; height: 42px; border-radius: 12px; font-size: 14px; }

/* ============================================================
   Login screen
   ============================================================ */
.shell {
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(1100px 620px at 78% 12%, rgba(47, 191, 149, .12), transparent 60%),
    radial-gradient(900px 700px at 6% 92%, rgba(88, 198, 216, .08), transparent 58%),
    linear-gradient(160deg, #0a100e 0%, #0a0f0e 48%, #0b1311 100%);
}
.shell::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .018) 0 1px, transparent 1px 96px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .014) 0 1px, transparent 1px 96px);
  pointer-events: none;
}

.login-canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .55; }

.brand-bar {
  position: relative;
  z-index: 2;
  height: 90px;
  padding: 0 clamp(22px, 5vw, 76px);
  display: flex;
  align-items: center;
  gap: 16px;
}
.brand-bar h1 { margin: 0; font-size: 21px; font-weight: 800; letter-spacing: .01em; }
.brand-bar p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }

.login-layout {
  position: relative;
  z-index: 2;
  width: min(1180px, calc(100vw - 44px));
  min-height: calc(100vh - 120px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) 430px;
  gap: 40px;
  align-items: center;
  align-content: center;
  padding: 28px 0 54px;
}

.hero-panel { padding: 28px 0; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--brand-bright);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .26em;
  margin-bottom: 24px;
}
.eyebrow::before {
  content: "";
  width: 26px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--brand), transparent);
}

.hero-panel h2 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(40px, 5.4vw, 66px);
  line-height: 1.08;
  letter-spacing: -.01em;
  font-weight: 800;
  background: linear-gradient(180deg, #ffffff, #c8ddd5);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-copy { max-width: 660px; margin: 22px 0 0; color: var(--text-soft); font-size: 16px; line-height: 1.9; }

.signal-grid {
  width: min(680px, 100%);
  margin-top: 36px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.signal-grid div {
  min-height: 104px;
  padding: 18px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, .03), rgba(255, 255, 255, .005));
  backdrop-filter: blur(10px);
  transition: transform .2s ease, border-color .2s ease;
}
.signal-grid div:hover { transform: translateY(-3px); border-color: var(--brand-border); }
.signal-grid strong { display: block; color: var(--brand-bright); font-size: 19px; font-weight: 800; margin-bottom: 8px; }
.signal-grid span { color: var(--muted); font-size: 13px; }

.login-card {
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  padding: 30px;
  background: linear-gradient(180deg, rgba(22, 32, 29, .9), rgba(14, 21, 19, .92));
  backdrop-filter: blur(26px);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, .05);
}

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 26px; }
.card-head span { font-weight: 800; font-size: 17px; }
.card-head small { color: var(--muted); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }

.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 16px 0 22px;
}
.checkline { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--muted); font-weight: 500; font-size: 13px; }
.checkline input { width: auto; }

.login-note { margin-top: 18px; color: var(--muted); font-size: 12px; line-height: 1.7; }

/* ============================================================
   App shell · sidebar + topbar
   ============================================================ */
.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  background:
    radial-gradient(900px 500px at 100% 0%, rgba(47, 191, 149, .06), transparent 60%),
    var(--bg);
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #0c1211, #0a0f0e);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 6px 22px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.side-brand strong { display: block; font-size: 15px; font-weight: 800; }
.side-brand span { display: block; font-size: 11px; margin-top: 3px; color: var(--muted); letter-spacing: .06em; }

nav { display: grid; gap: 4px; }

.nav-item {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: var(--r-sm);
  padding: 11px 13px;
  font-weight: 600;
  font-size: 14px;
  transition: background .16s, color .16s, border-color .16s;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }
.nav-item:hover { background: var(--surface-2); color: var(--text-soft); }
.nav-item.active {
  background: var(--brand-soft);
  color: var(--brand-bright);
  border-color: var(--brand-border);
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--brand-bright);
  box-shadow: 0 0 12px var(--brand-glow);
}
.nav-item.active svg { opacity: 1; }

.side-foot {
  margin-top: auto;
  padding: 12px 10px 4px;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-size: 11px;
  line-height: 1.7;
}

.workspace { padding: 24px clamp(18px, 2.4vw, 34px) 40px; min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
  padding-bottom: 18px;
}
.topbar h2 { margin: 0; font-size: 21px; font-weight: 800; letter-spacing: -.005em; }
.topbar p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.top-actions { display: flex; align-items: center; gap: 10px; }

.server-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(61, 220, 151, .28);
  color: var(--green);
  border-radius: var(--r-pill);
  padding: 7px 13px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(61, 220, 151, .07);
}
.server-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

/* ============================================================
   Shared panel + section title
   ============================================================ */
.tool-panel, .editor-panel, .library-panel, .settings-panel, .empty-view {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 22px;
}

.panel-title, .queue-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.panel-title span, .queue-head span { font-weight: 800; font-size: 15px; }
.panel-title small, .queue-head small { color: var(--muted); font-size: 12px; }

/* ============================================================
   Create view
   ============================================================ */
.mode-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, 130px);
  gap: 5px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-soft);
  margin-bottom: 20px;
}
.mode-btn {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 9px 12px;
  font-weight: 700;
  transition: background .16s, color .16s;
}
.mode-btn:hover { color: var(--text-soft); }
.mode-btn.active {
  background: linear-gradient(135deg, var(--brand-soft-2), var(--brand-soft));
  color: var(--brand-bright);
  box-shadow: inset 0 0 0 1px var(--brand-border);
}

.content-grid {
  display: grid;
  grid-template-columns: 392px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 4px;
  background: var(--bg-soft);
}
.segmented button {
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  padding: 9px 8px;
  font-weight: 700;
  font-size: 12.5px;
  transition: background .16s, color .16s;
}
.segmented button:hover { color: var(--text-soft); }
.segmented button.active { background: var(--brand-soft-2); color: var(--brand-bright); }

.avatar-search { margin: 10px 0 2px; }

.avatar-list {
  display: grid;
  gap: 9px;
  max-height: 520px;
  overflow: auto;
  padding-right: 4px;
  margin-top: 8px;
}
.avatar-card {
  width: 100%;
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text);
  display: grid;
  grid-template-columns: 48px 1fr;
  grid-template-rows: auto auto;
  gap: 3px 12px;
  align-items: center;
  text-align: left;
  padding: 12px;
  transition: border-color .16s, background .16s, transform .16s;
}
.avatar-card:hover { border-color: var(--line-strong); background: var(--surface-3); transform: translateY(-1px); }
.avatar-card.selected { border-color: var(--brand-border); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand-border); }
.avatar-card strong { font-size: 13px; font-weight: 700; }
.avatar-card em { color: var(--muted); font-size: 12px; font-style: normal; }

.avatar-face {
  grid-row: 1 / 3;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: linear-gradient(145deg, #6fe3c0, #2f8fb0);
}
.avatar-face.alt { background: linear-gradient(145deg, #4fe2a6, #1c7d7a); }
.avatar-face.photo { border-radius: 50%; background: linear-gradient(145deg, #f4d19b, #46b89a); }
.avatar-thumb {
  grid-row: 1 / 3;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--brand-soft);
}

.two-col, .mini-config {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.range-group { margin-top: 14px; }
.range-group label { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.range-group label span { color: var(--brand-bright); font-weight: 800; font-variant-numeric: tabular-nums; }

.locked-config {
  margin-top: 16px;
  border: 1px solid rgba(61, 220, 151, .26);
  border-radius: var(--r-sm);
  padding: 12px 13px;
  background: rgba(61, 220, 151, .06);
  display: grid;
  gap: 3px;
}
.locked-config strong { color: var(--green); font-weight: 800; }
.locked-config span { color: var(--muted); font-size: 12px; }

.generate-actions { display: grid; gap: 10px; margin-top: 18px; }

/* —— Editor panel —— */
textarea { min-height: 280px; resize: vertical; line-height: 1.8; }

.editor-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}
.editor-meta strong { color: var(--brand-bright); font-variant-numeric: tabular-nums; }

.queue-head { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }

.task-table { margin-top: 12px; display: grid; gap: 10px; }

.queue-empty, .video-empty, .library-empty {
  border: 1px dashed var(--line-2);
  border-radius: var(--r-sm);
  color: var(--muted);
  text-align: center;
  background: var(--bg-soft);
}
.queue-empty { padding: 20px; }

.queue-card {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 15px;
  background: var(--surface-2);
}
.queue-card-main strong { display: block; margin-bottom: 6px; color: var(--text); }
.queue-card-main p { margin: 0 0 7px; color: var(--text-soft); line-height: 1.55; }
.queue-card-main small { color: var(--muted); word-break: break-all; }

.queue-steps { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.queue-progress {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: rgba(126, 196, 174, .12);
}
.queue-progress i { display: block; width: var(--progress); height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-bright)); }

/* —— Audio / video result panels —— */
.video-result-panel, .audio-result-panel {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  padding: 16px;
}

.video-result-list, .audio-result-list { display: grid; gap: 10px; margin-top: 12px; }

.audio-library-actions {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
  gap: 12px;
  align-items: stretch;
  margin-top: 14px;
}
.audio-action-group {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  padding: 13px;
  min-width: 0;
}
.audio-action-group label { margin: 0 0 8px; color: var(--muted); font-size: 12px; font-weight: 700; }
.audio-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 8px;
  align-items: center;
}
.audio-action-row button { width: 100%; min-height: 44px; white-space: nowrap; padding-inline: 14px; }
.audio-action-row input[type="file"] { min-width: 0; width: 100%; }

.video-empty {
  min-height: 78px;
  display: grid;
  place-items: center;
  padding: 16px;
}

.video-result-card, .audio-result-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 13px;
  background: var(--surface);
  transition: border-color .16s;
}
.video-result-card:hover, .audio-result-card:hover { border-color: var(--line-strong); }
.video-result-card strong, .audio-result-card strong { display: block; margin-bottom: 5px; }
.video-result-card p, .audio-result-card p { margin: 0 0 7px; color: var(--text-soft); line-height: 1.55; }
.video-result-card small, .audio-result-card small { color: var(--muted); }
.audio-result-main audio { width: 100%; height: 38px; margin-top: 10px; }

.video-open { min-width: 104px; min-height: 42px; }
.video-link { display: inline-flex; align-items: center; border: 0; text-decoration: none; font-weight: 800; }

/* —— Studio bottom (result / usage / log) —— */
.studio-bottom {
  display: grid;
  grid-template-columns: 1.1fr .75fr 1fr;
  gap: 14px;
  margin-top: 16px;
}
.result-box {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  padding: 16px;
  min-height: 152px;
}
.result-box audio { width: 100%; height: 38px; margin-top: 12px; }

.usage-meter { display: flex; align-items: baseline; gap: 8px; margin-top: 18px; }
.usage-meter strong { color: var(--brand-bright); font-size: 30px; line-height: 1; font-weight: 800; font-variant-numeric: tabular-nums; }
.usage-meter span { color: var(--muted); }

.meter-line {
  height: 7px;
  border-radius: var(--r-pill);
  background: rgba(126, 196, 174, .14);
  overflow: hidden;
  margin-top: 16px;
}
.meter-line i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand), var(--brand-bright)); transition: width .5s ease; }

.log-box {
  height: 100px;
  margin-top: 12px;
  overflow: auto;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.75;
}

/* ============================================================
   Status pills
   ============================================================ */
.status {
  width: fit-content;
  border-radius: var(--r-pill);
  padding: 4px 11px;
  font-size: 12px;
  font-weight: 700;
}
.status.waiting { color: var(--muted); background: rgba(126, 196, 174, .12); }
.status.running { color: var(--accent); background: var(--accent-soft); }
.status.done, .status.submitted { color: var(--green); background: rgba(61, 220, 151, .12); }
.status.rendering { color: var(--accent); background: var(--accent-soft); }
.status.ready { color: var(--brand-ink); background: linear-gradient(135deg, var(--brand-bright), var(--brand)); }
.status.failed { color: var(--danger); background: rgba(240, 105, 126, .12); }

/* live activity for in-progress states */
.status.running, .status.rendering {
  position: relative;
  padding-left: 19px;
  animation: status-breathe 1.9s ease-in-out infinite;
}
.status.running::before, .status.rendering::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 7px currentColor;
}
/* keep .ready button (also .status) free of the dot when used as a link */
.status.ready.video-link { padding-left: 11px; }
@keyframes status-breathe { 0%, 100% { opacity: 1; } 50% { opacity: .62; } }

/* ============================================================
   Library views (voices + avatars)
   ============================================================ */
.library-actions {
  display: grid;
  grid-template-columns: auto 180px 180px;
  gap: 10px;
  align-items: center;
  margin-top: 18px;
}
.library-actions.voices-actions { grid-template-columns: auto minmax(160px, 1fr) minmax(180px, 1fr) auto; }

.voice-library-list { display: grid; gap: 10px; margin-top: 16px; }

.voice-tools {
  display: grid;
  grid-template-columns: minmax(220px, .75fr) minmax(0, 1.25fr);
  gap: 10px;
  margin-top: 14px;
  align-items: center;
}
.voice-filter-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.voice-filter-tabs button {
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--muted);
  padding: 8px 13px;
  font-weight: 600;
  font-size: 12px;
  transition: border-color .16s, color .16s, background .16s;
}
.voice-filter-tabs button:hover { border-color: var(--brand-border); color: var(--text-soft); }
.voice-filter-tabs button.active { border-color: var(--brand-border); color: var(--brand-bright); background: var(--brand-soft); }

.voice-preview-bar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 320px;
  gap: 10px;
  margin-top: 14px;
  align-items: center;
}
.voice-preview-bar audio { width: 100%; height: 38px; }

.clone-panel {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  padding: 16px;
}
.clone-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.clone-options { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-top: 14px; }

.voice-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(180px, 1.2fr) 90px 90px auto auto auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  padding: 13px;
  transition: border-color .16s;
}
.voice-row:hover { border-color: var(--line-strong); }
.voice-row.is-default {
  border-color: var(--brand-border);
  background: linear-gradient(90deg, var(--brand-soft), var(--surface-2) 30%);
  box-shadow: inset 3px 0 0 var(--brand);
}
.voice-row strong, .voice-row span { display: block; }
.voice-row span { color: var(--muted); font-size: 12px; word-break: break-all; }
.voice-tag {
  width: fit-content;
  color: var(--green) !important;
  border: 1px solid rgba(61, 220, 151, .28);
  border-radius: var(--r-pill);
  padding: 5px 10px;
  background: rgba(61, 220, 151, .08);
  font-weight: 600;
}

.avatar-create-panel {
  margin-top: 18px;
  border: 1px solid var(--brand-border);
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--brand-soft), rgba(88, 198, 216, .05)), var(--surface-2);
  padding: 16px;
}
.avatar-create-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.avatar-create-tabs button {
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--muted);
  padding: 9px 14px;
  font-weight: 700;
  transition: border-color .16s, color .16s, background .16s;
}
.avatar-create-tabs button:hover { border-color: var(--brand-border); color: var(--text-soft); }
.avatar-create-tabs button.active { border-color: var(--brand-border); color: var(--brand-bright); background: var(--brand-soft-2); }

.avatar-create-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.avatar-create-grid textarea { min-height: 96px; resize: vertical; }
.avatar-create-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin-top: 14px;
}
.avatar-create-actions span { color: var(--muted); line-height: 1.6; font-size: 13px; }

.hidden-field { display: none; }

.avatar-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.library-empty {
  grid-column: 1 / -1;
  padding: 28px;
  border-style: solid;
  background: var(--surface-2);
}
.library-empty.compact { padding: 16px; font-size: 12px; }

.library-avatar {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  overflow: hidden;
  min-width: 0;
  transition: border-color .18s, transform .18s, box-shadow .18s;
}
.library-avatar:hover { border-color: var(--brand-border); transform: translateY(-3px); box-shadow: var(--shadow); }
.library-avatar.is-default { border-color: var(--brand-border); box-shadow: 0 0 0 1px var(--brand-border), var(--shadow); }
.library-avatar.is-default::after {
  content: "默认";
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1;
  color: var(--brand-ink);
  background: linear-gradient(135deg, var(--brand-bright), var(--brand));
  border-radius: var(--r-pill);
  padding: 4px 11px;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 4px 14px -4px var(--brand-glow);
}
.library-avatar img {
  display: block;
  width: 100%;
  height: clamp(240px, 22vw, 340px);
  object-fit: cover;
  object-position: top center;
  background: var(--brand-soft);
}
.library-avatar-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: clamp(240px, 22vw, 340px);
  color: var(--brand-bright);
  background: linear-gradient(135deg, var(--brand-soft-2), var(--accent-soft)), var(--bg-soft);
  font-weight: 800;
  line-height: 1.7;
  text-align: center;
}
.library-avatar-placeholder span { color: var(--muted); font-size: 12px; font-weight: 600; }
.library-avatar-body { padding: 12px 12px 8px; }
.library-avatar-body strong, .library-avatar-body span { display: block; }
.library-avatar-body span { color: var(--muted); font-size: 12px; margin-top: 4px; word-break: break-all; line-height: 1.45; }
.library-avatar-actions { display: grid; grid-template-columns: 1fr; gap: 8px; padding: 0 12px 12px; }

/* ============================================================
   Tasks / records
   ============================================================ */
.record-actions {
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  margin-top: 18px;
}
.record-list { display: grid; gap: 10px; margin-top: 18px; }
.record-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 15px;
  background: var(--surface-2);
  transition: border-color .16s;
}
.record-card:hover { border-color: var(--line-strong); }
.record-card strong { display: block; margin-bottom: 6px; }
.record-card p { margin: 0 0 6px; color: var(--text-soft); word-break: break-all; }
.record-card small { color: var(--muted); }

.record-buttons { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.video-download {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.video-download.disabled { pointer-events: none; opacity: .55; }

/* ============================================================
   Usage
   ============================================================ */
.usage-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.usage-config-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.usage-dashboard { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }

.usage-card {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  padding: 18px;
  transition: border-color .18s, transform .18s;
}
.usage-card:hover { border-color: var(--brand-border); transform: translateY(-2px); }
.usage-card span, .usage-card em { display: block; color: var(--muted); font-style: normal; font-size: 13px; }
.usage-card strong { display: block; margin: 12px 0 8px; color: var(--brand-bright); font-size: 27px; line-height: 1.1; font-weight: 800; font-variant-numeric: tabular-nums; }

.usage-note {
  margin-top: 16px;
  border: 1px solid var(--brand-border);
  border-radius: var(--r-md);
  background: var(--brand-soft);
  color: var(--text-soft);
  padding: 14px 16px;
  line-height: 1.8;
}

/* ============================================================
   Settings / team
   ============================================================ */
.settings-grid, .team-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
  gap: 20px;
  align-items: start;
}

.form-actions { display: flex; align-items: center; gap: 10px; margin-top: 22px; }

.notice, .config-preview {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  padding: 16px;
}
.notice { margin-top: 14px; }
.notice strong { color: var(--green); font-weight: 800; }
.notice p { margin: 8px 0 0; color: var(--muted); line-height: 1.8; }
.config-preview {
  margin-top: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.9;
}

/* ===== 系统设置：分组标签 + 分组面板 ===== */
.settings-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.settings-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s ease;
}
.settings-tab:hover { color: var(--text); border-color: var(--line-2); }
.settings-tab.active {
  background: var(--brand-soft);
  color: var(--brand-bright);
  border-color: var(--brand-border);
  box-shadow: var(--ring);
}
.settings-tab .st-ico { width: 15px; height: 15px; flex-shrink: 0; }

.settings-pane { display: none; animation: fadeUp .2s ease; }
.settings-pane.active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* 两栏布局（API 与默认配置） */
.settings-two {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, .9fr);
  gap: 20px;
  align-items: start;
}
/* 窄屏单列 */
.settings-narrow { max-width: 520px; }

/* 字段竖向堆叠（修改密码） */
.field-stack { display: grid; gap: 14px; }
.field-stack label { margin-bottom: 6px; }

/* 字段分组（MiniMax / HeyGen 等小标题归类） */
.field-group {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  padding: 14px 16px 16px;
  margin-top: 14px;
}
.field-group:first-of-type { margin-top: 16px; }
.field-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .4px;
  color: var(--text-soft);
  margin-bottom: 12px;
}
.fg-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.fg-dot.mm { background: var(--brand-bright); }
.fg-dot.hg { background: var(--accent); }

/* 配置状态条 */
.config-status-bar {
  margin-top: 0;
  margin-bottom: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  line-height: 1.7;
}

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

.member-list { display: grid; gap: 10px; margin-top: 18px; }
.member-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  padding: 13px;
  transition: border-color .16s;
}
.member-row:hover { border-color: var(--line-strong); }
.member-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--brand-ink);
  background: linear-gradient(135deg, var(--brand-bright), var(--brand-deep));
  font-weight: 900;
}
.member-row strong, .member-row em { display: block; }
.member-row em { color: var(--muted); font-style: normal; font-size: 12px; margin-top: 3px; }
.member-row b {
  color: var(--green);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(61, 220, 151, .28);
  border-radius: var(--r-pill);
  padding: 5px 11px;
  background: rgba(61, 220, 151, .08);
}

.role-table { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; margin-top: 18px; }
.role-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  padding: 14px 15px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}
.role-row:last-child { border-bottom: 0; }
.role-row.head { color: var(--text); background: var(--surface-2); font-weight: 800; }
.role-row strong { color: var(--brand-bright); font-weight: 700; }

/* ============================================================
   Multi-tenant console (团队 / 加盟商)
   ============================================================ */
.tenant-bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.perspective-switch {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 5px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-soft);
}
.perspective-switch button {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 9px 18px;
  font-weight: 700;
  transition: background .16s, color .16s;
}
.perspective-switch button:hover { color: var(--text-soft); }
.perspective-switch button.active {
  background: linear-gradient(135deg, var(--brand-soft-2), var(--brand-soft));
  color: var(--brand-bright);
  box-shadow: inset 0 0 0 1px var(--brand-border);
}
.tenant-hint { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.6; }

#tenant-platform > .library-panel,
#tenant-franchise > .library-panel { margin-top: 16px; }

.tenant-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 14px; }
.tenant-stat {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  padding: 16px 18px;
  transition: border-color .18s, transform .18s;
}
.tenant-stat:hover { border-color: var(--brand-border); transform: translateY(-2px); }
.tenant-stat span { display: block; color: var(--muted); font-size: 13px; }
.tenant-stat strong { display: block; margin-top: 8px; color: var(--brand-bright); font-size: 25px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tenant-stat em { display: block; margin-top: 4px; color: var(--dim); font-size: 12px; font-style: normal; }

.table-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; margin-top: 16px; }

.tenant-table-wrap { margin-top: 14px; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); }
.tenant-table { width: 100%; border-collapse: collapse; min-width: 720px; font-size: 13px; }
.tenant-table th {
  text-align: left;
  font-weight: 700;
  color: var(--muted);
  font-size: 12px;
  padding: 12px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tenant-table td { padding: 13px 14px; border-bottom: 1px solid var(--line); color: var(--text-soft); vertical-align: middle; }
.tenant-table tbody tr:last-child td { border-bottom: 0; }
.tenant-table tbody tr:hover td { background: rgba(126, 196, 174, .04); }
.tenant-table .cell-strong { color: var(--text); font-weight: 700; }
.tenant-table .cell-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); }
.tenant-table .cell-num { font-variant-numeric: tabular-nums; white-space: nowrap; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  border-radius: var(--r-pill);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag.ok { color: var(--green); background: rgba(61, 220, 151, .1); border: 1px solid rgba(61, 220, 151, .26); }
.tag.off { color: var(--muted); background: rgba(126, 196, 174, .08); border: 1px solid var(--line-2); }
.tag.warn { color: var(--warn); background: rgba(230, 176, 69, .1); border: 1px solid rgba(230, 176, 69, .28); }
.tag.fail { color: var(--danger); background: rgba(240, 105, 126, .1); border: 1px solid rgba(240, 105, 126, .28); }
.tag.role { color: var(--accent); background: var(--accent-soft); border: 1px solid rgba(88, 198, 216, .26); }
.tag.role::before { display: none; }
.tag.role.admin { color: var(--brand-bright); background: var(--brand-soft); border-color: var(--brand-border); }

.row-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.act-link {
  border: 0;
  background: transparent;
  color: var(--brand-bright);
  padding: 3px 7px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.act-link:hover { background: var(--brand-soft); }
.act-link.danger { color: #ff9aaa; }
.act-link.danger:hover { background: rgba(240, 105, 126, .12); }

.tenant-context {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  border: 1px solid var(--brand-border);
  border-radius: var(--r-md);
  background: var(--brand-soft);
  padding: 12px 16px;
  margin-bottom: 16px;
}
.tenant-context .ctx-badge {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--brand-bright), var(--brand-deep));
  color: var(--brand-ink);
  font-weight: 900;
}
.tenant-context strong { color: var(--text); display: block; }
.tenant-context .ctx-meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.tenant-context .ctx-spacer { margin-left: auto; }

.quota-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 14px; }
.quota-card { border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); padding: 14px 15px; }
.quota-card .q-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.quota-card .q-name { color: var(--text-soft); font-weight: 600; font-size: 13px; }
.quota-card .q-val { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.quota-card .q-val b { color: var(--brand-bright); font-size: 15px; }
.quota-bar { height: 7px; border-radius: 999px; background: rgba(126, 196, 174, .14); overflow: hidden; margin-top: 10px; }
.quota-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand), var(--brand-bright)); transition: width .5s ease; }
.quota-card.full .quota-bar i { background: linear-gradient(90deg, var(--warn), var(--danger)); }
.quota-card.full .q-val b { color: var(--danger); }

.isolation-note { margin-top: 16px; }
.isolation-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-top: 14px; }
.isolation-grid div { border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); padding: 13px 14px; }
.isolation-grid strong { display: block; color: var(--brand-bright); margin-bottom: 5px; }
.isolation-grid span { color: var(--muted); line-height: 1.6; }

.role-reference { margin-top: 16px; }

/* tenant form modal */
.tenant-modal { position: fixed; inset: 0; z-index: 85; display: grid; place-items: center; padding: 24px; }
.tenant-modal-backdrop { position: absolute; inset: 0; background: rgba(4, 8, 7, .74); backdrop-filter: blur(8px); }
.tenant-modal-card {
  position: relative;
  z-index: 1;
  width: min(540px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  padding: 22px;
}
.tenant-modal-desc { margin: 10px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.tenant-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; margin-top: 16px; }
.tenant-form .full { grid-column: 1 / -1; }
.tenant-form label { margin: 0 0 6px; }
.tenant-modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ============================================================
   财务中心 / 充值计费
   ============================================================ */
#finance-platform > .library-panel,
#finance-user > .library-panel { margin-top: 16px; }

.finance-warn {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: var(--r-md);
  padding: 13px 16px;
  margin-bottom: 16px;
  font-size: 13.5px;
  font-weight: 600;
}
.finance-warn::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.finance-warn.low { color: var(--warn); background: rgba(230, 176, 69, .1); border: 1px solid rgba(230, 176, 69, .3); }
.finance-warn.popup,
.finance-warn.blocked { color: var(--danger); background: rgba(240, 105, 126, .1); border: 1px solid rgba(240, 105, 126, .3); }

.finance-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: var(--surface-2);
  padding: 14px 16px;
  margin-top: 16px;
}
.finance-notice span { color: var(--text-soft); font-size: 13.5px; }

.req-banner {
  border: 1px solid rgba(230, 176, 69, .3);
  background: rgba(230, 176, 69, .08);
  border-radius: var(--r-md);
  padding: 14px 16px;
  margin-top: 16px;
}
.req-banner .req-head { color: var(--warn); font-weight: 700; font-size: 13.5px; margin-bottom: 10px; }
.req-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.req-row span { color: var(--text-soft); }
.req-row small { color: var(--muted); margin-left: 8px; }

.tenant-stat.accent strong { color: var(--brand-bright); }
.tenant-stat.warn-low strong { color: var(--warn); }
.tenant-stat.warn-block strong { color: var(--danger); }

.recharge-amounts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; align-items: center; }
.recharge-amounts button {
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--text-soft);
  border-radius: var(--r-sm);
  padding: 12px 22px;
  font-weight: 800;
  font-size: 15px;
  transition: border-color .16s, background .16s, color .16s;
}
.recharge-amounts button:hover { border-color: var(--brand-border); color: var(--text); }
.recharge-amounts button.active { border-color: var(--brand-border); background: var(--brand-soft); color: var(--brand-bright); }
.recharge-amounts input { width: 160px; }

.recharge-methods { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.recharge-methods button {
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--muted);
  border-radius: var(--r-pill);
  padding: 9px 16px;
  font-weight: 700;
  transition: border-color .16s, color .16s, background .16s;
}
.recharge-methods button:hover { border-color: var(--brand-border); color: var(--text-soft); }
.recharge-methods button.active { border-color: var(--brand-border); color: var(--brand-bright); background: var(--brand-soft); }

#offlineProofField { margin-top: 14px; }
.recharge-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  flex-wrap: wrap;
}
.recharge-note { color: var(--muted); font-size: 12.5px; line-height: 1.6; max-width: 560px; }

.finance-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 16px; }
.finance-filters select, .finance-filters input { width: auto; min-width: 150px; }

.amount-out { color: var(--danger); font-variant-numeric: tabular-nums; font-weight: 700; }
.amount-in { color: var(--green); font-variant-numeric: tabular-nums; font-weight: 700; }

.price-input { width: 110px; padding: 7px 10px; }
.order-status { display: inline-flex; }

/* —— 运营看板 —— */
.dashboard { margin-top: 16px; }
.dash-top {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.6fr);
  gap: 14px;
}
.dash-profit {
  border: 1px solid var(--brand-border);
  border-radius: var(--r-md);
  background: linear-gradient(140deg, var(--brand-soft-2), rgba(47, 191, 149, .03));
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.dash-profit span { color: var(--muted); font-size: 13px; }
.dash-profit strong { color: var(--brand-bright); font-size: 38px; font-weight: 800; line-height: 1.1; margin: 8px 0 6px; font-variant-numeric: tabular-nums; }
.dash-profit em { color: var(--dim); font-style: normal; font-size: 12px; }
.dash-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.dash-kpi {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.dash-kpi span { color: var(--muted); font-size: 13px; }
.dash-kpi strong { color: var(--text); font-size: 22px; font-weight: 800; margin-top: 8px; font-variant-numeric: tabular-nums; }

.dash-groups { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 14px; }
.dash-group { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); overflow: hidden; }
.dash-group-head {
  padding: 11px 16px;
  font-weight: 800;
  font-size: 13px;
  color: var(--text-soft);
  background: rgba(126, 196, 174, .05);
  border-bottom: 1px solid var(--line);
}
.dash-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.dash-row:last-child { border-bottom: 0; }
.dash-row span { color: var(--muted); font-size: 13px; }
.dash-row b { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.dash-row b.in { color: var(--green); }
.dash-row b.out { color: var(--brand-bright); }

/* —— 支付配置 —— */
#paymentConfigSection { margin-top: 18px; }
.pay-cfg-note code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--brand-bright); background: var(--bg-soft); padding: 1px 6px; border-radius: 5px; font-size: 12px; }
.pay-cfg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 12px; }
.pay-cfg-col { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); padding: 16px; }
.pay-cfg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.pay-cfg-head strong { color: var(--brand-bright); font-size: 14px; }
.pay-cfg-head .checkline { margin: 0; }
textarea.pay-key { min-height: 70px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; line-height: 1.5; }
.pay-cfg-state { color: var(--muted); font-size: 13px; }
@media (max-width: 720px) { .pay-cfg-grid { grid-template-columns: 1fr; } }

/* —— 扫码支付弹窗 —— */
.pay-card { width: min(380px, calc(100vw - 32px)); text-align: center; }
.pay-amount { font-size: 32px; font-weight: 800; color: var(--brand-bright); margin-top: 14px; font-variant-numeric: tabular-nums; }
.pay-qr { width: 180px; height: 180px; margin: 18px auto 0; border-radius: var(--r-md); overflow: hidden; box-shadow: 0 8px 28px rgba(0, 0, 0, .4); }
.pay-qr svg { width: 100%; height: 100%; display: block; }
.pay-status { margin-top: 16px; color: var(--text-soft); font-size: 14px; }
.pay-status b { color: var(--brand-bright); }
.pay-status.paid { color: var(--green); font-weight: 700; }
.pay-hint { margin-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.6; }

@media (max-width: 980px) {
  .dash-top, .dash-groups, .dash-kpis { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .recharge-foot { flex-direction: column; align-items: stretch; }
  .recharge-amounts input { width: 100%; }
}

/* ============================================================
   Empty view
   ============================================================ */
.empty-view { min-height: 320px; display: grid; place-content: center; text-align: center; }
.empty-view h3 { margin: 0 0 10px; font-size: 22px; }
.empty-view p { margin: 0; color: var(--muted); }

/* ============================================================
   Video modal
   ============================================================ */
.video-modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px; }
.video-modal-backdrop { position: absolute; inset: 0; background: rgba(4, 8, 7, .76); backdrop-filter: blur(10px); }
.video-modal-card {
  position: relative;
  z-index: 1;
  width: min(920px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  padding: 18px;
}
.video-modal-card video { width: 100%; max-height: min(68vh, 720px); margin-top: 12px; border-radius: var(--r-sm); background: #000; }
.video-modal-status { margin-top: 12px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.modal-actions { margin-top: 14px; }
.video-open.attention { box-shadow: 0 0 0 3px var(--brand-soft-2), 0 14px 38px -8px var(--brand-glow); }

/* ============================================================
   Toast
   ============================================================ */
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 90;
  max-width: 360px;
  border: 1px solid rgba(240, 105, 126, .34);
  border-radius: var(--r-md);
  background: rgba(34, 12, 16, .95);
  color: #ffe4e9;
  box-shadow: var(--shadow);
  padding: 14px 16px;
  line-height: 1.6;
  font-size: 13px;
  backdrop-filter: blur(10px);
  animation: toast-in .26s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.toast.toast-success { border-color: var(--brand-border); background: rgba(14, 28, 22, .96); color: #d8f5ea; }
.toast.toast-info { border-color: var(--line-2); background: rgba(17, 25, 23, .96); color: var(--text-soft); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1180px) {
  .content-grid { grid-template-columns: 340px minmax(0, 1fr); }
}

@media (max-width: 1080px) {
  .login-layout, .content-grid, .settings-grid, .team-grid, .studio-bottom {
    grid-template-columns: 1fr;
  }
  .hero-panel h2 { font-size: clamp(34px, 9vw, 52px); }
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  nav { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .nav-item.active::before { display: none; }
  .side-foot { display: none; }
}

@media (max-width: 720px) {
  .workspace { padding: 18px 16px 32px; }
  .signal-grid, .two-col, .mini-config, .library-actions, .library-actions.voices-actions,
  .voice-tools, .voice-preview-bar, .voice-row, .clone-grid, .avatar-create-grid,
  .avatar-create-actions, .audio-library-actions, .usage-config-grid, .usage-dashboard,
  .record-actions, .record-card, .table-toolbar, .tenant-form {
    grid-template-columns: 1fr;
  }
  .audio-action-row { grid-template-columns: 1fr; }
  .login-layout { width: calc(100vw - 28px); }
  .mode-switch { width: 100%; grid-template-columns: 1fr 1fr; }
  .queue-card, .video-result-card { grid-template-columns: 1fr; }
  .queue-steps { justify-content: flex-start; }
  .video-open { width: 100%; }
  .record-buttons { justify-content: stretch; }
  .record-buttons a { flex: 1; }
}
