/* HVoice Studio — tab Template
   Hình học lấy từ styled-components trong bundle Vbee (main.957547d7.chunk.js).
   Màu sắc giữ theo hệ HVoice (tím/emerald). Chỉ áp dụng dưới body.tpl-canvas. */

body.tpl-canvas {
  --tpl-grey: #f4f4f6;
  --tpl-grey-hover: #ebebef;
  --tpl-line: #e5e7eb;
  --tpl-line-soft: #f0f0f3;
  --tpl-ink: #1c1c1e;
  --tpl-ink-soft: #6b7280;
  --tpl-ink-dim: #9ca3af;
  --tpl-accent: #7c3aed;
  --tpl-accent-hover: #6d28d9;
  --tpl-accent-soft: rgba(124, 58, 237, 0.08);
  --tpl-thead: #f6f6f8;
  --tpl-top: 210px;
  --tpl-table-h: 320px;
  --tpl-player-h: 0px;
  --tpl-editor-min: 180px;
}

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

/* Vbee không có topbar trong vùng nội dung — tab tts cũng đã ẩn theo cách này. */
body.tpl-canvas .topbar,
body.tpl-canvas #studioTopnav { display: none !important; }

body.tpl-canvas .workspace { background: #fff; }
body.tpl-canvas .panel {
  padding: 12px 24px 20px !important;
  max-width: none !important;
  background: transparent;
  gap: 0;
}

body.tpl-canvas .workspace .hist { display: none; }

/* ── Trang ───────────────────────────────────────────── */
.tpl-page {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ── Đầu trang: 1 hàng — tiêu đề dự án + tiện ích + số dư ── */
.tpl-head {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  min-height: 44px;
  margin-bottom: 8px;
}
.tpl-head-utils {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.tpl-util-ico {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--tpl-grey);
  color: var(--tpl-ink-soft);
  display: grid;
  place-items: center;
  text-decoration: none;
  flex-shrink: 0;
}
.tpl-util-ico svg { width: 18px; height: 18px; }
.tpl-util-ico:hover {
  background: var(--tpl-accent-soft);
  color: var(--tpl-accent);
}
/* Khối số dư 2 dòng như Vbee: nhãn nhỏ trên, số lớn dưới */
.tpl-wallet {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.25;
}
.tpl-wallet-lbl {
  font-size: 12px;
  font-weight: 400;
  color: var(--tpl-ink-soft);
  white-space: nowrap;
}
.tpl-wallet-val {
  font-size: 16px;
  font-weight: 700;
  color: var(--tpl-ink);
  white-space: nowrap;
}
.tpl-wallet-plus {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--tpl-accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 17px;
  font-weight: 700;
  text-decoration: none;
  line-height: 1;
  flex-shrink: 0;
}
.tpl-wallet-plus:hover { background: var(--tpl-accent-hover); }

/* Ô tiêu đề dự án — chữ nhỏ màu xám đúng như ảnh Vbee */
.tpl-base-input {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  font-size: 14px;
  font-weight: 400;
  color: var(--tpl-ink-soft);
}
.tpl-base-input input {
  flex: 0 1 auto;
  width: 12ch;
  max-width: 100%;
  min-width: 60px;
  border: none;
  background: transparent;
  font: inherit;
  color: var(--tpl-ink);
  padding: 4px 2px;
  border-bottom: 1px solid transparent;
}
.tpl-base-input input:hover:not(:disabled) { border-bottom-color: var(--tpl-line); }
.tpl-base-input input:focus {
  outline: none;
  border-bottom-color: var(--tpl-accent);
}
.tpl-base-input input:disabled { opacity: 0.75; }
/* Span đo chữ để ô tiêu đề co giãn đúng độ dài như Vbee (.size-span) */
.tpl-title-measure {
  position: absolute;
  visibility: hidden;
  white-space: pre;
  pointer-events: none;
  left: -9999px;
  top: 0;
  font: inherit;
}
.tpl-title-edit {
  border: none;
  background: transparent;
  color: var(--tpl-ink-dim);
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
  border-radius: 8px;
}
.tpl-title-edit:hover { background: var(--tpl-grey); }
.tpl-base-input .proj-save-hint {
  font-size: 12px;
  font-weight: 400;
  color: var(--tpl-ink-dim);
  white-space: nowrap;
}
/* ── Vùng soạn nội dung — phẳng trên nền trắng như Vbee ── */
.tpl-card {
  background: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

/* Toolbar — Vbee .toolbar-row */
.tpl-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 15px;
}
.tpl-left-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  background-color: var(--tpl-grey);
  padding: 8px;
  border-radius: 8px;
  box-sizing: border-box;
}
.tpl-right-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.tpl-group {
  display: flex;
  width: fit-content;
  align-items: center;
}
.tpl-divider {
  width: 1px;
  align-self: stretch;
  min-height: 20px;
  margin: 0 8px;
  background: #dcdce2;
}

/* Nút chọn giọng — Vbee .choose-voice */
.tpl-left-toolbar .voice-pick-btn {
  display: flex;
  align-items: center;
  gap: 0;
  cursor: pointer;
  border: none;
  background: transparent;
  padding: 4px 6px;
  border-radius: 16px;
  max-width: 240px;
  min-width: 0;
  box-shadow: none;
}
.tpl-left-toolbar .voice-pick-btn:hover,
.tpl-left-toolbar .voice-pick-btn:focus {
  background: #fff;
}
.tpl-left-toolbar .voice-pick-btn .vp-av {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}
.tpl-left-toolbar .voice-pick-btn .vp-mid {
  margin-left: 10px;
  min-width: 0;
  text-align: left;
}
.tpl-left-toolbar .voice-pick-btn .vp-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--tpl-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tpl-left-toolbar .voice-pick-btn .vp-tags,
.tpl-left-toolbar .voice-pick-btn .vp-sub {
  font-size: 11px;
  color: var(--tpl-ink-dim);
}
.tpl-left-toolbar .voice-pick-btn .vp-chev {
  margin-left: 6px;
  color: var(--tpl-ink-soft);
}

/* Ô chọn tốc độ / định dạng / khoảng nghỉ */
.tpl-left-toolbar .tb-speed-wrap,
.tpl-toolbar-row .vb-break-pill,
.tpl-dropdown {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  padding: 0 8px;
  border: none;
  border-radius: 12px;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  color: var(--tpl-ink);
  cursor: pointer;
}
.tpl-left-toolbar .tb-speed-wrap:hover,
.tpl-dropdown:hover { background: #fff; }
.tpl-right-toolbar .vb-break-pill:hover { background: var(--tpl-grey); }
.tpl-left-toolbar .tb-speed-wrap select,
.tpl-toolbar-row .vb-break-pill select,
.tpl-dropdown {
  border: none;
  background: transparent;
  font: inherit;
  color: inherit;
  cursor: pointer;
  outline: none;
}
.tpl-toolbar-row .tb-bolt,
.tpl-toolbar-row .vb-pause-clock { width: 16px; height: 16px; }

/* Nút công cụ — Vbee .custom-button */
.tpl-tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: fit-content;
  height: 32px;
  padding: 4px 6px;
  border: none;
  background: transparent;
  border-radius: 12px;
  color: var(--tpl-ink-soft);
  cursor: pointer;
  text-transform: none;
  font-size: 14px;
  font-weight: 500;
  margin-right: 6px;
}
.tpl-tool-btn:last-child { margin-right: 0; }
.tpl-tool-btn svg { width: 18px; height: 18px; }
.tpl-left-toolbar .tpl-tool-btn:hover,
.tpl-left-toolbar .tpl-tool-btn:focus { background: #fff; }
.tpl-right-toolbar .tpl-tool-btn:hover,
.tpl-right-toolbar .tpl-tool-btn:focus { background: var(--tpl-grey); }
.tpl-tool-btn.on {
  background: var(--tpl-accent-soft);
  color: var(--tpl-accent);
}

/* Công tắc Tách câu */
.tpl-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--tpl-ink);
  cursor: pointer;
  white-space: nowrap;
  padding: 0 4px;
}
.tpl-switch input { position: absolute; opacity: 0; pointer-events: none; }
.tpl-switch-track {
  width: 36px;
  height: 20px;
  border-radius: 100px;
  background: #d1d5db;
  position: relative;
  transition: background 0.18s ease;
  flex-shrink: 0;
}
.tpl-switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.18s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.tpl-switch input:checked + .tpl-switch-track { background: #10b981; }
.tpl-switch input:checked ~ .tpl-switch-track .tpl-switch-thumb { transform: translateX(16px); }
.tpl-switch input:focus-visible + .tpl-switch-track { outline: 2px solid var(--tpl-accent); outline-offset: 2px; }
.tpl-switch input:checked ~ .tpl-switch-track { background: #10b981; }
.tpl-switch input:focus-visible ~ .tpl-switch-track { outline: 2px solid var(--tpl-accent); outline-offset: 2px; }

/* Nút Dự án — Vbee .project-button-container, nền đầy màu nhấn */
.tpl-project-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 15px;
  height: 32px;
  padding: 0 14px;
  border: none;
  border-radius: 500px;
  background: var(--tpl-accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.tpl-project-btn svg { width: 16px; height: 16px; }
.tpl-project-btn:hover { background: var(--tpl-accent-hover); }

/* ── Editor ─────────────────────────────────────────── */
.tpl-editor-wrap {
  position: relative;
  padding-top: 8px;
}
.tpl-editor {
  width: 100%;
  height: var(--tpl-editor-h, 320px);
  min-height: var(--tpl-editor-min);
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--tpl-ink);
  font-family: inherit;
  font-size: 16px;
  line-height: 1.5;
  padding: 8px 2px 40px;
  overflow-y: auto;
  overflow-x: hidden;
}
.tpl-editor:focus-visible {
  outline: 2px solid var(--tpl-accent);
  outline-offset: -2px;
}
.tpl-editor::placeholder { color: var(--tpl-ink-dim); }
.tpl-editor::-webkit-scrollbar { width: 4px; }
.tpl-editor::-webkit-scrollbar-track { background: #fff; }
.tpl-editor::-webkit-scrollbar-thumb { background: #d5d5dd; border-radius: 100px; }
.tpl-editor::-webkit-scrollbar-thumb:hover { background: #b9b9c4; border-radius: 100px; }

/* ── Hàng dưới editor: thẻ ví dụ + đếm ký tự + CTA cùng 1 hàng ── */
.tpl-bottom-row {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

/* Thẻ ví dụ — Vbee .tool-row-left */
.tpl-samples {
  flex: 1;
  padding: 8px 8px 0 0;
  min-width: 0;
}
.tpl-samples-title {
  display: block;
  font-size: 12px;
  font-style: normal;
  font-weight: 400;
  line-height: 16px;
  letter-spacing: -0.4px;
  color: var(--tpl-ink-dim);
  margin-bottom: 6px;
}
.tpl-samples-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
}
.tpl-samples-row::-webkit-scrollbar { display: none; }
.tpl-sample {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-width: fit-content;
  height: 32px;
  padding: 0;
  border: 1px solid var(--tpl-line);
  border-radius: 55px;
  background: #fff;
  cursor: pointer;
}
.tpl-sample:hover { background: var(--tpl-grey); }
.tpl-sample:active { background: var(--tpl-grey-hover); }
.tpl-sample-ico {
  padding: 0 8px 0 16px;
  min-width: fit-content;
  background-color: transparent;
  font-size: 15px;
  line-height: 32px;
}
.tpl-sample-lbl {
  font-size: 14px;
  font-weight: 500;
  min-width: fit-content;
  line-height: 32px;
  letter-spacing: -0.4px;
  text-transform: none;
  text-align: left;
  padding-right: 16px;
  color: var(--tpl-ink);
}

/* Ẩn dần thẻ ví dụ theo đúng các mốc của Vbee */
@media (max-width: 1400px) {
  .tpl-sample.tpl-sample-5 { display: none; }
}
@media (max-width: 1200px) {
  .tpl-sample.tpl-sample-4 { display: none; }
}
@media (max-width: 850px) {
  .tpl-sample.tpl-sample-3 { display: none; }
}

/* Cụm đếm ký tự + CTA — Vbee .web-title-bar */
.tpl-actionbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.tpl-count {
  font-size: 14px;
  font-weight: 400;
  min-width: 44px;
  color: var(--tpl-ink-soft);
}
.tpl-count.over-balance { color: #ef4444; font-weight: 600; }
.tpl-dur {
  font-size: 14px;
  font-weight: 400;
  color: var(--tpl-ink-soft);
}
.tpl-cost {
  color: var(--tpl-ink-soft);
  font-size: 12px;
  white-space: nowrap;
}
.tpl-cta {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  text-transform: none;
  min-width: 133px;
  height: 44px;
  padding: 0 20px;
  border: none;
  border-radius: 25px;
  margin-left: 12px;
  background: var(--tpl-accent);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.tpl-cta:hover { background: var(--tpl-accent-hover); }
.tpl-cta:disabled { opacity: 0.55; cursor: not-allowed; }
.tpl-cta svg { width: 16px; height: 16px; flex-shrink: 0; }

.tpl-card .msg { margin-top: 8px; }
.tts-retry-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 10px 16px;
  border-bottom: 1px solid #f1f2f5;
  background: rgba(255, 247, 237, 0.97);
  backdrop-filter: blur(4px);
}
.tts-retry-bar[hidden] { display: none !important; }
.tts-retry-bar.is-running {
  background: rgba(245, 243, 255, 0.97);
}
.tts-retry-bar-copy {
  flex: 1 1 200px;
  min-width: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: #c2410c;
  line-height: 1.35;
}
.tts-retry-bar.is-running .tts-retry-bar-copy {
  color: #6d28d9;
}
.tts-retry-bar-track {
  display: block;
  width: 100%;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #ede9fe;
  order: 3;
  flex: 1 0 100%;
}
.tts-retry-bar-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7c3aed, #a855f7);
  transition: width .35s ease;
}
.tts-retry-bar .msg-retry-btn,
.tts-retry-bar-btn {
  border: 1px solid rgba(234, 88, 12, 0.45);
  background: rgba(234, 88, 12, 0.12);
  color: #c2410c;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
  flex: 0 0 auto;
}
.tts-retry-bar-btn:hover { filter: brightness(0.97); }
.tts-retry-bar-btn:disabled { opacity: 0.6; cursor: wait; }
.msg.msg-with-retry {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.msg-retry-text { flex: 1 1 220px; min-width: 0; }
.msg-retry-btn {
  border: 1px solid rgba(234, 88, 12, 0.45);
  background: rgba(234, 88, 12, 0.1);
  color: #c2410c;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
  flex: 0 0 auto;
}
.msg-retry-btn:hover { filter: brightness(0.97); }
.msg-retry-btn:disabled { opacity: 0.6; cursor: wait; }

body.tpl-canvas.tpl-tts-tab .tpl-editor {
  min-height: 220px;
}

/* ── Danh sách chuyển đổi — Vbee .request ───────────── */
.tpl-request { margin-top: 18px; }
.tpl-request-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 15px;
}
.tpl-request-title-wrap {
  display: flex;
  align-items: center;
  min-width: 195px;
}
.tpl-expand {
  border: none;
  background: transparent;
  color: var(--tpl-ink-soft);
  cursor: pointer;
  margin-right: 8px;
  padding: 4px;
  border-radius: 8px;
  display: grid;
  place-items: center;
}
.tpl-expand svg {
  width: 18px;
  height: 18px;
  transition: transform 0.2s ease;
}
.tpl-expand[aria-expanded="false"] svg { transform: rotate(-90deg); }
.tpl-expand:hover { background: var(--tpl-grey); }
.tpl-request-title {
  font-weight: 700;
  font-size: 16px;
  color: var(--tpl-ink);
}
.tpl-request-title .cnt {
  font-weight: 500;
  color: var(--tpl-ink-dim);
}
.tpl-request-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
/* Ô tìm kiếm có kính lúp bên trong như Vbee */
.tpl-search-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.tpl-search-ico {
  position: absolute;
  left: 11px;
  display: grid;
  place-items: center;
  color: var(--tpl-ink-dim);
  pointer-events: none;
}
.tpl-search-ico svg { width: 15px; height: 15px; }
.tpl-filter-input {
  width: 133px;
  height: 32px;
  padding: 0 12px 0 32px;
  border: 1px solid var(--tpl-line);
  border-radius: 100px;
  background: #fff;
  font-size: 14px;
  color: var(--tpl-ink);
  outline: none;
}
.tpl-filter-input::-webkit-search-cancel-button { cursor: pointer; }
.tpl-filter-input:focus { border-color: var(--tpl-accent); }
.tpl-filter-date {
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--tpl-line);
  border-radius: 100px;
  background: #fff;
  font-size: 13px;
  color: var(--tpl-ink);
  outline: none;
}
.tpl-filter-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--tpl-line);
  border-radius: 50%;
  background: #fff;
  color: var(--tpl-ink-soft);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}
.tpl-filter-btn svg { width: 16px; height: 16px; }
.tpl-filter-btn:hover { border-color: var(--tpl-accent); color: var(--tpl-accent); }
.tpl-bulk-del {
  height: 32px;
  padding: 0 12px;
  border: 1px solid #fecaca;
  border-radius: 100px;
  background: #fff5f5;
  color: #b91c1c;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.tpl-bulk-del:hover { background: #fee2e2; }

/* Bảng — phẳng, không viền ngoài, chỉ có vạch chia dòng như Vbee */
.tpl-table {
  border: 0;
  border-radius: 0;
  background: #fff;
  border-top: 1px solid var(--tpl-line);
}
.tpl-request.is-collapsed .tpl-table { display: none; }

/* Vbee không có hàng tiêu đề cột; ô chọn tất cả để riêng một dòng nhỏ */
.tpl-selectall {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--tpl-thead);
  border-bottom: 1px solid var(--tpl-line);
  font-size: 12px;
  font-weight: 500;
  color: var(--tpl-ink-soft);
  cursor: pointer;
}
.tpl-selectall input {
  width: 16px;
  height: 16px;
  accent-color: var(--tpl-accent);
  margin: 0;
}

.tpl-table .tpl-tbody {
  max-height: none;
  overflow-y: auto;
}

/* Ghi đè hình học dòng lịch sử cho đúng kiểu Vbee */
.tpl-table .tpl-tbody .vb-hist-row {
  display: grid;
  grid-template-columns: 2% minmax(0, 1fr) 180px minmax(280px, max-content);
  gap: 12px;
  align-items: center;
  padding: 6px 12px;
  min-height: 56px;
  border-bottom: 1px solid var(--tpl-line-soft);
  background: #fff;
  cursor: pointer;
}
.tpl-table .tpl-tbody .vb-hist-row:nth-child(even) { background: #fff; }
.tpl-table .tpl-tbody .vb-hist-row:hover { background: #fafafa; }
.tpl-table .tpl-tbody .vb-hist-row:last-child { border-bottom: none; }
.tpl-table .tpl-tbody .vb-hist-main { min-width: 0; }
.tpl-table .tpl-tbody .vb-hist-preview {
  height: 28px;
  display: flex;
  align-items: center;
  max-width: 80%;
  font-size: 14px;
  font-weight: 510;
  line-height: 24px;
  color: var(--tpl-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tpl-table .tpl-tbody .vb-hist-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  opacity: 0.8;
  font-size: 12px;
  font-weight: 400;
  line-height: 16px;
  letter-spacing: -0.4px;
  color: var(--tpl-ink-soft);
  margin-top: 0;
}
.tpl-table .tpl-tbody .vb-hist-run {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 8px;
  color: var(--tpl-accent);
  white-space: nowrap;
}
.tpl-table .tpl-tbody .vb-hist-progress-track {
  display: inline-block;
  width: 72px;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--tpl-line-soft);
}
.tpl-table .tpl-tbody .vb-hist-progress-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--tpl-accent);
  will-change: width;
}
.tpl-table .tpl-tbody .vb-hist-progress-label {
  min-width: 28px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.tpl-table .tpl-tbody .vb-hist-voice { gap: 8px; }
.tpl-table .tpl-tbody .vb-vname {
  font-size: 14px;
  font-weight: 400;
  color: var(--tpl-ink);
}
/* Vbee luôn hiện cụm thao tác, không chờ hover */
.tpl-table .tpl-tbody .vb-hist-actions { gap: 4px; }
/* Nút phát dạng tròn viền xám như Vbee */
.tpl-table .tpl-tbody .vb-hist-act[data-vb-play] {
  width: 32px;
  height: 32px;
  border: 1px solid var(--tpl-line);
  border-radius: 50%;
}
.tpl-table .tpl-tbody .vb-hist-act:hover {
  background: var(--tpl-accent-soft);
  color: var(--tpl-accent);
}
.tpl-table .tpl-tbody .vb-hist-row.is-playing {
  background: var(--tpl-accent-soft);
}
.tpl-table .tpl-tbody .hist-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--tpl-ink-dim);
  font-size: 14px;
}

/* Phân trang — Vbee MuiTablePagination: chọn số mục bên trái, điều hướng bên phải */
.tpl-table .tpl-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: #fff;
  font-size: 13px;
  color: var(--tpl-ink-soft);
}
.tpl-table .tpl-pager-size {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tpl-table .tpl-pager-nav {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.tpl-table .tpl-pager select {
  border: 1px solid var(--tpl-line);
  border-radius: 6px;
  padding: 3px 6px;
  font-size: 13px;
  background: #fff;
  color: var(--tpl-ink);
}
.tpl-table .tpl-pager .pg-nav {
  width: 28px;
  height: 28px;
  border: 1px solid var(--tpl-line);
  border-radius: 50%;
  background: #fff;
  color: var(--tpl-ink);
  cursor: pointer;
  padding: 0;
}
.tpl-table .tpl-pager .pg-nav:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── Thanh phát audio cố định — Vbee audio player ───── */
.tpl-player {
  position: fixed;
  left: var(--side-w);
  right: 0;
  bottom: 0;
  z-index: 60;
  height: 84px;
  padding: 12px 24px;
  background: #fff;
  border-top: 1px solid var(--tpl-line);
  box-shadow: 0 -6px 20px rgba(15, 23, 42, 0.07);
  display: none;
  align-items: center;
}
body.tpl-canvas.tpl-player-on .tpl-player { display: flex; }
body.tpl-canvas.sidebar-collapsed .tpl-player { left: 64px; }

.tpl-player-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  width: 100%;
  min-width: 0;
}
/* Trên desktop 4 khối nằm cùng một hàng; wrapper chỉ tồn tại cho bản mobile. */
.tpl-player-row-top { display: contents; }
body.tpl-canvas.tpl-player-on .panel { padding-bottom: 104px !important; }
.tpl-player-voice {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 200px;
  flex-shrink: 0;
  min-width: 0;
}
.tpl-player-av {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: var(--tpl-grey);
  font-size: 14px;
  font-weight: 700;
  color: var(--tpl-ink-soft);
}
.tpl-player-av img { width: 100%; height: 100%; object-fit: cover; }
.tpl-player-meta {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}
.tpl-player-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--tpl-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tpl-player-vname {
  font-size: 14px;
  font-weight: 400;
  color: var(--tpl-ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tpl-player-action {
  display: flex;
  gap: 5px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.tpl-player-btn {
  padding: 6px;
  border-radius: 50%;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--tpl-ink-soft);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.tpl-player-btn svg { width: 20px; height: 20px; }
.tpl-player-btn:hover { background: var(--tpl-grey); }
.tpl-player-btn.tpl-player-main {
  background: var(--tpl-accent);
  color: #fff;
  width: 40px;
  height: 40px;
}
.tpl-player-btn.tpl-player-main:hover { background: var(--tpl-accent-hover); }
.tpl-player-wrap {
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  min-width: 80px;
}
.tpl-player-time {
  font-size: 13px;
  font-weight: 500;
  color: var(--tpl-ink-soft);
  min-width: 42px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.tpl-player-seek {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: #e3e3ea;
  border-radius: 100px;
  outline: none;
  padding: 0;
  cursor: pointer;
}
.tpl-player-seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--tpl-accent);
  border: 1px solid var(--tpl-accent);
  cursor: pointer;
}
.tpl-player-seek::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--tpl-accent);
  border: 1px solid var(--tpl-accent);
  cursor: pointer;
}
.tpl-player-end {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

@media (max-width: 1023px) {
  .tpl-player { left: 0; }
  body.tpl-canvas.sidebar-collapsed .tpl-player { left: 0; }
}
@media (max-width: 599px) {
  .tpl-player {
    height: auto;
    padding: 10px 14px 12px;
  }
  .tpl-player-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .tpl-player-voice { width: 100%; }
  .tpl-player-row-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
  }
}

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 1023px) {
  body.tpl-canvas .panel { padding: 12px 14px 20px !important; }
  .tpl-project-btn { margin-left: 4px; }
  .tpl-request-head { margin-bottom: 12px; }
}
@media (max-width: 767px) {
  .tpl-left-toolbar { width: 100%; }
  .tpl-right-toolbar { width: 100%; }
  .tpl-head-utils { margin-left: 0; }
  .tpl-bottom-row { align-items: stretch; }
  .tpl-actionbar { width: 100%; gap: 10px; }
  .tpl-cta { margin-left: auto; width: auto; }
  .tpl-filter-input { width: 100%; min-width: 120px; flex: 1; }
  .tpl-request-filter { width: 100%; }
}

