﻿:root {
  /* Klandify / SaasLanding */
  --navy: #1e293b;
  --navy-light: #334155;
  --bg: #f8f9fa;
  --bg-elevated: #ffffff;
  --card: #ffffff;
  --text: #212529;
  --muted: #6c757d;
  --border: #dee2e6;
  --border-strong: #ced4da;
  --accent: #0d6efd;
  --accent-soft: #e7f1ff;
  --accent-hover: #0b5ed7;
  --green: #198754;
  --green-bg: #d1e7dd;
  --yellow: #d97706;
  --yellow-bg: #fef3c7;
  --red: #dc3545;
  --red-bg: #f8d7da;
  --blue: #0d6efd;
  --blue-bg: #e7f1ff;
  --purple: #764ba2;
  --purple-bg: rgba(118, 75, 162, 0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 6px rgba(0,0,0,0.05);
  --shadow-hover: 0 5px 15px rgba(0,0,0,0.1);
  --sidebar-w: 260px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  touch-action: manipulation;
  overflow-x: clip;
  height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  letter-spacing: 0;
  font-weight: 400;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 100%;
  overflow-x: clip;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

html.scroll-locked,
body.scroll-locked {
  overflow: hidden !important;
  overscroll-behavior: none;
}

body.scroll-locked {
  position: fixed;
  width: 100%;
  left: 0;
  right: 0;
}

.app {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 100%;
  overflow-x: clip;
}

/* â”€â”€ Sidebar (Klandify) â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.sidebar {
  width: var(--sidebar-w);
  background: #ffffff;
  color: #343a40;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  border-right: 1px solid var(--border);
  padding: 0;
  transition: transform 0.4s var(--ease-out);
}

.sidebar-brand {
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.5rem;
}

.sidebar-brand-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
button.sidebar-brand-home {
  width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 10px;
  -webkit-tap-highlight-color: transparent;
}
button.sidebar-brand-home:hover { opacity: 0.88; }
button.sidebar-brand-home:active { opacity: 0.75; }

.sidebar-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: contain;
  flex-shrink: 0;
  background: #fff;
  padding: 2px;
}

.sidebar-brand-text { min-width: 0; flex: 1; }

.sidebar-brand h1 {
  font-family: var(--font);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.sidebar-nav { padding: 0.5rem 1rem 1rem; flex: 1; overflow-y: auto; }

.nav-section {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  padding: 0.85rem 1rem 0.35rem;
  font-weight: 500;
  opacity: 0.85;
}

.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 0.65rem 0.75rem;
}

.nav-section-empty {
  margin: 0.25rem 1rem 0.5rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.nav-link-modality {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--muted);
  padding: 0.5rem 0.85rem;
  margin: 0.05rem 0;
}

.nav-link-modality .nav-ico {
  opacity: 0.85;
}

.nav-link-modality:hover {
  color: var(--text);
  background: var(--bg);
}

.nav-link-modality.active {
  background: rgba(91, 61, 158, 0.1);
  color: #5b3d9e;
  font-weight: 600;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  color: #343a40;
  text-decoration: none;
  font-size: 0.925rem;
  font-weight: 500;
  letter-spacing: 0;
  margin: 0.15rem 0;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s var(--ease);
}

.nav-link-primary {
  font-weight: 600;
  color: var(--text);
}

.nav-link-quiet {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  padding: 0.65rem 1rem;
}

.nav-link-cta {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff !important;
  font-weight: 600;
  margin: 0.5rem 0 0.65rem;
  border: none;
  box-shadow: 0 3px 12px rgba(102, 126, 234, 0.25);
}

.nav-link-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
  color: #fff !important;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.nav-link-featured {
  background: var(--accent-soft);
  border: none;
  color: var(--accent);
  padding: 0.75rem 1rem;
  margin-bottom: 0.35rem;
  border-radius: 8px;
}

.nav-link-featured .nav-label {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
}

.nav-link-featured .nav-label strong {
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: -0.01em;
}

.nav-link-featured .nav-label small {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0;
  text-transform: none;
}

.nav-link-featured:hover {
  background: #dbeafe;
  color: var(--accent-hover);
}

.nav-link-featured.active {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: none;
}

.nav-link:hover { background: var(--bg); color: var(--text); }
.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  box-shadow: none;
}
.nav-link-quiet.active { color: var(--accent); font-weight: 600; }
.nav-icon {
  width: 1.1rem;
  min-width: 1.1rem;
  height: 1.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.95rem;
  line-height: 1;
  font-style: normal;
  opacity: 0.85;
}
.nav-icon-lg { font-size: 1.05rem; }

.nav-emoji {
  font-size: 0.85rem;
  line-height: 1;
  flex-shrink: 0;
  opacity: 0.7;
}

.icon {
  display: inline-block;
  width: 0.95rem;
  height: 0.95rem;
  vertical-align: middle;
  flex-shrink: 0;
  opacity: 0.88;
}
.icon-xs { width: 0.75rem; height: 0.75rem; }
.icon-sm { width: 0.85rem; height: 0.85rem; }
.icon-md { width: 1.05rem; height: 1.05rem; }
.icon-lg { width: 1.25rem; height: 1.25rem; }
.icon-xl { width: 1.85rem; height: 1.85rem; }
.icon-zone { width: 1.4rem; height: 1.4rem; opacity: 0.45; }
.icon-empty { width: 2rem; height: 2rem; opacity: 0.28; }
.icon-nav {
  width: 1rem;
  height: 1rem;
  opacity: 0.72;
}
.nav-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  flex-shrink: 0;
}
.nav-link.active .icon-nav,
.nav-link:hover .icon-nav,
.nav-link-primary .icon-nav,
.nav-link-cta .icon-nav {
  opacity: 1;
}

.empty-emoji {
  display: block;
  font-size: 2.5rem;
  line-height: 1;
  margin-bottom: 0.75rem;
  opacity: 0.45;
}

.btn-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.btn-with-icon .icon { margin: 0; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.28rem;
  min-width: 1.7rem;
  min-height: 1.7rem;
}
.icon-btn .icon { margin: 0; }

.page-back-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
}
.page-back-icon .icon { width: 1.1rem; height: 1.1rem; }

.empty-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.zone-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 0.35rem;
}

.video-card-play-btn .icon {
  width: 2rem;
  height: 2rem;
  opacity: 0.92;
}

.vm-center-btn .icon {
  width: 1.75rem;
  height: 1.75rem;
}

.alert-banner .icon-inline {
  display: inline-flex;
  vertical-align: -0.15em;
  margin-right: 0.35rem;
}
.alert-banner .icon-inline .icon {
  width: 1rem;
  height: 1rem;
}

.ref-thumb-remove,
.job-del-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ref-thumb-remove .icon,
.job-del-btn .icon {
  width: 0.85rem;
  height: 0.85rem;
}

.sidebar-footer {
  padding: 0.85rem 1rem 1.1rem;
  border-top: 1px solid var(--border);
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.sidebar-status {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.status-dot {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--muted);
}

.status-dot .icon {
  width: 0.85rem;
  height: 0.85rem;
  opacity: 0.75;
  flex-shrink: 0;
}

.status-dot .nav-emoji {
  opacity: 0.85;
}

.status-dot::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #adb5bd;
  flex-shrink: 0;
}

.status-dot.ok::before { background: #198754; }
.status-dot.ok { color: #495057; }

/* â”€â”€ Main â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 100%;
  overflow-x: clip;
}

.view {
  padding: 2rem 2.25rem 3.5rem;
  max-width: 1400px;
  width: 100%;
  overflow-x: clip;
  will-change: opacity, transform;
}

/* Screen shell (subtle): elements use .el-reveal for the main motion */
@keyframes viewMicroIn {
  from { opacity: 0.4; }
  to { opacity: 1; }
}
@keyframes viewMicroOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

.view.view-exit {
  animation: viewMicroOut 0.1s ease both;
  pointer-events: none;
}
.view.view-enter {
  animation: viewMicroIn 0.2s ease both;
}

/* Elements appear with staggered micro-motion */
@keyframes elReveal {
  from {
  opacity: 0;
  transform: translateY(14px);
  }
  to {
  opacity: 1;
  transform: none;
  }
}
.el-reveal {
  animation: elReveal 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: var(--reveal-delay, 0ms);
}

@media (prefers-reduced-motion: reduce) {
  .view.view-exit,
  .view.view-enter,
  .el-reveal {
  animation: none !important;
  filter: none !important;
  transform: none !important;
  }
}

/* â”€â”€ Page header â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.page-header h2 {
  font-family: var(--font);
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text);
}

.page-header p {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 400;
  margin-top: 0.35rem;
  letter-spacing: 0.01em;
  max-width: 36rem;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Library hero actions: Video / Images (grand like Generate) */
.lib-page-header {
  align-items: center;
  gap: 1rem;
}
.lib-page-titling { min-width: 0; flex: 1; }
.lib-hero-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: auto;
}
.btn-lib-refresh,
.btn-lib-new {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin: 0;
  border: none;
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}
.btn-lib-refresh {
  min-height: 48px;
  padding: 0.65rem 1.05rem;
  border-radius: 14px;
  background: #fff;
  color: var(--ink, #1e293b);
  font-size: 0.95rem;
  font-weight: 700;
  border: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}
.btn-lib-refresh:hover { background: var(--bg); }
.btn-lib-refresh:active { transform: scale(0.98); }
.btn-lib-new {
  min-height: 52px;
  padding: 0.75rem 1.35rem;
  border-radius: 16px;
  color: #fff !important;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(145deg, #8b7cf5 0%, #5b3d9e 55%, #4a2f86 100%) !important;
  box-shadow: 0 10px 28px rgba(91, 61, 158, 0.4);
}
.btn-lib-new:hover { filter: brightness(1.04); }
.btn-lib-new:active { transform: scale(0.98); }
.btn-lib-new-xl {
  width: 100%;
  max-width: 420px;
  min-height: 64px !important;
  font-size: 1.22rem !important;
  border-radius: 18px !important;
  padding: 0.95rem 1.4rem !important;
  box-shadow: 0 14px 36px rgba(91, 61, 158, 0.42) !important;
}
.lib-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.45rem;
  padding: 2.25rem 1rem 2.75rem;
}
.lib-empty-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: var(--text);
}
.lib-empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: center;
  margin-top: 1rem;
}

.lib-empty-lead {
  margin: 0 0 1rem;
  max-width: 22rem;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--muted);
}

/* Images → New: start from prompt or photo */
.image-start-overlay {
  z-index: 280;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.45);
}
.image-start-sheet {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 1.35rem 1.2rem 1.4rem;
  border-radius: 18px 18px 14px 14px;
  background: #fff;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.22);
  animation: elReveal 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.image-start-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.image-start-title {
  margin: 0 2rem 0.25rem 0;
  font-size: 1.35rem;
  font-weight: 750;
  letter-spacing: -0.02em;
}
.image-start-lead {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.image-start-grid {
  display: grid;
  gap: 0.55rem;
}
@media (min-width: 769px) {
  .image-start-overlay {
  align-items: center;
  }
  .image-start-sheet {
  border-radius: 16px;
  }
}

/* â”€â”€ Prompt library (card list, mobile-first) â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.prompt-library {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.prompt-lib-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow);
}

.prompt-lib-text {
  font-size: 0.85rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  max-height: 12rem;
  overflow-y: auto;
}

.prompt-lib-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.65rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
}

.prompt-del-btn { color: var(--red) !important; }

.videos-filters { margin-bottom: 1rem; }

/* â”€â”€ Buttons â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.25;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.2s var(--ease);
  min-height: 36px;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.btn:active:not(:disabled) { transform: translateY(0); opacity: 0.95; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.btn-green {
  background: #fff;
  color: #198754;
  border: 1px solid #198754;
}
.btn-green:hover:not(:disabled) {
  background: #d1e7dd;
  color: #146c43;
}
.btn-genera {
  background: #0d6efd;
  color: #fff;
  border-color: #0d6efd;
  font-weight: 600;
  padding: 0.45rem 1rem;
  font-size: 0.875rem;
  letter-spacing: 0;
  box-shadow: 0 2px 8px rgba(13, 110, 253, 0.22);
}
.btn-genera:hover:not(:disabled) {
  background: #0b5ed7;
  border-color: #0b5ed7;
}
.btn-ghost {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}
.btn-sm {
  padding: 0.32rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 500;
  min-height: 32px;
}
.btn-full { width: 100%; justify-content: center; }
.btn-danger {
  background: transparent;
  color: var(--red);
  border: 1px solid rgba(212, 114, 106, 0.35);
}
.btn-danger:hover:not(:disabled) {
  background: var(--red-bg);
}

/* â”€â”€ KPI bar â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.kpi-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.kpi {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  animation: none !important;
  transform: none !important;
}
#jobsKpiBar .kpi,
#jobsKpiBar .kpi-value {
  animation: none !important;
  transition: none !important;
}

.kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.kpi-label { font-size: 0.8rem; color: var(--muted); margin-top: 0.2rem; }
.kpi.info .kpi-value { color: var(--blue); }
.kpi.success .kpi-value { color: var(--green); }
.kpi.warning .kpi-value { color: var(--yellow); }
.kpi.danger .kpi-value { color: var(--red); }

/* â”€â”€ Cards â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 1.35rem 1.4rem;
  transition: box-shadow 0.28s var(--ease), transform 0.28s var(--ease);
}

.card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.card-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.75rem;
  display: block;
}

/* â”€â”€ Batch layout â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.batch-page {
  position: relative;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}
.batch-lite,
.still-create {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}

/* Create page: keep the column truly centered in the main area */
.view:has(.batch-page) {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.view:has(.batch-page) > .batch-page {
  width: 100%;
}

.batch-topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
}
.batch-topbar-title { min-width: 0; }
.batch-topbar-title h2 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--text);
}
.batch-topbar-title p {
  margin: 0.1rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}
.batch-header { margin-bottom: 0.35rem; }
.batch-header-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
}
.batch-header h2 { font-size: 1.1rem; margin: 0; flex: 1; min-width: 0; }
.batch-header p { display: none; }

.page-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.65rem 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.page-back-btn:hover {
  background: var(--blue-bg);
  border-color: #93c5fd;
  color: var(--blue);
}
.page-back-icon {
  font-size: 1rem;
  line-height: 1;
}
.page-back-label { line-height: 1.2; }

.batch-flow {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

/* ── Create flow: light / native ───────────────────────── */
.batch-page-lite .batch-flow { gap: 0.65rem; }
.batch-page-lite .batch-section {
  padding: 0.55rem 0;
  box-shadow: none !important;
  border: none !important;
  border-radius: 0;
  background: transparent;
}
.batch-page-lite .batch-topbar { margin-bottom: 0.4rem; }
.batch-page-lite .batch-topbar-title h2 { font-size: 1.05rem; }
.batch-page-lite .batch-topbar-title p { font-size: 0.75rem; }

@media (max-width: 768px) {
  .batch-page {
  width: 100%;
  max-width: 100%;
  padding-bottom: 0.15rem;
  }
  .batch-page-lite .batch-flow { gap: 0.55rem; }
  .batch-page-lite .batch-section {
  padding: 0.45rem 0;
  }
  .batch-page-lite .batch-topbar { margin-bottom: 0.3rem; }
  .batch-step {
  gap: 0.4rem;
  }
  .batch-step-num {
  width: 1.3rem;
  height: 1.3rem;
  font-size: 0.68rem;
  }
  .batch-step .batch-section-head { margin-bottom: 0.3rem; }
  .upload-zone-hero {
  min-height: 6.25rem;
  border-radius: 10px;
  font-size: 0.88rem !important;
  }
  .vid-preview.compact {
  max-height: 36vh;
  min-height: 120px;
  margin-top: 0.4rem;
  }
  .transform-change-input {
  font-size: 16px !important;
  min-height: 3.4rem;
  border-radius: 12px;
  margin-top: 0.2rem;
  padding: 0.75rem 0.85rem;
  }
  .batch-simple-toggle {
  padding: 0.5rem 0.6rem;
  gap: 0.55rem;
  }
  .batch-lang-select,
  .mode-select {
  font-size: 16px !important;
  min-height: 44px;
  border-radius: 10px;
  margin-bottom: 0.4rem;
  }
  .batch-launch-sticky {
  width: 100%;
  max-width: 100%;
  margin: 1.25rem 0 0 !important;
  padding: 0.85rem 0 0.15rem !important;
  }
  .view:has(.batch-page-lite) {
  padding-bottom: 0.15rem;
  }
  .batch-launch-sticky #btnLaunch,
  .batch-launch-sticky .btn-generate {
  max-width: 100%;
  min-height: 68px !important;
  font-size: 1.28rem !important;
  border-radius: 18px !important;
  }
  .batch-launch .launch-estimate {
  margin-top: 0.35rem;
  }
  .create-chosen-pill {
  margin: 0 auto 0.35rem;
  }
  .view:has(.batch-page) {
  padding-left: 0.9rem;
  padding-right: 0.9rem;
  }
  .ratio-picker {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.3rem;
  }
  .duration-control {
  max-width: 100%;
  }
  .quick-fill-chips {
  margin-top: 0.35rem;
  gap: 0.28rem;
  }
}

.create-path-chooser {
  width: 100%;
  max-width: 420px;
  margin: 0.25rem auto 0;
}

.create-path-lead {
  margin: 0 0 0.55rem;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
}

.create-path-card-hero {
  border-color: rgba(91, 61, 158, 0.4) !important;
  background: linear-gradient(180deg, rgba(91, 61, 158, 0.08), #fff 55%) !important;
  order: -1;
}
.create-path-card-hero strong {
  font-size: 1.05rem !important;
  color: #5b3d9e;
}

.batch-step-creative {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}
.batch-step-prompt .batch-step-body {
  padding-top: 0.15rem;
}
.prompt-field-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #5b3d9e;
}
.prompt-field-ico {
  display: inline-flex;
  color: #5b3d9e;
}
.creative-step-lead {
  margin: 0 0 0.55rem;
  font-size: 0.84rem;
  color: var(--text);
  line-height: 1.35;
}
.creative-input,
.prompt-box {
  min-height: 7.5rem !important;
  border: 1.5px solid rgba(91, 61, 158, 0.28) !important;
  background: #fff !important;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03) !important;
  border-radius: 14px !important;
  padding: 0.85rem 0.95rem !important;
  font-size: 0.95rem !important;
  line-height: 1.45 !important;
}
.prompt-box:focus {
  outline: none !important;
  border-color: #5b3d9e !important;
  box-shadow: 0 0 0 3px rgba(91, 61, 158, 0.14) !important;
}
.prompt-box::placeholder {
  color: #94a3b8;
}
.creative-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.55rem;
}

