/* Independent Studio application shell.
   This document is the canonical Studio lifecycle. */

html body.tpl-app-document {
  display: flex;
  min-width: 0;
  flex-direction: column;
  background: #f5f7fa;
  color: #1f2937;
}

body.tpl-app-document .tpl-app-shell {
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  visibility: visible;
}

body.tpl-app-document.tpl-app-ready .tpl-app-shell {
  visibility: visible;
}

body.tpl-app-document:not(.tpl-app-ready) .sidebar-backdrop,
body.tpl-app-document:not(.tpl-app-ready) .hist-backdrop {
  visibility: hidden;
}

body.tpl-app-document .studio-promo,
body.tpl-app-document #studioPromo {
  display: none !important;
}

body.tpl-app-document .tpl-app-sidebar {
  z-index: 10;
  width: 260px;
  min-width: 260px;
  height: auto;
  min-height: 100%;
  padding: 16px 12px;
  overflow: hidden;
  background: #fff;
  border-right: 1px solid #e5e7eb;
}

body.tpl-app-document .tpl-app-main {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  background: #f5f7fa;
}

body.tpl-app-document .tpl-app-workspace {
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  background: #f5f7fa;
}

body.tpl-app-document .panel {
  width: 100%;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  background: transparent;
}

body.tpl-app-document .tpl-app-workspace .tpl-app-history {
  display: flex;
  width: min(560px, 38vw);
  min-width: 320px;
  height: auto;
  max-height: none;
  flex: 0 0 min(560px, 38vw);
  flex-direction: column;
  background: #fff;
  border-left: 1px solid #e5e7eb;
}

body.tpl-app-document[data-studio-tab="tts"] .tpl-app-workspace .tpl-app-history,
body.tpl-app-document[data-studio-tab="template"] .tpl-app-workspace .tpl-app-history,
body.tpl-app-document[data-studio-tab="srt"] .tpl-app-workspace .tpl-app-history,
body.tpl-app-document[data-studio-tab="voiceclone"] .tpl-app-workspace .tpl-app-history,
body.tpl-app-document[data-studio-tab="voice-library"] .tpl-app-workspace .tpl-app-history,
body.tpl-app-document[data-studio-tab="dialog"] .tpl-app-workspace .tpl-app-history,
body.tpl-app-document[data-studio-tab="pricing"] .tpl-app-workspace .tpl-app-history,
body.tpl-app-document[data-studio-tab="projects"] .tpl-app-workspace .tpl-app-history,
body.tpl-app-document[data-studio-tab="referral"] .tpl-app-workspace .tpl-app-history,
body.tpl-app-document[data-studio-tab="about"] .tpl-app-workspace .tpl-app-history {
  display: none !important;
}

/* The app document uses the generated HVoice sidebar, never the static legacy one. */
body.tpl-app-document .tpl-sidebar-original {
  display: none !important;
}

body.tpl-app-document .tpl-sidebar-clone {
  display: flex;
  min-height: 0;
  flex: 1;
}

body.tpl-app-document .tpl-sidebar-user {
  position: relative;
}

body.tpl-app-document .tpl-sidebar-dots {
  display: grid;
  width: 28px;
  height: 30px;
  margin: 0;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #9ca3af;
  cursor: pointer;
  font: inherit;
  font-size: 18px;
  line-height: 1;
}

body.tpl-app-document .tpl-sidebar-dots:hover,
body.tpl-app-document .tpl-sidebar-dots:focus-visible {
  background: #f3f4f6;
  color: #374151;
  outline: none;
}

body.tpl-app-document .tpl-sidebar-user-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 30;
  min-width: 130px;
  padding: 5px;
  border: 1px solid #e5e7eb;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .14);
}

body.tpl-app-document .tpl-sidebar-user-menu button {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #dc2626;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  text-align: left;
}

body.tpl-app-document .tpl-sidebar-user-menu button:hover,
body.tpl-app-document .tpl-sidebar-user-menu button:focus-visible {
  background: #fef2f2;
  outline: none;
}

html body.tpl-app-document {
  height: 100%;
  overflow: hidden;
}

body.tpl-app-document .tpl-app-main,
body.tpl-app-document .tpl-app-workspace,
body.tpl-app-document .panel {
  min-height: 0;
  overflow: hidden;
}

body.tpl-app-document .panel {
  display: flex;
  flex-direction: column;
}

body.tpl-app-document .tpl-page {
  display: flex;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}

body.tpl-app-document .tpl-page-body {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  overflow: hidden;
}

body.tpl-app-document .tpl-page-body > .tpl-card {
  min-height: 0;
  flex: 1 1 auto;
}

body.tpl-app-document .tpl-page-body > .tpl-list-card {
  min-height: 0;
  flex: 0 0 auto;
  overflow: hidden;
}

body.tpl-app-document .tpl-table {
  display: flex;
  min-height: 0;
  flex-direction: column;
}

body.tpl-app-document .tpl-table .tpl-tbody {
  max-height: 360px;
  overflow-y: auto;
}

body.tpl-app-document[data-studio-tab="tts"] .tpl-editor-wrap {
  min-height: 0;
  flex: 1 1 auto;
}

body.tpl-app-document[data-studio-tab="tts"] .tpl-editor {
  max-height: none;
  overflow-y: auto;
}

/* Editor / History panels fill leftover viewport (card is nested, not body > card). */
body.tpl-app-document[data-studio-tab="tts"] .tpl-tts-tabs {
  flex: 0 0 auto;
}

body.tpl-app-document[data-studio-tab="tts"] #tplTtsPanelEditor,
body.tpl-app-document[data-studio-tab="tts"] #tplTtsPanelHistory {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
}

body.tpl-app-document[data-studio-tab="tts"] #tplTtsPanelEditor[hidden],
body.tpl-app-document[data-studio-tab="tts"] #tplTtsPanelHistory[hidden] {
  display: none !important;
}

/* SRT: Chuyển đổi | Lịch sử — cùng pattern TTS */
body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-tabs {
  display: flex;
  flex: 0 0 auto;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
  margin: 0 0 14px;
  padding: 0;
  width: fit-content;
  max-width: 100%;
  background: transparent;
  border-bottom: 1px solid #e5e7eb;
}
body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-tabs .tpl-tts-tab {
  appearance: none;
  flex: 0 0 auto;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #9ca3af;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 800;
  padding: 10px 16px;
  border-radius: 0;
  cursor: pointer;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}
body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-tabs .tpl-tts-tab:hover {
  color: #374151;
}
body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-tabs .tpl-tts-tab.is-active {
  color: #15803d;
  border-bottom-color: #22c55e;
}
body.tpl-app-document[data-studio-tab="srt"] #tplSrtPanelEditor,
body.tpl-app-document[data-studio-tab="srt"] #tplSrtPanelHistory {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
}
body.tpl-app-document[data-studio-tab="srt"] #tplSrtPanelEditor[hidden],
body.tpl-app-document[data-studio-tab="srt"] #tplSrtPanelHistory[hidden] {
  display: none !important;
}
body.tpl-app-document[data-studio-tab="srt"] #tplSrtPanelEditor .tpl-srt-card {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}
body.tpl-app-document[data-studio-tab="srt"] #tplSrtPanelHistory .tpl-srt-history {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
}

body.tpl-app-document[data-studio-tab="tts"] #tplTtsPanelEditor .tpl-card {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}

body.tpl-app-document[data-studio-tab="tts"] #tplTtsPanelEditor .tpl-toolbar-row,
body.tpl-app-document[data-studio-tab="tts"] #tplTtsPanelEditor .tts-retry-bar,
body.tpl-app-document[data-studio-tab="tts"] #tplTtsPanelEditor .tpl-bottom-row,
body.tpl-app-document[data-studio-tab="tts"] #tplTtsPanelEditor .msg {
  flex: 0 0 auto;
}

body.tpl-app-document[data-studio-tab="tts"] #tplTtsPanelEditor .tpl-editor-wrap {
  display: flex;
  flex: 1 1 auto;
  min-height: 280px;
  flex-direction: column;
}