/* Bảng chuyển sang bố cục xếp dọc sớm hơn để cột nội dung không bị cắt */
@media (max-width: 900px) {
  .tpl-table .tpl-tbody .vb-hist-row {
    grid-template-columns: 24px minmax(0, 1fr) auto;
    row-gap: 6px;
    padding: 10px 12px;
  }
  /* studio-vbee-pages.css ẩn cột giọng dưới 900px; ở tab Template vẫn giữ, xếp xuống dòng dưới */
  .tpl-table .tpl-tbody .vb-hist-voice {
    display: flex;
    grid-row: 2;
    grid-column: 2 / -1;
  }
  .tpl-table .tpl-tbody .vb-hist-preview { max-width: 100%; }
  .tpl-table .tpl-tbody .vb-hist-actions {
    grid-row: 1;
    grid-column: 3;
  }
  .tpl-table .tpl-tbody .vb-hist-err { grid-row: 3; }
}
@media (max-width: 1200px) {
  .tpl-table .tpl-tbody .vb-hist-preview { max-width: 100%; }
}
@media (max-width: 479px) {
  .tpl-divider { display: none; }
  .tpl-left-toolbar { gap: 4px; }
  .tpl-base-input input { min-width: 90px; }
}

/* ── Gemini mockup parity: card shell, toolbar và danh sách ── */
body.tpl-canvas .workspace {
  background: #f5f7fa;
}
body.tpl-canvas .panel {
  padding: 0 !important;
  background: transparent;
}
body.tpl-canvas .workspace .hist {
  display: none;
}