.create-path-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.45rem;
}

.create-path-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  padding: 0.9rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.1s ease, border-color 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}

.create-path-card:active { background: var(--bg); }
.create-path-card:hover { border-color: rgba(91, 61, 158, 0.35); }

.create-path-ico {
  display: inline-flex;
  width: 1.75rem;
  height: 1.75rem;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(91, 61, 158, 0.1);
  color: #5b3d9e;
  margin-bottom: 0.1rem;
}

.create-path-card strong {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.create-path-card > span:last-child {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
}

.modality-grid-lead {
  margin: 0 0 0.4rem;
  font-size: 0.74rem;
  color: var(--muted);
  line-height: 1.3;
  text-align: center;
}

.modality-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  gap: 0.35rem;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}

.modality-picker-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.modality-your-prompt {
  width: 100%;
  text-align: left;
  cursor: pointer;
}
.modality-templates-label {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}
.modality-card {
  display: flex;
  flex-direction: column;
  flex: 0 0 calc((100% - 0.7rem) / 3);
  width: calc((100% - 0.7rem) / 3);
  max-width: calc((100% - 0.7rem) / 3);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  text-align: center;
  cursor: pointer;
  font-family: inherit;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  content-visibility: auto;
  contain: content;
}

.modality-card:active { opacity: 0.92; }

.modality-card.active {
  border-color: #5b3d9e;
  box-shadow: 0 0 0 2px rgba(91, 61, 158, 0.18);
}

.modality-video-wrap {
  position: relative;
  aspect-ratio: 9 / 12;
  max-height: 148px;
  width: 100%;
  background: #0f172a;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modality-video-wrap-sm {
  aspect-ratio: 9 / 12;
  max-height: 72px;
  border-radius: 8px;
}

.modality-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
  margin: 0 auto;
  background: #0f172a;
}

.modality-video-badge {
  position: absolute;
  left: 50%;
  bottom: 0.3rem;
  transform: translateX(-50%);
  padding: 0.12rem 0.32rem;
  border-radius: 5px;
  font-size: 0.52rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(15, 23, 42, 0.72);
  white-space: nowrap;
  max-width: calc(100% - 0.4rem);
  overflow: hidden;
  text-overflow: ellipsis;
}

.modality-card-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.08rem;
  padding: 0.35rem 0.28rem 0.4rem;
  text-align: center;
}

.modality-card-body strong {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.modality-result {
  font-size: 0.58rem;
  color: var(--muted);
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.create-chosen {
  display: flex;
  gap: 0.7rem;
  align-items: center;
}

.create-chosen-video {
  width: 68px;
  flex-shrink: 0;
}

.create-chosen-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.create-chosen-kicker {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.create-chosen-text strong {
  font-size: 0.95rem;
  letter-spacing: -0.02em;
}

.create-chosen-text > span:last-child {
  font-size: 0.74rem;
  color: var(--muted);
  line-height: 1.3;
}

.create-chosen-lite {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.create-chosen-pill {
  display: flex;
  align-self: center;
  justify-content: center;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: rgba(91, 61, 158, 0.08);
  color: #5b3d9e;
  font-size: 0.72rem;
  margin-bottom: 0.35rem;
}
.create-chosen-pill strong {
  font-weight: 700;
  letter-spacing: -0.01em;
}

.batch-section-chosen {
  padding: 0.55rem 0.7rem !important;
}

/* Simple 3-step create form: stacked so content is full-width & centered */
.batch-step {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-items: stretch;
  width: 100%;
}
.batch-step-num {
  flex-shrink: 0;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 999px;
  background: #5b3d9e;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  margin: 0;
}
.batch-step-body {
  flex: 1;
  min-width: 0;
  width: 100%;
}
.batch-step .batch-section-head { margin-bottom: 0.4rem; }
.batch-page-lite .batch-section,
.batch-page-lite .batch-step-body,
.batch-page-lite .upload-block,
.batch-page-lite .duration-control,
.batch-page-lite .ratio-picker,
.batch-page-lite .transform-change-input,
.batch-page-lite .creative-input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.batch-page-lite .batch-topbar {
  width: 100%;
}
.batch-page-lite .batch-flow {
  width: 100%;
  align-items: stretch;
}

.upload-zone-hero {
  min-height: 7.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-size: 0.92rem !important;
  font-weight: 700;
  border-style: dashed;
}

.batch-field-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0.15rem 0 0.35rem;
}
.batch-lang-select { margin-bottom: 0.55rem; }

.batch-simple-toggles {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.batch-simple-toggle {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}
.batch-simple-toggle input {
  margin-top: 0.15rem;
  width: 1.05rem;
  height: 1.05rem;
  accent-color: #5b3d9e;
  flex-shrink: 0;
}
.batch-simple-toggle span {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}
.batch-simple-toggle strong {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text);
}
.batch-simple-toggle small {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 400;
  line-height: 1.3;
}
.lang-step-lead {
  margin: 0 0 0.55rem;
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--muted);
}
.lang-uses {
  margin: 0.55rem 0 0.65rem;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  background: rgba(91, 61, 158, 0.06);
  border: 1px solid rgba(91, 61, 158, 0.18);
}
.lang-uses-title {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #5b3d9e;
}
.lang-uses-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}
.lang-uses-list li {
  font-size: 0.8rem;
  line-height: 1.35;
  color: var(--text);
}
.lang-uses-list li strong {
  font-weight: 700;
}
.lang-uses-list .lang-use-off {
  color: var(--muted);
}
.lang-uses-list .lang-use-extra {
  color: #4a2f86;
}
.lang-uses-foot {
  margin: 0.45rem 0 0;
  font-size: 0.74rem;
  line-height: 1.35;
  color: var(--muted);
}
.lang-extra-hint {
  margin: 0.2rem 0 0.4rem;
  font-size: 0.72rem;
  line-height: 1.3;
  color: #5b3d9e;
  font-weight: 650;
}

.batch-simple-toggle:has(input:checked) {
  border-color: rgba(91, 61, 158, 0.35);
  background: rgba(91, 61, 158, 0.06);
}
.batch-simple-toggle-inline {
  margin-top: 0.35rem;
  padding: 0.5rem 0.65rem;
}

.translate-targets {
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border);
}
.translate-targets.hidden { display: none !important; }

.batch-change-auto {
  margin: 0;
  font-size: 0.84rem;
  color: var(--text);
  line-height: 1.4;
}
.compact-hint { margin: 0.4rem 0 0 !important; }

/* Duration step: ask clearly (esp. photo → video) */
.batch-step-duration {
  border-color: rgba(91, 61, 158, 0.28) !important;
  background: rgba(91, 61, 158, 0.04) !important;
}
.duration-step-lead {
  margin: 0 0 0.55rem;
  font-size: 0.86rem;
  font-weight: 650;
  color: var(--text);
  line-height: 1.35;
}
.dur-pick-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  margin-bottom: 0.65rem;
}
.dur-pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  min-height: 3.4rem;
  padding: 0.45rem 0.3rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.dur-pick strong {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
}
.dur-pick small {
  font-size: 0.62rem;
  color: var(--muted);
  font-weight: 500;
}
.dur-pick.active {
  border-color: #5b3d9e;
  background: rgba(91, 61, 158, 0.12);
  box-shadow: 0 0 0 2px rgba(91, 61, 158, 0.18);
}
.dur-pick.active strong { color: #5b3d9e; }
.batch-step-duration .duration-control {
  margin-top: 0.15rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--border);
}
.batch-step-duration .duration-control-head label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.batch-section-more {
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}
.batch-more {
  border: none;
  background: transparent;
}
.batch-more summary,
.batch-more-tab {
  cursor: pointer;
  list-style: none;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  padding: 0.55rem 1rem 0.55rem 0.9rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: #0f172a;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -1px 0 rgba(15, 23, 42, 0.04);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.batch-more summary::-webkit-details-marker { display: none; }
.batch-more-tab-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.batch-more-tab-label .icon-sm {
  width: 1rem;
  height: 1rem;
  opacity: 0.75;
}
.batch-more-tab-chevron {
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-top: -0.15rem;
  opacity: 0.55;
  transition: transform 0.15s ease;
}
.batch-more[open] > summary,
.batch-more[open] > .batch-more-tab {
  margin-bottom: 0;
  color: #5b3d9e;
  background: #f5f3ff;
  border-color: rgba(91, 61, 158, 0.35);
}
.batch-more[open] .batch-more-tab-chevron {
  transform: rotate(225deg);
  margin-top: 0.15rem;
}
.batch-more-body {
  padding: 0.85rem 1rem 0.9rem;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 0 12px 12px 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.batch-more:not([open]) .batch-more-body { display: none; }
.batch-more:not([open]) > summary,
.batch-more:not([open]) > .batch-more-tab {
  border-bottom: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.batch-launch {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0.35rem 0 0.75rem !important;
}
.batch-launch .btn-block {
  width: 100%;
  justify-content: center;
  min-height: 2.85rem;
  font-size: 1rem;
}
.batch-launch .launch-estimate {
  margin: 0.45rem 0 0;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
}
.btn-block { width: 100%; justify-content: center; }

/* Generate CTA: bottom of form, centered, scroll to reach (not fixed) */
.batch-launch-sticky {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin: 1.5rem auto 0 !important;
  padding: 1rem 0 0.25rem !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  z-index: auto;
  align-self: center;
}
/* Create editor ends at Generate — no dead scroll below */
.batch-page-lite,
.still-create {
  padding-bottom: 0 !important;
}
.batch-page-lite .batch-launch-sticky,
.still-create .batch-launch-sticky {
  margin-bottom: 0 !important;
  padding-bottom: 0.25rem !important;
}
.view:has(.batch-page-lite) {
  padding-bottom: 0.35rem;
}
.batch-launch-sticky #btnLaunch,
.batch-launch-sticky .btn-generate {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  min-height: 66px !important;
  font-size: 1.28rem !important;
  font-weight: 800 !important;
  letter-spacing: -0.02em;
  border: none !important;
  border-radius: 16px !important;
  color: #fff !important;
  background: linear-gradient(145deg, #8b7cf5 0%, #5b3d9e 55%, #4a2f86 100%) !important;
  box-shadow: 0 12px 32px rgba(91, 61, 158, 0.4);
  justify-content: center;
  padding: 0.9rem 1.25rem !important;
}
.batch-launch-sticky #btnLaunch:not(:disabled):active,
.batch-launch-sticky .btn-generate:not(:disabled):active {
  transform: scale(0.98);
}
.batch-launch-sticky #btnLaunch:disabled,
.batch-launch-sticky .btn-generate:disabled {
  opacity: 0.55;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.1);
}
.batch-launch-sticky .launch-estimate {
  order: -1;
  width: 100%;
  margin: 0 !important;
  text-align: center;
  font-weight: 650;
  font-size: 0.82rem;
  color: var(--text);
}
.batch-launch-sticky .launch-need {
  color: #b45309;
}

.vid-preview.compact {
  display: block;
  width: 100%;
  max-height: 260px;
  min-height: 160px;
  margin-top: 0.55rem;
  border-radius: 8px;
  background: #111827;
  object-fit: cover;
}

.duration-auto-hint {
  margin: 0.4rem 0 0 !important;
  color: #5b3d9e !important;
  font-weight: 600;
}

.video-res-hint {
  margin: 0.4rem 0 0 !important;
  color: #b45309 !important;
  font-weight: 600;
}
.video-res-hint.ok {
  color: #15803d !important;
}

.transform-change-input.is-required-empty {
  border-color: transparent;
  box-shadow: inset 0 0 0 1.5px #f59e0b, 0 0 0 3px rgba(245, 158, 11, 0.12);
}

.launch-need {
  color: #b45309;
  font-weight: 600;
}

.quick-fill-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.quick-fill-chip {
  border: 1px solid var(--border);
  background: var(--bg, #f8fafc);
  color: var(--text);
  border-radius: 999px;
  padding: 0.3rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.quick-fill-chip:active {
  background: rgba(91, 61, 158, 0.1);
  border-color: rgba(91, 61, 158, 0.35);
}

.transform-change-input {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.85rem 0.95rem;
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.45;
  resize: vertical;
  min-height: 3.6rem;
  background: var(--bg);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
}

.transform-change-input:focus {
  outline: none;
  background: #fff;
  box-shadow: inset 0 0 0 1.5px rgba(91, 61, 158, 0.35), 0 0 0 3px rgba(124, 108, 240, 0.1);
}

.batch-scratch-preview {
  margin-top: 0.55rem;
  max-height: 140px;
  overflow: auto;
  padding: 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg, #f8fafc);
  font-size: 0.75rem;
  white-space: pre-wrap;
}

.batch-advanced { border: none; }
.batch-advanced summary {
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  list-style: none;
  user-select: none;
}
.batch-advanced summary::-webkit-details-marker { display: none; }
.batch-advanced[open] summary { margin-bottom: 0.55rem; }
.batch-section-advanced {
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
}

@media (max-width: 480px) {
  .create-path-grid { grid-template-columns: 1fr; }
  .modality-grid {
  gap: 0.28rem;
  max-width: 100%;
  }
  .modality-card {
  flex-basis: calc((100% - 0.56rem) / 3);
  width: calc((100% - 0.56rem) / 3);
  max-width: calc((100% - 0.56rem) / 3);
  border-radius: 9px;
  }
  .modality-video-wrap { max-height: 128px; }
  .modality-card-body { padding: 0.28rem 0.2rem 0.32rem; }
  .modality-card-body strong { font-size: 0.62rem; }
  .modality-result { font-size: 0.54rem; }
  .batch-lite { max-width: 100%; margin: 0 auto; }
}

.batch-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  box-shadow: var(--shadow);
}

.batch-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.batch-badge {
  font-size: 0.68rem;
  font-weight: 700;
  background: var(--blue-bg);
  color: var(--blue);
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
}

.batch-tag {
  font-size: 0.65rem;
  font-weight: 600;
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-transform: none;
  letter-spacing: 0;
}
.batch-tag.ok { color: var(--green); }

.mode-select {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.82rem;
  background: var(--card);
  color: var(--text);
  margin-bottom: 0.35rem;
}

.batch-section .field-hint {
  margin: 0 0 0.55rem;
  font-size: 0.74rem;
  line-height: 1.4;
}

.batch-section .upload-zone {
  padding: 1rem 0.75rem;
  font-size: 0.82rem;
}

.batch-active-prompt {
  margin: 0.5rem 0 0.65rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--green);
  border-radius: 8px;
  background: rgba(34, 197, 94, 0.06);
}

.batch-active-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.batch-active-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--green);
}

.batch-active-actions {
  display: flex;
  gap: 0.25rem;
}

.batch-active-preview {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text);
}

