/*
 * Canonical shared component contract for the Studio shell.
 *
 * TTS and SRT keep their feature-specific rules in the existing files, while
 * every shared shell/card/toolbar/history primitive is defined here. This
 * file is loaded last so new features have one stable CSS extension point.
 */
:root {
  --studio-space-1: 4px;
  --studio-space-2: 8px;
  --studio-space-3: 12px;
  --studio-space-4: 16px;
  --studio-space-5: 20px;
  --studio-radius-sm: 8px;
  --studio-radius-md: 12px;
  --studio-border: #e5e7eb;
  --studio-border-soft: #f1f2f5;
  --studio-surface: #fff;
  --studio-muted: #6b7280;
  --studio-text: #111827;
  --studio-accent: #7c3aed;
}

body.tpl-app-document,
body.tpl-app-document *,
body.tpl-app-document *::before,
body.tpl-app-document *::after {
  box-sizing: border-box;
}

body.tpl-app-document .studio-bootstrap-loading {
  display: flex;
  min-height: 180px;
  align-items: center;
  justify-content: center;
  gap: var(--studio-space-2);
  color: var(--studio-muted);
  font-size: 14px;
}

body.tpl-app-document .studio-bootstrap-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--studio-border);
  border-top-color: var(--studio-accent);
  border-radius: 50%;
  animation: studio-bootstrap-spin .8s linear infinite;
}

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

body.tpl-app-document .tpl-page,
body.tpl-app-document .tpl-page-body,
body.tpl-app-document .tpl-page-body > .tpl-card,
body.tpl-app-document .tpl-page-body > .tpl-list-card,
body.tpl-app-document .tpl-list-card .tpl-request,
body.tpl-app-document .tpl-list-card .tpl-table,
body.tpl-app-document .tpl-list-card .tpl-table .tpl-tbody {
  width: 100%;
  min-width: 0;
  max-width: none;
}

body.tpl-app-document .tpl-page-body > .tpl-card,
body.tpl-app-document .tpl-page-body > .tpl-list-card {
  align-self: stretch;
  background: var(--studio-surface);
  border-color: var(--studio-border-soft);
  border-radius: var(--studio-radius-md);
}

body.tpl-app-document .tpl-card,
body.tpl-app-document .tpl-list-card,
body.tpl-app-document .tpl-table,
body.tpl-app-document .tpl-request,
body.tpl-app-document .tpl-toolbar-row,
body.tpl-app-document .tpl-pager {
  min-height: 0;
}

/* Shared page frame for every non-editor menu. */
body.tpl-app-document .panel > .vb-page,
body.tpl-app-document .panel > .projects-page,
body.tpl-app-document .panel > .paywall,
body.tpl-app-document .panel > .about-page,
body.tpl-app-document .panel > .dialog-page,
body.tpl-app-document .panel > .clone-page,
body.tpl-app-document .panel > .library-page {
  box-sizing: border-box;
  width: 100%;
  margin: 0 auto;
  padding: 24px clamp(16px, 3vw, 40px) 32px;
}

body.tpl-app-document .panel > .vb-page h1,
body.tpl-app-document .panel > .projects-page h1,
body.tpl-app-document .panel > .paywall h2,
body.tpl-app-document .panel > .about-page h2,
body.tpl-app-document .panel > .dialog-page h2,
body.tpl-app-document .panel > .clone-page h1,
body.tpl-app-document .panel > .library-page h1 {
  color: var(--studio-text);
  line-height: 1.2;
}

/* Voice clone page: keep the existing three-step flow in the shared shell. */
body.tpl-app-document[data-studio-tab="voiceclone"] .panel {
  overflow-x: hidden;
  overflow-y: auto;
  padding: 24px clamp(16px, 3vw, 40px) 32px;
}

body.tpl-app-document[data-studio-tab="voiceclone"] .clone-page {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  color: var(--studio-text);
}