body.tpl-canvas .tpl-page {
  width: 100%;
}
body.tpl-canvas .tpl-head {
  box-sizing: border-box;
  width: 100%;
  height: 60px;
  min-height: 60px;
  margin: 0;
  padding: 0 24px;
  flex-wrap: nowrap;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}
body.tpl-canvas .tpl-page-body {
  padding: 24px;
}
body.tpl-canvas .tpl-card,
body.tpl-canvas .tpl-list-card {
  background: #fff;
  border: 1px solid #f1f2f5;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
}
body.tpl-canvas .tpl-card {
  padding: 0;
}
body.tpl-canvas .tpl-list-card {
  margin-top: 24px;
}
body.tpl-canvas .tpl-request {
  margin-top: 0;
}

/* Header controls in the mockup are small bordered icon buttons. */
body.tpl-canvas .tpl-util-ico {
  width: 32px;
  height: 32px;
  border: 1px solid #e5e7eb;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
}
body.tpl-canvas .tpl-util-ico svg {
  width: 16px;
  height: 16px;
}

/* Toolbar: each primary control has its own bordered pill. */
body.tpl-canvas .tpl-toolbar-row {
  box-sizing: border-box;
  min-height: 58px;
  padding: 12px;
  gap: 12px;
  border-bottom: 1px solid #f1f2f5;
}
body.tpl-canvas .tpl-left-toolbar {
  gap: 8px;
  padding: 0;
  background: transparent;
  border-radius: 0;
}
body.tpl-canvas .tpl-left-toolbar .tpl-control-group {
  height: 32px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
  padding: 0 12px;
  box-sizing: border-box;
}
body.tpl-canvas .tpl-left-toolbar .tpl-control-group .voice-pick-btn {
  height: 30px;
  padding: 0;
}
body.tpl-canvas .tpl-left-toolbar .voice-pick-btn .vp-av {
  width: 20px;
  height: 20px;
}
body.tpl-canvas .tpl-left-toolbar .voice-pick-btn .vp-mid {
  margin-left: 8px;
}
body.tpl-canvas .tpl-left-toolbar .voice-pick-btn .vp-name {
  font-size: 13px;
}
body.tpl-canvas .tpl-left-toolbar .voice-pick-btn .vp-tags {
  display: none;
}
body.tpl-canvas .tpl-left-toolbar .tpl-speed-group {
  min-width: 72px;
}
body.tpl-canvas .tpl-left-toolbar .tpl-format-group {
  min-width: 74px;
}
body.tpl-canvas .tpl-left-toolbar .tb-speed-wrap,
body.tpl-canvas .tpl-left-toolbar .tpl-dropdown {
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
body.tpl-canvas .tpl-left-toolbar .tpl-dropdown {
  width: 100%;
}
body.tpl-canvas .tpl-left-toolbar .tpl-tool-group {
  gap: 2px;
  padding-left: 8px;
  border-left: 1px solid #e5e7eb;
}
body.tpl-canvas .tpl-left-toolbar .tpl-tool-btn {
  margin-right: 0;
  width: 30px;
  padding: 4px;
  border-radius: 6px;
}
body.tpl-canvas .tpl-right-toolbar {
  gap: 8px;
}
body.tpl-canvas .tpl-right-toolbar .vb-break-pill {
  position: relative;
  min-width: 72px;
  height: 32px;
  padding: 0 4px;
  border: 0;
  border-radius: 6px;
  background: transparent;
}
body.tpl-canvas .tpl-right-toolbar .vb-break-pill:hover {
  background: #f3f4f6;
}
body.tpl-canvas .tpl-right-toolbar .vb-break-pill .vb-break-value,
body.tpl-canvas .tpl-right-toolbar .vb-break-pill .vb-pause-clock,
body.tpl-canvas .tpl-right-toolbar .vb-break-pill .vp-chev {
  pointer-events: none;
}
body.tpl-canvas .tpl-right-toolbar .vb-break-pill .vb-break-value {
  min-width: 2.5em;
  text-align: center;
}
body.tpl-canvas .tpl-right-toolbar .vb-break-pill select {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  min-width: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
  appearance: auto;
  -webkit-appearance: auto;
}
body.tpl-canvas .tpl-right-toolbar .vb-break-pill:focus-within {
  outline: 2px solid var(--tpl-accent);
  outline-offset: 2px;
}
body.tpl-canvas .tpl-right-toolbar .tpl-tool-btn {
  width: 32px;
  height: 32px;
  margin-right: 0;
  padding: 0;
  border: 1px solid #e5e7eb;
  border-radius: 50%;
  background: #fff;
}
body.tpl-canvas .tpl-right-toolbar .tpl-tool-btn:hover {
  background: #f9fafb;
}
body.tpl-canvas .tpl-switch {
  flex-direction: row;
  gap: 8px;
  min-height: 32px;
  margin-left: 4px;
  padding-left: 12px;
  border-left: 1px solid #e5e7eb;
}
body.tpl-canvas .tpl-switch-track {
  order: 2;
}
body.tpl-canvas .tpl-switch > span:not(.tpl-switch-track) {
  order: 1;
}
body.tpl-canvas .tpl-project-btn {
  height: 32px;
  margin-left: 4px;
  padding: 0 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, #8b5cf6 0%, #d946ef 100%);
  color: #fff;
}
body.tpl-canvas .tpl-project-btn:hover {
  background: linear-gradient(90deg, #7c3aed 0%, #c026d3 100%);
}
body.tpl-canvas .tpl-project-btn svg:last-child {
  width: 13px;
  height: 13px;
}
body.tpl-canvas .tpl-speed-icon,
body.tpl-canvas .tpl-format-icon {
  display: inline-flex;
  color: var(--tpl-ink-soft);
}
body.tpl-canvas .tpl-speed-icon svg,
body.tpl-canvas .tpl-format-icon svg {
  width: 16px;
  height: 16px;
}
body.tpl-canvas .tpl-speed-group .tb-bolt {
  display: none;
}
body.tpl-canvas .tpl-format-group {
  gap: 6px;
}

/* Editor and the light footer band. */
body.tpl-canvas .tpl-editor-wrap {
  padding: 24px;
}
body.tpl-canvas .tpl-editor {
  min-height: 192px;
  padding: 0;
  font-size: 15px;
  line-height: 1.625;
}
body.tpl-canvas .tpl-bottom-row {
  box-sizing: border-box;
  align-items: flex-end;
  min-height: 92px;
  padding: 16px 24px;
  gap: 16px;
  background: rgba(249, 250, 251, 0.4);
  border-top: 1px solid #f9fafb;
  border-radius: 0 0 12px 12px;
}
body.tpl-canvas .tpl-samples {
  padding: 0;
}
body.tpl-canvas .tpl-sample {
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
}
body.tpl-canvas .tpl-sample-ico {
  padding: 0 7px 0 0;
  line-height: 32px;
}
body.tpl-canvas .tpl-sample-ico svg {
  width: 15px;
  height: 15px;
  vertical-align: middle;
}
body.tpl-canvas .tpl-sample-ico-1 { color: #6366f1; }
body.tpl-canvas .tpl-sample-ico-2 { color: #3b82f6; }
body.tpl-canvas .tpl-sample-ico-3 { color: #f97316; }
body.tpl-canvas .tpl-sample-ico-4 { color: #14b8a6; }
body.tpl-canvas .tpl-sample-ico-5 { color: #ef4444; }
body.tpl-canvas .tpl-sample-lbl {
  padding-right: 0;
  font-size: 12px;
}
body.tpl-canvas .tpl-actionbar {
  gap: 16px;
}
body.tpl-canvas .tpl-count,
body.tpl-canvas .tpl-dur,
body.tpl-canvas .tpl-cost {
  font-size: 13px;
}
body.tpl-canvas .tpl-dur::before {
  content: "◷";
  margin-right: 4px;
}
body.tpl-canvas .tpl-cta {
  min-width: 0;
  height: 44px;
  margin-left: 0;
  padding: 0 32px;
  border-radius: 999px;
  background: #ffdd00;
  color: #111827;
}
body.tpl-canvas .tpl-cta:hover {
  background: #f5d500;
}

/* List card header, rows and pagination. */
body.tpl-canvas .tpl-request-head {
  box-sizing: border-box;
  min-height: 64px;
  margin: 0;
  padding: 16px;
  border-bottom: 1px solid #f1f2f5;
}
body.tpl-canvas .tpl-request-title-wrap {
  min-width: 0;
  gap: 4px;
}
body.tpl-canvas .tpl-selectall {
  display: inline-flex;
  width: 16px;
  height: 16px;
  padding: 0;
  margin: 0 4px 0 0;
  background: transparent;
  border: 0;
}
body.tpl-canvas .tpl-selectall input {
  width: 16px;
  height: 16px;
  margin: 0;
}
body.tpl-canvas .tpl-request-title {
  font-size: 16px;
}
body.tpl-canvas .tpl-request-filter {
  gap: 8px;
}
body.tpl-canvas .tpl-search-wrap,
body.tpl-canvas .tpl-filter-input {
  width: 192px;
}
body.tpl-canvas .tpl-filter-btn {
  border-radius: 6px;
}
body.tpl-canvas .tpl-table {
  border: 0;
  border-radius: 0;
}
body.tpl-canvas .tpl-table .tpl-tbody .vb-hist-row {
  min-height: 72px;
  padding: 16px;
  grid-template-columns: 20px minmax(0, 1fr) 192px minmax(280px, max-content);
  gap: 16px;
}
body.tpl-canvas .tpl-table .tpl-tbody .vb-hist-preview {
  font-size: 14px;
  font-weight: 500;
}
body.tpl-canvas .tpl-table .tpl-tbody .vb-hist-meta {
  font-size: 11px;
}
body.tpl-canvas .tpl-table .tpl-tbody .vb-hist-actions {
  visibility: visible;
}
body.tpl-canvas .tpl-table .tpl-tbody .vb-hist-act[data-vb-play] {
  border: 0;
  background: #f3f4f6;
}
body.tpl-canvas .tpl-table .tpl-tbody .vb-hist-act[data-vb-play]:hover {
  background: var(--tpl-accent-soft);
}
body.tpl-canvas .tpl-table .tpl-pager {
  min-height: 64px;
  box-sizing: border-box;
  padding: 16px;
  border-top: 1px solid #f1f2f5;
  background: rgba(249, 250, 251, 0.5);
}
body.tpl-canvas .tpl-table .tpl-pager .pg-nav {
  border-radius: 6px;
}

/* Voice metadata added only on the Template history list. */
body.tpl-canvas .tpl-table .vb-hav {
  position: relative;
  display: inline-flex;
}
body.tpl-canvas .tpl-voice-lang {
  position: absolute;
  right: -5px;
  bottom: -3px;
  min-width: 14px;
  height: 14px;
  padding: 0 2px;
  box-sizing: border-box;
  border: 1px solid #fff;
  border-radius: 4px;
  background: #eef2ff;
  color: #4f46e5;
  font-size: 8px;
  font-weight: 700;
  line-height: 12px;
  text-align: center;
}
body.tpl-canvas .tpl-voice-tier {
  display: block;
  margin-left: 0;
  color: var(--tpl-ink-dim);
  font-size: 10px;
  line-height: 16px;
}
body.tpl-canvas .tpl-voice-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

/* Keep all five examples available; narrow screens can scroll the chip row. */
body.tpl-canvas .tpl-sample.tpl-sample-3,
body.tpl-canvas .tpl-sample.tpl-sample-4,
body.tpl-canvas .tpl-sample.tpl-sample-5 {
  display: flex;
}

@media (max-width: 900px) {
  body.tpl-canvas .tpl-table .tpl-tbody .vb-hist-row {
    grid-template-columns: 20px minmax(0, 1fr) auto;
    row-gap: 6px;
    padding: 16px;
  }
  body.tpl-canvas .tpl-table .tpl-tbody .vb-hist-voice {
    display: flex;
    grid-row: 2;
    grid-column: 2 / -1;
  }
  body.tpl-canvas .tpl-table .tpl-tbody .vb-hist-actions {
    grid-row: 1;
    grid-column: 3;
  }
  body.tpl-canvas .tpl-table .tpl-tbody .vb-hist-preview {
    max-width: 100%;
  }
}

@media (max-width: 767px) {
  body.tpl-canvas .tpl-head {
    height: auto;
    min-height: 60px;
    padding: 12px 14px;
    flex-wrap: wrap;
  }
  body.tpl-canvas .tpl-head-utils {
    margin-left: auto;
  }
  body.tpl-canvas .tpl-page-body {
    padding: 16px 14px 24px;
  }
  body.tpl-canvas .tpl-toolbar-row {
    padding: 12px;
  }
  body.tpl-canvas .tpl-left-toolbar,
  body.tpl-canvas .tpl-right-toolbar {
    width: 100%;
  }
  body.tpl-canvas .tpl-right-toolbar {
    justify-content: flex-start;
  }
  body.tpl-canvas .tpl-editor-wrap {
    padding: 16px;
  }
  body.tpl-canvas .tpl-bottom-row {
    padding: 16px;
  }
  body.tpl-canvas .tpl-actionbar {
    width: 100%;
  }
  body.tpl-canvas .tpl-cta {
    margin-left: auto;
  }
  body.tpl-canvas .tpl-request-head {
    align-items: flex-start;
    padding: 12px;
  }
  body.tpl-canvas .tpl-request-title-wrap {
    width: 100%;
  }
  body.tpl-canvas .tpl-request-filter {
    width: 100%;
  }
  body.tpl-canvas .tpl-search-wrap,
  body.tpl-canvas .tpl-filter-input {
    width: 100%;
    min-width: 0;
  }
  body.tpl-canvas .tpl-table .tpl-pager {
    padding: 12px;
  }
}

/* The injected banner stays inert when the user switches away from Template. */
.tpl-flash-sale {
  display: none;
}

/* ── Full Template shell: scoped imitation of Gemini's Vbee page ── */
body.tpl-canvas {
  flex-direction: column;
  background: #f5f7fa;
}
body.tpl-canvas .studio-body {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  background: #f5f7fa;
}
body.tpl-canvas .sidebar {
  width: 260px;
  height: 100%;
  padding: 16px 12px;
  background: #fff;
  border-right: 1px solid #e5e7eb;
}
body.tpl-canvas .main {
  height: 100%;
  background: #f5f7fa;
}
body.tpl-canvas #studioPromo {
  display: none !important;
}
body.tpl-canvas .tpl-flash-sale {
  display: flex;
  flex: 0 0 40px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 40px;
  padding: 8px 16px;
  box-sizing: border-box;
  overflow: hidden;
  background: linear-gradient(90deg, #ff1b00 0%, #ff6a00 100%);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}
body.tpl-canvas .tpl-flash-sale strong {
  color: #ffef70;
  font-size: 13px;
  font-style: italic;
  letter-spacing: .06em;
  white-space: nowrap;
}
body.tpl-canvas .tpl-flash-bolt {
  color: #ffef70;
}
body.tpl-canvas .logo-t {
  font-size: 0;
}
body.tpl-canvas .logo-t::after {
  content: "AIVoice";
  color: #111827;
  font-size: 1rem;
}
body.tpl-canvas .logo-s {
  font-size: 0;
}
body.tpl-canvas .logo-s::after {
  content: "by HVoice";
  color: #6b7280;
  font-size: .62rem;
}
body.tpl-canvas .studio-switch-btn,
body.tpl-canvas .side-credits {
  background: #fff;
  border-color: #e5e7eb;
}
body.tpl-canvas .nav-item {
  border-radius: 8px;
}
body.tpl-canvas .nav-item.active {
  background: #eff6ff;
  color: #2563eb;
  border-left: 4px solid #2563eb;
}
body.tpl-canvas .side-promo-swiper {
  background: #ffdd00;
  border-color: #f5d547;
}
body.tpl-canvas .side-upgrade-btn {
  background: #ffdd00;
  color: #111827;
}
body.tpl-canvas .tpl-player {
  left: 260px;
}

@media (max-width: 1023px) {
  body.tpl-canvas {
    overflow-x: hidden;
    overflow-y: auto;
  }
  body.tpl-canvas .studio-body {
    min-height: calc(100dvh - 40px);
    overflow: visible;
  }
  body.tpl-canvas .sidebar {
    width: 260px;
    height: 100%;
  }
  body.tpl-canvas .main {
    height: auto;
    min-height: calc(100dvh - 40px);
  }
  body.tpl-canvas .tpl-player {
    left: 0;
  }
}
@media (max-width: 599px) {
  body.tpl-canvas .tpl-flash-sale {
    justify-content: flex-start;
    font-size: 10px;
    gap: 6px;
  }
  body.tpl-canvas .tpl-flash-sale span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* Template-only sidebar matching the Gemini reference menu. */
body.tpl-canvas .sidebar {
  overflow: hidden;
}
body.tpl-canvas .tpl-sidebar-original {
  display: none !important;
}
body.tpl-canvas .tpl-sidebar-clone {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  gap: 8px;
  color: #374151;
  font-family: Inter, Arial, sans-serif;
}
body.tpl-canvas .tpl-sidebar-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 4px 10px;
}
body.tpl-canvas .tpl-sidebar-logo-mark {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 6px;
  background: #111827;
  color: #facc15;
}
body.tpl-canvas .tpl-sidebar-logo-mark svg {
  width: 18px;
  height: 18px;
}
body.tpl-canvas .tpl-sidebar-logo strong,
body.tpl-canvas .tpl-sidebar-logo small {
  display: block;
}
body.tpl-canvas .tpl-sidebar-logo strong {
  color: #111827;
  font-size: 16px;
  line-height: 1.1;
}
body.tpl-canvas .tpl-sidebar-logo small {
  margin-top: 2px;
  color: #6b7280;
  font-size: 9px;
}
body.tpl-canvas .tpl-workspace-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  color: #374151;
  font-size: 12px;
  text-align: left;
}
body.tpl-canvas .tpl-workspace-btn > span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
body.tpl-canvas .tpl-workspace-btn i {
  display: grid;
  width: 19px;
  height: 19px;
  place-items: center;
  border-radius: 4px;
  background: #fff1e6;
  color: #f97316;
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
}
body.tpl-canvas .tpl-workspace-btn svg {
  width: 13px;
  height: 13px;
  color: #9ca3af;
}
body.tpl-canvas .tpl-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 2px;
}
body.tpl-canvas .tpl-sidebar-item,
body.tpl-canvas .tpl-sidebar-api {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 32px;
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #4b5563;
  font-size: 12px;
  font-weight: 500;
  text-align: left;
}
body.tpl-canvas .tpl-sidebar-item {
  cursor: pointer;
}
body.tpl-canvas .tpl-sidebar-api {
  cursor: pointer;
  font-family: inherit;
}
body.tpl-canvas .tpl-sidebar-item:hover,
body.tpl-canvas .tpl-sidebar-api:hover {
  background: #f9fafb;
}
body.tpl-canvas .tpl-sidebar-item.active,
body.tpl-canvas .tpl-sidebar-api.active {
  border-left: 3px solid #2563eb;
  border-radius: 4px 7px 7px 4px;
  background: #eff6ff;
  color: #2563eb;
  font-weight: 600;
}
body.tpl-canvas .tpl-sidebar-item svg,
body.tpl-canvas .tpl-sidebar-api svg {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
}
body.tpl-canvas .tpl-nav-ico {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border-radius: 7px;
  transition: transform 0.15s ease;
}
body.tpl-canvas .tpl-nav-ico svg {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
}
body.tpl-canvas .tpl-sidebar-item:hover .tpl-nav-ico,
body.tpl-canvas .tpl-sidebar-api:hover .tpl-nav-ico {
  transform: scale(1.04);
}
body.tpl-canvas .tpl-nav-ico--home { background: #dbeafe; color: #2563eb; }
body.tpl-canvas .tpl-nav-ico--template { background: #ede9fe; color: #7c3aed; }
body.tpl-canvas .tpl-nav-ico--tts { background: #d1fae5; color: #059669; }
body.tpl-canvas .tpl-nav-ico--srt { background: #ffedd5; color: #ea580c; }
body.tpl-canvas .tpl-nav-ico--projects { background: #e2e8f0; color: #475569; }
body.tpl-canvas .tpl-nav-ico--voiceclone { background: #ffe4e6; color: #e11d48; }
body.tpl-canvas .tpl-nav-ico--voice-library { background: #e0e7ff; color: #4f46e5; }
body.tpl-canvas .tpl-nav-ico--pricing { background: #fef3c7; color: #d97706; }
body.tpl-canvas .tpl-nav-ico--referral { background: #fce7f3; color: #db2777; }
body.tpl-canvas .tpl-nav-ico--api { background: #cffafe; color: #0891b2; }
body.tpl-canvas .tpl-sidebar-item.active .tpl-nav-ico {
  box-shadow: 0 0 0 2px color-mix(in srgb, currentColor 28%, transparent);
}
body.tpl-canvas .tpl-sidebar-sep {
  height: 1px;
  margin: 6px 4px;
  background: #f1f2f5;
}
body.tpl-canvas .tpl-sidebar-api {
  position: relative;
}
body.tpl-canvas .tpl-sidebar-api b {
  margin-left: auto;
  padding: 2px 5px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 8px;
}
body.tpl-canvas .tpl-sidebar-promo {
  margin: auto 4px 0;
  padding: 12px 9px;
  overflow: hidden;
  border: 1px solid #f5d547;
  border-radius: 10px;
  background: #ffdd00;
  color: #5c4a00;
  font-size: 10px;
  line-height: 1.35;
  text-align: center;
}
body.tpl-canvas .tpl-sidebar-promo .side-promo-slide {
  display: block;
  font-size: 10px;
}
body.tpl-canvas .tpl-sidebar-promo .side-promo-slide strong {
  color: #3d3200;
  font-size: 11px;
}
body.tpl-canvas .tpl-sidebar-promo a {
  color: #7c5a00;
}
body.tpl-canvas .tpl-sidebar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 4px 0;
  border-top: 1px solid #e5e7eb;
}
body.tpl-canvas .tpl-sidebar-avatar {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  flex: 0 0 28px;
  border-radius: 50%;
  background: #facc15;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
body.tpl-canvas .tpl-sidebar-user-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}
body.tpl-canvas .tpl-sidebar-user-copy strong,
body.tpl-canvas .tpl-sidebar-user-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body.tpl-canvas .tpl-sidebar-user-copy strong {
  color: #1f2937;
  font-size: 11px;
}
body.tpl-canvas .tpl-sidebar-user-copy small {
  color: #9ca3af;
  font-size: 9px;
}
body.tpl-canvas .tpl-sidebar-dots {
  color: #9ca3af;
  font-size: 16px;
}
body.tpl-canvas .tpl-sidebar-mode {
  display: none;
}

@media (max-width: 1023px) {
  body.tpl-canvas .tpl-sidebar-clone {
    overflow-y: auto;
  }
}

/* Compact spacing is limited to the original "Chuyển văn bản" tab. */
body.tpl-canvas.tpl-tts-tab .tpl-page-body {
  padding: 14px 16px 18px;
}
body.tpl-canvas.tpl-tts-tab .tpl-list-card {
  margin-top: 16px;
}
body.tpl-canvas.tpl-tts-tab .tpl-table .tpl-tbody {
  max-height: 360px;
  overflow-y: auto;
}
body.tpl-canvas.tpl-tts-tab .tpl-toolbar-row {
  min-height: 50px;
  padding: 8px 10px;
  gap: 8px;
}
body.tpl-canvas.tpl-tts-tab .tpl-left-toolbar,
body.tpl-canvas.tpl-tts-tab .tpl-right-toolbar {
  gap: 5px;
}
body.tpl-canvas.tpl-tts-tab .tpl-left-toolbar .tpl-control-group {
  height: 30px;
  padding: 0 8px;
}
body.tpl-canvas.tpl-tts-tab .tpl-left-toolbar .voice-pick-btn {
  max-width: 210px;
}
body.tpl-canvas.tpl-tts-tab .tpl-right-toolbar {
  gap: 4px;
}
body.tpl-canvas.tpl-tts-tab .tpl-editor-wrap {
  padding: 14px 16px;
}
body.tpl-canvas.tpl-tts-tab .tpl-editor {
  min-height: 220px;
}
body.tpl-canvas.tpl-tts-tab .tpl-bottom-row {
  min-height: 72px;
  padding: 10px 16px;
  gap: 10px;
}
body.tpl-canvas.tpl-tts-tab .tpl-sample {
  height: 30px;
  padding: 0 10px;
}
body.tpl-canvas.tpl-tts-tab .tpl-actionbar {
  gap: 10px;
}
body.tpl-canvas.tpl-tts-tab .tpl-cta {
  height: 38px;
  padding: 0 22px;
}

@media (max-width: 767px) {
  body.tpl-canvas.tpl-tts-tab .tpl-page-body {
    padding: 12px 10px 18px;
  }
  body.tpl-canvas.tpl-tts-tab .tpl-toolbar-row {
    padding: 8px;
    flex-wrap: wrap;
  }
  body.tpl-canvas.tpl-tts-tab .tpl-left-toolbar,
  body.tpl-canvas.tpl-tts-tab .tpl-right-toolbar {
    width: 100%;
    flex-wrap: wrap;
  }
  body.tpl-canvas.tpl-tts-tab .tpl-editor-wrap {
    padding: 12px;
  }
  body.tpl-canvas.tpl-tts-tab .tpl-bottom-row {
    position: sticky;
    bottom: 0;
    z-index: 35;
    padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px));
    background: #fff;
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -6px 20px rgba(15, 23, 42, .08);
  }
  body.tpl-canvas.tpl-tts-tab .tpl-actionbar {
    width: 100%;
  }
  body.tpl-canvas.tpl-tts-tab .tpl-cta {
    width: 100%;
    margin-left: 0;
    justify-content: center;
  }
}

/* Custom break-time picker: the whole control and its arrow open one menu. */
body.tpl-canvas .vb-break-picker {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
}
body.tpl-canvas .vb-break-picker .vb-break-pill {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  line-height: 1;
  white-space: nowrap;
}
body.tpl-canvas .vb-break-picker .vb-break-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 80;
  display: none;
  min-width: 78px;
  padding: 4px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
}
body.tpl-canvas .vb-break-picker.open .vb-break-menu {
  display: grid;
  gap: 2px;
}
body.tpl-canvas .vb-break-picker .vb-break-menu button {
  min-height: 30px;
  padding: 5px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #374151;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
body.tpl-canvas .vb-break-picker .vb-break-menu button:hover,
body.tpl-canvas .vb-break-picker .vb-break-menu button[aria-selected="true"] {
  background: #eff6ff;
  color: #2563eb;
}
body.tpl-canvas .vb-break-picker .vb-break-menu button:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: -2px;
}
body.tpl-canvas .vb-break-picker .vb-break-native {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  clip-path: inset(50%);
}
body.tpl-canvas .vb-break-picker .vb-break-pill {
  gap: 6px;
  min-width: 0;
  padding: 0 9px 0 8px;
  border: 1px solid #e5e7eb;
  border-right: 0;
  border-radius: 6px 0 0 6px;
  background: #fff;
  overflow: hidden;
}
body.tpl-canvas .vb-break-picker .vb-break-arrow {
  display: inline-flex;
  align-items: center;
  align-self: stretch;
  justify-content: center;
  width: 24px;
  margin: 0;
  padding: 0;
  border: 1px solid #e5e7eb;
  border-radius: 0 6px 6px 0;
  background: #fff;
  color: #6b7280;
  cursor: pointer;
}
body.tpl-canvas .vb-break-picker .vb-break-arrow .vp-chev {
  line-height: 1;
}
body.tpl-canvas .vb-break-picker .vb-break-main:hover,
body.tpl-canvas .vb-break-picker .vb-break-arrow:hover {
  background: #f9fafb;
}
body.tpl-canvas .vb-break-picker .vb-break-arrow:focus-visible,
body.tpl-canvas .vb-break-picker .vb-break-main:focus-visible {
  z-index: 3;
  outline: 2px solid var(--tpl-accent);
  outline-offset: 1px;
}


/* ── TTS tabs: Chuyển đổi | Lịch sử (gọn, không kéo full width) ── */
body.tpl-canvas.tpl-tts-tab .tpl-tts-tabs {
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
  margin: 0 0 14px;
  padding: 0;
  width: fit-content;
  max-width: 100%;
  background: transparent;
  border-radius: 0;
  border-bottom: 1px solid #e5e7eb;
}
body.tpl-canvas.tpl-tts-tab .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;
  box-shadow: none;
  white-space: nowrap;
}
body.tpl-canvas.tpl-tts-tab .tpl-tts-tab:hover {
  color: #374151;
}
body.tpl-canvas.tpl-tts-tab .tpl-tts-tab.is-active {
  background: transparent;
  color: #15803d;
  border-bottom-color: #22c55e;
  box-shadow: none;
}
body.tpl-canvas.tpl-tts-tab .tpl-tts-panel-history .tpl-list-card {
  margin-top: 0;
}
body.tpl-canvas.tpl-tts-tab .tpl-tts-panel-history .tpl-table .tpl-tbody,
body.tpl-canvas.tpl-tts-tab .tpl-tts-panel-history #vbHistList {
  max-height: min(70vh, calc(100vh - 220px));
  overflow-y: auto;
}