.batch-active-full {
  margin: 0;
  padding: 0.55rem 0.6rem;
  font-family: inherit;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 160px;
  overflow-y: auto;
  background: var(--bg);
  border-radius: 6px;
  border: 1px solid var(--border);
}

.modal-duplicate-hint {
  margin: 0 0 0.5rem;
  text-align: center;
}

.batch-prompt-hint {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  text-align: center;
}

.batch-prompt-list {
  max-height: 150px;
}

.mode-chips {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.45rem;
}

.mode-chip {
  flex: 1;
  padding: 0.42rem 0.3rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}

.mode-chip.selected {
  border-color: var(--blue);
  background: var(--blue-bg);
  color: var(--blue);
}

.upload-zone.compact {
  padding: 0.65rem 0.5rem;
  font-size: 0.78rem;
  line-height: 1.3;
}
.upload-zone.compact .zone-icon {
  font-size: 1.1rem;
  margin-bottom: 0.15rem;
}

.img-preview.compact {
  max-height: 80px;
  margin-top: 0.4rem;
}

.toolbar.compact {
  margin-bottom: 0.4rem;
  gap: 0.35rem;
}
.toolbar.compact .search-input {
  min-width: 0;
  padding: 0.4rem 0.55rem;
  font-size: 0.82rem;
}
.btn-icon { min-width: 34px; padding-left: 0.4rem; padding-right: 0.4rem; }

.prompt-list.compact {
  max-height: 130px;
  gap: 0.35rem;
}
.prompt-list.compact .prompt-item {
  padding: 0.45rem 0.55rem;
  gap: 0.45rem;
  border-radius: 8px;
}
.prompt-list.compact .prompt-preview {
  font-size: 0.74rem;
  -webkit-line-clamp: 1;
  margin-top: 0.15rem;
}
.prompt-list.compact .prompt-actions {
  flex-direction: row;
  gap: 0.15rem;
}
.prompt-list.compact .prompt-actions .btn {
  padding: 0.15rem 0.35rem;
  font-size: 0.68rem;
  min-height: 0;
}

.lang-grid.compact {
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
  margin-bottom: 0;
}
.lang-grid.compact .lang-chip {
  padding: 0.38rem 0.2rem;
  border-radius: 8px;
}
.lang-grid.compact .lang-code {
  font-size: 0.78rem;
}

.batch-advanced {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.batch-advanced summary {
  padding: 0.55rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.batch-advanced summary::-webkit-details-marker { display: none; }
.batch-advanced-body {
  padding: 0 0.75rem 0.65rem;
  border-top: 1px solid var(--border);
}
.form-group.compact { margin-bottom: 0.45rem; }
.form-group.compact label {
  font-size: 0.68rem;
  margin-bottom: 0.15rem;
}
.form-group.compact select {
  padding: 0.35rem 0.5rem;
  font-size: 0.8rem;
}
.form-row-3.compact { gap: 0.4rem; }
.checkbox-row.compact {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

.batch-launch {
  margin-bottom: 1rem;
  padding: 0.7rem 0.85rem !important;
}
.batch-launch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.batch-launch .launch-estimate {
  font-size: 0.8rem;
  margin: 0;
  text-align: left;
  background: transparent;
  border: none;
  padding: 0;
  color: var(--muted);
}
.batch-launch .launch-estimate strong { color: var(--accent); font-weight: 700; }
.batch-launch .launch-estimate .launch-cost,
.launch-estimate .launch-cost {
  color: var(--ink, #1e293b);
  font-variant-numeric: tabular-nums;
}
.batch-launch-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.batch-launch .btn-genera,
.batch-launch #btnLaunch:not(.btn-generate) {
  min-height: 36px;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.45rem 1rem;
}
.translate-preview-btn {
  margin-top: 0;
  min-height: 32px;
}
.batch-prompt-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}
.batch-inline-hint {
  margin: 0 !important;
  font-size: 0.78rem;
}
.batch-prompt-hint {
  text-align: left !important;
  margin-top: 0.45rem !important;
}
.batch-advanced summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.batch-advanced-hint {
  font-size: 0.72rem;
  font-weight: 500;
  color: #adb5bd;
  text-transform: none;
  letter-spacing: 0;
}

.translate-test-box {
  margin-bottom: 0.65rem;
}

.translate-test-label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.translate-test-input {
  min-height: 88px;
  max-height: 160px;
  resize: vertical;
  font-size: 0.9rem !important;
}

.modal-translate-preview .translate-preview-body {
  max-height: min(70vh, 520px);
  overflow-y: auto;
}

.translate-preview-block {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.translate-preview-block:first-of-type {
  margin-top: 0.5rem;
  padding-top: 0;
  border-top: none;
}

.translate-preview-block-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.translate-preview-tag {
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--border);
}

.translate-preview-meta {
  font-size: 0.82rem;
  margin-bottom: 0.5rem;
}

.translate-preview-meta.muted { color: var(--muted); }

.translate-preview-label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.translate-preview-text {
  min-height: 160px;
  max-height: 280px;
  resize: vertical;
}

.translate-preview-text-sm {
  min-height: 100px;
  max-height: 200px;
}

.translate-preview-details {
  margin-top: 0.65rem;
  font-size: 0.82rem;
}

.translate-preview-details summary {
  cursor: pointer;
  color: var(--blue);
  margin-bottom: 0.35rem;
}

.duplicate-modal-meta {
  margin-bottom: 0.65rem;
}

.duplicate-modal-warn {
  margin-bottom: 0.65rem;
}

.duplicate-prompt-view {
  min-height: 140px;
  max-height: 320px;
  resize: vertical;
}

.videos-empty-cta {
  max-width: 360px;
  margin: 0 auto 1rem;
  padding: 0 0.5rem;
}
.videos-empty-cta .btn { min-height: 36px; font-size: 0.84rem; font-weight: 600; }

.alert-banner.compact {
  padding: 0.45rem 0.65rem;
  font-size: 0.78rem;
  margin-bottom: 0.45rem;
}

.batch-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
  margin-bottom: 1.25rem;
}

.batch-bottom {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.25rem;
  align-items: start;
}

/* â”€â”€ Upload immagine â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.image-mode-select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.875rem;
  background: var(--bg);
  color: var(--text);
  margin-bottom: 1rem;
}

.upload-block { margin-bottom: 0.75rem; }

.upload-label-text {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
  font-weight: 500;
}

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  background: #fafbfc;
  line-height: 1.4;
}

.upload-zone:hover,
.upload-zone.drag { border-color: var(--blue); background: var(--blue-bg); color: #0369a1; }
.upload-zone.has-file { border-color: var(--green); background: var(--green-bg); color: #166534; }

.upload-zone.upload-zone-green {
  border-color: #86efac;
  border-width: 2px;
  background: var(--green-bg);
  color: #166534;
  font-weight: 600;
}
.upload-zone.upload-zone-green:hover,
.upload-zone.upload-zone-green.drag {
  border-color: var(--green);
  background: #bbf7d0;
  color: #14532d;
}
.upload-zone.upload-zone-green.has-file {
  border-color: var(--green);
  background: #dcfce7;
}

.upload-zone .zone-icon { display: flex; justify-content: center; margin-bottom: 0.35rem; }

.img-preview {
  margin-top: 0.65rem;
  max-height: 140px;
  max-width: 100%;
  border-radius: 8px;
  object-fit: contain;
  border: 1px solid var(--border);
  display: block;
}

.refs-thumbs { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.65rem; }
.refs-loaded {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
}
.ref-thumb-wrap {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.ref-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ref-thumb-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-size: 0.7rem;
  cursor: pointer;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ref-thumb-remove:hover { background: var(--red); }
.ref-remove-btn {
  color: var(--red) !important;
  border-color: var(--border) !important;
}
.ref-remove-btn:hover { background: var(--red-bg) !important; }
.refs-thumbs img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

/* â”€â”€ Prompt list â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.toolbar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.toolbar-prompt {
  align-items: stretch;
}

.toolbar-prompt .search-input {
  flex: 1 1 100%;
  min-width: 0;
}

.btn-create-prompt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  flex: 0 0 auto;
  width: auto;
  min-height: 32px;
  padding: 0.32rem 0.75rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(13, 110, 253, 0.22);
  transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
}

.btn-create-prompt:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 4px 14px rgba(30, 41, 59, 0.32);
}

.btn-create-prompt:active:not(:disabled) { transform: scale(0.98); }

#settingsSavedMsg {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.search-input {
  flex: 1;
  min-width: 160px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.875rem;
  background: var(--card);
}

.prompt-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 2px;
}

.prompt-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.prompt-item:hover { border-color: #94a3b8; }
.prompt-item.selected { border-color: var(--blue); background: var(--blue-bg); }

.prompt-item input[type=checkbox] { margin-top: 2px; accent-color: var(--blue); flex-shrink: 0; }

.prompt-meta { flex: 1; min-width: 0; }
.prompt-title { font-weight: 600; font-size: 0.875rem; }
.prompt-cat {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--blue);
  background: var(--blue-bg);
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  margin-top: 0.2rem;
}
.prompt-preview {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.4rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.prompt-actions {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s;
}

.prompt-item:hover .prompt-actions { opacity: 1; }

.prompt-actions .btn { padding: 0.25rem 0.5rem; font-size: 0.75rem; }

/* â”€â”€ Language chips â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.lang-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.lang-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.6rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
  text-align: center;
}

.lang-chip:hover { border-color: #94a3b8; }
.lang-chip.selected { border-color: var(--blue); background: var(--blue-bg); }
.lang-chip.disabled { opacity: 0.4; pointer-events: none; }

.lang-flag {
  font-size: 1.45rem;
  line-height: 1;
  margin-bottom: 0.15rem;
}
.lang-code { font-size: 0.72rem; font-weight: 700; color: var(--muted); }
.lang-name { font-size: 0.78rem; color: var(--text); font-weight: 650; margin-top: 0.05rem; }
.lang-chip.selected .lang-name { color: var(--blue); }
.lang-chip.selected .lang-code { color: var(--blue); }

.lang-grid-nations {
  margin-top: 0.35rem;
  margin-bottom: 0;
}
.lang-grid-nations .lang-chip {
  min-height: 3.1rem;
  padding: 0.35rem 0.25rem;
}
.lang-chip-flag {
  min-height: 3.15rem !important;
  gap: 0.1rem;
  padding: 0.3rem 0.2rem !important;
}
.lang-flag-lg {
  font-size: 1.2rem;
  line-height: 1;
}
.lang-chip-flag .lang-name {
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.15;
}

.video-lang-grid {
  margin-top: 0.3rem;
  margin-bottom: 0.45rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(3.4rem, 1fr));
  gap: 0.3rem;
}
.video-lang-chip.selected {
  border-color: #5b3d9e;
  background: rgba(91, 61, 158, 0.1);
  box-shadow: 0 0 0 1px rgba(91, 61, 158, 0.2);
}
.video-lang-chip.selected .lang-name,
.video-lang-chip.selected .lang-code {
  color: #5b3d9e;
}

.lang-uses-compact {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.35;
  color: var(--text);
}
.multi-lang-card {
  margin-top: 0.65rem;
  border: 1px solid rgba(91, 61, 158, 0.22);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(91, 61, 158, 0.06), #fff 55%);
  padding: 0.15rem;
  overflow: hidden;
}
.multi-lang-toggle {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.8rem 0.85rem;
  cursor: pointer;
}
.multi-lang-toggle input {
  margin-top: 0.35rem;
  width: 1.1rem;
  height: 1.1rem;
  accent-color: #5b3d9e;
  flex-shrink: 0;
}
.multi-lang-toggle-body {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  min-width: 0;
}
.multi-lang-ico {
  flex-shrink: 0;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: #1e293b;
  color: #fde68a;
}
.multi-lang-toggle-body strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 750;
  color: var(--text);
  margin-bottom: 0.15rem;
}
.multi-lang-toggle-body small {
  display: block;
  font-size: 0.76rem;
  line-height: 1.35;
  color: var(--muted);
}
.multi-lang-toggle-body small em {
  font-style: normal;
  font-weight: 700;
  color: #5b3d9e;
}
.multi-lang-card .translate-targets {
  margin: 0;
  padding: 0 0.85rem 0.85rem;
  border-top: none;
}
.multi-lang-pick-lead {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: #5b3d9e;
}
.multi-lang-toggle:has(input:checked) {
  background: rgba(91, 61, 158, 0.05);
}

/* â”€â”€ Seedance config â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.form-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}
.form-row-2.compact { gap: 0.5rem; margin-bottom: 0.55rem; }
.batch-toggles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}
.batch-toggle {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}
.batch-toggle input {
  margin: 0 0 0.15rem;
  accent-color: var(--accent);
  width: 1rem;
  height: 1rem;
}
.batch-toggle small {
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--muted);
}
.batch-toggle:has(input:checked) {
  border-color: rgba(13, 110, 253, 0.35);
  background: #e7f1ff;
}
@media (max-width: 560px) {
  .form-row-2, .batch-toggles { grid-template-columns: 1fr; }
}

/* Formato con icone + durata slider */
.batch-mini-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.45rem;
}
.batch-format-block { margin-bottom: 0.85rem; }
.batch-duration-block { margin-bottom: 0.75rem; }

.ratio-picker {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.45rem;
}
.ratio-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.55rem 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.ratio-card:hover { border-color: #94a3b8; }
.ratio-card.selected {
  border-color: var(--accent);
  background: #e7f1ff;
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.12);
}
.ratio-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 36px;
}
.ratio-frame {
  display: block;
  border: 2px solid #64748b;
  border-radius: 3px;
  background: rgba(100, 116, 139, 0.08);
}
.ratio-card.selected .ratio-frame { border-color: var(--accent); background: rgba(13, 110, 253, 0.12); }
.ratio-portrait .ratio-frame { width: 16px; height: 28px; }
.ratio-square .ratio-frame { width: 22px; height: 22px; }
.ratio-landscape .ratio-frame { width: 30px; height: 17px; }
.ratio-adapt .ratio-frame {
  width: 24px;
  height: 20px;
  border-style: dashed;
}
.ratio-label { font-size: 0.72rem; font-weight: 600; color: var(--text); line-height: 1.1; }
.ratio-sub { font-size: 0.65rem; color: var(--muted); }

.duration-control { padding: 0.15rem 0 0; }
.duration-control-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}
.duration-control-head label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0;
}
.duration-value { text-align: right; }
.duration-value strong {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.duration-value span {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: capitalize;
}
.duration-track-wrap {
  position: relative;
  height: 28px;
  display: flex;
  align-items: center;
}
.duration-bar {
  position: absolute;
  left: 0; right: 0;
  height: 8px;
  border-radius: 999px;
  background: #e9ecef;
  pointer-events: none;
  overflow: hidden;
}
.duration-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #0d6efd);
  border-radius: 999px;
  transition: width 0.08s linear;
}
.duration-slider {
  position: relative;
  z-index: 2;
  width: 100%;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  height: 28px;
  cursor: pointer;
}
.duration-slider::-webkit-slider-runnable-track {
  height: 8px;
  background: transparent;
  border-radius: 999px;
}
.duration-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -7px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #0d6efd;
  box-shadow: 0 2px 8px rgba(13, 110, 253, 0.35);
  cursor: grab;
}
.duration-slider:active::-webkit-slider-thumb { cursor: grabbing; transform: scale(1.08); }
.duration-slider::-moz-range-track {
  height: 8px;
  background: transparent;
  border: none;
}
.duration-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #0d6efd;
  box-shadow: 0 2px 8px rgba(13, 110, 253, 0.35);
  cursor: grab;
}
.duration-ticks {
  display: flex;
  justify-content: space-between;
  gap: 0.1rem;
  margin-top: 0.35rem;
}
.dur-tick {
  flex: 1;
  padding: 0.2rem 0;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.65rem;
  font-weight: 600;
  color: #adb5bd;
  cursor: pointer;
  border-radius: 4px;
}
.dur-tick:hover { color: var(--text); background: #f1f3f5; }
.dur-tick.active { color: var(--accent); }
.duration-ends {
  display: flex;
  justify-content: space-between;
  margin-top: 0.15rem;
  font-size: 0.68rem;
  color: var(--muted);
}
@media (max-width: 560px) {
  .ratio-picker { grid-template-columns: repeat(2, 1fr); }
}

.form-group { margin-bottom: 0.75rem; }

.field-hint {
  margin: 0.4rem 0 0;
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--muted);
}

.form-group label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 0.3rem;
}

.form-group select,
.form-group input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.875rem;
  background: var(--card);
  color: var(--text);
}

