:root {
  --green: #10b981;
  --green-600: #059669;
  --green-700: #047857;
  --green-50: #ecfdf5;
  --green-100: #d1fae5;
  --green-200: #a7f3d0;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --bg: #f8fafc;
  --white: #ffffff;
  --line: #e2e8f0;
  --line-soft: #f1f5f9;
  --amber: #b45309;
  --amber-bg: #fffbeb;
  --amber-line: #fde68a;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --display: "Plus Jakarta Sans", "Inter", sans-serif;
  --shadow: 0 1px 2px rgba(15, 23, 42, .035);
  --shadow-lift: 0 8px 28px -20px rgba(15, 23, 42, .22);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(780px 360px at 50% -140px, rgba(16, 185, 129, .10), transparent 65%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
i { line-height: 1; }
svg { display: block; }
::selection { background: var(--green-100); color: var(--ink); }

.app { display: grid; grid-template-columns: 270px minmax(0, 1fr); min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
  background: var(--white);
  border-right: 1px solid #eef2f7;
}
.sidebar-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 16px 12px 14px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.brand { display: flex; align-items: center; gap: 9px; padding: 2px 10px 0; }
.brand-logo {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: linear-gradient(145deg, #34d399, var(--green-600));
  color: #fff;
  box-shadow: 0 5px 12px -6px rgba(5, 150, 105, .55);
  flex: none;
}
.brand-logo svg { width: 19px; height: 19px; }
.brand-text {
  font-family: var(--display);
  font-size:19px;
  font-weight: 800;
  letter-spacing: -.035em;
  color: var(--ink);
  line-height: 1;
}
.nav { display: flex; flex-direction: column; margin-top: 18px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  margin: 15px 12px 5px;
  color: var(--muted-2);
  font-size:12px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 0 10px;
  border-radius: 9px;
  color: #475569;
  font-size:12.4px;
  font-weight: 500;
  transition: background .14s ease, color .14s ease;
}
.nav-item > i { width: 17px; text-align: center; font-size:13px; color: var(--muted-2); flex: none; }
.nav-item:hover { background: #f8fafc; color: var(--ink); }
.nav-item.active { background: #f1f5f9; color: var(--ink); font-weight: 600; }
.nav-item.active > i { color: var(--green-600); }
.nav-badge {
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 99px;
  border: 1px solid var(--green-200);
  background: var(--green-50);
  color: var(--green-700);
  font-size:12px;
  font-weight: 700;
  letter-spacing: .02em;
}
.nav-count {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--line-soft);
  color: var(--muted);
  font-size:12px;
  font-weight: 600;
}
.sidebar-bottom { margin-top: auto; padding-top: 18px; }
.guest-card {
  padding: 10px;
  border: 1px solid var(--amber-line);
  border-radius: 11px;
  background: linear-gradient(180deg, #fffdf5, var(--amber-bg));
}
.guest-head { display: flex; align-items: center; gap: 6px; color: var(--amber); font-size:12px; font-weight: 700; }
.guest-head i { font-size:12px; }
.guest-badge {
  margin-left: auto;
  padding: 2px 5px;
  border-radius: 99px;
  background: var(--green-50);
  border: 1px solid var(--green-200);
  color: var(--green-700);
  font-size:12px;
  font-weight: 700;
}
.guest-card p { margin: 5px 0 0; color: #92640f; font-size:12px; }
.guest-card strong { display: block; margin-top: 2px; color: #90610e; font-size:12px; font-weight: 600; line-height: 1.35; }
.login-link {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 9px 2px;
  color: var(--ink-2);
  font-size:12px;
  font-weight: 500;
}
.login-link > i:first-child { color: var(--muted); font-size:12px; }
.login-link .login-gear { margin-left: auto; color: var(--muted-2); font-size:12px; }
.login-link:hover { color: var(--green-700); }

/* ---------- Topbar ---------- */
.main-shell { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  border-bottom: 1px solid #eef2f7;
  background: rgba(255, 255, 255, .93);
  backdrop-filter: blur(12px);
}
.topbar-left { display: flex; align-items: center; gap: 9px; min-width: 0; }
.topbar-title {
  font-family: var(--display);
  font-size:17px;
  font-weight: 700;
  letter-spacing: -.02em;
  white-space: nowrap;
}
.service-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--green-200);
  border-radius: 99px;
  background: var(--green-50);
  color: var(--green-700);
  font-size:12px;
  font-weight: 600;
  white-space: nowrap;
}
.dot { width: 5px; height: 5px; border-radius: 99px; background: var(--green); flex: none; }
.service-pill.error { border-color: #fecaca; background: var(--red-bg); color: var(--red); }
.service-pill.error .dot { background: var(--red); }
.service-pill:not(.error) .dot { animation: softPulse 2.4s ease-in-out infinite; }
.topbar-actions { display: flex; align-items: center; gap: 7px; }
.top-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink-2);
  font-size:12px;
  font-weight: 600;
  transition: background .14s ease, border-color .14s ease, color .14s ease;
  white-space: nowrap;
}
.top-btn i { font-size:12px; color: var(--muted); }
.top-btn:hover { background: #f8fafc; border-color: #cbd5e1; }
.top-btn-green { border-color: var(--green-200); background: var(--green-50); color: var(--green-700); }
.top-btn-green i { color: var(--green-600); }
.top-btn-green:hover { background: var(--green-100); border-color: var(--green-200); }
.top-btn-login { padding: 0 15px; border-color: var(--green-200); background: var(--green-50); color: var(--green-700); }
.top-btn-login:hover { background: var(--green-100); }
.icon-btn {
  width: 32px; height: 32px;
  display: inline-grid; place-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  flex: none;
  transition: background .14s ease, color .14s ease, border-color .14s ease;
}
.icon-btn:hover { background: #f8fafc; border-color: var(--line); color: var(--ink); }
.icon-btn.gear { border-color: var(--line); background: #fff; width: 34px; height: 34px; font-size:13px; }
.menu-btn { display: none !important; }
.sidebar-backdrop { position: fixed; inset: 0; z-index: 35; background: rgba(15, 23, 42, .35); backdrop-filter: blur(2px); }

/* ---------- Layout ---------- */
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 348px;
  align-items: start;
  gap: 22px;
  width: 100%;
  max-width: 1540px;
  margin: 0 auto;
  padding: 22px 26px 42px;
}
.page { width: 100%; max-width: 860px; min-width: 0; margin: 0 auto; }
.breadcrumb { display: flex; align-items: center; gap: 7px; margin: 2px 0 15px; color: var(--muted-2); font-size:12px; font-weight: 500; }
.breadcrumb a { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); }
.breadcrumb a:hover { color: var(--green-700); }
.breadcrumb a i { font-size:12px; }
.breadcrumb > i { font-size:12px; color: #cbd5e1; }
.breadcrumb span { color: var(--ink-2); font-weight: 600; }

/* ---------- Hero ---------- */
.hero { text-align: center; margin: 4px 0 20px; }
.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 27px;
  padding: 0 11px;
  margin-bottom: 12px;
  border: 1px solid var(--green-200);
  border-radius: 99px;
  background: rgba(236, 253, 245, .8);
  color: var(--green-700);
  font-size:12px;
  font-weight: 700;
  letter-spacing: .02em;
}
.hero-pill i { font-size:12px; color: var(--green-600); }
.hero h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(30px, 3.4vw, 39px);
  font-weight: 800;
  letter-spacing: -.045em;
  line-height: 1.1;
  color: var(--ink);
}
.hero h1 span { color: var(--green-600); }
.hero p {
  max-width: 600px;
  margin: 10px auto 0;
  color: var(--muted);
  font-size:12.8px;
  line-height: 1.65;
}

/* ---------- Cards / composer ---------- */
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.composer { overflow: hidden; }
.tabs { display: flex; align-items: center; gap: 2px; padding: 0 8px; border-bottom: 1px solid var(--line-soft); }
.tab {
  display: inline-flex;
  align-items: center;
  height: 45px;
  padding: 0 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted-2);
  font-size:12.2px;
  font-weight: 500;
  transition: color .14s ease, border-color .14s ease;
}
.tab:hover { color: var(--ink-2); }
.tab.active { border-bottom-color: var(--green); color: var(--green-700); font-weight: 600; }
.composer-body { padding: 18px; }
.composer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 11px; }
.composer-head h2 { margin: 0; font-family: var(--display); font-size:14.5px; font-weight: 700; letter-spacing: -.02em; }
.composer-head p { margin: 3px 0 0; color: var(--muted); font-size:12px; }
.tiny-chip {
  flex: none;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: #f8fafc;
  color: var(--muted);
  font-size:12px;
  font-weight: 600;
  white-space: nowrap;
}
.dropzone {
  position: relative;
  min-height: 178px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 18px;
  border: 1.5px dashed #cbd5e1;
  border-radius: 13px;
  background: #f8fafc;
  text-align: center;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.dropzone:hover { border-color: var(--green-200); background: #f0fdf9; }
.dropzone.dragover { border-color: var(--green); background: var(--green-50); box-shadow: inset 0 0 0 3px rgba(16, 185, 129, .07); }
.dropzone.has-file { min-height: 0; padding: 10px; border-style: solid; border-color: var(--line); background: #fff; cursor: default; }
.dropzone.has-file .drop-default { display: none; }
.drop-default { display: flex; flex-direction: column; align-items: center; }
.drop-icon {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  margin-bottom: 10px;
  border-radius: 50%;
  border: 1px solid var(--green-100);
  background: var(--green-50);
  color: var(--green);
  font-size:19px;
}
.drop-copy { display: flex; flex-direction: column; gap: 2px; }
.drop-copy strong { font-size:12.8px; font-weight: 600; letter-spacing: -.01em; }
.drop-copy span { color: var(--muted-2); font-size:12px; }
.link { margin-top: 7px; padding: 0; border: 0; background: none; color: var(--green-600); font-size:12px; font-weight: 600; }
.link:hover { color: var(--green-700); text-decoration: underline; text-underline-offset: 3px; }
.file-card { width: 100%; display: flex; align-items: center; gap: 10px; padding: 4px 5px; text-align: left; }
.file-thumb {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--green-50);
  border: 1px solid var(--green-100);
  color: var(--green-600);
  font-size:15px;
  flex: none;
}
.file-thumb.small { width: 30px; height: 30px; border-radius: 8px; font-size:12px; }
.file-info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.file-info strong { font-size:12.3px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-info span { color: var(--muted); font-size:12px; }
.file-card .icon-btn { margin-left: auto; }

.language-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.fields { display: flex; align-items: flex-end; gap: 7px; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { padding-left: 2px; color: var(--muted-2); font-size:12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.select-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 39px;
  min-width: 145px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  transition: border-color .14s ease, box-shadow .14s ease;
}
.select-wrap:hover { border-color: #cbd5e1; }
.select-wrap:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-50); }
.select-wrap .flag { font-size:13px; line-height: 1; flex: none; }
.select-wrap select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-width: 0;
  padding: 0 16px 0 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size:12px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}
.select-wrap .chev { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); color: var(--muted-2); font-size:12px; pointer-events: none; }
.lang-arrow { height: 39px; display: grid; place-items: center; color: #cbd5e1; font-size:12px; }
.smart-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 8px;
  margin-bottom: 1px;
  border: 1px solid var(--green-200);
  border-radius: 99px;
  background: var(--green-50);
  color: var(--green-700);
  font-size:12px;
  font-weight: 600;
  white-space: nowrap;
}
.smart-badge i { font-size:12px; }
.composer-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 13px; }
.advanced-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 2px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size:12px;
  font-weight: 500;
}
.advanced-btn i { font-size:12px; transition: transform .16s ease; }
.advanced-btn[aria-expanded="true"] i { transform: rotate(180deg); }
.advanced-btn:hover { color: var(--green-700); }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size:12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.btn i { font-size:12px; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .icon-btn:focus-visible, .nav-item:focus-visible, .link:focus-visible, .select-wrap:focus-within, .tab:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}
.btn-primary {
  height: 42px;
  padding: 0 19px;
  background: linear-gradient(135deg, #34d399, var(--green-600));
  color: #fff;
  border-color: var(--green-600);
  box-shadow: 0 7px 16px -10px rgba(5, 150, 105, .7);
  font-size:12.2px;
  font-weight: 700;
}
.btn-primary:hover { background: linear-gradient(135deg, #10b981, var(--green-700)); transform: translateY(-1px); box-shadow: 0 10px 20px -10px rgba(5, 150, 105, .65); }
.btn-primary:disabled { opacity: .38; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-ghost { border-color: var(--line); background: #fff; color: var(--ink-2); }
.btn-ghost:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn-sm { height: 30px; padding: 0 10px; font-size:12px; border-radius: 8px; }
.advanced-panel { margin-top: 11px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; animation: fadeIn .15s ease; }
.check-row { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; }
.check-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check-box {
  width: 17px; height: 17px;
  display: grid; place-items: center;
  margin-top: 1px;
  border: 1.5px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  color: #fff;
  font-size:12px;
  flex: none;
  transition: background .14s ease, border-color .14s ease;
}
.check-box i { opacity: 0; }
.check-row input:checked + .check-box { background: var(--green); border-color: var(--green); }
.check-row input:checked + .check-box i { opacity: 1; }
.check-row input:focus-visible + .check-box { outline: 2px solid var(--green); outline-offset: 2px; }
.check-copy { display: flex; flex-direction: column; gap: 1px; }
.check-copy strong { font-size:12px; font-weight: 600; }
.check-copy small { color: var(--muted); font-size:12px; line-height: 1.4; }
.setup-banner {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 11px;
  padding: 10px;
  border: 1px solid var(--amber-line);
  border-radius: 10px;
  background: var(--amber-bg);
  color: #7c4a0b;
}
.setup-banner > i { margin-top: 2px; color: var(--amber); font-size:12px; }
.setup-banner strong { display: block; font-size:12px; font-weight: 600; }
.setup-banner span { display: block; margin-top: 1px; font-size:12px; line-height: 1.4; }
.composer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted-2);
  font-size:12px;
}
.composer-foot i { color: var(--green); font-size:12px; margin-right: 3px; }
.credit-note { white-space: nowrap; color: var(--muted); font-weight: 500; }

/* ---------- Progress / result ---------- */
.progress-card { margin-top: 16px; padding: 18px; }
.progress-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.progress-file { display: flex; align-items: center; gap: 9px; min-width: 0; }
.progress-file > div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.progress-file strong { font-size:12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress-file span { color: var(--muted); font-size:12px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 99px;
  font-size:12px;
  font-weight: 600;
  white-space: nowrap;
}
.chip-working { background: var(--amber-bg); border: 1px solid var(--amber-line); color: var(--amber); }
.chip-ready { background: var(--green-50); border: 1px solid var(--green-200); color: var(--green-700); }
.chip-failed { background: var(--red-bg); border: 1px solid #fecaca; color: var(--red); }
.chip-dot { width: 5px; height: 5px; border-radius: 99px; background: currentColor; }
.spinner { width: 9px; height: 9px; border: 1.5px solid currentColor; border-right-color: transparent; border-radius: 99px; animation: spin .8s linear infinite; }
.progress-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin: 15px 0 10px; }
.progress-title-row h3 { margin: 0; font-family: var(--display); font-size:17px; font-weight: 700; letter-spacing: -.025em; }
.progress-title-row p { margin: 3px 0 0; color: var(--muted); font-size:12px; line-height: 1.5; }
.progress-percent { font-family: var(--display); font-size:18px; font-weight: 700; letter-spacing: -.03em; color: var(--ink); font-variant-numeric: tabular-nums; }
.bar { position: relative; height: 6px; border-radius: 99px; background: var(--line-soft); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--green), #34d399); transition: width .3s ease; }
.bar.is-indeterminate span { width: 34%; animation: indeterminate 1.8s ease-in-out infinite; }
.progress-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-top: 15px; }
.pstep { display: flex; align-items: center; gap: 6px; color: var(--muted-2); font-size:12px; font-weight: 500; }
.pstep-dot { width: 6px; height: 6px; border-radius: 99px; background: #e2e8f0; flex: none; transition: background .2s ease, box-shadow .2s ease; }
.pstep.is-done { color: var(--muted); }
.pstep.is-done .pstep-dot { background: var(--green); }
.pstep.is-active { color: var(--ink); font-weight: 600; }
.pstep.is-active .pstep-dot { background: var(--green); box-shadow: 0 0 0 4px var(--green-50); }
.progress-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 15px; padding-top: 11px; border-top: 1px solid var(--line-soft); }
.elapsed { color: var(--muted-2); font-size:12px; font-variant-numeric: tabular-nums; }
.result-card { margin-top: 16px; padding: 18px; }
.result-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.result-title h2 { margin: 8px 0 0; font-family: var(--display); font-size:20px; font-weight: 700; letter-spacing: -.03em; }
.result-title p { margin: 3px 0 0; color: var(--muted); font-size:12px; }
.result-actions { display: flex; align-items: center; gap: 7px; flex: none; }
.result-player { margin-top: 14px; border-radius: 12px; overflow: hidden; border: 1px solid #1e293b; background: #0f172a; }
.result-player video { display: block; width: 100%; max-height: 460px; background: #0f172a; }
.result-player audio { display: block; width: 100%; padding: 8px; background: #0f172a; }

/* ---------- History panel ---------- */
.history-panel {
  position: sticky;
  top: 86px;
  max-height: calc(100vh - 106px);
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}
.history-head-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.history-title {
  display: flex; align-items: center; gap: 6px;
  color: var(--ink-2);
  font-size:12px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.history-title i { color: var(--green-600); font-size:12px; }
.clear-btn { padding: 4px 6px; border: 0; background: transparent; color: var(--muted-2); font-size:12px; font-weight: 500; }
.clear-btn:hover { color: var(--red); }
.history-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 9px 10px;
  margin-bottom: 10px;
  border: 1px solid var(--amber-line);
  border-radius: 10px;
  background: var(--amber-bg);
  color: #92640f;
  font-size:12px;
  line-height: 1.45;
}
.history-note i { margin-top: 2px; color: var(--amber); font-size:12px; flex: none; }
.history-note a { font-weight: 700; color: var(--amber); text-decoration: underline; text-underline-offset: 2px; }
.search {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 33px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted-2);
}
.search:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-50); }
.search i { font-size:12px; }
.search input { width: 100%; border: 0; outline: 0; background: transparent; font-size:12px; color: var(--ink); }
.search input::placeholder { color: var(--muted-2); }
.history-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.history-row {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow);
  transition: border-color .14s ease, box-shadow .14s ease;
}
.history-row:hover { border-color: var(--green-200); box-shadow: var(--shadow-lift); }
.history-item-top { display: flex; align-items: flex-start; gap: 8px; }
.history-file-icon {
  width: 31px; height: 31px;
  display: grid; place-items: center;
  border-radius: 8px;
  border: 1px solid var(--green-100);
  background: var(--green-50);
  color: var(--green-600);
  font-size:12px;
  flex: none;
}
.history-item-copy { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.history-item-copy strong { font-size:12px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-item-copy span { color: var(--muted); font-size:12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-item-actions { display: flex; align-items: center; gap: 1px; margin-left: auto; opacity: .55; transition: opacity .14s ease; }
.history-row:hover .history-item-actions { opacity: 1; }
.history-item-actions .icon-btn { width: 24px; height: 24px; border-radius: 6px; font-size:12px; }
.history-item-actions .icon-btn:hover { background: var(--green-50); color: var(--green-700); border-color: var(--green-100); }
.history-item-actions .icon-btn.danger:hover { background: var(--red-bg); color: var(--red); border-color: #fecaca; }
.history-item-actions .icon-btn:disabled { opacity: .25; cursor: not-allowed; }
.history-item-meta { display: flex; align-items: center; gap: 6px; margin-top: 7px; padding-top: 6px; border-top: 1px solid var(--line-soft); color: var(--muted-2); font-size:12px; font-variant-numeric: tabular-nums; }
.history-item-meta .chip { height: 18px; padding: 0 6px; font-size:12px; }
.history-item-meta .spinner { width: 7px; height: 7px; }
.empty { padding: 28px 14px 30px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; }
.empty-icon { width: 40px; height: 40px; display: grid; place-items: center; margin-bottom: 4px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--muted-2); font-size:16px; }
.empty strong { font-size:12px; font-weight: 600; }
.empty span:last-child { max-width: 250px; color: var(--muted); font-size:12px; line-height: 1.5; }
.usage-card {
  margin-top: 12px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.usage-title { display: flex; align-items: center; gap: 5px; color: var(--ink-2); font-size:12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.usage-title i { color: var(--green-600); font-size:12px; }
.usage-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; color: var(--muted); font-size:12px; }
.usage-row strong { color: var(--ink); font-size:12px; font-weight: 600; }
.usage-bar { height: 4px; margin-top: 7px; border-radius: 99px; background: var(--green-50); overflow: hidden; }
.usage-bar span { display: block; width: 100%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green), #34d399); }
.usage-row-small { margin-top: 6px; font-size:12px; color: var(--muted-2); }
.usage-row-small strong { font-size:12px; color: var(--muted); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 100;
  max-width: min(440px, calc(100vw - 28px));
  padding: 10px 14px;
  border-radius: 9px;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 16px 40px -16px rgba(15, 23, 42, .65);
  font-size:12px;
  line-height: 1.45;
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: #7f1d1d; }
.compat { display: none !important; }

/* ---------- Animations ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes indeterminate { 0% { transform: translateX(-110%); } 60% { transform: translateX(260%); } 100% { transform: translateX(260%); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-2px); } to { opacity: 1; transform: none; } }
@keyframes softPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, .25); } 50% { box-shadow: 0 0 0 4px rgba(16, 185, 129, .06); } }
.composer, .progress-card, .result-card { animation: fadeIn .3s ease both; }

/* ---------- Responsive ---------- */
@media (max-width: 1320px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 330px; padding: 20px 22px 36px; gap: 18px; }
  .page { max-width: 820px; }
}
@media (max-width: 1180px) {
  .workspace { grid-template-columns: 1fr; max-width: 980px; }
  .page { max-width: 900px; }
  .history-panel { position: static; max-height: none; overflow: visible; margin-top: 4px; }
  .history-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .history-note, .search, .history-head-row { max-width: none; }
  .usage-card { max-width: 360px; }
}
@media (max-width: 1080px) {
  .topbar-actions .top-btn-green span, .topbar-actions .top-btn:not(.top-btn-login) span { display: none; }
  .topbar-actions .top-btn-green, .topbar-actions .top-btn:not(.top-btn-login) { width: 34px; padding: 0; justify-content: center; }
  .topbar-actions .top-btn-green i, .topbar-actions .top-btn:not(.top-btn-login) i { font-size:13px; }
}
@media (max-width: 980px) {
  .app { display: block; }
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    width: 270px;
    height: 100vh;
    transform: translateX(-102%);
    transition: transform .22s ease;
    box-shadow: 30px 0 60px -30px rgba(15, 23, 42, .35);
    z-index: 50;
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open { overflow: hidden; }
  .menu-btn { display: inline-grid !important; }
  .topbar { padding: 0 16px; height: 58px; }
  .workspace { padding: 18px 16px 32px; }
}
@media (max-width: 760px) {
  .topbar-actions .gear { display: none; }
  .topbar-actions .top-btn-green, .topbar-actions .top-btn:not(.top-btn-login) { display: none; }
  .service-pill { display: none; }
  .topbar-title { font-size:15px; }
  .hero { margin: 2px 0 16px; }
  .hero h1 { font-size:30px; }
  .hero p { font-size:12px; max-width: 420px; }
  .hero-pill { margin-bottom: 9px; }
  .breadcrumb { margin-bottom: 11px; }
  .composer-body { padding: 14px; }
  .tabs { padding: 0 4px; }
  .tab { height: 41px; padding: 0 10px; font-size:12px; }
  .dropzone { min-height: 158px; padding: 20px 14px; }
  .drop-icon { width: 42px; height: 42px; font-size:17px; margin-bottom: 8px; }
  .language-row { flex-direction: column; align-items: stretch; gap: 9px; }
  .fields { display: grid; grid-template-columns: minmax(0, 1fr) 20px minmax(0, 1fr); gap: 4px; align-items: end; }
  .field { min-width: 0; }
  .select-wrap { min-width: 0; width: 100%; height: 38px; padding: 0 7px; }
  .select-wrap select { font-size:12px; padding-right: 12px; }
  .select-wrap .flag { font-size:12px; }
  .lang-arrow { height: 38px; }
  .smart-badge { align-self: flex-start; height: 24px; font-size:12px; }
  .composer-bottom { gap: 8px; }
  .btn-primary { height: 39px; padding: 0 14px; font-size:12px; }
  .composer-foot { flex-direction: column; align-items: flex-start; gap: 4px; font-size:12px; }
  .progress-card, .result-card { padding: 14px; margin-top: 13px; }
  .progress-title-row h3 { font-size:15.5px; }
  .progress-title-row p { font-size:12px; }
  .progress-percent { font-size:15px; }
  .progress-steps { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .result-head { flex-direction: column; gap: 11px; }
  .result-actions { width: 100%; }
  .result-actions .btn { flex: 1; }
  .result-title h2 { font-size:18px; }
  .history-panel { margin-top: 8px; }
  .history-list { grid-template-columns: 1fr; }
  .history-note { font-size:12px; }
  .usage-card { max-width: none; }
  .empty { padding: 22px 12px 24px; }
  .toast { bottom: 14px; font-size:12px; }
}
@media (max-width: 420px) {
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar-title { font-size:14px; }
  .topbar-actions .top-btn-login { padding: 0 10px; font-size:12px; }
  .workspace { padding: 14px 11px 26px; }
  .hero h1 { font-size:27px; }
  .hero p { font-size:12px; }
  .composer-head h2 { font-size:13.5px; }
  .tiny-chip { display: none; }
  .drop-copy strong { font-size:12px; }
  .composer-bottom { flex-direction: column-reverse; align-items: stretch; }
  .advanced-btn { justify-content: center; }
  .btn-primary { width: 100%; }
  .result-actions { flex-direction: column; }
  .result-actions .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* Live site auth / quota additions */
.topbar-user { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.topbar-avatar {
  width: 26px; height: 26px; border-radius: 99px;
  display: grid; place-items: center;
  background: var(--green-50); border: 1px solid var(--green-200);
  color: var(--green-700); font-size:12px; font-weight: 700; flex: none;
}
.topbar-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size:12px; font-weight: 600; color: var(--ink-2); }
.top-auth-form { display: inline-flex; margin: 0; }
.guest-card.is-auth { border-color: var(--green-200); background: linear-gradient(180deg, #f8fffc, var(--green-50)); }
.guest-card.is-auth .guest-head { color: var(--green-700); }
.guest-card.is-auth p { color: var(--green-700); }
.guest-card.is-auth .guest-badge { color: var(--green-700); }
.login-form { margin: 0; }
.login-form .login-link { width: 100%; border: 0; background: transparent; text-align: left; }
.login-form .login-link:hover { color: var(--green-700); }
@media (max-width: 1180px) { .topbar-name { display: none; } }

/* Full-width history rows inside the dubbing right rail */
.history-panel,
.history-list,
.history-row { width: 100%; max-width: none; box-sizing: border-box; }

/* Right-rail history must stay single-column (mobile 2-col grid was making rows half width) */
body.dubbing-embed-mode .history-list { display: flex !important; flex-direction: column !important; }
body.dubbing-embed-mode .history-row { width: 100% !important; }