body.tpl-app-document[data-studio-tab="voiceclone"] .clone-page-title {
  margin: 0 0 20px;
  color: var(--studio-text);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
}

body.tpl-app-document[data-studio-tab="voiceclone"] .clone-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 16px;
  align-items: start;
}

body.tpl-app-document[data-studio-tab="voiceclone"] .clone-main,
body.tpl-app-document[data-studio-tab="voiceclone"] .clone-side {
  width: auto;
  max-width: none;
  min-width: 0;
  border: 1px solid var(--studio-border);
  border-radius: var(--studio-radius-md);
  background: var(--studio-surface);
  box-shadow: 0 1px 3px rgba(15, 23, 42, .05);
}

body.tpl-app-document[data-studio-tab="voiceclone"] .clone-main {
  padding: 24px 28px;
}

body.tpl-app-document[data-studio-tab="voiceclone"] .clone-side {
  position: sticky;
  top: 16px;
  padding: 16px;
}

body.tpl-app-document[data-studio-tab="voiceclone"] .clone-steps {
  width: 100%;
  margin: 0 0 28px;
  justify-content: stretch;
}

body.tpl-app-document[data-studio-tab="voiceclone"] .clone-step {
  flex: 1 1 auto;
}

body.tpl-app-document[data-studio-tab="voiceclone"] .clone-step-lbl {
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

body.tpl-app-document[data-studio-tab="voiceclone"] .clone-step-lbl.on {
  font-weight: 700;
}

body.tpl-app-document[data-studio-tab="voiceclone"] .clone-field {
  margin-bottom: 18px;
}

body.tpl-app-document[data-studio-tab="voiceclone"] .clone-field label {
  margin-bottom: 7px;
  color: var(--studio-text);
  font-size: 13px;
  font-weight: 600;
}

body.tpl-app-document[data-studio-tab="voiceclone"] .clone-field input,
body.tpl-app-document[data-studio-tab="voiceclone"] .clone-field textarea,
body.tpl-app-document[data-studio-tab="voiceclone"] .clone-field select {
  box-sizing: border-box;
  min-height: 40px;
  border-color: var(--studio-border);
  border-radius: var(--studio-radius-sm);
  background: #fff;
  color: var(--studio-text);
  font-size: 13px;
}

body.tpl-app-document[data-studio-tab="voiceclone"] .clone-field textarea {
  min-height: 80px;
}

body.tpl-app-document[data-studio-tab="voiceclone"] .clone-help {
  margin: 6px 0 0;
  color: var(--studio-muted);
  font-size: 11px;
  line-height: 1.4;
}

body.tpl-app-document[data-studio-tab="voiceclone"] .clone-field input:focus,
body.tpl-app-document[data-studio-tab="voiceclone"] .clone-field textarea:focus,
body.tpl-app-document[data-studio-tab="voiceclone"] .clone-field select:focus {
  border-color: #86efac;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, .12);
}

body.tpl-app-document[data-studio-tab="voiceclone"] .clone-drop {
  min-height: 180px;
  padding: 28px 18px;
  border-color: #d1d5db;
  border-radius: var(--studio-radius-md);
  background: #fafafa;
}

body.tpl-app-document[data-studio-tab="voiceclone"] .clone-drop:hover,
body.tpl-app-document[data-studio-tab="voiceclone"] .clone-drop.drag {
  border-color: #22c55e;
  background: #f0fdf4;
}

body.tpl-app-document[data-studio-tab="voiceclone"] .clone-foot {
  margin-top: 24px;
  padding-top: 18px;
  border-top-color: var(--studio-border-soft);
}

body.tpl-app-document[data-studio-tab="voiceclone"] .clone-btn-back,
body.tpl-app-document[data-studio-tab="voiceclone"] .clone-btn-next,
body.tpl-app-document[data-studio-tab="voiceclone"] .clone-btn-submit {
  min-height: 38px;
  border-radius: var(--studio-radius-sm);
  font-size: 13px;
}

body.tpl-app-document[data-studio-tab="voiceclone"] .clone-btn-back {
  border: 1px solid var(--studio-border);
  background: #fff;
  color: var(--studio-text);
}

body.tpl-app-document[data-studio-tab="voiceclone"] .clone-btn-next,
body.tpl-app-document[data-studio-tab="voiceclone"] .clone-btn-submit {
  background: #22c55e;
}

body.tpl-app-document[data-studio-tab="voiceclone"] .clone-btn-next:hover,
body.tpl-app-document[data-studio-tab="voiceclone"] .clone-btn-submit:hover {
  background: #16a34a;
}

body.tpl-app-document[data-studio-tab="voiceclone"] .clone-side-h {
  margin-bottom: 12px;
  color: var(--studio-text);
  font-size: 13px;
}

body.tpl-app-document[data-studio-tab="voiceclone"] .clone-side-h span:last-child {
  color: var(--studio-muted);
  font-size: 12px;
}

body.tpl-app-document[data-studio-tab="voiceclone"] .clone-side-empty {
  padding: 28px 12px;
  border-color: var(--studio-border);
  background: #fafafa;
  font-size: 12px;
}

body.tpl-app-document[data-studio-tab="voiceclone"] .clone-voice-card {
  padding: 12px;
  border-color: var(--studio-border-soft);
  border-radius: var(--studio-radius-sm);
  background: #fafafa;
}

body.tpl-app-document[data-studio-tab="voiceclone"] .clone-voice-card h4 {
  color: var(--studio-text);
  font-size: 13px;
  margin: 0;
}

body.tpl-app-document[data-studio-tab="voiceclone"] .clone-voice-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

body.tpl-app-document[data-studio-tab="voiceclone"] .clone-voice-info {
  flex: 1;
  min-width: 0;
}

body.tpl-app-document[data-studio-tab="voiceclone"] .clone-play {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border: 1px solid var(--studio-border);
  border-radius: 50%;
  background: #fff;
  color: var(--studio-accent, #7c3aed);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}

body.tpl-app-document[data-studio-tab="voiceclone"] .clone-play:hover {
  border-color: var(--studio-accent, #7c3aed);
}

body.tpl-app-document[data-studio-tab="voiceclone"] .clone-play.playing {
  border-color: var(--studio-accent, #7c3aed);
  background: var(--studio-accent, #7c3aed);
  color: #fff;
}

body.tpl-app-document[data-studio-tab="voiceclone"] .clone-play.loading {
  opacity: .85;
  pointer-events: none;
}

body.tpl-app-document[data-studio-tab="voiceclone"] .clone-play.loading svg {
  animation: vc-preview-spin .7s linear infinite;
}

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

body.tpl-app-document[data-studio-tab="voiceclone"] .clone-voice-actions button.del {
  color: #dc2626;
  border-color: #fecaca;
}

body.tpl-app-document[data-studio-tab="voiceclone"] .vc-delete-modal {
  width: min(420px, 100%);
}

body.tpl-app-document[data-studio-tab="voiceclone"] .vc-delete-hint {
  margin: 12px 0 8px;
  font-size: 13px;
  color: var(--studio-muted);
}

body.tpl-app-document[data-studio-tab="voiceclone"] .vc-delete-hint code {
  padding: 2px 6px;
  border-radius: 4px;
  background: #f3f4f6;
  font-size: 12px;
}

body.tpl-app-document[data-studio-tab="voiceclone"] .vc-delete-input {
  box-sizing: border-box;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--studio-border);
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
}

body.tpl-app-document[data-studio-tab="voiceclone"] .vc-delete-confirm:disabled {
  opacity: .45;
  cursor: not-allowed;
}

body.tpl-app-document[data-studio-tab="voiceclone"] .clone-voice-actions {
  gap: 6px;
}

body.tpl-app-document[data-studio-tab="voiceclone"] .clone-voice-actions button {
  border-color: var(--studio-border);
  border-radius: 6px;
  font-size: 11px;
}

body.tpl-app-document[data-studio-tab="voiceclone"] .clone-voice-actions button.use {
  border-color: #86efac;
  color: #15803d;
}

body.tpl-app-document[data-studio-tab="voiceclone"] .clone-guide-btn {
  margin-top: 16px;
  border-color: var(--studio-border);
  background: #fff;
  color: var(--studio-muted);
  font-size: 12px;
}

@media (max-width: 860px) {
  body.tpl-app-document[data-studio-tab="voiceclone"] .clone-layout {
    grid-template-columns: 1fr;
  }

  body.tpl-app-document[data-studio-tab="voiceclone"] .clone-side {
    position: static;
  }
}

@media (max-width: 560px) {
  body.tpl-app-document[data-studio-tab="voiceclone"] .panel {
    padding: 16px 12px 24px;
  }

  body.tpl-app-document[data-studio-tab="voiceclone"] .clone-main {
    padding: 18px 16px;
  }

  body.tpl-app-document[data-studio-tab="voiceclone"] .clone-step-lbl {
    display: none;
  }

  body.tpl-app-document[data-studio-tab="voiceclone"] .clone-step {
    justify-content: center;
  }
}

/* Shared toolbar contract */
body.tpl-app-document .tpl-toolbar-row {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: var(--studio-space-3);
}

body.tpl-app-document .tpl-left-toolbar,
body.tpl-app-document .tpl-right-toolbar,
body.tpl-app-document .tpl-control-group,
body.tpl-app-document .tpl-group {
  min-width: 0;
}

body.tpl-app-document .tpl-dropdown,
body.tpl-app-document .tpl-filter-input,
body.tpl-app-document .tpl-filter-date,
body.tpl-app-document .tpl-pager select {
  min-width: 0;
  border-color: var(--studio-border);
  border-radius: var(--studio-radius-sm);
  color: var(--studio-text);
}

body.tpl-app-document .tpl-tool-btn,
body.tpl-app-document .tpl-project-btn,
body.tpl-app-document .tpl-filter-btn,
body.tpl-app-document .tpl-expand {
  flex: 0 0 auto;
}

body.tpl-app-document .tpl-filter-btn.active {
  border-color: #c4b5fd;
  background: #ede9fe;
  color: #6d28d9;
}

body.tpl-app-document .tpl-status-filter {
  position: relative;
  display: inline-flex;
}

body.tpl-app-document .tpl-status-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 30;
  display: grid;
  width: 136px;
  overflow: hidden;
  border: 1px solid var(--studio-border);
  border-radius: var(--studio-radius-sm);
  background: var(--studio-surface);
  box-shadow: 0 6px 16px rgba(15, 23, 42, .14);
}

body.tpl-app-document .tpl-status-menu[hidden] {
  display: none;
}

body.tpl-app-document .tpl-status-menu button {
  min-height: 28px;
  padding: 6px 8px;
  border: 0;
  background: transparent;
  color: var(--studio-text);
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

body.tpl-app-document .tpl-status-menu button:hover,
body.tpl-app-document .tpl-status-menu button[aria-selected="true"] {
  background: #ede9fe;
  color: #6d28d9;
}

/* Shared card and history contract */
body.tpl-app-document .tpl-request {
  width: 100%;
  margin-top: 0;
}

body.tpl-app-document .tpl-request-head {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  align-items: center;
  gap: var(--studio-space-3);
}

body.tpl-app-document .tpl-request-title-wrap,
body.tpl-app-document .tpl-request-filter {
  min-width: 0;
}

body.tpl-app-document .tpl-table {
  width: 100%;
  overflow: hidden;
  border-color: var(--studio-border);
  background: var(--studio-surface);
}

body.tpl-app-document .tpl-table .tpl-selectall,
body.tpl-app-document .tpl-table .tpl-tbody,
body.tpl-app-document .tpl-table .tpl-pager {
  width: 100%;
  min-width: 0;
}

body.tpl-app-document .tpl-list-card .tpl-table .tpl-tbody {
  overflow-x: hidden;
}

body.tpl-app-document .tpl-list-card .tpl-table .vb-hist-row {
  display: grid;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  grid-template-columns: 2% minmax(0, 1fr) 180px minmax(280px, max-content);
  align-items: center;
}

body.tpl-app-document .tpl-list-card .tpl-table .vb-hist-main,
body.tpl-app-document .tpl-list-card .tpl-table .vb-hist-voice,
body.tpl-app-document .tpl-list-card .tpl-table .vb-hist-actions {
  min-width: 0;
}

body.tpl-app-document .tpl-list-card .tpl-table .vb-hist-preview,
body.tpl-app-document .tpl-list-card .tpl-table .vb-hist-meta,
body.tpl-app-document .tpl-list-card .tpl-table .vb-vname {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.tpl-app-document .tpl-list-card .tpl-table .tpl-pager {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: var(--studio-space-3);
  border-top: 1px solid var(--studio-border-soft);
}

body.tpl-app-document .tpl-list-card .tpl-table .tpl-pager-size,
body.tpl-app-document .tpl-list-card .tpl-table .tpl-pager-nav {
  min-width: 0;
}

body.tpl-app-document .tpl-list-card .tpl-table .tpl-pager-nav {
  display: inline-flex;
  align-items: center;
  gap: var(--studio-space-2);
}

@media (min-width: 1024px) {
  body.tpl-app-document[data-studio-tab="tts"] .tpl-page-body > .tpl-list-card:not(.is-collapsed),
  body.tpl-app-document[data-studio-tab="srt"] .tpl-page-body > .tpl-list-card:not(.is-collapsed) {
    height: 380px;
    min-height: 380px;
    max-height: 380px;
    flex: 0 0 380px;
  }

  body.tpl-app-document[data-studio-tab="tts"] .tpl-list-card .tpl-table .tpl-tbody,
  body.tpl-app-document[data-studio-tab="srt"] .tpl-list-card .tpl-table .tpl-tbody {
    height: 240px;
    min-height: 240px;
    max-height: 240px;
    flex: 0 0 240px;
    overflow-x: hidden;
    overflow-y: auto;
  }

  body.tpl-app-document[data-studio-tab="tts"] .tpl-list-card .tpl-table .vb-hist-row,
  body.tpl-app-document[data-studio-tab="srt"] .tpl-list-card .tpl-table .vb-hist-row {
    height: 48px;
    min-height: 48px;
    flex: 0 0 48px;
  }

  body.tpl-app-document[data-studio-tab="tts"] .tpl-list-card .tpl-table .tpl-pager,
  body.tpl-app-document[data-studio-tab="srt"] .tpl-list-card .tpl-table .tpl-pager {
    min-height: 40px;
    flex: 0 0 40px;
  }
}

/* Shared status/form primitives */
body.tpl-app-document .msg {
  box-sizing: border-box;
  max-width: 100%;
}

body.tpl-app-document .msg.progress {
  display: grid;
  gap: 6px;
  color: var(--studio-accent);
}

body.tpl-app-document .msg-progress-copy {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.tpl-app-document .msg-progress-track {
  display: block;
  width: 100%;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #ede9fe;
}

body.tpl-app-document .msg-progress-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7c3aed, #a855f7);
  transition: width .35s ease;
}

body.tpl-app-document button,
body.tpl-app-document input,
body.tpl-app-document select,
body.tpl-app-document textarea {
  font: inherit;
}

body.tpl-app-document button:focus-visible,
body.tpl-app-document input:focus-visible,
body.tpl-app-document select:focus-visible,
body.tpl-app-document textarea:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--studio-accent) 45%, transparent);
  outline-offset: 2px;
}

@media (max-width: 900px) {
  body.tpl-app-document .tpl-toolbar-row {
    align-items: stretch;
    flex-wrap: wrap;
  }

  body.tpl-app-document .tpl-left-toolbar,
  body.tpl-app-document .tpl-right-toolbar {
    max-width: 100%;
  }

  body.tpl-app-document .tpl-list-card .tpl-table .vb-hist-row {
    grid-template-columns: 24px minmax(0, 1fr) auto;
  }

  body.tpl-app-document .tpl-list-card .tpl-table .vb-hist-voice {
    grid-column: 2 / -1;
  }
}

@media (max-width: 640px) {
  body.tpl-app-document .tpl-request-head,
  body.tpl-app-document .tpl-list-card .tpl-table .tpl-pager {
    align-items: flex-start;
    flex-direction: column;
  }

  body.tpl-app-document .tpl-list-card .tpl-table .tpl-pager-nav {
    width: 100%;
    justify-content: space-between;
  }
}

/* Voice library page */
body.tpl-app-document[data-studio-tab="voice-library"] .panel {
  overflow-x: hidden;
  overflow-y: auto;
  padding: 24px clamp(16px, 3vw, 40px) 32px;
}

body.tpl-app-document[data-studio-tab="voice-library"] .library-page {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  color: var(--studio-text);
}

body.tpl-app-document[data-studio-tab="voice-library"] .library-page-title {
  margin: 0 0 20px;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-head {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-tabs {
  display: inline-flex;
  gap: 0;
  padding: 4px;
  border: 1px solid var(--studio-border);
  border-radius: 999px;
  background: #f3f4f6;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-tabs::-webkit-scrollbar {
  display: none;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-tab {
  border: 0;
  background: transparent;
  padding: 8px 14px;
  border-radius: 999px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--studio-muted);
  cursor: pointer;
  white-space: nowrap;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-tab.active {
  background: #fff;
  color: var(--studio-text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-search {
  flex: 1;
  min-width: 180px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--studio-border);
  border-radius: 12px;
  background: #fafafa;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-search svg {
  width: 16px;
  height: 16px;
  color: #9ca3af;
  flex-shrink: 0;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-search input {
  flex: 1;
  border: 0;
  background: transparent;
  outline: none;
  font: inherit;
  font-size: 14px;
  color: var(--studio-text);
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-dd {
  appearance: none;
  -webkit-appearance: none;
  padding: 10px 32px 10px 12px;
  border: 1px solid var(--studio-border);
  border-radius: 12px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") right 10px center/12px no-repeat;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  cursor: pointer;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-clear-btn {
  border: 1px solid var(--studio-border);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--studio-muted);
  cursor: pointer;
  white-space: nowrap;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-clear-btn:hover {
  border-color: var(--studio-accent);
  color: var(--studio-accent);
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  margin-bottom: 8px;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-chip button {
  border: 0;
  background: transparent;
  color: #1d4ed8;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-clear-all {
  border: 0;
  background: transparent;
  color: #2563eb;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--studio-muted);
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-view-toggle {
  display: inline-flex;
  gap: 0;
  padding: 3px;
  border: 1px solid var(--studio-border);
  border-radius: 10px;
  background: #f9fafb;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-view-btn {
  border: 0;
  background: transparent;
  padding: 6px 12px;
  border-radius: 8px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--studio-muted);
  cursor: pointer;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-view-btn.active {
  background: #fff;
  color: var(--studio-text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-body {
  min-height: 200px;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-grid[hidden],
body.tpl-app-document[data-studio-tab="voice-library"] .lib-list[hidden] {
  display: none !important;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-card {
  position: relative;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-card-fav {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 30px;
  height: 30px;
  border: 1px solid var(--studio-border);
  border-radius: 8px;
  background: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: #9ca3af;
  padding: 0;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-card-fav svg {
  width: 16px;
  height: 16px;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-card-fav.on {
  color: #ef4444;
  border-color: #fecaca;
  background: #fef2f2;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-av-wrap {
  position: relative;
  flex-shrink: 0;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-av-play {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 22px;
  height: 22px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--studio-accent, #7c3aed);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  z-index: 2;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-av-play svg {
  width: 10px;
  height: 10px;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-av-play.playing {
  background: #ef4444;
  border-color: #fff;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-av-play.loading {
  opacity: .88;
  pointer-events: none;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-av-play.loading svg {
  animation: vc-preview-spin .7s linear infinite;
}

body.tpl-app-document[data-studio-tab="voice-library"] #libGrid .vico[data-lib-preview].playing,
body.tpl-app-document[data-studio-tab="voice-library"] #libGrid .vico[data-lib-preview].loading {
  border: none;
  background: var(--studio-accent, #7c3aed);
  color: #fff;
}

body.tpl-app-document[data-studio-tab="voice-library"] #libGrid .vico[data-lib-preview].playing {
  background: #ef4444;
}

body.tpl-app-document[data-studio-tab="voice-library"] #libGrid .vico[data-lib-preview].loading svg {
  animation: vc-preview-spin .7s linear infinite;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid transparent;
  border-radius: 14px;
  background: transparent;
  transition: border-color .15s, background .15s;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-row:hover {
  background: #fafafa;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-row.selected {
  border-color: rgba(124, 58, 237, .35);
  background: rgba(124, 58, 237, .05);
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-av {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #c4b5fd, #818cf8);
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-av .voice-av-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-meta {
  flex: 1;
  min-width: 0;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-meta strong {
  display: block;
  font-size: 15px;
  font-weight: 800;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-sub {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  color: var(--studio-muted);
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-lang-col {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  min-width: 110px;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-flag .voice-flag {
  width: 26px;
  height: 26px;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-lang-lbl {
  font-size: 12px;
  font-weight: 700;
  color: #374151;
  line-height: 1.25;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-copy,
body.tpl-app-document[data-studio-tab="voice-library"] .lib-fav {
  width: 36px;
  height: 36px;
  border: 1px solid var(--studio-border);
  border-radius: 10px;
  background: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: #9ca3af;
  padding: 0;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-fav.on {
  color: #ef4444;
  border-color: #fecaca;
  background: #fef2f2;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-fav svg,
body.tpl-app-document[data-studio-tab="voice-library"] .lib-copy svg {
  width: 16px;
  height: 16px;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-use {
  padding: 8px 16px;
  border: 1px solid var(--studio-border);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--studio-text);
  cursor: pointer;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-use:hover {
  border-color: var(--studio-accent);
  color: var(--studio-accent);
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-use.active {
  background: var(--studio-accent, #7c3aed);
  border-color: var(--studio-accent, #7c3aed);
  color: #fff;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-empty {
  padding: 40px 20px;
  text-align: center;
  color: #9ca3af;
  font-size: 14px;
  line-height: 1.6;
  grid-column: 1 / -1;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-empty a {
  color: var(--studio-accent);
  font-weight: 700;
  text-decoration: none;
}

body.tpl-app-document[data-studio-tab="voice-library"] .lib-empty a:hover {
  text-decoration: underline;
}

@media (max-width: 1024px) {
  body.tpl-app-document[data-studio-tab="voice-library"] .lib-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  body.tpl-app-document[data-studio-tab="voice-library"] .lib-grid {
    grid-template-columns: 1fr;
  }

  body.tpl-app-document[data-studio-tab="voice-library"] .lib-row {
    flex-wrap: wrap;
  }

  body.tpl-app-document[data-studio-tab="voice-library"] .lib-lang-col {
    min-width: 0;
  }

  body.tpl-app-document[data-studio-tab="voice-library"] .lib-tools {
    flex-direction: column;
    align-items: stretch;
  }

  body.tpl-app-document[data-studio-tab="voice-library"] .lib-dd,
  body.tpl-app-document[data-studio-tab="voice-library"] .lib-clear-btn {
    width: 100%;
  }
}