.checkbox-row {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.checkbox-row label { display: flex; align-items: center; gap: 0.4rem; cursor: pointer; }
.checkbox-row input { accent-color: var(--blue); }

.launch-estimate {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 1rem;
  padding: 0.65rem 0.85rem;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

/* â”€â”€ Badge / pill â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0;
  background: #e9ecef;
  color: #495057;
}

.pill {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0;
  white-space: nowrap;
}

.pill-queued, .pill-ok { background: #e9ecef; color: #495057; }
.pill-running { background: #e7f1ff; color: #0d6efd; }
.pill-completed { background: #d1e7dd; color: #198754; }
.pill-partial { background: #fff3cd; color: #997404; }
.pill-failed { background: #f8d7da; color: #dc3545; }
.pill-dry_run { background: #e2d9f3; color: #6f42c1; }

/* â”€â”€ Job cards â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.jobs-layout {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.jobs-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.45rem;
}

.job-card {
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.85rem;
  box-shadow: none;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: box-shadow 0.25s var(--ease), border-color 0.25s var(--ease), transform 0.25s var(--ease);
}

.job-card {
  animation: none !important;
}
.job-card:hover {
  box-shadow: var(--shadow);
  border-color: rgba(13, 110, 253, 0.25);
  transform: none;
}
.job-card.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: none;
}

.job-card-header {
  margin-bottom: 0.35rem;
}

.job-card-main { min-width: 0; }

.job-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  margin-bottom: 0.15rem;
}

.job-card-id {
  font-family: monospace;
  font-size: 0.68rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.job-card-langs {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.job-card-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.2rem;
  font-size: 0.72rem;
  color: var(--muted);
}
.job-card-phase {
  margin-top: 0.25rem;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}
.job-card-tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.job-tag {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: #f1f3f5;
  color: #495057;
  font-size: 0.68rem;
  font-weight: 600;
}
.job-pipeline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem;
  margin: 0.55rem 0 0.45rem;
  font-size: 0.68rem;
  font-weight: 600;
}
.job-pipeline-step {
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  background: #f1f3f5;
  color: #adb5bd;
}
.job-pipeline-step.done { background: #d1e7dd; color: #198754; }
.job-pipeline-step.current {
  background: #e7f1ff;
  color: #0d6efd;
  box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.15);
}
.job-pipeline-step.error { background: #f8d7da; color: #dc3545; }
.job-pipeline-step.todo { opacity: 0.75; }
.job-pipeline-sep { color: #ced4da; font-weight: 400; padding: 0 0.05rem; }
.job-items-mini {
  display: grid;
  gap: 0.3rem;
  margin-top: 0.45rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--border);
}
.job-item-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 0.35rem 0.45rem;
  align-items: center;
  font-size: 0.74rem;
}
.job-item-lang {
  font-weight: 700;
  color: var(--accent);
  min-width: 1.6rem;
}
.job-item-title {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.job-item-st { font-weight: 600; white-space: nowrap; }
.job-item-st-ok { color: #198754; }
.job-item-st-run { color: #0d6efd; }
.job-item-st-fail { color: #dc3545; }
.job-item-prog {
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  font-weight: 700;
}
.job-item-err {
  grid-column: 1 / -1;
  color: #b91c1c;
  font-size: 0.78rem;
  line-height: 1.35;
  margin-top: 0.15rem;
  white-space: normal;
}
.job-item-row-fail {
  background: rgba(220, 38, 38, 0.06);
  border-radius: 6px;
  padding: 0.25rem 0.35rem;
}
.job-card-error {
  margin: 0.55rem 0 0.35rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  background: var(--red-bg, #fef2f2);
  border: 1px solid #fecaca;
  color: #991b1b;
  font-size: 0.8rem;
  line-height: 1.4;
  font-weight: 500;
}
.job-card-has-error {
  border-color: #fca5a5;
}
.job-detail-error {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
}
.job-detail-error p {
  margin: 0.25rem 0 0;
  font-weight: 500;
}
.job-detail-error-hint {
  font-size: 0.78rem;
  opacity: 0.85;
  font-weight: 400 !important;
}
.job-error-cell .job-error-msg {
  display: inline-block;
  max-width: 18rem;
  color: #b91c1c;
  font-size: 0.8rem;
  line-height: 1.35;
  white-space: normal;
}

/* Center loader (import / short blocking ops) — minimal */
.cc-center-loader {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: rgba(15, 23, 42, 0.22);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  opacity: 0;
  transition: opacity 0.2s var(--ease);
  pointer-events: all;
}
.cc-center-loader.is-on { opacity: 1; }
.cc-center-loader-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  padding: 1.35rem 1.6rem 1.25rem;
  min-width: 148px;
  background: var(--bg-elevated);
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.12);
}
.cc-center-loader-ring {
  width: 26px;
  height: 26px;
  border: 2px solid #e9ecef;
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: video-spin 0.7s linear infinite;
}
.cc-center-loader-label {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.01em;
  line-height: 1.2;
}
@media (prefers-reduced-motion: reduce) {
  .cc-center-loader { transition: none; }
  .cc-center-loader-ring { animation: none; border-top-color: var(--navy); opacity: 0.7; }
}

.app-toast {
  position: fixed;
  left: 50%;
  bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 10050;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  max-width: min(92vw, 28rem);
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: #1f2937;
  color: #f9fafb;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
  font-size: 0.9rem;
  line-height: 1.4;
  animation: app-toast-in 0.22s ease-out;
}
.app-toast-danger {
  background: #7f1d1d;
  border: 1px solid #fecaca;
}
.app-toast-ok {
  background: #14532d;
  border: 1px solid #bbf7d0;
}
.app-toast-text { flex: 1; }
.app-toast-close {
  color: inherit;
  opacity: 0.8;
  flex-shrink: 0;
}
@keyframes app-toast-in {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
@media (max-width: 720px) {
  .app-toast {
  bottom: calc(4.75rem + env(safe-area-inset-bottom, 0px));
  }
}
.jobs-live-dot {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 600;
  color: #6c757d;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.jobs-live-dot::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #adb5bd;
}
.jobs-live-dot.active {
  color: #198754;
}
.jobs-live-dot.active::before {
  background: #198754;
}

.job-card-date { opacity: 0.85; }

.job-elapsed-running {
  font-weight: 700;
  color: var(--blue);
  font-variant-numeric: tabular-nums;
}

.job-elapsed-done {
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.job-card .pill {
  font-size: 0.62rem;
  padding: 0.12rem 0.4rem;
  flex-shrink: 0;
}

.progress-wrap { margin: 0.3rem 0 0; }
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

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

.progress-fill.done { background: var(--green); }
.progress-fill.error { background: var(--red); }

/* â”€â”€ Job items detail â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.items-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 0.85rem;
  margin-top: 1.25rem;
}

.items-table th {
  text-align: left;
  padding: 0.65rem 1rem;
  background: var(--bg-elevated);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.items-table td {
  padding: 0.65rem 1rem;
  border-top: 1px solid var(--border);
  vertical-align: middle;
}

.items-table tr:hover td { background: #fafbfc; }

.item-links a {
  color: var(--blue);
  text-decoration: none;
  font-size: 0.8rem;
  margin-right: 8px;
}

.item-links a:hover { text-decoration: underline; }

/* â”€â”€ Manifest box â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
/* â”€â”€ Cost display â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.cost-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: linear-gradient(90deg, #0d2137 0%, #1a3a5c 100%);
  border-radius: 10px;
  padding: 0.85rem 1.2rem;
  margin-bottom: 1rem;
  color: #fff;
}
.cost-banner-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.7;
  flex-shrink: 0;
}
.cost-banner-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: #4cd79a;
  letter-spacing: -0.01em;
}
.cost-banner-tokens {
  font-size: 0.8rem;
  opacity: 0.65;
  margin-left: auto;
}
.cost-cell {
  white-space: nowrap;
  font-size: 0.82rem;
  color: #1a3a5c;
  font-variant-numeric: tabular-nums;
}
.cost-tokens {
  display: inline-block;
  margin-left: 0.3rem;
  font-size: 0.72rem;
  color: var(--muted);
  background: #f0f4f9;
  padding: 1px 5px;
  border-radius: 4px;
}
.cost-est {
  color: var(--warning, #f59e0b);
  font-style: normal;
  font-size: 0.9em;
}
.job-card-cost {
  margin-top: 0.25rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: #1a6640;
  background: #e6f7ee;
  border-radius: 4px;
  padding: 1px 5px;
  display: inline-block;
}

.job-detail-panel {
  margin-top: 0.25rem;
}

.job-detail-elapsed-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.65rem;
  padding: 0.5rem 0.75rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.job-detail-elapsed-wrap .job-elapsed-running,
.job-detail-elapsed-wrap .job-elapsed-done {
  font-size: 1rem;
}

.job-detail-status { font-size: 0.72rem !important; }

.manifest-box {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  background: var(--green-bg);
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  font-size: 0.85rem;
  color: #166534;
}

/* â”€â”€ Prompt library page â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.prompt-table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  font-size: 0.85rem;
}

.data-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  background: var(--bg-elevated);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.data-table td { padding: 0.7rem 1rem; border-top: 1px solid var(--border); vertical-align: top; }
.data-table tr:hover td { background: #fafbfc; }
.data-table td:last-child { max-width: 480px; font-size: 0.8rem; color: var(--muted); }

/* â”€â”€ Empty state â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.empty-state {
  text-align: center;
  padding: 3.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.empty-state .empty-icon { display: flex; justify-content: center; margin-bottom: 0.75rem; }

/* â”€â”€ Alert banner â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.alert-banner {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: var(--yellow-bg);
  border: 1px solid #fde047;
  color: #854d0e;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 1rem;
}

.alert-banner.info { background: var(--blue-bg); border-color: #bae6fd; color: #0369a1; }
.alert-banner.danger { background: var(--red-bg); border-color: #fca5a5; color: #991b1b; }
.alert-banner.warn { background: var(--yellow-bg); border-color: #fde68a; color: #78350f; }

.form-group textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  background: var(--card);
  color: var(--text);
  resize: vertical;
  line-height: 1.5;
}

.form-group textarea:focus,
.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(2,132,199,0.12);
}

.still-create .still-create-tabs {
  margin: 0 0 0.75rem;
}
.still-create .img-preview {
  margin-top: 0.65rem;
  border-radius: 10px;
  max-height: 240px;
  width: 100%;
  object-fit: contain;
  background: var(--bg);
}
.still-edit-chips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
  gap: 0.3rem;
  margin: 0.15rem 0 0.55rem;
}
.still-edit-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.55rem;
  padding: 0.35rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font-family: inherit;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.still-edit-chip strong {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.still-edit-chip.active {
  border-color: rgba(91, 61, 158, 0.45);
  background: rgba(91, 61, 158, 0.07);
  box-shadow: 0 0 0 1px rgba(91, 61, 158, 0.12);
}
.still-edit-chip.active strong {
  color: #5b3d9e;
}
.preset-chips-sm {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.preset-chip-sm {
  min-height: 2.2rem !important;
  padding: 0.3rem 0.55rem !important;
  border-radius: 999px !important;
}
.preset-chip-sm strong {
  font-size: 0.72rem !important;
}
.still-create .prompt-box {
  min-height: 6.5rem !important;
}

.image-card-player {
  cursor: zoom-in;
}
.image-card-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.image-lightbox-overlay {
  touch-action: none;
  z-index: 2200;
  padding: 0 !important;
  margin: 0;
  align-items: stretch !important;
  justify-content: stretch !important;
  background: rgba(0, 0, 0, 0.94) !important;
  height: 100dvh;
  height: 100vh;
}
.image-lightbox-fs {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  background: #0a0a0a;
  touch-action: auto;
}
.image-lightbox-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-shrink: 0;
  min-height: 56px;
  padding: 0.65rem 1rem;
  padding-top: calc(0.65rem + env(safe-area-inset-top, 0px));
  background: rgba(10, 10, 10, 0.92);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 2;
}
.image-lightbox-title {
  min-width: 0;
  flex: 1;
  font-size: 0.95rem;
  font-weight: 650;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.image-lightbox-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}
.image-lightbox-download,
.image-lightbox-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 42px;
  padding: 0.45rem 0.9rem;
  border-radius: 12px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: none;
  -webkit-tap-highlight-color: transparent;
}
a.image-lightbox-download {
  background: #fff;
  color: #0f172a;
}
button.image-lightbox-download {
  background: linear-gradient(145deg, #8b7cf5 0%, #5b3d9e 55%, #4a2f86 100%);
  color: #fff;
}
.image-lightbox-close {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.image-lightbox-x {
  position: absolute;
  top: calc(4.25rem + env(safe-area-inset-top, 0px));
  right: 0.85rem;
  z-index: 3;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
}
.image-lightbox-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
  cursor: pointer;
  background: #000;
}
.image-lightbox-stage img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  border-radius: 0;
  background: transparent;
  pointer-events: none;
  user-select: none;
}
@media (max-width: 768px) {
  .image-lightbox-bar .image-lightbox-close span,
  .image-lightbox-bar .image-lightbox-download span { display: none; }
  .image-lightbox-download,
  .image-lightbox-close {
  min-width: 44px;
  padding: 0.55rem;
  }
  .image-lightbox-x {
  top: calc(0.75rem + env(safe-area-inset-top, 0px));
  }
}

.nav-acc {
  margin: 0.15rem 0;
  border: none;
}
.nav-acc-sum {
  list-style: none;
  cursor: pointer;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  padding: 0.7rem 1rem 0.3rem;
  font-weight: 600;
  opacity: 0.9;
  user-select: none;
}
.nav-acc-sum::-webkit-details-marker { display: none; }
.nav-acc-sum::after {
  content: '▸';
  float: right;
  margin-right: 0.35rem;
  opacity: 0.7;
}
.nav-acc[open] > .nav-acc-sum::after { content: '▾'; }
.nav-acc-body {
  padding: 0 0.15rem 0.25rem;
}

/* Image page tabs */
.img-tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
}

.img-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.img-tab:hover { border-color: #94a3b8; color: var(--text); }
.img-tab.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* â”€â”€ Seedream image results â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.preset-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}

.preset-chip:hover { border-color: var(--blue); background: var(--blue-bg); }
.preset-chip strong { font-size: 0.82rem; }
.preset-chip span { font-size: 0.72rem; color: var(--muted); }

.image-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.image-result-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
}

.image-result-card img {
  width: 100%;
  display: block;
  aspect-ratio: 9/16;
  object-fit: cover;
  background: #e2e8f0;
}

.image-result-meta {
  padding: 0.75rem;
}

.image-result-meta > span {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
  word-break: break-all;
}

.image-result-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

/* â”€â”€ Modal â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.modal-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  background: rgba(15,23,42,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  animation: fadeIn 0.15s ease;
  overflow: hidden;
  overscroll-behavior: contain;
  touch-action: none;
}

.modal {
  background: var(--card);
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  max-height: min(55vh, 55dvh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,0.2);
  touch-action: auto;
}

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

.modal-prompt {
  max-height: min(55vh, 55dvh);
}

.modal-prompt .modal-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.modal-prompt .form-group {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  margin-bottom: 0;
}

.modal-prompt-header {
  gap: 0.75rem;
}

.modal-prompt-header h3 {
  flex: 1;
  min-width: 0;
}

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.modal-paste-btn {
  font-size: 16px;
  white-space: nowrap;
}

.modal-prompt-field label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.15rem 1.35rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-header h3 { font-size: 1rem; font-weight: 700; }

.modal-close {
  border: none;
  background: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
  padding: 0.25rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover { background: var(--bg); color: var(--text); }

.modal-body {
  padding: 1.35rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.35rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── Subtitles editor (aligned with video editor ed-* shell) ── */
.subs-shell {
  width: min(980px, 100%);
}

.subs-ed-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
  background: #f8f9fa;
}

.subs-preview-wrap {
  height: min(38vh, 380px);
  max-height: min(38vh, 380px);
}

.subs-preview-video {
  pointer-events: auto;
}

.subs-ed-workspace {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(280px, 1.15fr);
  gap: 0;
  overflow: hidden;
  border-top: 1px solid var(--border);
}

.subs-ed-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background: #fff;
  padding: 0.75rem 0.9rem;
  overflow: hidden;
}

.subs-ed-panel + .subs-ed-panel {
  border-left: 1px solid var(--border);
  background: #eef2ff;
}

.subs-ed-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
  flex-shrink: 0;
}

.subs-ed-panel-head strong {
  font-size: 0.92rem;
  font-weight: 700;
  color: #312e81;
}

.subs-ed-panel-head span {
  font-size: 0.72rem;
  color: var(--muted);
  text-align: right;
  line-height: 1.3;
}

.subs-ed-words-panel .subs-word-list {
  flex: 1 1 auto;
  max-height: none;
  min-height: 0;
}