body.tpl-app-document[data-studio-tab="tts"] #tplTtsPanelEditor .tpl-editor {
  flex: 1 1 auto;
  width: 100%;
  height: 100% !important;
  min-height: 280px;
  max-height: none;
  overflow-y: auto;
  box-sizing: border-box;
}

body.tpl-app-document[data-studio-tab="tts"] #tplTtsPanelHistory .tpl-list-card {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-card {
  min-height: 0;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work {
  min-height: 0;
  overflow: hidden;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work .srt-cue-list {
  max-height: 235px;
  overflow-y: auto;
}

body.tpl-app-document[data-studio-tab="tts"] .tpl-page-body {
  gap: 10px;
}

body.tpl-app-document[data-studio-tab="tts"] .tpl-page-body > .tpl-card,
body.tpl-app-document[data-studio-tab="tts"] .tpl-page-body > .tpl-list-card {
  min-height: 0;
  flex: 1 1 0;
}

body.tpl-app-document[data-studio-tab="tts"] .tpl-page-body > .tpl-card {
  overflow: hidden;
}

body.tpl-app-document[data-studio-tab="tts"] .tpl-page-body > .tpl-list-card {
  max-height: 50%;
}

body.tpl-app-document[data-studio-tab="tts"] .tpl-editor-wrap {
  min-height: 280px;
  flex: 1 1 auto;
}

body.tpl-app-document[data-studio-tab="tts"] .tpl-editor {
  height: 100% !important;
  max-height: none;
  min-height: 280px;
  overflow-y: auto;
}

body.tpl-app-document[data-studio-tab="tts"] .tpl-list-card .tpl-request,
body.tpl-app-document[data-studio-tab="tts"] .tpl-list-card .tpl-table {
  display: flex;
  min-height: 0;
  flex-direction: column;
}

body.tpl-app-document[data-studio-tab="tts"] .tpl-list-card .tpl-request {
  height: 100%;
}

body.tpl-app-document[data-studio-tab="tts"] .tpl-list-card .tpl-table {
  height: auto;
  flex: 1 1 auto;
  overflow: hidden;
}

body.tpl-app-document[data-studio-tab="tts"] .tpl-list-card .tpl-table .tpl-tbody {
  max-height: none;
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
}

body.tpl-app-document[data-studio-tab="tts"] .tpl-list-card .tpl-table .vb-hist-row {
  min-height: 48px;
  padding: 7px 12px;
  gap: 10px;
}

body.tpl-app-document[data-studio-tab="tts"] .tpl-list-card .tpl-table .vb-hist-preview {
  height: 20px;
  line-height: 18px;
}

body.tpl-app-document[data-studio-tab="tts"] .tpl-list-card .tpl-table .vb-hist-meta {
  line-height: 14px;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-page-body {
  gap: 10px;
}

body.tpl-app-document[data-studio-tab="srt"] #tplSrtPanelEditor .tpl-srt-card,
body.tpl-app-document[data-studio-tab="srt"] #tplSrtPanelHistory .tpl-srt-history {
  min-height: 0;
  flex: 1 1 0;
}

body.tpl-app-document[data-studio-tab="srt"] #tplSrtPanelEditor .tpl-srt-card {
  overflow: hidden;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-list-card .tpl-request,
body.tpl-app-document[data-studio-tab="srt"] .tpl-list-card .tpl-table {
  display: flex;
  min-height: 0;
  flex-direction: column;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-list-card .tpl-request {
  height: 100%;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-list-card .tpl-table {
  height: auto;
  flex: 1 1 auto;
  overflow: hidden;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-list-card .tpl-table .tpl-tbody {
  max-height: none;
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-list-card .tpl-table .vb-hist-row {
  min-height: 48px;
  padding: 7px 12px;
  gap: 10px;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-list-card .tpl-table .vb-hist-preview {
  height: 20px;
  line-height: 18px;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-list-card .tpl-table .vb-hist-meta {
  line-height: 14px;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-card {
  flex: 1 1 0;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work .srt-cue-list {
  max-height: 235px;
  overflow-y: auto;
}

body.tpl-app-document .mobile-top {
  display: none;
}

/* SRT workspace uses the same card and toolbar rhythm as Chuyển văn bản. */
body.tpl-app-document[data-studio-tab="srt"] .tpl-app-workspace > .panel {
  width: auto;
  flex: 1 1 auto;
  overflow-y: auto;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-page {
  min-height: 100%;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-page .tpl-page-body {
  gap: 14px;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-card {
  display: flex;
  min-height: min(650px, calc(100vh - 160px));
  flex-direction: column;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-toolbar {
  flex: 0 0 auto;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-top-actions {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px 0;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work {
  display: flex;
  min-height: 260px;
  flex: 1 1 auto;
  flex-direction: column;
  padding: 20px 22px 12px;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work .srt-work {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work .srt-drop {
  display: flex;
  min-height: 260px;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  padding: 28px;
  border: 1.5px dashed #cbd5e1;
  border-radius: 14px;
  background: #f8fafc;
  color: #64748b;
  text-align: center;
  transition: border-color .18s ease, background .18s ease;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work .srt-drop > svg {
  width: 42px;
  height: 42px;
  margin-bottom: 10px;
  color: #2563eb;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work .srt-drop:hover,
body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work .srt-drop.dragover {
  border-color: #2563eb;
  background: #eff6ff;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work .srt-drop p {
  margin: 4px 0;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work .srt-drop p:first-of-type {
  color: #475569;
  font-size: 14px;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work .srt-drop p:first-of-type a {
  color: #2563eb;
  cursor: pointer;
  font-weight: 700;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work .srt-sample a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #64748b;
  font-size: 12px;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work .srt-sample svg {
  width: 14px;
  height: 14px;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work .srt-file-summary {
  position: relative;
  display: flex;
  min-height: 84px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  padding: 14px 18px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f8fafc;
  text-align: center;
}

body.tpl-app-document[data-studio-tab="srt"] .srt-file-summary-icon {
  display: grid;
  width: 30px;
  height: 34px;
  flex: 0 0 30px;
  place-items: center;
  border: 1px solid #bfdbfe;
  border-radius: 7px;
  background: #eff6ff;
  color: #2563eb;
}

body.tpl-app-document[data-studio-tab="srt"] .srt-file-summary-icon svg {
  width: 21px;
  height: 21px;
}

body.tpl-app-document[data-studio-tab="srt"] .srt-file-summary-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

body.tpl-app-document[data-studio-tab="srt"] .srt-file-summary-copy strong {
  max-width: min(100%, 720px);
  overflow: hidden;
  color: #1e293b;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.tpl-app-document[data-studio-tab="srt"] .srt-file-summary-copy span {
  color: #64748b;
  font-size: 11px;
}

body.tpl-app-document[data-studio-tab="srt"] .srt-file-summary-copy small {
  color: #94a3b8;
  font-size: 10px;
}

body.tpl-app-document[data-studio-tab="srt"] .srt-file-replace {
  padding: 0;
  border: 0;
  background: transparent;
  color: #2563eb;
  cursor: pointer;
  font-size: 11px;
}

body.tpl-app-document[data-studio-tab="srt"] .srt-file-replace:hover {
  color: #2563eb;
}

@media (max-width: 640px) {
  body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work .srt-file-summary {
    justify-content: flex-start;
    padding: 12px;
    text-align: left;
  }

  body.tpl-app-document[data-studio-tab="srt"] .srt-file-summary-copy {
    align-items: center;
    text-align: center;
  }
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work .srt-title-wrap {
  display: flex;
  margin-bottom: 12px;
  background: #ffffff !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 12px;
  padding: 10px 14px;
  color: #0f172a !important;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work .srt-title-inp {
  width: min(100%, 460px);
  padding: 10px 12px;
  border: 1px solid #e5e7eb !important;
  border-radius: 8px;
  background: #fff !important;
  color: #1f2937 !important;
  font: inherit;
  font-size: 13px;
  outline: none;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work .srt-title-inp:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work .srt-lang-warn {
  margin-bottom: 12px;
  padding: 9px 12px;
  border: 1px solid #fde68a;
  border-radius: 8px;
  background: #fffbeb;
  color: #92400e;
  font-size: 12px;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work .srt-editor {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work .srt-editor-h {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid #eef0f3;
  background: #f8fafc !important;
  color: #334155 !important;
  font-size: 12px;
  font-weight: 700;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work .srt-editor-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work .tpl-srt-inline-cta {
  display: inline-flex;
  min-width: 126px;
  height: 32px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: #2563eb;
  color: #fff;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work .tpl-srt-inline-cta:hover {
  background: #1d4ed8;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work .srt-del-file {
  padding: 6px 10px;
  border: 1px solid #fecaca;
  border-radius: 7px;
  background: #fff;
  color: #dc2626;
  cursor: pointer;
  font-size: 11px;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work .srt-cue-list {
  min-height: 0;
  flex: 0 0 235px;
  height: 235px;
  max-height: 235px;
  overflow-y: auto;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work .srt-cue-row {
  display: grid;
  grid-template-columns: minmax(120px, 180px) minmax(0, 1fr);
  gap: 16px;
  padding: 13px 14px;
  background: #ffffff !important;
  border: none !important;
  border-radius: 0 !important;
  border-bottom: 1px solid #eef0f3 !important;
  color: #0f172a !important;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work .srt-cue-row:nth-child(even) {
  background: #fafafa !important;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work .srt-cue-row:hover {
  background: #f8fafc !important;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work .srt-cue-row:last-child {
  border-bottom: 0 !important;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work .srt-cue-time {
  color: #64748b !important;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work .srt-cue-time b {
  color: #0f172a !important;
  font-weight: 800;
  margin-right: 6px;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work .srt-cue-text {
  min-width: 0;
  margin: 0;
  color: #1f2937 !important;
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-bottom {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 22px 18px;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-summary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #64748b;
  font-size: 12px;
}

body.tpl-app-document[data-studio-tab="srt"] .srt-file-input {
  position: fixed;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  z-index: -1;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-cta {
  min-width: 132px;
}

@media (max-width: 1023px) {
  body.tpl-app-document .tpl-app-shell {
    position: relative;
  }

  body.tpl-app-document .mobile-top {
    display: flex;
    height: 56px;
    min-height: 56px;
    align-items: center;
    padding: 0 16px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
  }

  body.tpl-app-document .tpl-app-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(280px, 86vw);
    min-width: 0;
    transform: translateX(-105%);
    transition: transform .2s ease;
    box-shadow: 10px 0 30px rgba(15, 23, 42, .14);
  }

  body.tpl-app-document.sidebar-open .tpl-app-sidebar {
    transform: translateX(0);
  }

  body.tpl-app-document .tpl-app-main {
    width: 100%;
  }

  body.tpl-app-document .tpl-app-workspace {
    min-height: 0;
  }

  body.tpl-app-document .tpl-app-workspace .tpl-app-history {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 55;
    width: 100%;
    min-width: 0;
    max-height: 78vh;
    border-top: 1px solid #e5e7eb;
    border-left: 0;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, .2);
  }

  body.tpl-app-document[data-studio-tab="srt"] .tpl-app-workspace .tpl-app-history {
    display: none !important;
  }

  body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-toolbar {
    align-items: stretch;
  }

  body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-toolbar .tpl-left-toolbar,
  body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-toolbar .tpl-right-toolbar {
    flex-wrap: wrap;
  }

  body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work {
    padding: 14px 12px 8px;
  }

  body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-top-actions {
    padding: 12px 12px 0;
  }

}

@media (max-width: 640px) {
  body.tpl-app-document .panel {
    overflow-x: hidden;
  }

  body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-page .tpl-page-body {
    padding: 10px;
  }

  body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work .srt-drop {
    min-height: 420px;
    flex-direction: column;
  }

  body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work .srt-cue-row {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-bottom {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-top-actions {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-cta {
    width: 100%;
  }
}

/* Sentence split view: keep the editor calm at five sentences per page. */
body.tpl-app-document[data-studio-tab="tts"] .tpl-split-editor {
  min-height: 0;
}

body.tpl-app-document[data-studio-tab="tts"] .tpl-split-editor .sent-editor {
  min-height: 0;
  height: 100%;
}

body.tpl-app-document[data-studio-tab="tts"] .tpl-split-editor .sent-list {
  min-height: 0;
  gap: 6px;
  padding: 8px 10px;
}

body.tpl-app-document[data-studio-tab="tts"] .tpl-split-editor .sent-block {
  min-height: 48px;
  padding: 6px 8px 6px 6px;
  gap: 6px;
  align-items: center;
}

body.tpl-app-document[data-studio-tab="tts"] .tpl-split-editor .sent-input {
  max-height: 42px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.35;
  padding: 2px 0;
}

body.tpl-app-document[data-studio-tab="tts"] .tpl-split-editor .sent-status {
  min-height: 11px;
  font-size: 10px;
}

body.tpl-app-document[data-studio-tab="tts"] .tpl-split-editor .sent-idx,
body.tpl-app-document[data-studio-tab="tts"] .tpl-split-editor .sent-play,
body.tpl-app-document[data-studio-tab="tts"] .tpl-split-editor .sent-convert,
body.tpl-app-document[data-studio-tab="tts"] .tpl-split-editor .sent-del {
  width: 28px;
  height: 28px;
}

body.tpl-app-document[data-studio-tab="tts"] .tpl-split-editor .sent-idx {
  font-size: 11px;
}

body.tpl-app-document[data-studio-tab="tts"] .tpl-split-editor .sent-drag {
  width: 18px;
  height: 28px;
  font-size: 11px;
}

body.tpl-app-document[data-studio-tab="tts"] .tpl-split-editor .sent-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 34px;
  padding: 4px 10px;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-size: 11px;
  flex-shrink: 0;
}

body.tpl-app-document[data-studio-tab="tts"] .tpl-split-editor .sent-page-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

body.tpl-app-document[data-studio-tab="tts"] .tpl-split-editor .sent-page {
  min-width: 25px;
  height: 25px;
  padding: 0 6px;
  border: 1px solid var(--line2);
  border-radius: 6px;
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
}

body.tpl-app-document[data-studio-tab="tts"] .tpl-split-editor .sent-page.active,
body.tpl-app-document[data-studio-tab="tts"] .tpl-split-editor .sent-page:hover:not(:disabled) {
  border-color: var(--green);
  background: rgba(34, 197, 94, .08);
  color: var(--green-text);
}

body.tpl-app-document[data-studio-tab="tts"] .tpl-split-editor .sent-page:disabled {
  cursor: not-allowed;
  opacity: .4;
}

@media (min-width: 1024px) {
  body.tpl-app-document[data-studio-tab="tts"]:has(.tpl-split-editor) .tpl-app-workspace {
    overflow-y: auto;
  }

  body.tpl-app-document[data-studio-tab="tts"]:has(.tpl-split-editor) .panel {
    overflow: visible;
  }

  body.tpl-app-document[data-studio-tab="tts"]:has(.tpl-split-editor) .tpl-page {
    height: auto;
    min-height: 100%;
    overflow: visible;
  }

  body.tpl-app-document[data-studio-tab="tts"]:has(.tpl-split-editor) .tpl-page-body {
    overflow: visible;
  }
}

@media (max-width: 640px) {
  body.tpl-app-document[data-studio-tab="tts"] .tpl-split-editor .sent-pager {
    align-items: flex-start;
    flex-direction: column;
  }
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-page .tpl-page-body {
  gap: 10px;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-page .tpl-srt-card {
  min-height: 0;
  flex: 1 1 0;
}

body.tpl-app-document .tpl-request.is-collapsed .tpl-table {
  display: none;
}

body.tpl-app-document[data-studio-tab="tts"] .tpl-page-body > .tpl-list-card.is-collapsed,
body.tpl-app-document[data-studio-tab="srt"] .tpl-page-body > .tpl-list-card.is-collapsed,
body.tpl-app-document[data-studio-tab="srt"] #tplSrtPanelHistory .tpl-list-card.is-collapsed {
  height: auto;
  max-height: none;
  flex: 0 0 auto;
}

body.tpl-app-document[data-studio-tab="tts"] .tpl-list-card.is-collapsed .tpl-request,
body.tpl-app-document[data-studio-tab="srt"] .tpl-list-card.is-collapsed .tpl-request {
  height: auto;
}

body.tpl-app-document[data-studio-tab="tts"] .tpl-page-body > .tpl-card,
body.tpl-app-document[data-studio-tab="srt"] .tpl-page-body > .tpl-card {
  flex: 1 1 0;
}

@media (min-width: 1024px) {
  body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work {
    min-height: 0;
  }

  body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work .srt-drop {
    min-height: 160px;
  }
}

@media (min-width: 1024px) {
  body.tpl-app-document[data-studio-tab="tts"] .tpl-bottom-row {
    min-height: 56px;
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
    padding: 6px 16px;
  }

  body.tpl-app-document[data-studio-tab="tts"] .tpl-editor-wrap {
    padding: 8px 16px;
  }

  body.tpl-app-document[data-studio-tab="tts"] .tpl-samples {
    padding: 0;
  }

  body.tpl-app-document[data-studio-tab="tts"] .tpl-samples-title {
    margin-bottom: 3px;
    font-size: 10px;
    line-height: 12px;
  }

  body.tpl-app-document[data-studio-tab="tts"] .tpl-samples-row {
    gap: 5px;
  }

  body.tpl-app-document[data-studio-tab="tts"] .tpl-sample {
    height: 26px;
    padding: 0 9px;
  }

  body.tpl-app-document[data-studio-tab="tts"] .tpl-sample-ico {
    padding: 0 5px 0 0;
    line-height: 26px;
  }

  body.tpl-app-document[data-studio-tab="tts"] .tpl-sample-ico svg {
    width: 13px;
    height: 13px;
  }

  body.tpl-app-document[data-studio-tab="tts"] .tpl-sample-lbl {
    font-size: 11px;
    line-height: 26px;
  }

  body.tpl-app-document[data-studio-tab="tts"] .tpl-actionbar {
    gap: 8px;
    white-space: nowrap;
  }

  body.tpl-app-document[data-studio-tab="tts"] .tpl-count,
  body.tpl-app-document[data-studio-tab="tts"] .tpl-dur,
  body.tpl-app-document[data-studio-tab="tts"] .tpl-cost {
    font-size: 11px;
  }

  body.tpl-app-document[data-studio-tab="tts"] .tpl-cta {
    height: 34px;
    min-width: 116px;
    margin-left: 4px;
    padding: 0 16px;
    font-size: 12px;
  }
}

@media (min-width: 1024px) {
  body.tpl-app-document[data-studio-tab="tts"] .tpl-request-head,
  body.tpl-app-document[data-studio-tab="srt"] .tpl-request-head {
    margin-bottom: 8px;
    gap: 8px;
  }

  body.tpl-app-document[data-studio-tab="tts"] .tpl-request-title,
  body.tpl-app-document[data-studio-tab="srt"] .tpl-request-title {
    font-size: 14px;
  }

  body.tpl-app-document[data-studio-tab="tts"] .tpl-request-filter,
  body.tpl-app-document[data-studio-tab="srt"] .tpl-request-filter {
    gap: 6px;
  }

  body.tpl-app-document[data-studio-tab="tts"] .tpl-filter-btn,
  body.tpl-app-document[data-studio-tab="srt"] .tpl-filter-btn {
    width: 28px;
    height: 28px;
  }

  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 {
    min-height: 34px;
    padding: 3px 10px;
    gap: 8px;
  }

  body.tpl-app-document[data-studio-tab="tts"] .tpl-list-card .tpl-table .vb-hist-preview,
  body.tpl-app-document[data-studio-tab="srt"] .tpl-list-card .tpl-table .vb-hist-preview {
    height: 16px;
    font-size: 12px;
    line-height: 14px;
  }

  body.tpl-app-document[data-studio-tab="tts"] .tpl-list-card .tpl-table .vb-hist-meta,
  body.tpl-app-document[data-studio-tab="srt"] .tpl-list-card .tpl-table .vb-hist-meta {
    font-size: 10px;
    line-height: 10px;
  }

  body.tpl-app-document[data-studio-tab="tts"] .tpl-list-card .tpl-table .vb-hist-voice,
  body.tpl-app-document[data-studio-tab="srt"] .tpl-list-card .tpl-table .vb-hist-voice {
    gap: 5px;
  }

  body.tpl-app-document[data-studio-tab="tts"] .tpl-list-card .tpl-table .vb-hist-act,
  body.tpl-app-document[data-studio-tab="srt"] .tpl-list-card .tpl-table .vb-hist-act {
    width: 24px;
    height: 24px;
  }

  body.tpl-app-document[data-studio-tab="tts"] .tpl-list-card .tpl-table .vb-hist-act svg,
  body.tpl-app-document[data-studio-tab="srt"] .tpl-list-card .tpl-table .vb-hist-act svg {
    width: 13px;
    height: 13px;
  }

  body.tpl-app-document[data-studio-tab="tts"] .tpl-list-card .tpl-table .tpl-voice-copy,
  body.tpl-app-document[data-studio-tab="srt"] .tpl-list-card .tpl-table .tpl-voice-copy {
    line-height: 11px;
  }

  body.tpl-app-document[data-studio-tab="tts"] .tpl-list-card .tpl-table .vb-vname,
  body.tpl-app-document[data-studio-tab="srt"] .tpl-list-card .tpl-table .vb-vname {
    font-size: 11px;
  }

  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;
    padding: 6px 10px;
    font-size: 11px;
  }

  body.tpl-app-document[data-studio-tab="tts"] .tpl-list-card .tpl-table .tpl-pager select,
  body.tpl-app-document[data-studio-tab="srt"] .tpl-list-card .tpl-table .tpl-pager select {
    padding: 2px 5px;
    font-size: 11px;
  }

  body.tpl-app-document[data-studio-tab="tts"] .tpl-list-card .tpl-table .tpl-tbody[data-visible-count="5"],
  body.tpl-app-document[data-studio-tab="srt"] .tpl-list-card .tpl-table .tpl-tbody[data-visible-count="5"] {
    display: grid;
    grid-template-rows: repeat(5, minmax(0, 1fr));
    overflow-y: hidden;
  }

  body.tpl-app-document[data-studio-tab="tts"] .tpl-list-card .tpl-table .tpl-tbody[data-visible-count="5"] .vb-hist-row,
  body.tpl-app-document[data-studio-tab="srt"] .tpl-list-card .tpl-table .tpl-tbody[data-visible-count="5"] .vb-hist-row {
    box-sizing: border-box;
    min-height: 0;
    height: auto;
    overflow: hidden;
  }
}

body.tpl-app-document[data-studio-tab="srt"] .srt-cue-head {
  display: grid;
  grid-template-columns: minmax(120px, 180px) minmax(0, 1fr);
  gap: 16px;
  min-height: 34px;
  align-items: center;
  padding: 0 14px;
  border-bottom: 1px solid #eef0f3;
  background: #f8fafc;
  color: #475569;
  font-size: 11px;
  font-weight: 600;
}

body.tpl-app-document[data-studio-tab="srt"] .srt-cue-pager {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 14px;
  border-top: 1px solid #eef0f3;
  color: #64748b;
  font-size: 11px;
}

body.tpl-app-document[data-studio-tab="srt"] .srt-cue-page-nav {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

body.tpl-app-document[data-studio-tab="srt"] .srt-cue-page {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  padding: 0;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
  color: #475569;
  cursor: pointer;
  font-size: 11px;
}

body.tpl-app-document[data-studio-tab="srt"] .srt-cue-page.active {
  border-color: #2563eb;
  background: #eff6ff;
  color: #2563eb;
  font-weight: 700;
}

body.tpl-app-document[data-studio-tab="srt"] .srt-cue-page:disabled {
  cursor: not-allowed;
  opacity: .4;
}

body.tpl-app-document[data-studio-tab="srt"] .srt-cue-page:not(:disabled):hover {
  border-color: #2563eb;
}

@media (max-width: 640px) {
  body.tpl-app-document[data-studio-tab="srt"] .srt-cue-head {
    grid-template-columns: 1fr;
    gap: 0;
    min-height: 42px;
  }
}

/* Match the compact cue-table arrangement for the TTS sentence editor. */
body.tpl-app-document[data-studio-tab="tts"] .tpl-split-editor .sent-head {
  display: grid;
  grid-template-columns: 22px 28px minmax(0, 1fr) repeat(3, 28px);
  align-items: center;
  min-height: 32px;
  padding: 0 8px 0 6px;
  border-bottom: 1px solid var(--line);
  background: var(--navy3);
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .02em;
  text-transform: uppercase;
  flex-shrink: 0;
}

body.tpl-app-document[data-studio-tab="tts"] .tpl-split-editor .sent-list {
  padding: 0;
  gap: 0;
}

body.tpl-app-document[data-studio-tab="tts"] .tpl-split-editor .sent-block {
  grid-template-columns: 22px 28px minmax(0, 1fr) repeat(3, 28px);
  min-height: 48px;
  padding: 6px 8px 6px 6px;
  border-width: 0 0 1px;
  border-radius: 0;
  box-shadow: none;
}

body.tpl-app-document[data-studio-tab="tts"] .tpl-split-editor .sent-block:last-child {
  border-bottom: 0;
}

body.tpl-app-document[data-studio-tab="tts"] .tpl-split-editor .sent-block:hover {
  background: var(--navy3);
}

body.tpl-app-document[data-studio-tab="tts"] .tpl-split-editor .sent-block:focus-within {
  box-shadow: inset 2px 0 0 var(--green);
}

body.tpl-app-document[data-studio-tab="tts"] .tpl-split-editor .sent-block > .sent-play,
body.tpl-app-document[data-studio-tab="tts"] .tpl-split-editor .sent-block > .sent-convert,
body.tpl-app-document[data-studio-tab="tts"] .tpl-split-editor .sent-block > .sent-del {
  width: 28px;
  height: 28px;
}

@media (max-width: 640px) {
  body.tpl-app-document[data-studio-tab="tts"] .tpl-split-editor .sent-head {
    grid-template-columns: 18px 26px minmax(0, 1fr) repeat(3, 26px);
    padding-right: 6px;
  }

  body.tpl-app-document[data-studio-tab="tts"] .tpl-split-editor .sent-block {
    grid-template-columns: 18px 26px minmax(0, 1fr) repeat(3, 26px);
    padding-right: 6px;
  }
}

/* Reserve enough room for the complete five-row sentence page. */
@media (min-width: 1024px) {
  body.tpl-app-document[data-studio-tab="tts"]:has(.tpl-split-editor) .tpl-page-body {
    flex: 0 0 auto;
  }

  body.tpl-app-document[data-studio-tab="tts"]:has(.tpl-split-editor) .tpl-page-body > .tpl-card {
    min-height: 540px;
    flex: 0 0 540px;
  }

  body.tpl-app-document[data-studio-tab="tts"]:has(.tpl-split-editor) .tpl-split-editor {
    min-height: 410px;
  }

  body.tpl-app-document[data-studio-tab="tts"]:has(.tpl-split-editor) .tpl-split-editor .sent-input {
    max-height: 32px;
  }

  body.tpl-app-document[data-studio-tab="tts"]:has(.tpl-split-editor) .tpl-split-editor .sent-status {
    min-height: 10px;
    line-height: 10px;
  }

  body.tpl-app-document[data-studio-tab="tts"]:has(.tpl-split-editor) .tpl-split-editor .sent-block {
    min-height: 48px;
  }

  body.tpl-app-document[data-studio-tab="tts"]:has(.tpl-split-editor) .tpl-page-body > .tpl-list-card:not(.is-collapsed) {
    min-height: 242px;
    max-height: 242px;
    flex: 0 0 242px;
  }

  body.tpl-app-document[data-studio-tab="tts"]:has(.tpl-split-editor) .tpl-page-body > .tpl-list-card.is-collapsed {
    min-height: 0;
    max-height: none;
    flex: 0 0 auto;
  }

  body.tpl-app-document[data-studio-tab="tts"]:has(.tpl-split-editor) .tpl-page-body > .tpl-list-card:not(.is-collapsed) {
    min-height: 320px;
    max-height: none;
    flex: 0 0 auto;
  }

  body.tpl-app-document[data-studio-tab="tts"]:has(.tpl-split-editor) .tpl-list-card .tpl-table .vb-hist-row {
    min-height: 48px;
    padding: 7px 12px;
    gap: 10px;
  }

  body.tpl-app-document[data-studio-tab="tts"]:has(.tpl-split-editor) .tpl-list-card .tpl-table .vb-hist-preview {
    height: 20px;
    line-height: 18px;
  }

  body.tpl-app-document[data-studio-tab="tts"]:has(.tpl-split-editor) .tpl-list-card .tpl-table .vb-hist-meta {
    line-height: 14px;
  }

  body.tpl-app-document[data-studio-tab="tts"]:has(.tpl-split-editor) .tpl-list-card .tpl-table .tpl-tbody[data-visible-count="5"] {
    grid-template-rows: repeat(5, minmax(48px, auto));
  }

  body.tpl-app-document[data-studio-tab="tts"]:has(.tpl-split-editor) .tpl-list-card .tpl-table .tpl-tbody[data-visible-count="5"] .vb-hist-row {
    min-height: 48px;
    height: auto;
  }
}

/* Keep the history viewport stable when the page size changes. */
@media (min-width: 1024px) {
  body.tpl-app-document[data-studio-tab="tts"] .tpl-page-body > .tpl-list-card:not(.is-collapsed) {
    min-height: 320px;
    max-height: 320px;
    flex: 0 0 320px;
  }

  body.tpl-app-document[data-studio-tab="tts"] .tpl-page-body > .tpl-list-card.is-collapsed,
  body.tpl-app-document[data-studio-tab="srt"] #tplSrtPanelHistory .tpl-list-card.is-collapsed {
    min-height: 0;
    max-height: none;
    flex: 0 0 auto;
  }

  body.tpl-app-document[data-studio-tab="tts"]:has(.tpl-split-editor) .tpl-page-body > .tpl-list-card:not(.is-collapsed) {
    min-height: 320px;
    max-height: 320px;
    flex: 0 0 320px;
  }

  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 {
    display: flex;
    flex: 0 0 240px;
    height: 240px;
    min-height: 240px;
    max-height: 240px;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-gutter: stable;
  }

  body.tpl-app-document[data-studio-tab="tts"] .tpl-list-card .tpl-table .tpl-tbody .vb-hist-row,
  body.tpl-app-document[data-studio-tab="srt"] .tpl-list-card .tpl-table .tpl-tbody .vb-hist-row {
    box-sizing: border-box;
    flex: 0 0 48px;
    min-height: 48px;
    height: 48px;
  }

  /* Fail/retry rows must grow — fixed 48px clips fail-box (đoạn lỗi + Tạo lại) */
  body.tpl-app-document[data-studio-tab="tts"] .tpl-list-card .tpl-table .tpl-tbody .vb-hist-row.fail,
  body.tpl-app-document[data-studio-tab="tts"] .tpl-list-card .tpl-table .tpl-tbody .vb-hist-row:has(.vb-hist-fail-box),
  body.tpl-app-document[data-studio-tab="tts"] .tpl-list-card .tpl-table .tpl-tbody .vb-hist-row:has(.vb-hist-retry-status),
  body.tpl-app-document[data-studio-tab="srt"] .tpl-list-card .tpl-table .tpl-tbody .vb-hist-row.fail,
  body.tpl-app-document[data-studio-tab="srt"] .tpl-list-card .tpl-table .tpl-tbody .vb-hist-row:has(.vb-hist-fail-box),
  body.tpl-app-document[data-studio-tab="srt"] .tpl-list-card .tpl-table .tpl-tbody .vb-hist-row:has(.vb-hist-retry-status),
  body.tpl-app-document[data-studio-tab="tts"]:has(.tpl-split-editor) .tpl-list-card .tpl-table .tpl-tbody[data-visible-count="5"] .vb-hist-row.fail,
  body.tpl-app-document[data-studio-tab="tts"]:has(.tpl-split-editor) .tpl-list-card .tpl-table .tpl-tbody[data-visible-count="5"] .vb-hist-row:has(.vb-hist-fail-box),
  body.tpl-app-document[data-studio-tab="tts"]:has(.tpl-split-editor) .tpl-list-card .tpl-table .tpl-tbody[data-visible-count="5"] .vb-hist-row:has(.vb-hist-retry-status) {
    height: auto !important;
    max-height: none !important;
    flex: 0 0 auto !important;
    min-height: 48px;
    overflow: visible;
    align-items: start;
  }

  body.tpl-app-document[data-studio-tab="tts"] .tpl-list-card .tpl-table .tpl-tbody .vb-hist-row.fail .vb-hist-preview,
  body.tpl-app-document[data-studio-tab="srt"] .tpl-list-card .tpl-table .tpl-tbody .vb-hist-row.fail .vb-hist-preview {
    height: auto;
    min-height: 18px;
    overflow: visible;
    white-space: normal;
  }

  body.tpl-app-document[data-studio-tab="tts"]:has(.tpl-split-editor) .tpl-list-card .tpl-table .tpl-tbody[data-visible-count="5"] {
    display: flex;
    grid-template-rows: none;
    overflow-y: auto;
  }

  body.tpl-app-document[data-studio-tab="tts"]:has(.tpl-split-editor) .tpl-list-card .tpl-table .tpl-tbody[data-visible-count="5"] .vb-hist-row {
    box-sizing: border-box;
    flex: 0 0 48px;
    min-height: 48px;
    height: 48px;
  }

  body.tpl-app-document[data-studio-tab="tts"] .tpl-list-card .tpl-table .tpl-tbody[data-visible-count="5"],
  body.tpl-app-document[data-studio-tab="srt"] .tpl-list-card .tpl-table .tpl-tbody[data-visible-count="5"] {
    display: flex;
    grid-template-rows: none;
    overflow-y: auto;
  }
}

/* Keep the five-row history viewport and its pager inside the card. */
@media (min-width: 1024px) {
  body.tpl-app-document[data-studio-tab="tts"] .tpl-page-body > .tpl-list-card:not(.is-collapsed) {
    min-height: 380px;
    max-height: 380px;
    flex: 0 0 380px;
  }

  body.tpl-app-document[data-studio-tab="srt"] #tplSrtPanelHistory .tpl-srt-history:not(.is-collapsed) {
    min-height: 0;
    max-height: none;
    flex: 1 1 auto;
  }
}

/* Keep the cue pager and summary close after moving the CTA into the editor header. */
body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-bottom {
  min-height: 32px;
  padding: 2px 22px 4px;
}

@media (max-width: 1023px) {
  body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-bottom {
    min-height: 32px;
    gap: 0;
    padding: 4px 12px 6px;
  }
}

/* SRT history is a separate sub-tab — no stacked scroll with editor (desktop) */
body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-page .tpl-page-body {
  overflow: hidden;
}

body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-page.tpl-srt-loaded .tpl-page-body {
  overflow: hidden;
}

/* Phone/tablet: must scroll — overflow:hidden + fixed card min-height breaks SRT */
@media (max-width: 1023px) {
  body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-page {
    min-height: 0;
    height: 100%;
  }

  body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-page .tpl-page-body,
  body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-page.tpl-srt-loaded .tpl-page-body {
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
  }

  body.tpl-app-document[data-studio-tab="srt"] #tplSrtPanelEditor,
  body.tpl-app-document[data-studio-tab="srt"] #tplSrtPanelHistory {
    flex: 1 1 auto;
    min-height: 0;
    overflow: visible;
  }

  body.tpl-app-document[data-studio-tab="srt"] #tplSrtPanelEditor .tpl-srt-card,
  body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-card {
    min-height: 0;
    height: auto;
    flex: 0 0 auto;
    overflow: visible;
  }

  body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work {
    min-height: 0;
    flex: 0 0 auto;
    overflow: visible;
  }

  body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work .srt-drop {
    min-height: 220px;
  }

  body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work .srt-editor {
    min-height: 0;
    max-height: none;
    height: auto;
    flex: 0 0 auto;
  }

  body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-work .srt-cue-list {
    flex: 0 0 auto;
    height: auto;
    max-height: min(280px, 40vh);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.tpl-app-document[data-studio-tab="srt"] #tplSrtPanelHistory .tpl-srt-history {
    min-height: 0;
    flex: 1 1 auto;
    overflow: visible;
  }

  body.tpl-app-document[data-studio-tab="srt"] .tpl-list-card .tpl-table .tpl-tbody,
  body.tpl-app-document[data-studio-tab="srt"] .tpl-list-card #vbHistList {
    max-height: none;
    overflow: visible;
  }
}

/* Loaded state: editor panel fills; history is separate tab */
@media (min-width: 1024px) {
  body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-page.tpl-srt-loaded #tplSrtPanelEditor .tpl-srt-card {
    min-height: 0;
    flex: 1 1 auto;
  }

  body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-page.tpl-srt-loaded .tpl-srt-work {
    min-height: 0;
    flex: 1 1 auto;
    padding-bottom: 4px;
  }

  body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-page.tpl-srt-loaded .srt-file-summary {
    min-height: 64px;
    gap: 4px;
    padding: 8px 14px;
  }

  body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-page.tpl-srt-loaded .srt-editor {
    box-sizing: border-box;
    height: auto;
    min-height: 280px;
    flex: 1 1 auto;
  }

  body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-page.tpl-srt-loaded .srt-editor-h,
  body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-page.tpl-srt-loaded .srt-cue-head,
  body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-page.tpl-srt-loaded .srt-cue-pager {
    flex: 0 0 auto;
    box-sizing: border-box;
  }

  body.tpl-app-document[data-studio-tab="srt"] .tpl-srt-page.tpl-srt-loaded .srt-cue-list {
    box-sizing: border-box;
    flex: 1 1 auto;
    height: auto;
    max-height: none;
    min-height: 160px;
  }
}

.text-clean-hint {
  margin: 0 0 10px;
  font-size: 0.88rem;
  color: var(--muted, #64748b);
  line-height: 1.45;
}

.text-clean-status {
  min-height: 1.25rem;
  margin-bottom: 10px;
  font-size: 0.82rem;
  color: var(--muted, #64748b);
}

.text-clean-panes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  min-height: 220px;
}

@media (max-width: 768px) {
  .text-clean-panes {
    grid-template-columns: 1fr;
  }
}

.text-clean-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg, #fff);
}

.text-clean-pane-label {
  padding: 8px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted, #64748b);
  border-bottom: 1px solid var(--line, #e2e8f0);
  background: var(--bg-soft, #f8fafc);
}

.text-clean-pre {
  margin: 0;
  padding: 12px;
  flex: 1;
  min-height: 180px;
  max-height: 42vh;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text, #0f172a);
}

.ivoi-modal-lg {
  width: min(920px, calc(100vw - 32px));
  max-width: 920px;
}

/* ═══════════════════════════════════════════════════════════
   Responsive multi-device — body.tpl-app-document only
   phone ≤767 · tablet 768–1023 · laptop 1024–1365 · desktop ≥1366
   ═══════════════════════════════════════════════════════════ */

html body.tpl-app-document {
  overflow-x: hidden;
  max-width: 100vw;
}

/* —— Laptop compact (keep dual pane, shrink fixed mins) —— */
@media (min-width: 1024px) and (max-width: 1365px) {
  body.tpl-app-document .tpl-app-sidebar {
    width: 220px;
    min-width: 220px;
  }

  body.tpl-app-document .tpl-app-workspace .tpl-app-history {
    width: min(400px, 34vw);
    min-width: 240px;
    flex: 0 0 min(400px, 34vw);
  }
}

/* —— Phone + tablet shell —— */
@media (max-width: 1023px) {
  body.tpl-app-document {
    overflow-x: hidden;
  }

  body.tpl-app-document .tpl-app-shell {
    flex-direction: column;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  body.tpl-app-document .mobile-top {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 40;
  }

  body.tpl-app-document .mob-tabs {
    display: flex;
    position: sticky;
    top: 56px;
    z-index: 39;
    background: #fff;
  }

  /* Mobile đã có #mobTabs — ẩn pill/in-page tabs trùng */
  body.tpl-app-document .tpl-tts-tabs {
    display: none !important;
  }

  body.tpl-app-document .tpl-app-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    width: min(280px, 86vw);
    min-width: 0;
    max-width: 86vw;
    height: 100%;
    max-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateX(-105%);
    transition: transform .2s ease;
    box-shadow: 10px 0 30px rgba(15, 23, 42, .14);
  }

  body.tpl-app-document.sidebar-open .tpl-app-sidebar {
    transform: translateX(0);
  }

  body.tpl-app-document .sidebar-backdrop {
    z-index: 45;
  }

  body.tpl-app-document .side-close-btn {
    display: grid;
    place-items: center;
  }

  body.tpl-app-document .tpl-app-main {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  body.tpl-app-document .tpl-app-workspace {
    width: 100%;
    min-width: 0;
    flex-direction: column;
  }

  body.tpl-app-document .panel {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
  }

  body.tpl-app-document .tpl-app-workspace .tpl-app-history {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 55;
    width: 100%;
    min-width: 0;
    max-height: 78vh;
    flex: none;
    border-top: 1px solid #e5e7eb;
    border-left: 0;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, .2);
  }

  body.tpl-app-document .vb-utility-bar {
    padding-left: 10px;
    padding-right: 10px;
  }

  body.tpl-app-document .vb-util-credits-lbl {
    display: none;
  }

  body.tpl-app-document .chat-fab {
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  }

  body.tpl-app-document .support-pop {
    right: 14px;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    max-width: calc(100vw - 28px);
  }

  /* Phase 3 — pricing / referral / api stack */
  body.tpl-app-document .paywall .price-grid {
    grid-template-columns: 1fr;
    max-width: 420px;
  }

  body.tpl-app-document .api-page,
  body.tpl-app-document .vb-page,
  body.tpl-app-document .ref-box {
    max-width: 100%;
  }

  body.tpl-app-document .ref-row {
    flex-direction: column;
    align-items: stretch;
  }

  body.tpl-app-document .ref-row button {
    width: 100%;
  }

  body.tpl-app-document .clone-layout {
    flex-direction: column;
  }

  body.tpl-app-document .clone-side {
    width: 100%;
    position: static;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  body.tpl-app-document .paywall .price-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 720px;
  }
}

/* —— Phone: TTS CTA sticky + voice modal sheet + tighter chrome —— */
@media (max-width: 767px) {
  body.tpl-app-document.tpl-tts-tab .tpl-toolbar-row,
  body.tpl-app-document.tpl-canvas.tpl-tts-tab .tpl-toolbar-row {
    flex-wrap: wrap;
    align-items: stretch;
  }

  body.tpl-app-document.tpl-tts-tab .tpl-left-toolbar,
  body.tpl-app-document.tpl-tts-tab .tpl-right-toolbar,
  body.tpl-app-document.tpl-canvas.tpl-tts-tab .tpl-left-toolbar,
  body.tpl-app-document.tpl-canvas.tpl-tts-tab .tpl-right-toolbar {
    width: 100%;
    flex-wrap: wrap;
  }

  body.tpl-app-document.tpl-tts-tab .tpl-bottom-row,
  body.tpl-app-document.tpl-canvas.tpl-tts-tab .tpl-bottom-row {
    position: sticky;
    bottom: 0;
    z-index: 35;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -6px 20px rgba(15, 23, 42, .08);
  }

  body.tpl-app-document.tpl-tts-tab .tpl-actionbar,
  body.tpl-app-document.tpl-canvas.tpl-tts-tab .tpl-actionbar {
    width: 100%;
    flex-wrap: wrap;
  }

  body.tpl-app-document.tpl-tts-tab .tpl-cta,
  body.tpl-app-document.tpl-canvas.tpl-tts-tab .tpl-cta {
    width: 100%;
    margin-left: 0;
    justify-content: center;
  }

  body.tpl-app-document.tpl-tts-tab .tpl-editor,
  body.tpl-app-document.tpl-canvas.tpl-tts-tab .tpl-editor {
    min-height: 160px;
    height: auto;
  }

  body.tpl-app-document #voiceModal.modal-backdrop.open {
    align-items: flex-end;
    padding: 0;
  }

  body.tpl-app-document #voiceModal .voice-modal {
    width: 100%;
    max-width: 100%;
    max-height: min(92dvh, 100%);
    border-radius: 16px 16px 0 0;
  }

  body.tpl-app-document #voiceModal .voice-modal .vm-filters {
    flex-direction: column;
  }

  body.tpl-app-document #voiceModal .voice-modal .vm-filters input {
    min-width: 0;
    width: 100%;
  }

  body.tpl-app-document #voiceModal .voice-modal .vm-grid {
    grid-template-columns: 1fr;
  }

  body.tpl-app-document .key-row {
    flex-direction: column;
    align-items: stretch;
  }

  body.tpl-app-document .api-key-row {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Hist action chips: shell tpl-app luôn light — không lấy --bg từ html.dark */
body.tpl-app-document {
  color-scheme: light;
}
body.tpl-app-document .vb-hist-row .hfoot-btn,
body.tpl-app-document .vb-hist-row .vb-hist-actions button,
body.tpl-app-document .vb-hist-row .vb-hist-actions a,
body.tpl-app-document .hfoot-speed-pill {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid rgba(148, 163, 184, 0.35) !important;
}
body.tpl-app-document .vb-hist-row .hfoot-btn:hover,
body.tpl-app-document .vb-hist-row .vb-hist-actions button:hover,
body.tpl-app-document .vb-hist-row .vb-hist-actions a:hover {
  background: #f8fafc !important;
  border-color: rgba(100, 116, 139, 0.45) !important;
}
body.tpl-app-document .vb-hist-row .btn-play.playing {
  color: #ea580c !important;
  background: rgba(254, 243, 199, 0.75) !important;
  border-color: rgba(234, 88, 12, 0.45) !important;
}
body.tpl-app-document .vb-hist-row .btn-dl .btn-ico-dl {
  color: #2563eb !important;
}
body.tpl-app-document .vb-hist-row .btn-del {
  color: #dc2626 !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
}
body.tpl-app-document .hfoot-speed-pill .speed-val-lbl {
  color: #0f172a !important;
}
body.tpl-app-document .hfoot-speed-pill .speed-caret {
  color: #64748b !important;
}

/* Voice cards (modal + tab Thư viện giọng): ép light — không inherit html.dark */
body.tpl-app-document #voiceModal .voice-modal {
  background: #ffffff !important;
  color: #0f172a !important;
  border-color: #e5e7eb !important;
}
body.tpl-app-document #voiceModal .voice-modal .vm-h,
body.tpl-app-document #voiceModal .voice-modal .vm-filters {
  border-color: #e5e7eb !important;
}
body.tpl-app-document #voiceModal .voice-modal .vm-h h2 {
  color: #0f172a !important;
}
body.tpl-app-document #voiceModal .voice-modal .vm-x,
body.tpl-app-document #voiceModal .voice-modal .vm-clear,
body.tpl-app-document #voiceModal .voice-modal .vm-filters input,
body.tpl-app-document #voiceModal .voice-modal .vm-filters select {
  background: #ffffff !important;
  color: #0f172a !important;
  border-color: #e5e7eb !important;
}
body.tpl-app-document #voiceModal .voice-modal .vm-x,
body.tpl-app-document #voiceModal .voice-modal .vm-clear {
  color: #6b7280 !important;
}
body.tpl-app-document #voiceModal .voice-modal .vm-clear:hover {
  border-color: #22c55e !important;
  color: #15803d !important;
}

body.tpl-app-document #voiceModal .vcard,
body.tpl-app-document[data-studio-tab="voice-library"] .vcard,
body.tpl-app-document[data-studio-tab="voice-library"] .lib-card {
  background: #ffffff !important;
  color: #0f172a !important;
  border-color: #e8eaed !important;
}
body.tpl-app-document #voiceModal .vcard .vn,
body.tpl-app-document[data-studio-tab="voice-library"] .vcard .vn,
body.tpl-app-document[data-studio-tab="voice-library"] .lib-meta strong,
body.tpl-app-document[data-studio-tab="voice-library"] .library-page-title {
  color: #0f172a !important;
}
body.tpl-app-document #voiceModal .vcard .vd,
body.tpl-app-document #voiceModal .vcard .vt,
body.tpl-app-document[data-studio-tab="voice-library"] .vcard .vd,
body.tpl-app-document[data-studio-tab="voice-library"] .vcard .vt,
body.tpl-app-document[data-studio-tab="voice-library"] .lib-sub,
body.tpl-app-document[data-studio-tab="voice-library"] .lib-lang-lbl,
body.tpl-app-document[data-studio-tab="voice-library"] .lib-count {
  color: #6b7280 !important;
}
body.tpl-app-document #voiceModal .vcard .vt span,
body.tpl-app-document #voiceModal .vcard .vt .vt-flag,
body.tpl-app-document[data-studio-tab="voice-library"] .vcard .vt span,
body.tpl-app-document[data-studio-tab="voice-library"] .vcard .vt .vt-flag {
  background: #f3f4f6 !important;
  border-color: #e5e7eb !important;
  color: #4b5563 !important;
}
body.tpl-app-document #voiceModal .vcard .vico,
body.tpl-app-document[data-studio-tab="voice-library"] .vcard .vico {
  background: #ffffff !important;
  border-color: #e5e7eb !important;
  color: #6b7280 !important;
}
body.tpl-app-document #voiceModal .vcard .vico:hover,
body.tpl-app-document[data-studio-tab="voice-library"] .vcard .vico:hover {
  border-color: #22c55e !important;
  color: #15803d !important;
}
body.tpl-app-document #voiceModal .vcard .vico[data-preview].playing,
body.tpl-app-document #voiceModal .vcard .vico[data-preview].loading,
body.tpl-app-document[data-studio-tab="voice-library"] .vcard .vico[data-lib-preview].playing,
body.tpl-app-document[data-studio-tab="voice-library"] .vcard .vico[data-lib-preview].loading,
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 {
  background: #22c55e !important;
  border-color: #22c55e !important;
  color: #ffffff !important;
}
body.tpl-app-document #voiceModal .vcard .vuse,
body.tpl-app-document[data-studio-tab="voice-library"] .vcard .vuse,
body.tpl-app-document[data-studio-tab="voice-library"] .lib-use {
  background: #ffffff !important;
  color: #0f172a !important;
  border-color: #e5e7eb !important;
}
body.tpl-app-document #voiceModal .vcard.active .vuse,
body.tpl-app-document[data-studio-tab="voice-library"] .vcard.active .vuse,
body.tpl-app-document[data-studio-tab="voice-library"] .lib-use.active {
  background: #22c55e !important;
  border-color: #22c55e !important;
  color: #ffffff !important;
}
body.tpl-app-document #voiceModal .vcard.active,
body.tpl-app-document[data-studio-tab="voice-library"] .vcard.active {
  border-color: #22c55e !important;
}
body.tpl-app-document[data-studio-tab="voice-library"] .lib-row {
  color: #0f172a !important;
}
body.tpl-app-document[data-studio-tab="voice-library"] .lib-dd,
body.tpl-app-document[data-studio-tab="voice-library"] .lib-search,
body.tpl-app-document[data-studio-tab="voice-library"] .lib-search input,
body.tpl-app-document[data-studio-tab="voice-library"] .lib-clear-btn {
  background: #ffffff !important;
  color: #0f172a !important;
  border-color: #e5e7eb !important;
}

/* SRT banners: khóa bản sáng trên shell tpl-app */
body.tpl-app-document[data-studio-tab="srt"] .srt-info-banner,
body.tpl-app-document[data-studio-tab="srt"] .srt-dub-banner {
  background: #eef2ff !important;
  border: 1px solid #c7d2fe !important;
  color: #3730a3 !important;
}
body.tpl-app-document[data-studio-tab="srt"] .srt-lang-warn {
  background: #fffbeb !important;
  border-color: #fde68a !important;
  color: #92400e !important;
}
body.tpl-app-document[data-studio-tab="srt"] .srt-cue-head {
  background: #f8fafc !important;
  color: #475569 !important;
  border-bottom-color: #eef0f3 !important;
}
body.tpl-app-document[data-studio-tab="srt"] .srt-cue-pager {
  background: #fff !important;
  color: #64748b !important;
  border-top-color: #eef0f3 !important;
}
body.tpl-app-document[data-studio-tab="srt"] .srt-cue-page {
  background: #fff !important;
  color: #334155 !important;
  border-color: #e5e7eb !important;
}
body.tpl-app-document[data-studio-tab="srt"] .srt-cue-page.active {
  background: #2563eb !important;
  border-color: #2563eb !important;
  color: #fff !important;
}

/* Pricing / paywall: ép sáng — không inherit html.dark --bg2/--card/--text */
body.tpl-app-document .paywall,
body.tpl-app-document .pricing-page {
  background:
    radial-gradient(ellipse 70% 50% at 50% -10%, rgba(6, 182, 212, 0.12), transparent 55%),
    #f8fafc !important;
  border-color: #e5e7eb !important;
  color: #0f172a !important;
}
body.tpl-app-document .paywall-kicker {
  color: #0891b2 !important;
}
body.tpl-app-document .paywall-kicker.wait {
  color: #d97706 !important;
}
body.tpl-app-document .paywall h2 {
  color: #0f172a !important;
}
body.tpl-app-document .paywall .sub,
body.tpl-app-document .paywall-foot {
  color: #64748b !important;
}
body.tpl-app-document .paywall-foot a {
  color: #0891b2 !important;
}
body.tpl-app-document .paywall .price-card {
  background: #ffffff !important;
  border-color: #e5e7eb !important;
  color: #0f172a !important;
}
body.tpl-app-document .paywall .price-card.popular {
  border-color: rgba(6, 182, 212, 0.45) !important;
  background: linear-gradient(165deg, rgba(6, 182, 212, 0.08), #ffffff 50%) !important;
  box-shadow: 0 12px 40px rgba(6, 182, 212, 0.1) !important;
}
body.tpl-app-document .paywall .price-card.is-mine {
  border-color: rgba(34, 197, 94, 0.55) !important;
}
body.tpl-app-document .paywall .price-name,
body.tpl-app-document .paywall .price-amount {
  color: #0f172a !important;
}
body.tpl-app-document .paywall .price-credits {
  color: #0891b2 !important;
}
body.tpl-app-document .paywall .price-feats li {
  color: #475569 !important;
}
body.tpl-app-document .paywall .price-amount span {
  color: #64748b !important;
}
body.tpl-app-document .paywall .price-badge.mine {
  background: rgba(34, 197, 94, 0.15) !important;
  color: #15803d !important;
}
body.tpl-app-document .paywall .price-card.is-locked .btn-gloss:disabled,
body.tpl-app-document .paywall .price-card.is-locked button.btn-gloss:disabled {
  background: #e5e7eb !important;
  color: #374151 !important;
}
body.tpl-app-document .paywall.wait-act {
  background:
    radial-gradient(ellipse 70% 50% at 50% -10%, rgba(245, 158, 11, 0.14), transparent 55%),
    #fffbeb !important;
}