.subs-overlay-panel {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.subs-overlay-inline-head {
  margin: 0 0 0.35rem;
  justify-content: flex-start;
}

#subsOverlayList {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding-right: 0.1rem;
}

.subs-overlay-layer {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  /* left/top/width/height overridden in JS to match object-fit:contain video frame */
}

@media (max-width: 820px) {
  .subs-ed-workspace {
  grid-template-columns: 1fr;
  overflow-y: auto;
  }
  .subs-ed-panel + .subs-ed-panel {
  border-left: none;
  border-top: 1px solid var(--border);
  }
  .subs-preview-wrap {
  height: min(32vh, 280px);
  max-height: min(32vh, 280px);
  }
}

.subs-drag-box {
  position: absolute;
  transform: translate(-50%, -50%); /* same as ASS \an5 center */
  pointer-events: auto;
  cursor: grab;
  text-align: center;
  padding: 0;
  border: none;
  outline: 1px dashed rgba(255,255,255,0.45);
  outline-offset: 2px;
  border-radius: 0;
  background: transparent;
  box-sizing: border-box;
  touch-action: none;
  user-select: none;
  width: max-content;
}

.subs-drag-box.dragging {
  cursor: grabbing;
  border-color: rgba(255,255,255,0.7);
  background: rgba(15, 23, 42, 0.28);
  z-index: 3;
}

.subs-drag-text {
  display: block;
  color: #fff;
  font-weight: 900;
  font-size: 14px;
  line-height: 1.15;
  letter-spacing: 0.01em;
  white-space: pre-line;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.subs-style-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  margin-top: 0.45rem;
}

.subs-style-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 600;
}

.subs-style-size {
  flex: 1;
  min-width: 120px;
}

.subs-style-size input[type="range"] {
  width: 100%;
}

.subs-color-input {
  width: 2.4rem;
  height: 1.7rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.subs-style-label {
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 600;
  min-width: 2.6rem;
}

.subs-form-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.subs-form-btn {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}

.subs-form-btn.active {
  border-color: var(--accent, #2563eb);
  background: rgba(37, 99, 235, 0.12);
  color: var(--accent, #2563eb);
}

.subs-overlay-card {
  border: 1px solid #c7d2fe;
  border-radius: 12px;
  padding: 0.6rem 0.7rem;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.subs-overlay-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.subs-overlay-card-head strong {
  font-size: 0.8rem;
}

.subs-overlay-text {
  width: 100%;
  resize: vertical;
  min-height: 2.6rem;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  font-size: 0.88rem;
  line-height: 1.35;
  font-family: inherit;
}

.subs-overlay-text:focus {
  outline: none;
  border-color: var(--accent, #2563eb);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.subs-overlay-tip {
  margin: 0.3rem 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.3;
}

.subs-preview-meta {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.subs-hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
}

.subs-words-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.subs-words-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.45rem;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
}

.subs-word-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  overflow-y: auto;
  max-height: min(52vh, 420px);
  padding-right: 0.15rem;
  overscroll-behavior: contain;
}

.subs-word-row {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 0.45rem;
  align-items: center;
}

.subs-word-time {
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  white-space: nowrap;
}

.subs-word-input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 8px;
  padding: 0.4rem 0.55rem;
  font-size: 0.9rem;
}

.subs-word-input:focus {
  outline: none;
  border-color: var(--accent, #2563eb);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.subs-loading,
.subs-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.subs-unavailable {
  padding: 0.5rem 0;
}

.subs-unavailable p {
  margin: 0 0 0.5rem;
  color: var(--text);
  line-height: 1.45;
}

.subs-unavailable-hint {
  color: var(--muted) !important;
  font-size: 0.85rem;
}

.subs-unavailable {
  padding: 1.25rem 1rem;
}

.subs-ed-words-panel .subs-word-input {
  background: #fff;
  border-color: #c7d2fe;
}

.subs-word-row-locked {
  opacity: 0.72;
  pointer-events: none;
}
.subs-word-locked-text {
  flex: 1;
  font-size: 0.9rem;
  color: var(--muted);
}

.subs-generate-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.65rem 0.75rem;
  margin: 0 0 0.75rem;
  padding: 0.65rem 0.75rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.subs-generate-lang {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 9rem;
  flex: 1;
}
.subs-generate-lang span {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.subs-generate-lang select {
  appearance: none;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
}
.subs-generate-bar .btn {
  flex-shrink: 0;
}

.subs-form-btn.active,
.ed-chip.subs-form-btn.active {
  border-color: #0d6efd;
  background: rgba(13, 110, 253, 0.12);
  color: #0d6efd;
}

@media (max-width: 720px) {
  .subs-word-row {
  grid-template-columns: 1fr;
  gap: 0.2rem;
  }
}

/* ── Duration check modal (stesso linguaggio UI della piattaforma) ── */
.duration-modal-overlay {
  z-index: 1200;
}

.modal-duration {
  max-width: 440px;
  max-height: min(88vh, 88dvh);
}

.duration-modal-lead {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.45;
}

.duration-modal-reason {
  margin: 0 0 1rem;
  padding: 0;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.duration-modal-rows {
  margin: 0 0 1rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--card);
}

.duration-modal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border);
  margin: 0;
}

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

.duration-modal-row dt {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
}

.duration-modal-row dd {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.duration-modal-row-accent {
  background: var(--accent-soft);
}

.duration-modal-row-accent dt {
  color: var(--accent);
  font-weight: 600;
}

.duration-modal-row-accent dd {
  color: var(--accent);
}

.duration-modal-hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}

.duration-modal-footer {
  flex-wrap: wrap;
  gap: 0.5rem;
}

.duration-modal-footer .btn {
  white-space: nowrap;
}

@media (max-width: 560px) {
  .modal-duration {
  max-width: 100%;
  }

  .duration-modal-footer {
  flex-direction: column-reverse;
  }

  .duration-modal-footer .btn {
  width: 100%;
  justify-content: center;
  min-height: 44px;
  }
}

.modal-prompt-textarea {
  width: 100%;
  flex: 1;
  min-height: 220px;
  max-height: min(55vh, 480px);
  height: auto;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 16px !important;
  background: var(--card);
  color: var(--text);
  resize: vertical;
  line-height: 1.5;
  display: block;
  overflow-y: auto;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

.modal-prompt-textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(2,132,199,0.12);
}

.modal-body textarea,
.modal-body input,
.modal-body select {
  font-size: 16px;
}

.form-group textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.875rem;
  background: var(--card);
  color: var(--text);
  resize: vertical;
  min-height: 110px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(2,132,199,0.12);
}

/* â”€â”€ Utility â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.hidden { display: none !important; }
.mt { margin-top: 1rem; }
.mt-sm { margin-top: 0.5rem; }
.divider { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes modalSheetIn { from { transform: translateY(100%); } to { transform: translateY(0); } }
.fade-in { animation: fadeIn 0.2s ease; }

/* â”€â”€ Job delete button â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.job-card { position: relative; }

.job-del-btn {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 3px 5px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
  line-height: 1;
}

.job-card:hover .job-del-btn { opacity: 1; }
.job-del-btn:hover { background: var(--red-bg); color: var(--red); }

/* â”€â”€ Clean preview box â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.clean-preview-box {
  background: var(--yellow-bg);
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: #78350f;
}

/* â”€â”€ Logs table â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.logs-table { font-size: 0.79rem; }
.logs-table th { white-space: nowrap; }
.log-ts { white-space: nowrap; color: var(--muted); font-size: 0.74rem; }
.log-level { font-weight: 700; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; }
.log-source { background: #f0f4f9; border-radius: 4px; padding: 1px 5px; font-size: 0.72rem; color: var(--muted); }
.log-msg { max-width: 520px; word-break: break-word; }
.log-detail {
  font-family: monospace;
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 0.3rem;
  background: var(--bg-elevated);
  border-radius: 4px;
  padding: 4px 6px;
  white-space: pre-wrap;
  max-height: 60px;
  overflow: hidden;
}
.log-job-link {
  cursor: pointer;
  color: var(--blue);
  text-decoration: underline;
  font-size: 0.74rem;
}

/* â”€â”€ Jobs filters bar â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.jobs-filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  align-items: center;
}

.jobs-filters .search-input { flex: 1; min-width: 160px; }

.jobs-filters select {
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.875rem;
  background: var(--card);
  color: var(--text);
}

/* â”€â”€ Pagination â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1.25rem 0 0.5rem;
  flex-wrap: wrap;
}

.pagination-info {
  font-size: 0.83rem;
  color: var(--muted);
}

/* ── Mobile header ─────────────────────────────────────── */
.mobile-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: calc(52px + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 0.75rem 0;
  background: var(--navy);
  z-index: 200;
  align-items: center;
  gap: 0.65rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.mobile-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex: 1;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.mobile-brand:active { opacity: 0.8; }

.mobile-logo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  object-fit: contain;
  flex-shrink: 0;
  background: var(--bg-elevated);
  padding: 2px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.mobile-page-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.mobile-credits-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 40px;
  padding: 0.35rem 0.7rem;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.mobile-credits-chip .mobile-credits-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.8;
}

.mobile-credits-chip strong {
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.hamburger {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  margin: 0;
  border: none;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background: #fff;
  transition: transform 0.22s ease, opacity 0.18s ease;
}

.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.sidebar-sheet-close,
.sidebar-sheet-handle,
.sidebar-more-label,
.sidebar-nav-sheet {
  display: none;
}

/* ── Mobile bottom tab bar ─────────────────────────────── */
.mobile-tabbar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 210;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  will-change: transform;
  /* JS pins this under the keyboard via translateY: never float up */
}

/* Keyboard open: keep Video/New/Plans at the bottom (hidden under keyboard, never floating mid-screen) */
.mobile-tabbar.kb-open,
body.kb-open .mobile-tabbar {
  pointer-events: none;
  visibility: hidden;
  transform: translate3d(0, 110%, 0) !important;
}

.tabbar-dock {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 0.1rem;
  width: 100%;
  min-height: 56px;
  padding: 0.3rem 0.4rem calc(0.3rem + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.96) 0%, rgba(15, 23, 42, 0.98) 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 -2px 10px rgba(15, 23, 42, 0.16);
}

.tabbar-item {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  min-width: 0;
  min-height: 48px;
  padding: 0.25rem 0.15rem;
  border: none;
  background: none;
  color: rgba(248, 250, 252, 0.5);
  cursor: pointer;
  border-radius: 10px;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s ease;
}

.tabbar-item:active {
  background: rgba(255, 255, 255, 0.05);
}

.tabbar-item.active {
  color: #fff;
}

.tabbar-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.3rem;
  height: 1.3rem;
  color: inherit;
}

.icon-tab {
  width: 1.2rem;
  height: 1.2rem;
  opacity: 1;
}

.tabbar-label {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
}

.tabbar-item.active .tabbar-label {
  font-weight: 600;
}

.tabbar-cta {
  color: rgba(248, 250, 252, 0.65);
}

.tabbar-cta.active {
  color: #fff;
}

.tabbar-cta-orb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 50%;
  background: linear-gradient(145deg, #7c6cf0 0%, #5b3d9e 100%);
  color: #fff;
  box-shadow: 0 3px 10px rgba(91, 61, 158, 0.35);
}

.tabbar-cta-orb .icon-tab {
  width: 1.15rem;
  height: 1.15rem;
  color: #fff;
}

.tabbar-cta.active .tabbar-cta-orb {
  box-shadow: 0 0 0 2px rgba(124, 108, 240, 0.35), 0 3px 10px rgba(91, 61, 158, 0.4);
}

.tabbar-plans-hot .tabbar-ico {
  position: relative;
}

.tabbar-plans-hot .tabbar-ico::after {
  content: '';
  position: absolute;
  top: -2px;
  right: -4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #c4b5fd;
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.95);
}

/* ── Sidebar overlay (mobile) ──────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 150;
}

.sidebar-overlay.visible { display: block; }

.prompt-cell-text {
  max-width: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--text);
}

#mPrompt {
  min-height: 280px;
  font-size: 0.9rem;
  line-height: 1.5;
  resize: vertical;
}

/* â”€â”€ Video Gallery â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.video-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.video-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  overflow: hidden;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.3s var(--ease), transform 0.3s var(--ease), border-color 0.3s var(--ease);
}

.video-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
  border-color: rgba(0,0,0,0.1);
}

.video-del-action { color: var(--red); }
.video-del-action:hover { background: var(--red-bg); }

.video-drive-btn {
  border-color: rgba(2, 132, 199, 0.35);
  color: var(--blue);
  font-weight: 600;
}

.video-drive-btn:hover:not(:disabled) {
  background: var(--blue-bg);
  border-color: var(--blue);
}

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

.video-card-player {
  position: relative;
  cursor: pointer;
  background:
  radial-gradient(circle at 35% 25%, rgba(59, 130, 246, 0.28), transparent 34%),
  linear-gradient(145deg, #111827, #020617);
  aspect-ratio: 9/16;
  overflow: hidden;
}

.video-card-thumb,
.video-card-player video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.video-card-thumb {
  position: relative;
  z-index: 1;
}

.video-card-thumb-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0.85rem;
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
  pointer-events: none;
}

.video-card-play-btn {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: rgba(255,255,255,0.85);
  background: rgba(0,0,0,0.25);
  transition: background 0.15s;
  pointer-events: none;
  z-index: 2;
}

.video-card-duration {
  position: absolute;
  right: 0.4rem;
  bottom: 0.4rem;
  z-index: 2;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
  pointer-events: none;
}

.video-card-dur-meta {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  flex-shrink: 0;
}
.video-card-dur-meta:empty { display: none; }

.video-card-player:hover .video-card-play-btn {
  background: rgba(0,0,0,0.45);
}

.video-card-info {
  padding: 0.65rem 0.75rem 0.25rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.video-card-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-card-date {
  font-size: 0.72rem;
  color: var(--muted);
  padding: 0 0.75rem 0.2rem;
}

.video-card-actions {
  padding: 0.5rem 0.75rem 0.75rem;
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

/* â”€â”€ Video in generazione (library) â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.videos-pending-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--blue);
  margin: 0 0 0.65rem;
}

.video-card-pending {
  border-color: rgba(2, 132, 199, 0.35);
  box-shadow: 0 2px 14px rgba(2, 132, 199, 0.12);
}

.video-card-loading {
  cursor: default;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 1rem 0.75rem;
  background: linear-gradient(160deg, #0f172a 0%, #1e3a5f 100%);
}

.video-card-loader {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.14);
  border-top-color: #38bdf8;
  border-radius: 50%;
  animation: video-spin 0.85s linear infinite;
}

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

.video-pending-pct {
  font-size: 1.35rem;
  font-weight: 700;
  font-family: var(--font);
  color: #e0f2fe;
  letter-spacing: -0.02em;
  line-height: 1;
}

.video-pending-bar {
  width: 78%;
  height: 5px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
}

.video-pending-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #0284c7, #38bdf8);
  border-radius: 999px;
  transition: width 0.35s ease;
}

.video-pending-status {
  font-size: 0.72rem;
  font-weight: 600;
  color: #7dd3fc;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.video-pending-eta {
  font-size: 0.68rem;
  color: #64748b;
}

.video-pending-meta {
  display: flex;
  align-items: center;
  padding: 0 0.85rem 0.25rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.video-pending-elapsed {
  font-weight: 600;
  color: var(--blue);
}

/* â”€â”€ Settings page â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.settings-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
}

.settings-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.6rem;
}

.settings-section-desc {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1rem;
  line-height: 1.6;
}

.settings-section-desc code {
  background: var(--bg);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  font-size: 0.82em;
  color: var(--navy-light);
}

.settings-lang-grid {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.settings-lang-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.settings-folder-name-input {
  width: 9rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.82rem;
  background: var(--bg);
  color: var(--text);
}

.settings-folder-name-input:focus {
  outline: none;
  border-color: #3b82f6;
  background: var(--bg-elevated);
}

.settings-create-folder-btn {
  flex-shrink: 0;
  min-width: 3.5rem;
}

.settings-reset-pub-btn {
  flex-shrink: 0;
  white-space: nowrap;
  font-size: 0.78rem;
}

.settings-folder-input {
  flex: 1;
  min-width: 12rem;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
  background: var(--bg);
  color: var(--text);
  font-family: monospace;
}

.settings-folder-hint {
  flex-shrink: 0;
  font-size: 0.72rem;
  color: var(--green);
  white-space: nowrap;
}

.settings-folder-input:focus {
  outline: none;
  border-color: #3b82f6;
  background: var(--bg-elevated);
}

/* â”€â”€ Responsive breakpoints â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */

/* Tablet */
@media (max-width: 1100px) {
  .batch-layout { grid-template-columns: 1fr; }
  .batch-bottom { grid-template-columns: 1fr; }
}

/* Mobile */
@media (max-width: 768px) {
  /* App-like mobile: no double-tap zoom, no sideways bounce, safe scroll */
  html, body {
  height: 100%;
  overscroll-behavior: none;
  overscroll-behavior-y: none;
  touch-action: manipulation;
  }

  body {
  position: relative;
  width: 100%;
  }

  /* iOS zooms inputs under 16px: keep form fields readable without viewport jump */
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]),
  select,
  textarea {
  font-size: 16px !important;
  line-height: 1.35;
  }

  button,
  a,
  label,
  summary,
  .btn,
  .lang-chip,
  .upload-zone,
  .modality-card,
  .create-path-card,
  .batch-simple-toggle,
  .ratio-card,
  .dur-tick,
  .quick-fill-chip,
  .tabbar-item,
  .hamburger,
  .mobile-credits-chip,
  .page-back-btn,
  .nav-link {
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  }

  input, textarea, [contenteditable="true"] {
  -webkit-user-select: text;
  user-select: text;
  touch-action: manipulation;
  }

  img, video, svg {
  max-width: 100%;
  height: auto;
  -webkit-user-drag: none;
  }

  .mobile-header:not([hidden]) { display: flex; }
  .mobile-tabbar:not([hidden]) { display: flex; }

  .app, .main, .view, .batch-page, .batch-flow {
  max-width: 100%;
  overflow-x: clip;
  }

  .main {
  margin-left: 0;
  width: 100%;
  padding-top: calc(52px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  min-height: 100dvh;
  }

  .view {
  padding: 0.85rem 0.8rem calc(1.1rem + env(safe-area-inset-bottom, 0px));
  min-height: 0;
  }

  /* Sidebar → drawer da sinistra */
  .sidebar {
  top: 0;
  left: 0;
  right: auto;
  bottom: 0;
  width: min(86vw, 300px);
  max-height: none;
  border-right: 1px solid var(--border);
  border-top: none;
  border-radius: 0;
  transform: translateX(-105%);
  transition: transform 0.16s cubic-bezier(.2, 0.8, 0.2, 1);
  z-index: 220;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 4px 0 18px rgba(15, 23, 42, 0.12);
  }

  .sidebar.open {
  transform: translateX(0);
  }

  .sidebar-overlay {
  z-index: 215;
  }

  .sidebar-brand {
  position: relative;
  padding: 1rem 1rem 0.85rem;
  padding-top: calc(0.85rem + env(safe-area-inset-top, 0px));
  margin-bottom: 0;
  display: block;
  }

  .sidebar-brand-row {
  width: 100%;
  gap: 0.65rem;
  padding-right: 2.5rem;
  }

  .sidebar-logo {
  display: block;
  width: 36px;
  height: 36px;
  }

  .sidebar-brand h1 { font-size: 1.1rem; }
  .sidebar-brand .brand-domain,
  .sidebar-brand .made-in-italy { font-size: 0.72rem; }

  .sidebar-sheet-handle { display: none !important; }

  .sidebar-sheet-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: calc(0.65rem + env(safe-area-inset-top, 0px));
  right: 0.65rem;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  }

  .sidebar-more-label {
  display: block;
  margin: 0.15rem 0.85rem 0.35rem;
  font-size: 0.7rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  }


  .sidebar-nav {
  padding: 0.35rem 0.65rem 0.5rem;
  }

  .nav-link {
  min-height: 48px;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  margin: 0.2rem 0;
  border-radius: 12px;
  }

  .nav-link-quiet {
  padding: 0.85rem 1rem;
  font-size: 1rem;
  }

  .sidebar-footer {
  padding: 0.65rem 0.85rem 0.85rem;
  }

  .sidebar-credits {
  min-height: 0;
  padding: 0.65rem 0.1rem 0.75rem;
  }

  .sidebar-logout {
  min-height: 40px;
  font-size: 0.88rem;
  }

  /* Layouts a colonna singola */
  .batch-layout { grid-template-columns: 1fr; }
  .batch-bottom { grid-template-columns: 1fr; }

  /* One-finger touch targets */
  .btn {
  min-height: 44px;
  padding-left: 1rem;
  padding-right: 1rem;
  }
  .btn-sm { min-height: 40px; }
  .lang-chip {
  min-height: 44px;
  padding: 0.55rem 0.45rem;
  }

  .lang-grid { grid-template-columns: repeat(3, 1fr); }
  .lang-grid .lang-name { display: block; font-size: 0.65rem; }
  .batch-prompt-list { max-height: 120px; }
  .batch-section .upload-zone { padding: 0.85rem 0.6rem; }
  .batch-advanced[open] summary { margin-bottom: 0; }

  /* KPI compatte */
  .kpi-bar { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  .kpi-value { font-size: 1.4rem; }

  /* Jobs: griglia compatta */
  .jobs-list {
  grid-template-columns: repeat(2, 1fr);
  gap: 0.35rem;
  }
  .job-card { padding: 0.55rem 0.6rem; }
  .job-card-langs { font-size: 0.72rem; }
  .job-detail-elapsed-wrap .job-elapsed-running,
  .job-detail-elapsed-wrap .job-elapsed-done { font-size: 0.9rem; }

  /* Jobs: elenco e dettaglio in colonna */
  .jobs-panel { grid-template-columns: 1fr; }

  /* Tabella scroll orizzontale */
  .items-table-wrap, .items-table { overflow-x: auto; display: block; width: 100%; }
  .items-table { font-size: 0.78rem; }
  .items-table th, .items-table td { white-space: nowrap; padding: 0.5rem 0.65rem; }

  /* Page header compatto */
  .page-header { gap: 0.5rem; flex-direction: column; align-items: stretch; }
  .page-header h2 { font-size: 1.2rem; }
  .page-header-actions {
  width: 100%;
  justify-content: flex-end;
  }
  .page-header-actions .btn-primary {
  flex: 0 1 auto;
  justify-content: center;
  min-height: 36px;
  font-size: 0.875rem;
  }
  .page-header-secondary { flex-shrink: 0; }

  .lib-page-header {
  align-items: stretch;
  }
  .lib-hero-actions {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.55rem;
  }
  .btn-lib-refresh {
  min-height: 54px;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  }
  .btn-lib-new {
  min-height: 54px !important;
  font-size: 1.12rem !important;
  width: 100%;
  }
  .btn-lib-new-xl {
  min-height: 66px !important;
  font-size: 1.22rem !important;
  }
  .lib-empty { padding: 1.75rem 0.25rem 2.25rem; }

  .prompt-lib-text { max-height: none; font-size: 0.82rem; }
  .prompt-lib-actions .btn { flex: 1; justify-content: center; min-height: 32px; }

  .videos-filters {
  flex-direction: column;
  align-items: stretch;
  }
  .videos-filters select,
  .videos-filters .search-input { width: 100%; max-width: none; }

  /* Bottoni full-width su mobile */
  .launch-btn-wrap .btn-primary { width: 100%; justify-content: center; }

  /* Cost banner compatto */
  .cost-banner { flex-direction: column; align-items: flex-start; gap: 0.4rem; padding: 0.75rem 1rem; }
  .cost-banner-tokens { margin-left: 0; }

  /* Modal bottom sheet su mobile â€” metÃ  schermo, flottante */
  .modal-overlay {
  padding: 0;
  align-items: flex-end;
  justify-content: center;
  background: rgba(15, 23, 42, 0.35);
  }

  .modal {
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 55dvh;
  border-radius: 16px 16px 0 0;
  margin: 0;
  box-shadow: 0 -12px 48px rgba(15, 23, 42, 0.22);
  animation: modalSheetIn 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  }

  .modal-prompt {
  height: 55dvh;
  max-height: 55dvh;
  }

  .modal::before {
  content: '';
  display: block;
  width: 36px;
  height: 4px;
  margin: 0.55rem auto 0;
  border-radius: 999px;
  background: var(--border);
  flex-shrink: 0;
  }

  .modal-header {
  padding-top: 0.5rem;
  padding-left: max(0.75rem, env(safe-area-inset-left));
  padding-right: max(0.75rem, env(safe-area-inset-right));
  }

  .modal-footer {
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
  padding-left: max(0.75rem, env(safe-area-inset-left));
  padding-right: max(0.75rem, env(safe-area-inset-right));
  }

  .modal-prompt-textarea {
  min-height: 0;
  }

  /* Evita zoom automatico iOS su input/textarea */
  input,
  textarea,
  select,
  .form-group textarea,
  .form-group input,
  .form-group select,
  .search-input {
  font-size: 16px !important;
  touch-action: manipulation;
  }

  /* Image page tabs */
  .img-tabs { gap: 0.25rem; }
  .img-tab { font-size: 0.8rem; padding: 0.5rem 0.75rem; }

  /* Prompt list altezza ridotta */
  .prompt-list { max-height: 260px; }

  /* Image results grid 1 col */
  .image-results-grid { grid-template-columns: 1fr 1fr; }

  /* Video gallery 2 col su mobile */
  .video-gallery { grid-template-columns: 1fr 1fr; gap: 0.6rem; }
  .video-card-actions { gap: 0.3rem; }
  .settings-lang-grid { grid-template-columns: 1fr; }
}

/* Legacy batch 2-col — never apply to create chooser / studio desk */
@media (min-width: 900px) {
  .batch-flow:not(:has(.studio-configure)):not(:has(.create-path-chooser)):not(:has(.still-create-body)) {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  }
  .batch-flow:not(:has(.studio-configure)):not(:has(.create-path-chooser)):not(:has(.still-create-body)) .batch-advanced,
  .batch-flow:not(:has(.studio-configure)):not(:has(.create-path-chooser)):not(:has(.still-create-body)) .batch-launch {
  grid-column: 1 / -1;
  }
  .batch-prompt-list { max-height: 180px; }
}

@media (min-width: 1200px) {
  .jobs-list {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.4rem;
  }
}

@media (max-width: 400px) {
  .jobs-list { grid-template-columns: 1fr; }
  .lang-grid { grid-template-columns: 1fr 1fr; }
  .kpi-bar { grid-template-columns: 1fr 1fr; }
  .image-results-grid { grid-template-columns: 1fr; }
  .form-row-3 { grid-template-columns: 1fr; }
}

/* â”€â”€ Video modal â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.vm-overlay {
  padding: 0;
  background: rgba(0,0,0,0.95);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  overscroll-behavior: contain;
  touch-action: none;
  height: 100dvh;
  height: 100vh;
}

.vm-box {
  display: flex;
  flex-direction: column;
  width: 95vw;
  max-width: 900px;
  max-height: 95dvh;
  max-height: 95vh;
  background: #0a0a0a;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,0.7);
  touch-action: auto;
}

.vm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  background: #111;
  flex-shrink: 0;
  min-height: 48px;
}

.vm-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.vm-close {
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  line-height: 1;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.vm-close:hover { background: rgba(255,255,255,0.2); }

.vm-body {
  flex: 1;
  min-height: 0;
  background: #000;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.vm-video {
  width: 100%;
  height: 100%;
  max-height: calc(95dvh - 110px);
  max-height: calc(95vh - 110px);
  display: block;
  object-fit: contain;
  background: #000;
  pointer-events: none;
}

.vm-center-btn {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 72px;
  height: 72px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 1.8rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
  transition: opacity 0.2s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.vm-center-btn:active {
  transform: translate(-50%, -50%) scale(0.94);
}

.vm-center-btn.hidden {
  opacity: 0;
  pointer-events: none;
}

.vm-play-btn {
  min-width: 6.5rem;
}

.vm-footer {
  display: flex;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  background: #111;
  flex-shrink: 0;
  flex-wrap: wrap;
  align-items: center;
  min-height: 54px;
}

/* Mobile: fullscreen vero */
@media (max-width: 768px) {
  .vm-overlay {
  align-items: flex-start;
  padding: 0;
  }

  .vm-box {
  width: 100vw;
  max-width: 100%;
  height: 100dvh;
  height: 100vh;
  max-height: 100dvh;
  max-height: 100vh;
  border-radius: 0;
  }

  .vm-header {
  padding: 0.6rem 0.75rem;
  min-height: 52px;
  }

  .vm-video {
  max-height: calc(100dvh - 106px);
  max-height: calc(100vh - 106px);
  }

  .vm-center-btn {
  width: 80px;
  height: 80px;
  font-size: 2rem;
  }

  .vm-footer {
  padding: 0.5rem 0.75rem;
  min-height: 54px;
  }

  .vm-close {
  width: 40px;
  height: 40px;
  font-size: 1.5rem;
  }
}

/* ── CapCut-like video editor ── */
.ed-overlay {
  z-index: 1100;
  padding: 0.5rem;
  background: rgba(15, 23, 42, 0.62);
  align-items: stretch;
  justify-content: center;
  overscroll-behavior: none;
}

.ed-shell {
  width: min(960px, 100%);
  height: min(98dvh, 100%);
  max-height: 98dvh;
  max-height: 98vh;
  margin: auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.ed-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.ed-header-left {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.ed-header-left strong {
  font-size: 1.05rem;
  font-weight: 700;
}

.ed-header-sub {
  font-size: 0.78rem;
  color: var(--muted);
}

.ed-preview-wrap {
  position: relative;
  background: #0b0f19;
  height: min(42vh, 420px);
  min-height: 200px;
  max-height: min(42vh, 420px);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  flex-shrink: 0;
  padding: 0.5rem;
  overflow: hidden;
}

.ed-toolbar,
.ed-header,
.ed-footer {
  flex-shrink: 0;
}

.ed-preview-stage {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  background: #000;
  overflow: hidden;
  display: block;
}

.ed-preview-stage[data-ratio="9:16"] {
  aspect-ratio: 9/16;
  width: auto;
  height: 100%;
  max-width: 42%;
}
.ed-preview-stage[data-ratio="1:1"] {
  aspect-ratio: 1/1;
  width: auto;
  height: 100%;
  max-width: 55%;
}
.ed-preview-stage[data-ratio="16:9"] {
  aspect-ratio: 16/9;
  width: min(100%, 720px);
  height: auto;
  max-height: 100%;
}

.ed-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
  background: #000;
  display: block;
}

.ed-video[hidden] {
  display: none !important;
}

.ed-image-box {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 40%;
  max-width: 92%;
  max-height: 92%;
  transform: translate(-50%, -50%);
  z-index: 3;
  cursor: grab;
  touch-action: none;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.45));
  overflow: hidden;
}

.ed-image-box:active { cursor: grabbing; }

.ed-image-box.ed-image-selected {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.ed-image-img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.ed-img-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid #fff;
  background: #0d6efd;
  border-radius: 3px;
  padding: 0;
  z-index: 4;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  touch-action: none;
}

.ed-img-handle[data-corner="nw"] { left: -7px; top: -7px; cursor: nwse-resize; }
.ed-img-handle[data-corner="ne"] { right: -7px; top: -7px; cursor: nesw-resize; }
.ed-img-handle[data-corner="sw"] { left: -7px; bottom: -7px; cursor: nesw-resize; }
.ed-img-handle[data-corner="se"] { right: -7px; bottom: -7px; cursor: nwse-resize; }

.ed-image-box:not(.ed-image-selected) .ed-img-handle {
  opacity: 0.85;
}

.ed-format-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}

.ed-select {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 0.35rem 0.45rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
}

.ed-inspector {
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--border);
  background: #eef2ff;
  flex-shrink: 0;
}

.ed-insp-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #312e81;
  margin-bottom: 0.4rem;
}

.ed-insp-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
  font-weight: 600;
}

.ed-insp-row input[type="range"] {
  flex: 1;
  min-width: 120px;
}

.ed-speed-btns {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.ed-chip {
  border: 1px solid #c7d2fe;
  background: #fff;
  color: #312e81;
  border-radius: 999px;
  padding: 0.28rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.ed-chip.active {
  background: #0d6efd;
  border-color: #0d6efd;
  color: #fff;
}

.ed-error-overlay { z-index: 1300; }
.ed-error-modal { max-width: 560px; max-height: min(85vh, 85dvh); }
.ed-error-lead {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.ed-error-text {
  width: 100%;
  min-height: 160px;
  resize: vertical;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.4;
  padding: 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff7ed;
  color: #9a3412;
}

.ed-preview-time {
  position: absolute;
  left: 0.75rem;
  bottom: 0.65rem;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.ed-toolbar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--border);
  background: #f8f9fa;
  flex-shrink: 0;
}

.ed-tool {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 10px;
  padding: 0.45rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.ed-tool:hover { background: #eef2ff; border-color: #c7d2fe; }
.ed-tool-accent {
  background: #0d6efd;
  border-color: #0d6efd;
  color: #fff;
}
.ed-tool-accent:hover { background: #0b5ed7; color: #fff; }
.ed-tool-ico { font-size: 0.95rem; line-height: 1; }
.ed-tool-sep {
  width: 1px;
  height: 22px;
  background: var(--border);
  margin: 0 0.2rem;
}
.ed-tool-hint {
  margin-left: auto;
  font-size: 0.74rem;
  color: var(--muted);
  max-width: 280px;
  text-align: right;
}

.ed-timeline-wrap {
  padding: 0.55rem 0.75rem 0.35rem;
  background: #111827;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ed-zoom {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-bottom: 0.35rem;
  flex-shrink: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.ed-zoom::-webkit-scrollbar { display: none; }

.ed-zoom .btn {
  min-width: 34px;
  min-height: 34px;
  color: #e5e7eb !important;
  border-color: #374151 !important;
  background: #1f2937 !important;
  flex-shrink: 0;
}

.ed-zoom-sep {
  width: 1px;
  height: 22px;
  background: #374151;
  margin: 0 0.15rem;
  flex-shrink: 0;
}

.ed-zoom-tool {
  min-height: 34px !important;
  padding: 0.3rem 0.55rem !important;
  font-size: 0.75rem !important;
  border-radius: 8px !important;
  flex-shrink: 0;
  background: #1f2937;
  border-color: #374151;
  color: #e5e7eb;
}

.ed-zoom-tool.ed-tool-accent {
  background: #0d6efd;
  border-color: #0d6efd;
  color: #fff;
}

.ed-zoom-tool:hover {
  background: #374151;
  border-color: #4b5563;
  color: #fff;
}

.ed-zoom-tool.ed-tool-accent:hover {
  background: #0b5ed7;
  border-color: #0b5ed7;
  color: #fff;
}

.ed-timeline-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: auto;
  overflow-y: auto;
  padding-bottom: 0.35rem;
  cursor: pointer;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  touch-action: pan-x pan-y;
}

.ed-timeline {
  position: relative;
  min-width: 100%;
  padding-bottom: 0.25rem;
}

.ed-ruler {
  position: relative;
  height: 18px;
  margin-bottom: 0.35rem;
  cursor: ew-resize;
  touch-action: none; /* scrub only from ruler / playhead */
}

.ed-ruler-mark {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  font-size: 0.62rem;
  color: #9ca3af;
  white-space: nowrap;
}

.ed-track {
  display: flex;
  align-items: stretch;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
  min-height: 44px;
}

.ed-track-label {
  width: 48px;
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
}

.ed-track-lane {
  position: relative;
  flex: 1;
  min-height: 44px;
  background: #1f2937;
  border-radius: 8px;
  border: 1px solid #374151;
}

.ed-track-empty {
  height: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  font-size: 0.78rem;
  font-weight: 600;
}

.ed-clip {
  position: absolute;
  top: 4px;
  bottom: 4px;
  border-radius: 8px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--clip-color) 85%, #fff), var(--clip-color));
  border: 2px solid transparent;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  /* pan-x lets mobile scroll a long timeline; handles keep touch-action: none */
  touch-action: pan-x;
}

.ed-clip.selected {
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35), 0 4px 14px rgba(0, 0, 0, 0.45);
  z-index: 2;
}

.ed-clip-body {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 12px;
  color: #fff;
  pointer-events: none;
}

.ed-clip-title { font-size: 0.72rem; font-weight: 700; }
.ed-clip-dur { font-size: 0.64rem; opacity: 0.9; }

.ed-clip-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 10px;
  border: none;
  padding: 0;
  background: rgba(255, 255, 255, 0.35);
  cursor: ew-resize;
  z-index: 3;
  touch-action: none;
}

.ed-clip-handle-l { left: 0; border-radius: 6px 0 0 6px; }
.ed-clip-handle-r { right: 0; border-radius: 0 6px 6px 0; }
.ed-clip-handle:hover { background: rgba(255, 255, 255, 0.7); }

.ed-media-block {
  position: absolute;
  top: 6px;
  bottom: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0 12px;
  font-size: 0.74rem;
  font-weight: 700;
  color: #fff;
  touch-action: pan-x;
  cursor: grab;
  border: 2px solid transparent;
  overflow: hidden;
}

.ed-media-block.selected {
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
  z-index: 2;
}

.ed-media-block:active { cursor: grabbing; }
.ed-media-label { pointer-events: none; flex: 1; text-align: center; }

.ed-audio-block { background: #059669; }
.ed-image-block { background: #d97706; }

.ed-media-block .ed-clip-handle {
  background: rgba(255, 255, 255, 0.35);
}

.ed-media-x {
  border: none;
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1;
}

.ed-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: #f43f5e;
  box-shadow: 0 0 0 1px rgba(244, 63, 94, 0.35);
  pointer-events: auto;
  z-index: 8;
  cursor: ew-resize;
  touch-action: none;
}

/* Area cliccabile più larga della linea */
.ed-playhead::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -10px;
  width: 22px;
}

.ed-playhead::before {
  content: '';
  position: absolute;
  top: 2px;
  left: -6px;
  width: 14px;
  height: 14px;
  background: #f43f5e;
  border-radius: 3px;
  transform: rotate(45deg);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.ed-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  flex-wrap: nowrap;
  padding: 0.7rem 0.85rem;
  padding-bottom: max(0.7rem, env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  background: #fff;
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 30;
  box-shadow: 0 -6px 20px rgba(15, 23, 42, 0.08);
}

.ed-footer-left {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  flex: 1 1 auto;
}

.ed-footer-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
  margin-left: auto;
}

.ed-footer-meta {
  font-size: 0.78rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ed-cancel-btn {
  min-height: 44px;
  padding: 0.55rem 0.9rem;
  font-weight: 600;
}

.ed-save-btn {
  min-height: 48px;
  min-width: 132px;
  padding: 0.7rem 1.35rem !important;
  font-size: 1rem !important;
  font-weight: 700 !important;
  border-radius: 12px !important;
  box-shadow: 0 4px 14px rgba(13, 110, 253, 0.35);
}

.ed-save-btn:disabled {
  opacity: 0.7;
  box-shadow: none;
}

@media (max-width: 700px) {
  .ed-overlay {
  padding: 0;
  align-items: stretch;
  }

  .ed-shell {
  width: 100%;
  height: 100dvh;
  height: 100vh;
  max-height: 100dvh;
  max-height: 100vh;
  border-radius: 0;
  margin: 0;
  }

  .ed-header {
  padding: 0.55rem 0.75rem;
  }

  .ed-tool span:not(.ed-tool-ico) { display: none; }
  .ed-zoom-tool span:not(.ed-tool-ico) { display: none; }
  .ed-tool-hint { display: none; }
  .ed-header-sub { display: none; }
  .ed-preview-wrap {
  height: min(22vh, 180px);
  max-height: min(22vh, 180px);
  min-height: 110px;
  flex: 0 0 auto;
  }
  .ed-toolbar {
  padding: 0.4rem 0.55rem;
  gap: 0.3rem;
  }
  .ed-format-wrap span { display: none; }

  .ed-footer {
  gap: 0.5rem;
  padding: 0.55rem 0.7rem;
  padding-bottom: max(0.65rem, env(safe-area-inset-bottom, 0px));
  flex-shrink: 0;
  position: relative;
  z-index: 40;
  }

  .ed-footer-left {
  flex: 0 0 auto;
  max-width: none;
  }

  .ed-footer-meta {
  display: none;
  }

  .ed-footer-actions {
  flex: 1 1 auto;
  justify-content: flex-end;
  min-width: 0;
  }

  .ed-cancel-btn {
  min-height: 44px;
  padding: 0.55rem 0.7rem;
  font-size: 0.88rem;
  }

  .ed-save-btn {
  flex: 1 1 auto;
  min-width: 7.5rem;
  min-height: 48px;
  font-size: 1rem !important;
  padding: 0.7rem 0.9rem !important;
  }
}

/* legacy trim (unused fallback) */
.trim-overlay {
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
}

.trim-modal {
  max-width: min(94vw, 520px) !important;
  max-height: 96dvh !important;
  max-height: 96vh !important;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.trim-modal .modal-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.trim-body { display: flex; flex-direction: column; gap: 0.85rem; flex: 1; min-height: 0; }
.trim-hint {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
  flex-shrink: 0;
}
.trim-player-wrap {
  position: relative;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  margin: 0 auto;
  width: 100%;
  flex: 1 1 auto;
  min-height: min(58vh, 620px);
  max-height: calc(96dvh - 250px);
  max-height: calc(96vh - 250px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.trim-preview-video {
  width: 100%;
  height: 100%;
  max-height: calc(96dvh - 250px);
  max-height: calc(96vh - 250px);
  object-fit: contain;
  display: block;
  background: #000;
}
.trim-mode-tabs {
  display: flex;
  gap: 0.4rem;
  padding: 0.2rem;
  background: var(--bg);
  border-radius: 10px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.trim-mode-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.trim-mode-btn:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.trim-mode-btn.active {
  background: var(--green);
  color: #052e16;
}
.trim-timeline { user-select: none; touch-action: none; flex-shrink: 0; }
.trim-timeline-track {
  position: relative;
  height: 52px;
  background: #1a1a1a;
  border-radius: 10px;
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
}
.trim-shade {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.55);
  pointer-events: none;
}
.trim-keep-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(34, 197, 94, 0.22);
  border-top: 2px solid #22c55e;
  border-bottom: 2px solid #22c55e;
  pointer-events: none;
}
.trim-remove-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(239, 68, 68, 0.35);
  border-top: 2px solid #ef4444;
  border-bottom: 2px solid #ef4444;
  pointer-events: none;
}
.trim-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--bg-elevated);
  box-shadow: 0 0 6px rgba(255,255,255,0.6);
  pointer-events: none;
  transform: translateX(-1px);
  z-index: 2;
}
.trim-handle {
  position: absolute;
  top: 4px;
  bottom: 4px;
  width: 14px;
  margin-left: -7px;
  border: none;
  border-radius: 6px;
  background: var(--bg-elevated);
  box-shadow: 0 2px 8px rgba(0,0,0,0.45);
  cursor: ew-resize;
  z-index: 3;
  padding: 0;
}
.trim-handle::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 4px;
  background: linear-gradient(180deg, #e2e8f0, #94a3b8);
}
.trim-handle:active { transform: scaleX(1.15); }
.trim-timeline-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 0.35rem;
  font-size: 0.74rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.trim-result-meta {
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
  flex-shrink: 0;
}
.trim-result-meta strong { color: var(--text); }
.trim-transport {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.trim-mode-desc {
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.35;
  flex: 1;
  min-width: 12rem;
}
.trim-footer { flex-wrap: wrap; gap: 0.5rem; }
.trim-footer-spacer { flex: 1; }
.pill-trim {
  background: rgba(249, 115, 22, 0.15);
  color: #ea580c;
  border: 1px solid rgba(249, 115, 22, 0.35);
  font-size: 0.68rem;
  padding: 0.1rem 0.45rem;
}

/* â”€â”€ Auth / Billing / Admin (stesso design system) â”€â”€â”€â”€â”€â”€â”€ */
body.auth-mode .mobile-header,
body.auth-mode .mobile-tabbar,
body.auth-mode .sidebar,
body.auth-mode .sidebar-overlay { display: none !important; }
body.auth-mode .app { display: block !important; min-height: 100dvh; width: 100%; }
body.auth-mode .main { margin: 0 !important; margin-left: 0 !important; padding: 0 !important; width: 100% !important; max-width: none !important; }
body.auth-mode .view { padding: 0 !important; max-width: none !important; width: 100% !important; margin: 0 !important; }

.auth-screen {
  min-height: 100dvh;
  width: 100%;
  display: grid;
  place-items: center;
  justify-items: center;
  padding: 2rem 1.25rem;
  position: relative;
  overflow: auto;
  background:
  radial-gradient(900px 500px at 10% -10%, rgba(13,110,253,0.1), transparent 55%),
  radial-gradient(800px 480px at 90% 110%, rgba(118,75,162,0.08), transparent 50%),
  #f8f9fa;
}
.auth-ambient {
  position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(15,23,42,0.04) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: 0.7;
}
.auth-panel {
  position: relative;
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  padding: 2rem 1.75rem 1.75rem;
  animation: authIn 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes authIn {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
.auth-brand {
  display: flex; align-items: center; gap: 0.85rem; margin-bottom: 1.5rem;
}
.auth-brand img {
  width: 48px; height: 48px; border-radius: 12px; background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.auth-brand strong { display: block; font-size: 1.05rem; color: #212529; font-weight: 700; }
.auth-brand span { display: block; font-size: 0.85rem; color: #6c757d; }
.auth-title { font-size: 1.55rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 0.35rem; color: #212529; }
.auth-sub { color: #6c757d; margin-bottom: 1.25rem; font-size: 0.95rem; }
.auth-error {
  background: #f8d7da; color: #dc3545; border-radius: 10px;
  padding: 0.7rem 0.85rem; font-size: 0.88rem; margin-bottom: 1rem;
}
.auth-form { display: flex; flex-direction: column; gap: 0.85rem; }
.auth-form label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.85rem; color: #6c757d; font-weight: 500; }
.auth-form input {
  border: 1px solid #dee2e6; border-radius: 8px; padding: 0.75rem 0.9rem;
  font: inherit; color: #212529; background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.auth-form input:focus {
  outline: none; border-color: #0d6efd;
  box-shadow: 0 0 0 3px rgba(13,110,253,0.15);
}
.btn-block { width: 100%; justify-content: center; }
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 0.6rem;
  width: 100%; border: 1px solid #dee2e6; background: #fff; color: #212529;
  border-radius: 10px; padding: 0.75rem 1rem; font-weight: 600; text-decoration: none;
  transition: background 0.15s, transform 0.15s;
}
.btn-google:hover { background: #f8f9fa; transform: translateY(-1px); }
.auth-divider {
  display: flex; align-items: center; gap: 0.75rem; margin: 1.1rem 0; color: var(--muted); font-size: 0.8rem;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.auth-links {
  display: flex; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap;
  margin-top: 1.1rem; font-size: 0.88rem;
}
.linkish {
  background: none; border: none; color: var(--blue); cursor: pointer; font: inherit; padding: 0;
}
.linkish:hover { text-decoration: underline; }

.sidebar-credits {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  margin: 0;
  padding: 0.55rem 0.15rem 0.65rem;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-align: left;
  transition: opacity 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.sidebar-credits:hover { opacity: 0.75; }
.sidebar-credits:hover .sidebar-credits-go { transform: translateX(2px); }

.sidebar-credits-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
}

.sidebar-credits-label {
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0.01em;
}

.sidebar-credits strong {
  color: var(--text);
  font-size: 1.35rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1;
}

.sidebar-credits-go {
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  transition: transform 0.15s ease;
}

.sidebar-logout {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  width: auto;
  min-height: 0;
  margin: 0.15rem 0 0;
  padding: 0.35rem 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.sidebar-logout:hover {
  color: var(--text);
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── Billing / purchase screen ─────────────────────────── */
.billing-page {
  max-width: 920px;
  margin: 0 auto;
  font-family: var(--font);
}

.billing-mobile { display: none; }
.billing-desktop { display: block; }

.billing-label {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Simple header: balance + title */
.billing-masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-bottom: 1.35rem;
  padding: 1rem 1.15rem;
  border-radius: 12px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
}
.billing-masthead-title {
  margin: 0;
  font-family: var(--font);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text);
}
.billing-masthead-lead {
  margin: 0.25rem 0 0;
  max-width: 26rem;
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--muted);
}
.billing-balance {
  min-width: 8.5rem;
  padding: 0.55rem 0.85rem;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  text-align: right;
}
.billing-balance .billing-label { color: var(--muted); }
.billing-balance strong {
  display: block;
  margin: 0.1rem 0;
  font-family: var(--font);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  color: var(--text);
}
.billing-balance strong.is-low { color: #c2410c; }
.billing-balance-plan {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
}

.billing-section { margin: 0 0 1.75rem; }
.billing-section-head { margin-bottom: 0.75rem; }
.billing-section-head h2 {
  font-family: var(--font);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 0.2rem;
}
.billing-section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.packs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}
.pack-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  text-align: left;
  padding: 1.1rem 1rem 1rem;
  min-height: 148px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  cursor: pointer;
  color: inherit;
  font: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.pack-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}
.pack-card-best {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.pack-badge,
.plan-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
}
.pack-badge {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
}
.plan-badge-current { background: var(--ink, #1e293b); }
.pack-credits {
  font-family: var(--font);
  font-size: 1.75rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.pack-credits-label { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.35rem; }
.pack-price {
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: auto;
  font-variant-numeric: tabular-nums;
}
.pack-meta { font-size: 0.75rem; color: var(--muted); margin-bottom: 0.55rem; }
.pack-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 42px;
  margin-top: 0.65rem;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 650;
  font-size: 0.9rem;
}
.pack-card-best .pack-cta { background: var(--accent); }
.pack-card.is-loading { opacity: 0.65; pointer-events: none; }

.plans-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}
.plan-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.15rem 1.05rem 1.05rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.plan-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}
.plan-featured {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 1px var(--accent-soft);
}
.plan-current {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.plan-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.1rem;
}
.plan-name {
  font-family: var(--font);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}
.plan-price {
  font-family: var(--font);
  font-size: 1.55rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.plan-price small { font-size: 0.78rem; color: var(--muted); font-weight: 500; margin-left: 0.15rem; }
.plan-credits-hero { font-size: 0.9rem; }
.plan-credits-hero strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.plan-tagline { color: var(--muted); font-size: 0.84rem; margin: 0 0 0.35rem; line-height: 1.35; }
.plan-features {
  list-style: none;
  font-size: 0.84rem;
  display: grid;
  gap: 0.3rem;
  flex: 1;
  margin: 0.15rem 0 0.5rem;
  padding: 0;
}
.plan-features li { padding-left: 1.1rem; position: relative; }
.plan-features li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.45em;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--accent);
}
.plan-card .btn { min-height: 46px; margin-top: auto; font-weight: 650; }

.billing-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  margin-bottom: 0.85rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
}

.billing-status-bar .billing-label { color: var(--muted); }

.billing-status-bar strong {
  display: block;
  font-family: var(--font);
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.billing-status-bar strong.is-low { color: #c2410c; }
.billing-status-plan strong { font-size: 1.05rem; }
.billing-status-plan { text-align: right; }

.billing-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  background: var(--blue-bg);
  color: var(--blue);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}
.billing-banner.ok { background: var(--green-bg); color: var(--green); }
.billing-banner.pending {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa;
}

.billing-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem;
  padding: 0.3rem;
  margin-bottom: 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.billing-tab {
  min-height: 44px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 650;
  font-size: 0.9rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.billing-tab.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.billing-panel-hint {
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.35;
}

.buy-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.buy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  min-height: 72px;
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.buy-row:active { transform: scale(0.99); }
.buy-row.is-loading { opacity: 0.6; pointer-events: none; }

.buy-row-best {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.buy-row-current {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.buy-row-main {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.buy-row-main strong {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.buy-row-tag {
  font-size: 0.75rem;
  font-weight: 650;
  color: var(--ink-soft, #334155);
}

.buy-row-tag.quiet { color: var(--muted); font-weight: 500; }

.buy-row-action {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  flex-shrink: 0;
}

.buy-row-price {
  font-size: 1.05rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.buy-row-price small {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  margin-left: 0.1rem;
}

.buy-row-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  min-height: 40px;
  padding: 0 0.9rem;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
}

.buy-row-cta.is-disabled,
.buy-row-cta:disabled {
  background: var(--bg);
  color: var(--muted);
  cursor: default;
}

.buy-row-plan {
  cursor: default;
}

.buy-row-plan .buy-row-cta { cursor: pointer; }

.billing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}
.billing-actions .btn { min-height: 44px; }

.billing-more {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  margin: 1.25rem 0 2rem;
}
.billing-more > summary {
  list-style: none;
  cursor: pointer;
  padding: 1rem 1.1rem;
  font-weight: 650;
  min-height: 48px;
  display: flex;
  align-items: center;
  -webkit-tap-highlight-color: transparent;
}
.billing-more > summary::-webkit-details-marker { display: none; }
.billing-more > summary::after {
  content: '+';
  margin-left: auto;
  color: var(--muted);
  font-weight: 500;
}
.billing-more[open] > summary::after { content: '−'; }
.billing-more-body { padding: 0 1.1rem 1.1rem; }
.billing-hist-list { display: grid; gap: 0.45rem; }
.billing-hist-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  background: var(--bg);
  border-radius: 10px;
}
.billing-hist-row strong { display: block; font-size: 0.9rem; }
.billing-hist-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.pill-warn {
  background: #fff7ed; color: #c2410c; border: 1px solid #fdba74;
}

.billing-hero { display: none; }

@media (max-width: 768px) {
  .billing-page { max-width: 560px; }
  .billing-desktop { display: none; }
  .billing-mobile { display: block; }
}

@media (min-width: 769px) and (max-width: 960px) {
  .packs-grid,
  .plans-grid { grid-template-columns: repeat(3, 1fr); gap: 0.7rem; }
}

.account-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-top: 0.75rem;
}
.account-grid .muted { display: block; font-size: 0.8rem; margin-bottom: 0.2rem; }

.admin-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.75rem; margin-bottom: 0.5rem;
}
.admin-stat {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 0.9rem 1rem;
}
.admin-stat span { display: block; color: var(--muted); font-size: 0.78rem; }
.admin-stat strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.admin-table th, .admin-table td { padding: 0.75rem 0.9rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); background: var(--bg-elevated); }
.admin-user { display: flex; flex-direction: column; gap: 0.1rem; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.pill-ok { background: var(--green-bg); color: var(--green); }
.pill-fail { background: var(--red-bg); color: var(--red); }

@media (max-width: 720px) {
  .auth-panel { padding: 1.5rem 1.2rem; }
  .admin-actions { flex-direction: column; align-items: stretch; }
}


/* Account / admin layout (theme in klandify-theme.css) */
.account-panels { display: grid; gap: 1rem; max-width: 720px; }
.account-form { display: grid; gap: 0.75rem; margin-top: 0.65rem; }
.account-form label, .account-form-row label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.8rem; color: var(--muted); font-weight: 500; }
.account-form input, .account-form-row input, .account-form-row select { padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: 8px; font: inherit; color: var(--text); background: #fff; }
.account-form-row { display: flex; flex-wrap: wrap; gap: 0.65rem; align-items: flex-end; margin-top: 0.5rem; }
.checkbox-inline { flex-direction: row !important; align-items: center; gap: 0.4rem !important; font-size: 0.8rem; }
.danger-zone { border-color: rgba(220, 53, 69, 0.35); }
.admin-user-link { text-align: left; width: 100%; }
.admin-detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; margin-top: 1rem; }
.admin-mini-list { display: grid; gap: 0.45rem; margin-top: 0.55rem; }
.admin-mini-row { display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; padding: 0.45rem 0.55rem; background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; font-size: 0.8rem; }
.admin-mini-row .muted { font-size: 0.72rem; }

/* ── Live support chat (minimal) ──────────────────────── */
.sc-root {
  --sc-ink: #111827;
  --sc-ink-soft: #6b7280;
  --sc-paper: #ffffff;
  --sc-paper-2: #f7f8fa;
  --sc-line: rgba(17, 24, 39, 0.08);
  --sc-accent: #111827;
  --sc-ease: cubic-bezier(0.22, 1, 0.36, 1);
  position: fixed;
  right: max(1rem, env(safe-area-inset-right, 0px));
  bottom: calc(1.15rem + env(safe-area-inset-bottom, 0px));
  z-index: 520;
  font-family: var(--font);
  pointer-events: none;
}
/* Only interactive pieces capture clicks — closed panel must NOT steal FAB taps */
.sc-fab,
.sc-root.is-open .sc-backdrop,
.sc-root.is-open .sc-panel {
  pointer-events: auto;
}

.sc-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.18);
  z-index: 519;
  opacity: 0;
  transition: opacity 0.25s var(--sc-ease);
  pointer-events: none;
}
.sc-root.is-open .sc-backdrop {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

.sc-fab {
  position: relative;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  padding: 0;
  border: 1px solid var(--sc-line);
  border-radius: 50%;
  cursor: pointer;
  color: var(--sc-ink);
  background: #fff;
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.1);
  font-family: var(--font);
  transition: transform 0.2s var(--sc-ease), box-shadow 0.2s ease, background 0.15s ease, opacity 0.2s ease;
  z-index: 241;
}
.sc-fab:hover {
  background: #f9fafb;
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(17, 24, 39, 0.12);
}
.sc-fab:active { transform: scale(0.97); }
.sc-root.is-open .sc-fab {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.92);
}
.sc-fab-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.sc-badge {
  position: absolute;
  top: -0.15rem;
  right: -0.15rem;
  min-width: 1.05rem;
  height: 1.05rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: #111827;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  z-index: 2;
}

.sc-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  width: min(22rem, calc(100vw - 1.5rem));
  height: min(32rem, calc(100dvh - 5rem));
  background: var(--sc-paper);
  border: 1px solid var(--sc-line);
  border-radius: 18px;
  box-shadow: 0 20px 48px rgba(17, 24, 39, 0.12);
  display: none;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(12px) scale(0.98);
  transition: opacity 0.28s var(--sc-ease), transform 0.3s var(--sc-ease), visibility 0.28s;
  z-index: 521;
}
.sc-root.is-open .sc-panel {
  display: flex;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.sc-sheet-handle {
  display: none;
  justify-content: center;
  padding: 0.45rem 0 0;
  background: transparent;
}
.sc-sheet-handle span {
  width: 2rem;
  height: 0.22rem;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.12);
}

.sc-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  background: #fff;
  color: var(--sc-ink);
  flex-shrink: 0;
  border-bottom: 1px solid var(--sc-line);
}
.sc-panel-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}
.sc-panel-title strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--sc-ink);
}
.sc-panel-title small {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.15rem;
  font-size: 0.72rem;
  color: var(--sc-ink-soft);
  font-weight: 500;
}
.sc-dot {
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
}
.sc-close {
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--sc-ink-soft);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease, color 0.15s ease;
}
.sc-close:hover { background: var(--sc-paper-2); color: var(--sc-ink); }
.sc-close:active { transform: scale(0.96); }

.sc-messages {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  background: var(--sc-paper-2);
  min-height: 0;
}
.sc-empty {
  margin: auto;
  text-align: center;
  padding: 1.25rem 1rem;
  max-width: 15rem;
}
.sc-empty p {
  margin: 0.2rem 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--sc-ink);
  letter-spacing: -0.015em;
  line-height: 1.35;
}
.sc-empty .muted {
  color: var(--sc-ink-soft);
  font-size: 0.78rem;
  line-height: 1.45;
  font-weight: 450;
}

.sc-msg {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  animation: sc-msg-in 0.22s var(--sc-ease);
}
@keyframes sc-msg-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.sc-msg time {
  font-size: 0.62rem;
  color: #9ca3af;
  margin-top: 0.22rem;
}
.sc-msg-me { align-self: flex-end; align-items: flex-end; }
.sc-msg-them { align-self: flex-start; align-items: flex-start; }
.sc-msg-system { align-self: center; max-width: 95%; }
.sc-msg-label {
  font-size: 0.62rem;
  color: var(--sc-ink-soft);
  margin-bottom: 0.18rem;
  font-weight: 600;
}
.sc-msg-bubble {
  padding: 0.6rem 0.8rem;
  border-radius: 14px;
  font-size: 0.875rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.sc-msg-me .sc-msg-bubble {
  background: var(--sc-accent);
  color: #fff;
  border-bottom-right-radius: 5px;
}
.sc-msg-them .sc-msg-bubble {
  background: #fff;
  border: 1px solid var(--sc-line);
  color: var(--sc-ink);
  border-bottom-left-radius: 5px;
}
.sc-msg-system .sc-msg-bubble {
  background: transparent;
  border: none;
  color: var(--sc-ink-soft);
  font-size: 0.72rem;
  text-align: center;
  padding: 0.2rem;
}

.sc-composer {
  display: flex;
  gap: 0.45rem;
  align-items: flex-end;
  padding: 0.7rem 0.8rem 0.85rem;
  border-top: 1px solid var(--sc-line);
  background: #fff;
  flex-shrink: 0;
}
.sc-composer textarea {
  flex: 1;
  resize: none;
  min-height: 2.5rem;
  max-height: 7rem;
  border: 1px solid var(--sc-line);
  border-radius: 12px;
  padding: 0.6rem 0.8rem;
  font: inherit;
  font-size: 16px;
  color: var(--sc-ink);
  background: var(--sc-paper-2);
  line-height: 1.4;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.sc-composer textarea::placeholder { color: #9ca3af; }
.sc-composer textarea:focus {
  outline: none;
  border-color: rgba(17, 24, 39, 0.22);
  background: #fff;
}
.sc-send {
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 12px;
  background: var(--sc-accent);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.sc-send:hover { opacity: 0.9; }
.sc-send:active { transform: scale(0.96); }

body.sc-chat-open { overflow: hidden; }

/* Admin support inbox */
.admin-support-jump {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-align: left;
  margin: 0 0 1.1rem;
  padding: 0.95rem 1.05rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  font: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.admin-support-jump:hover {
  border-color: rgba(13, 110, 253, 0.35);
  background: rgba(13, 110, 253, 0.04);
}
.admin-support-jump-ico {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 10px;
  background: #111827;
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.admin-support-jump-text {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
  flex: 1;
}
.admin-support-jump-text strong {
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--text);
}
.admin-support-jump-go {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-weight: 600;
  flex-shrink: 0;
}
.admin-support {
  display: grid;
  grid-template-columns: minmax(220px, 300px) 1fr;
  gap: 0;
  min-height: min(70vh, 640px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
}
.admin-support-list {
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; background: #f8fafc;
}
.admin-support-list-head {
  padding: 0.75rem 0.9rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
}
.admin-support-online {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.75rem; font-weight: 600; color: var(--green);
}
.admin-support-online::before {
  content: ''; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: #22c55e;
}
.admin-support-threads { overflow-y: auto; flex: 1; }
.admin-support-item {
  width: 100%; text-align: left; border: none; background: transparent;
  padding: 0.8rem 0.9rem; border-bottom: 1px solid var(--border); cursor: pointer;
  display: grid; gap: 0.2rem;
}
.admin-support-item:hover { background: #fff; }
.admin-support-item.active { background: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.admin-support-item strong { font-size: 0.86rem; color: var(--text); }
.admin-support-item .preview { font-size: 0.78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-support-item .meta { display: flex; gap: 0.45rem; align-items: center; font-size: 0.7rem; color: var(--muted); }
.admin-support-item .unread-dot {
  width: 0.45rem; height: 0.45rem; border-radius: 50%; background: var(--accent);
}
.admin-support-chat { display: flex; flex-direction: column; min-height: 0; }
.admin-support-chat-head {
  padding: 0.75rem 1rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap;
}
.admin-support-chat-head h3 { margin: 0; font-size: 1rem; }
.admin-support-msgs {
  flex: 1; overflow-y: auto; padding: 1rem; background: #f8fafc;
  display: flex; flex-direction: column; gap: 0.55rem; min-height: 280px;
}
.admin-support-empty {
  margin: auto; text-align: center; color: var(--muted); padding: 2rem 1rem;
}
.admin-support-composer {
  display: flex; gap: 0.5rem; padding: 0.75rem; border-top: 1px solid var(--border); background: #fff;
}
.admin-support-composer textarea {
  flex: 1; min-height: 2.6rem; max-height: 7rem; resize: none;
  border: 1px solid var(--border); border-radius: 10px; padding: 0.55rem 0.7rem; font: inherit;
}
.admin-tab .sc-tab-badge {
  display: inline-grid; place-items: center;
  min-width: 1.1rem; height: 1.1rem; padding: 0 0.3rem;
  margin-left: 0.35rem; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 0.65rem; font-weight: 700;
}

@media (max-width: 720px) {
  .sc-root {
    right: 0;
    left: 0;
    bottom: 0;
    top: auto;
  }
  .sc-root:not(.is-open) {
    right: max(0.95rem, env(safe-area-inset-right, 0px));
    left: auto;
    bottom: calc(4.85rem + env(safe-area-inset-bottom, 0px));
  }
  .sc-sheet-handle { display: flex; }
  .sc-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: min(88dvh, calc(100dvh - 1.25rem));
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 0.5rem);
    border-radius: 18px 18px 0 0;
    border: 1px solid rgba(17, 24, 39, 0.08);
    border-bottom: none;
    box-shadow: 0 -12px 40px rgba(17, 24, 39, 0.12);
    transform: translateY(108%);
  }
  .sc-root.is-open .sc-panel {
    transform: translateY(0);
  }
  .sc-composer {
    padding-bottom: calc(0.85rem + env(safe-area-inset-bottom, 0px));
  }
  .sc-fab {
    width: 2.85rem;
    height: 2.85rem;
  }
  .admin-support {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .admin-support-list { max-height: 220px; border-right: none; border-bottom: 1px solid var(--border); }
  .admin-support-msgs { min-height: 240px; }
}
body.kb-open .sc-root:not(.is-open) {
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
}

