/* ============================================================
   theme.css — light theme, Stripe-inspired
   Used across every page of the site (landing, app, docs, etc).
   ============================================================ */

:root {
  --bg: #ffffff;
  --bg-soft: #f8fafc;
  --bg-tinted: #f1f5f9;
  --text: #0a1929;
  --text-dim: #5a6b80;
  --text-faint: #94a3b8;
  --border: #e5e9f0;
  --border-strong: #cbd5e1;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: rgba(79, 70, 229, 0.08);
  --accent-text: #ffffff;
  --code-bg: #0f172a;
  --code-text: #e2e8f0;
  --code-keyword: #c4b5fd;
  --code-string: #86efac;
  --success: #16a34a;
  --warning: #d97706;
  --warning-soft: rgba(217, 119, 6, 0.1);
  --error: #dc2626;
  --error-soft: rgba(220, 38, 38, 0.08);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, sans-serif;
  line-height: 1.55;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

button { font-family: inherit; }

/* legacy alias so existing markup that still has body.landing keeps working */
body.landing { background: var(--bg); color: var(--text); }

/* ----- Layout primitives ----- */

.landing-section {
  max-width: 1080px;
  margin: 0 auto;
  padding: 5rem 1.5rem;
}

.landing-section.tinted {
  background: var(--bg-soft);
  max-width: none;
  padding-left: max(1.5rem, calc((100vw - 1080px) / 2));
  padding-right: max(1.5rem, calc((100vw - 1080px) / 2));
}

.landing h1 {
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin: 0 0 1rem;
  font-weight: 700;
  color: var(--text);
}

.landing h2 {
  font-size: clamp(1.75rem, 3.5vw, 2.25rem);
  letter-spacing: -0.02em;
  margin: 0 0 0.75rem;
  font-weight: 700;
}

.landing h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.landing p { margin: 0 0 1rem; color: var(--text-dim); }

.landing .lead { font-size: 1.125rem; max-width: 640px; }

/* ----- Header ----- */

.landing-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem max(1.5rem, calc((100vw - 1080px) / 2));
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}

.landing-header .brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
}

.landing-header .brand-mark {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), #818cf8);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.75rem;
}

.landing-header .main-nav {
  display: flex;
  gap: 1.5rem;
  margin-left: 2rem;
  flex: 1;
}

.landing-header .main-nav a {
  color: var(--text-dim);
  font-size: 0.92rem;
}

.landing-header .main-nav a:hover { color: var(--text); }

.lang-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  font-size: 0.78rem;
}

.lang-toggle a {
  padding: 0.25rem 0.7rem;
  color: var(--text-dim);
  font-weight: 500;
}

.lang-toggle a.active {
  background: var(--text);
  color: white;
}

.header-cta {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-left: 0.5rem;
}

.btn-ghost, .btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s, transform 0.15s;
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn-ghost {
  color: var(--text-dim);
}
.btn-ghost:hover { color: var(--text); background: var(--bg-tinted); }

.btn-primary {
  background: var(--text);
  color: white;
}
.btn-primary:hover { background: var(--accent); transform: translateY(-1px); color: white; }

.btn-accent {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.85rem 1.6rem;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  font-weight: 600;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}
.btn-accent:hover { background: var(--accent-hover); transform: translateY(-1px); }

/* ----- Hero ----- */

.hero {
  padding-top: 5rem;
  padding-bottom: 5rem;
  text-align: center;
}

.hero-eyebrow {
  display: inline-block;
  padding: 0.25rem 0.8rem;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  margin-bottom: 1.25rem;
}

.hero p.lead { margin: 0 auto 2rem; }

.hero-form {
  display: flex;
  gap: 0.5rem;
  max-width: 580px;
  margin: 0 auto 0.75rem;
  background: white;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 0.4rem 0.4rem 0.4rem 0.4rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05), 0 4px 16px rgba(15, 23, 42, 0.04);
}

.hero-form input[type="url"] {
  flex: 1;
  padding: 0.75rem 0.9rem;
  font-size: 1rem;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  min-width: 0;
}

.hero-form input[type="url"]::placeholder { color: var(--text-faint); }

.hero-form button {
  padding: 0.75rem 1.4rem;
  background: var(--text);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s;
}

.hero-form button:hover { background: var(--accent); }

.hero-comments-opt {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.6rem;
  font-size: 0.9rem;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}

.hero-comments-opt input { accent-color: var(--accent); }

.hero-trust {
  color: var(--text-faint);
  font-size: 0.85rem;
  margin: 0.5rem 0 1.5rem;
}

.hero-sub-cta {
  font-size: 0.95rem;
  font-weight: 500;
}

/* ----- Section header (shared) ----- */

.section-eyebrow {
  display: block;
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.4rem;
}

.section-sub {
  font-size: 1.05rem;
  color: var(--text-dim);
  max-width: 580px;
  margin: 0 auto 2.5rem;
  text-align: center;
}

.section-title-center { text-align: center; margin-bottom: 2rem; }

/* ----- How it works ----- */

.how-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.how-step {
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: white;
}

.how-step .step-num {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

/* ----- Use cases ----- */

.usecases-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 2.5rem;
}

.usecase {
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: white;
}

.usecase .icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  display: block;
}

/* ----- Dev section ----- */

.devs {
  padding-top: 5rem;
  padding-bottom: 5rem;
}

.devs-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 3rem;
  align-items: start;
}

.devs-side h2 { margin-bottom: 1rem; }

.devs-side ul {
  list-style: none;
  padding: 0;
  margin: 1.25rem 0;
}

.devs-side li {
  padding: 0.4rem 0;
  color: var(--text-dim);
  font-size: 0.95rem;
}
.devs-side li::before {
  content: '✓';
  color: var(--success);
  font-weight: 700;
  margin-right: 0.6rem;
}

.devs-code {
  background: var(--code-bg);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.12);
}

.devs-tabs {
  display: flex;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.devs-tabs button {
  flex: 1;
  padding: 0.75rem;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 500;
  transition: color 0.15s, background 0.15s;
}

.devs-tabs button.active {
  background: rgba(255, 255, 255, 0.07);
  color: white;
}

.devs-tabs button:hover:not(.active) { color: rgba(255, 255, 255, 0.85); }

.devs-code pre {
  margin: 0;
  padding: 1.25rem 1.5rem;
  color: var(--code-text);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  overflow-x: auto;
}

.devs-code .k { color: var(--code-keyword); }
.devs-code .s { color: var(--code-string); }

/* ----- Pricing ----- */

.landing-pricing-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  max-width: 760px;
  margin: 2.5rem auto 1.5rem;
}

.landing-price-card {
  position: relative;
  background: white;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem 1.75rem;
}

.landing-price-card.featured {
  border-color: var(--accent);
  background: linear-gradient(180deg, white, var(--accent-soft));
  box-shadow: 0 20px 40px rgba(79, 70, 229, 0.1);
}

.landing-price-card.featured::before {
  content: attr(data-recommended);
  position: absolute;
  top: -0.7rem;
  left: 1.5rem;
  background: var(--accent);
  color: white;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.landing-price-card h3 { font-size: 1rem; color: var(--text-dim); font-weight: 500; }

.landing-price-amount {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0.4rem 0 0.2rem;
  letter-spacing: -0.02em;
}

.landing-price-amount small {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-dim);
  margin-left: 0.3rem;
}

.landing-price-card ul {
  list-style: none;
  padding: 0;
  margin: 1.25rem 0 1.75rem;
}

.landing-price-card li {
  padding: 0.35rem 0;
  font-size: 0.95rem;
}
.landing-price-card li::before {
  content: '✓';
  color: var(--success);
  font-weight: 700;
  margin-right: 0.6rem;
}

.landing-price-card .price-cta {
  display: block;
  text-align: center;
  padding: 0.75rem;
  border-radius: 10px;
  font-weight: 600;
  background: var(--text);
  color: white;
}

.landing-price-card.featured .price-cta {
  background: var(--accent);
}

.landing-price-card .price-cta:hover { opacity: 0.92; color: white; }

.pricing-extra-cta { text-align: center; margin-top: 0.5rem; font-size: 0.9rem; }

/* ----- FAQ ----- */

.faq {
  max-width: 780px;
  margin: 0 auto;
}

.faq-item {
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
}

.faq-item summary {
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text);
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after {
  content: '+';
  font-size: 1.2rem;
  color: var(--text-faint);
  transition: transform 0.15s;
}

.faq-item[open] summary::after { content: '−'; }

.faq-item p {
  margin: 0.6rem 0 0;
  color: var(--text-dim);
  font-size: 0.95rem;
}

/* ----- Footer ----- */

.landing-footer {
  background: var(--bg-soft);
  border-top: 1px solid var(--border);
  padding: 3rem max(1.5rem, calc((100vw - 1080px) / 2)) 2rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-brand .brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.footer-brand p { font-size: 0.9rem; color: var(--text-dim); max-width: 280px; }

.footer-col h4 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  font-weight: 600;
  margin: 0 0 0.85rem;
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-col li { margin: 0.3rem 0; font-size: 0.9rem; }

.footer-col a { color: var(--text-dim); }
.footer-col a:hover { color: var(--text); }

.footer-bottom {
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-faint);
}

/* ----- Mobile ----- */

@media (max-width: 820px) {
  body.landing { font-size: 15px; }
  .landing-header { padding: 0.7rem 1rem; gap: 0.5rem; flex-wrap: wrap; }
  .landing-header .main-nav { display: none; }
  .landing-header .brand { flex: 1; }
  /* Keep BOTH login CTAs visible on mobile — compress padding instead of hiding. */
  .header-cta { gap: 0.4rem; }
  .header-cta .btn-ghost, .header-cta .btn-primary {
    padding: 0.45rem 0.8rem;
    font-size: 0.85rem;
  }
  .lang-toggle { order: 99; }
  .landing-section { padding: 3.5rem 1.25rem; }
  .hero { padding-top: 3rem; padding-bottom: 3rem; }
  .hero-form { flex-direction: column; padding: 0.5rem; }
  .hero-form button { width: 100%; padding: 0.85rem; }
  .how-grid { grid-template-columns: 1fr; }
  .usecases-grid { grid-template-columns: 1fr; }
  .devs-grid { grid-template-columns: 1fr; gap: 2rem; }
  .landing-pricing-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 1.5rem; }
}

@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   APP COMPONENTS (logged area + reusable bits)
   ============================================================ */

/* ----- container helpers ----- */

.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.container-narrow { max-width: 440px; padding-top: 4rem; }

.subtitle {
  color: var(--text-dim);
  margin: 0 0 2rem;
  font-size: 1rem;
}

.muted { color: var(--text-dim); }
.muted.small { font-size: 0.85rem; }

.error {
  padding: 1rem;
  background: var(--error-soft);
  border: 1px solid var(--error);
  border-radius: 10px;
  color: var(--error);
  margin-bottom: 1rem;
}
.error strong { display: block; margin-bottom: 0.3rem; }
.error p { margin: 0; font-size: 0.92rem; opacity: 0.95; }

[x-cloak] { display: none !important; }

/* ----- generic buttons in app (not the landing ones) ----- */

button {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 0.65rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 500;
  background: var(--text);
  color: white;
  transition: background 0.15s, transform 0.15s;
}
button:hover:not(:disabled) { background: var(--accent); }
button:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-link {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: var(--bg-tinted);
  color: var(--text);
  border-radius: 8px;
  font-size: 0.88rem;
  margin-right: 0.4rem;
  transition: background 0.15s;
}
.btn-link:hover { background: var(--border); color: var(--text); }

/* ----- Auth forms ----- */

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.auth-form input {
  padding: 0.75rem 1rem;
  font-size: 1rem;
  background: white;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.auth-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.auth-form button[type="submit"] {
  margin-top: 0.5rem;
  padding: 0.85rem;
  background: var(--accent);
}

.auth-form button[type="submit"]:hover:not(:disabled) { background: var(--accent-hover); }

.auth-alt {
  margin-top: 1.5rem;
  font-size: 0.92rem;
  text-align: center;
  color: var(--text-dim);
}
.auth-alt a { color: var(--accent); font-weight: 500; }

.link-subtle {
  font-size: 0.85rem;
  color: var(--text-dim);
  text-decoration: underline;
  margin-left: 0.35rem;
}
.link-subtle:hover { color: var(--accent); }

/* ----- OAuth (social login) ----- */

.oauth-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 1.25rem;
}

.btn-oauth {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 0.7rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: white;
  color: var(--text);
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.btn-oauth:hover {
  background: var(--bg-tinted);
  border-color: var(--accent);
}

.btn-oauth svg { flex-shrink: 0; }

.btn-oauth-github {
  background: #24292f;
  color: white;
  border-color: #24292f;
}
.btn-oauth-github:hover {
  background: #1b1f24;
  color: white;
  border-color: #1b1f24;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0 0.25rem;
  color: var(--text-dim);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.auth-divider span { white-space: nowrap; }

.oauth-error {
  margin-top: 1rem;
}

/* ----- Live page: server-rendered metadata (for bots / no-JS) ----- */

.server-meta {
  margin: 1.2rem 0;
  padding: 1rem 1.2rem;
  background: var(--bg-soft);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  font-size: 0.95rem;
}
.server-meta p { margin: 0.3rem 0; }
.server-meta:empty { display: none; }

.agent-note {
  margin: 1rem 0;
  padding: 0.8rem 1rem;
  background: var(--bg-tinted);
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.6;
}

/* ----- Friendly error card (no tech jargon, prominent retry CTA) ----- */

.error-card {
  max-width: 540px;
  margin: 3rem auto;
  padding: 2rem 2rem 2.2rem;
  background: white;
  border: 1px solid var(--border);
  border-radius: 14px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.error-card h1 {
  font-size: 1.4rem;
  margin: 0 0 0.8rem;
  color: var(--text);
}
.error-card .error-msg {
  color: var(--text-dim);
  font-size: 1rem;
  line-height: 1.55;
  margin: 0 0 1.6rem;
}
.error-card .error-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  align-items: stretch;
}
.error-card .btn-primary,
.error-card .btn-ghost {
  padding: 0.75rem 1.2rem;
  border-radius: 10px;
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}
.error-card .btn-primary {
  background: var(--accent);
  color: white;
}
.error-card .btn-primary:hover {
  background: var(--accent-hover);
}
.error-card .btn-ghost {
  background: white;
  color: var(--text);
  border-color: var(--border-strong);
}
.error-card .btn-ghost:hover {
  background: var(--bg-tinted);
  border-color: var(--accent);
}

/* "Nova transcrição" panel at the top of /historico */
.history-new {
  margin: 1.5rem 0 2.5rem;
  padding: 1.5rem 1.5rem 1.7rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.history-new-title {
  margin: 0 0 1rem;
  font-size: 1.15rem;
  font-weight: 600;
}
.history-listing-title {
  margin-top: 2rem;
}

/* Friendly failure reason under a failed row's meta line. */
.history-error-reason {
  margin: 0.45rem 0 0;
  color: var(--text-dim);
  font-size: 0.88rem;
  line-height: 1.4;
  font-style: italic;
}

/* ----- Detail page: view tabs (Transcript / Frames) ----- */
.view-tabs {
  display: flex;
  gap: 0.4rem;
  margin: 1.2rem 0 0.8rem;
  border-bottom: 1px solid var(--border);
}
.view-tabs button {
  background: transparent;
  border: 0;
  padding: 0.6rem 1.1rem;
  font-size: 0.95rem;
  color: var(--text-dim);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.view-tabs button:hover { color: var(--text); }
.view-tabs button.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}
.view-tabs .tab-count {
  margin-left: 0.25rem;
  font-variant-numeric: tabular-nums;
  opacity: 0.7;
  font-size: 0.85em;
}

/* ----- Language footer ----- */
.lang-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.2rem 1rem 1.6rem;
  font-size: 0.85rem;
  color: var(--text-faint);
}
.lang-footer a {
  color: var(--text-dim);
  text-decoration: none;
}
.lang-footer a:hover { color: var(--text); text-decoration: underline; }
.lang-footer a.active { color: var(--accent); font-weight: 600; }
.footer-bottom .lang-footer { padding: 0.6rem 0 0; }

/* ----- Comments list ----- */
.comments-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin: 1rem 0 1.5rem;
}
.comment-card {
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-soft);
}
.comment-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
}
.comment-author { font-weight: 600; }
.comment-badge {
  padding: 1px 7px;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  font-size: 0.72rem;
  font-weight: 600;
}
.comment-likes {
  margin-left: auto;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
.comment-text {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.5;
  font-size: 0.95rem;
}

/* ----- Frames grid ----- */
.frames-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.7rem;
  margin: 1rem 0 1.5rem;
}
.frame-tile {
  position: relative;
  display: block;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  background: var(--surface-2);
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.frame-tile:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}
.frame-tile img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #000;
}
.frame-timestamp {
  position: absolute;
  bottom: 6px;
  right: 6px;
  padding: 2px 6px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  border-radius: 3px;
  pointer-events: none;
}

/* ----- Lightbox ----- */
.frame-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
}
.frame-lightbox-img {
  max-width: 95vw;
  max-height: 88vh;
  object-fit: contain;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  border-radius: 4px;
}
.frame-lightbox-close,
.frame-lightbox-nav {
  position: absolute;
  background: rgba(0, 0, 0, 0.55);
  color: white;
  border: 0;
  cursor: pointer;
  font-size: 2.4rem;
  line-height: 1;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  transition: background 0.15s;
}
.frame-lightbox-close { top: 18px; right: 18px; font-size: 1.6rem; }
.frame-lightbox-nav { top: 50%; transform: translateY(-50%); }
.frame-lightbox-nav.prev { left: 18px; }
.frame-lightbox-nav.next { right: 18px; }
.frame-lightbox-close:hover,
.frame-lightbox-nav:hover { background: rgba(0, 0, 0, 0.85); }
.frame-lightbox-caption {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.55);
  color: white;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 0.9rem;
  display: flex;
  gap: 0.4rem;
}
@media (min-width: 480px) {
  .error-card .error-actions {
    flex-direction: row;
    justify-content: center;
  }
  .error-card .btn-primary,
  .error-card .btn-ghost {
    min-width: 180px;
  }
}

/* ----- Legal pages (privacy / terms) ----- */

.legal-doc {
  padding-top: 2rem;
  padding-bottom: 4rem;
  line-height: 1.65;
}
.legal-doc h1 { font-size: 2rem; margin-bottom: 0.5rem; }
.legal-doc h2 { margin-top: 2.2rem; font-size: 1.2rem; }
.legal-doc p, .legal-doc li { color: var(--text); }
.legal-doc ul { padding-left: 1.4rem; margin: 0.6rem 0; }
.legal-doc li { margin-bottom: 0.35rem; }
.legal-doc a { color: var(--accent); }
.legal-doc code { background: var(--bg-tinted); padding: 0.1em 0.4em; border-radius: 4px; font-size: 0.9em; }

/* ----- App header (logged or anonymous, drop-in for partial _header.html) ----- */

.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem max(1.5rem, calc((100vw - 1080px) / 2));
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}

.app-header .brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--text);
}
.app-header .brand-mark {
  width: 24px; height: 24px; border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), #818cf8);
  display: inline-flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 0.75rem;
}

.app-nav { display: flex; gap: 1.5rem; margin-left: 2rem; flex: 1; }
.app-nav a {
  color: var(--text-dim);
  font-size: 0.92rem;
}
.app-nav a:hover { color: var(--text); }
.app-nav a.active { color: var(--text); font-weight: 500; }

.app-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.88rem;
  color: var(--text-dim);
}
.app-user .user-name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 180px;
}
.app-user button {
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  background: var(--bg-tinted);
  color: var(--text);
}
.app-user button:hover { background: var(--border); }

@media (max-width: 820px) {
  .app-header { padding: 0.7rem 1rem; flex-wrap: wrap; gap: 0.6rem; }
  .app-nav { order: 3; flex-basis: 100%; margin-left: 0; overflow-x: auto; gap: 1rem; }
  .app-user .user-name { max-width: 120px; }
}

/* ----- Source zone (URL input + drag&drop) ----- */

.source-zone {
  border: 1.5px dashed var(--border-strong);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  background: white;
  transition: border-color 0.15s, background 0.15s;
}
.source-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.source-zone .source-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}
.source-zone input[type="text"] {
  flex: 1;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  outline: none;
  min-width: 0;
}
.source-zone input[type="text"]:focus {
  border-color: var(--accent);
  background: white;
}
.source-zone input[type="text"]:disabled { opacity: 0.5; }
.source-zone .source-hint {
  margin-top: 0.6rem;
  font-size: 0.82rem;
  color: var(--text-dim);
  text-align: center;
}
.source-zone .source-hint .file-pick {
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
}
.source-zone .file-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.9rem;
  font-size: 0.92rem;
  flex: 1;
  min-width: 0;
}
.source-zone .file-pill .file-name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: 1; min-width: 0;
}
.source-zone .file-pill .file-size {
  color: var(--text-dim); font-size: 0.82rem; font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.source-zone .file-pill .file-remove {
  background: transparent;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 0.2rem;
}
.source-zone .file-pill .file-remove:hover { color: var(--error); }
.source-zone input[type="file"] { display: none; }
.source-zone .source-row button {
  padding: 0.75rem 1.4rem;
  background: var(--text);
  white-space: nowrap;
}
.source-zone .source-row button:hover:not(:disabled) { background: var(--accent); }

@media (max-width: 600px) {
  .source-zone .source-row { flex-direction: column; }
}

/* ----- Shortcut tip (used in app/index) ----- */

.shortcut-tip {
  margin: 0 0 1.5rem;
  padding: 0.85rem 1.25rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  font-size: 0.9rem;
}
.shortcut-tip summary { cursor: pointer; color: var(--text); font-weight: 500; }
.shortcut-tip[open] summary { margin-bottom: 0.5rem; }
.shortcut-tip pre {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 0.65rem 0.85rem;
  border-radius: 6px;
  font-size: 0.82rem;
  overflow-x: auto;
  margin: 0.5rem 0;
}
.shortcut-tip code { font-family: ui-monospace, monospace; }
.shortcut-tip p { margin: 0.4rem 0; color: var(--text-dim); }

/* ----- Lock modal (full-screen progress overlay) ----- */

.lock-overlay {
  position: fixed; inset: 0;
  background: rgba(248, 250, 252, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  animation: fadein 0.2s ease-out;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

.lock-card {
  width: 100%; max-width: 520px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem 1.75rem 1.5rem;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.15);
  text-align: center;
}

.lock-visual { display: flex; justify-content: center; margin-bottom: 1.25rem; }
.orbit { position: relative; width: 88px; height: 88px; }
.orbit-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--accent);
  animation: orbit-spin 1.6s linear infinite;
}
.orbit-ring.delay-1 {
  inset: 10px;
  border-top-color: rgba(79, 70, 229, 0.5);
  animation-duration: 2.4s;
  animation-direction: reverse;
}
.orbit-ring.delay-2 {
  inset: 20px;
  border-top-color: rgba(79, 70, 229, 0.25);
  animation-duration: 3.2s;
}
.orbit-core {
  position: absolute; inset: 28px;
  border-radius: 50%;
  background: var(--bg-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
}
@keyframes orbit-spin { to { transform: rotate(360deg); } }

.lock-title { margin: 0 0 0.4rem; font-size: 1.3rem; font-weight: 600; letter-spacing: -0.01em; }
.lock-sub { margin: 0 0 1.25rem; color: var(--text-dim); font-size: 0.95rem; min-height: 1.4em; }

.lock-video {
  display: flex; gap: 0.75rem;
  background: var(--bg-soft);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  text-align: left;
  align-items: center;
}
.lock-thumb {
  width: 64px; height: auto; max-height: 80px;
  object-fit: contain; flex-shrink: 0; border-radius: 6px;
  background: var(--bg-tinted);
}
.lock-video-info { min-width: 0; flex: 1; }
.lock-video-title {
  font-size: 0.92rem; font-weight: 500;
  margin-bottom: 0.2rem;
  word-break: break-word; line-height: 1.35;
  color: var(--text);
}
.lock-video-meta { font-size: 0.8rem; color: var(--text-dim); }

.lock-progress {
  position: relative;
  width: 100%; height: 6px;
  background: var(--bg-tinted);
  border-radius: 3px; overflow: hidden;
  margin-bottom: 0.5rem;
}
.lock-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #818cf8);
  border-radius: 3px;
  transition: width 0.25s ease;
}
.lock-progress.indeterminate .lock-progress-fill {
  width: 35% !important;
  animation: indeterminate-slide 1.4s ease-in-out infinite;
}
@keyframes indeterminate-slide {
  0% { transform: translateX(-100%); } 100% { transform: translateX(300%); }
}

.lock-meter {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 0.82rem; color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  margin-bottom: 1.25rem; min-height: 1.2em;
}
.lock-pct { color: var(--text); font-weight: 500; }

.lock-stages {
  list-style: none; padding: 0; margin: 0 0 1.25rem;
  text-align: left;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}
.lock-stages li {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.35rem 0; font-size: 0.88rem;
  color: var(--text-dim);
}
.lock-check {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--bg-tinted); font-size: 0.7rem;
  flex-shrink: 0; color: var(--text-dim); font-weight: bold;
}
.lock-stages li.active { color: var(--text); }
.lock-stages li.active .lock-check {
  background: var(--accent); color: white;
  animation: lock-pulse 1.4s ease-in-out infinite;
}
.lock-stages li.done { color: var(--success); }
.lock-stages li.done .lock-check { background: var(--success); color: white; animation: none; }
.lock-stage-detail { margin-left: auto; font-size: 0.78rem; opacity: 0.75; }
@keyframes lock-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.5); }
  50% { box-shadow: 0 0 0 4px rgba(79, 70, 229, 0); }
}

.lock-warn {
  padding: 0.7rem 0.9rem;
  background: var(--warning-soft);
  border: 1px solid rgba(217, 119, 6, 0.3);
  border-radius: 8px;
  color: var(--warning);
  font-size: 0.78rem; line-height: 1.4;
}

/* "It's safe to close the tab" — replaces the old scary .lock-warn. */
.lock-safe {
  padding: 0.7rem 0.9rem;
  background: var(--bg-tinted);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 0.82rem;
  line-height: 1.45;
}
.lock-safe p { margin: 0; }
.lock-safe a { color: var(--accent); font-weight: 500; }

/* ----- AI hand-off banner: the URL + quick-launch + share buttons -----
   This sits ABOVE the textarea on the detail page. It's the page's primary
   call-to-action ("get this video into a chat with an AI"). */

.ai-banner {
  margin: 1rem 0 0.6rem;
  padding: 0.9rem 1rem;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 10px;
}
.ai-banner-lead {
  margin: 0 0 0.7rem;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--text);
}
.ai-banner-lead strong { color: var(--accent-strong, var(--accent)); }
.ai-banner-url {
  display: inline-block;
  margin-top: 0.35rem;
  padding: 0.3rem 0.55rem;
  background: white;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.82rem;
  word-break: break-all;
  color: var(--accent);
}
.ai-banner-url:hover {
  background: var(--bg-tinted);
  text-decoration: underline;
}
.ai-banner-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.ai-banner-row + .ai-banner-row { margin-top: 0.5rem; }
.ai-banner-row.share-row {
  padding-top: 0.55rem;
  border-top: 1px dashed rgba(0, 0, 0, 0.08);
}

/* "Open in <AI>" buttons — branded fills so the user spots them at a glance. */
.btn-ai {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: filter 0.12s, transform 0.12s;
}
.btn-ai:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn-ai.chatgpt { background: #10a37f; color: white; }
.btn-ai.claude  { background: #d97706; color: white; }
.btn-ai.gemini  { background: #1a73e8; color: white; }

/* Share row buttons — neutral so they don't steal focus from the AI ones. */
.btn-share {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.8rem;
  background: white;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.btn-share:hover { border-color: var(--accent); background: var(--bg-tinted); }
.btn-share.whatsapp { color: #25d366; }
.btn-share.whatsapp:hover { border-color: #25d366; }

/* ----- Format pills (replaces the old grid of download buttons) ----- */

.format-bar {
  flex-wrap: wrap;
  gap: 0.6rem;
}
.format-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.format-pill {
  padding: 0.35rem 0.7rem;
  background: white;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text-dim);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.format-pill:hover { border-color: var(--accent); color: var(--accent); }
.format-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* One-liner under the pills explaining the selected format. */
.format-desc {
  margin: 0;
  padding: 0.4rem 1rem 0.6rem;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* Inline download anchor — looks like a button, behaves like a link
   (so the browser respects the `download` attribute / data: URI). */
.btn-link-action {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.85rem;
  background: white;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.btn-link-action:hover { border-color: var(--accent); background: var(--bg-tinted); }

@media (max-width: 600px) {
  /* On phones the action row would otherwise overflow horizontally; let
     it stack under the pills with a small gap. */
  .format-bar { flex-direction: column; align-items: stretch; }
  .format-bar .output-actions { justify-content: flex-end; }
  .ai-banner-url { font-size: 0.78rem; }
}

/* ----- Subtitle download buttons + timestamps toggle ----- */

.output-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.ts-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}
.ts-toggle input[type="checkbox"] {
  accent-color: var(--accent);
  cursor: pointer;
}

.downloads {
  margin: 1.4rem 0;
  padding: 1rem 1.2rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.downloads > strong {
  display: block;
  margin-bottom: 0.8rem;
  font-weight: 600;
  font-size: 0.95rem;
}
.download-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.6rem;
}
.btn-download {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.7rem 0.9rem;
  background: white;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}
.btn-download:hover {
  border-color: var(--accent);
  background: var(--bg-tinted);
}
.btn-download-ext {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--accent);
}
.btn-download-desc {
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* The "AI-ready" download stands out — it's the headline value-add. */
.btn-download-featured {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.btn-download-featured:hover { background: var(--bg-tinted); }
.btn-download-featured .btn-download-ext { color: var(--accent-strong, var(--accent)); }

.downloads-tip {
  margin: 0.9rem 0 0;
  padding: 0.7rem 0.9rem;
  background: var(--bg-tinted);
  border-radius: 8px;
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--text-dim);
}
.downloads-tip code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  padding: 1px 4px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 3px;
  font-size: 0.95em;
}
.downloads-public-url {
  display: inline-block;
  margin-top: 0.4rem;
  padding: 0.35rem 0.55rem;
  background: white;
  border: 1px solid var(--border);
  border-radius: 4px;
  word-break: break-all;
  user-select: all;
  font-size: 0.85rem;
}

@media (max-width: 600px) {
  .lock-card { padding: 1.5rem 1.25rem 1.25rem; }
  .orbit { width: 72px; height: 72px; }
  .orbit-core { inset: 22px; }
}

/* ----- Output (markdown viewer + copy button) ----- */

.output {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin: 1rem 0;
}
.output-header {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text);
}
.output-header span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.output-header button {
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  background: var(--text);
}
.output-header button:hover { background: var(--accent); }
textarea {
  width: 100%;
  min-height: 400px;
  padding: 1rem;
  background: white;
  color: var(--text);
  border: none;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  resize: vertical;
  outline: none;
}

/* ----- Search box ----- */

.search-box {
  width: 100%;
  padding: 0.7rem 1rem;
  background: white;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.95rem;
  margin: 1rem 0;
  outline: none;
}
.search-box:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ----- History list ----- */

.history-list { list-style: none; padding: 0; margin: 0; }
.history-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.25rem 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}
.history-thumb-link { display: block; width: 96px; flex-shrink: 0; }
.history-thumb {
  display: block;
  width: 96px; height: auto; max-height: 144px;
  object-fit: contain;
  background: var(--bg-tinted);
  border-radius: 6px;
}
.thumb-placeholder {
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-tinted);
  color: var(--text-dim);
  font-size: 1.6rem;
  width: 96px; height: 96px;
  border-radius: 6px;
}
.history-body { min-width: 0; }
.history-title {
  color: var(--text);
  text-decoration: none; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block;
}
.history-title:hover { color: var(--accent); }
.history-meta { font-size: 0.8rem; color: var(--text-dim); display: flex; gap: 0.25rem; flex-wrap: wrap; align-items: center; }
.history-delete {
  grid-row: 1 / 3; grid-column: 3 / 4; align-self: center;
  background: transparent;
  color: var(--text-faint);
  border: none; cursor: pointer;
  font-size: 1.05rem;
  padding: 0.4rem;
}
.history-delete:hover { color: var(--error); background: transparent; }

.status-pill {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.status-pill.queued { background: var(--warning-soft); color: var(--warning); }
.status-pill.running { background: var(--accent-soft); color: var(--accent); }
.status-pill.failed { background: var(--error-soft); color: var(--error); }
.status-pill.done { display: none; }

@media (max-width: 600px) {
  .history-thumb-link, .history-thumb, .thumb-placeholder { width: 72px; }
  .thumb-placeholder { height: 72px; }
}

/* ----- Detail header (transcricao.html / transcricao_publica.html) ----- */

.detail-header {
  display: flex; gap: 1rem;
  margin-bottom: 1.25rem;
  align-items: flex-start;
}
.detail-thumb {
  display: block;
  width: 180px; height: auto; max-height: 240px;
  object-fit: contain;
  flex-shrink: 0;
  background: var(--bg-tinted);
  border-radius: 8px;
}
.detail-thumb.thumb-placeholder { width: 180px; height: 180px; font-size: 2.4rem; }
.detail-titlebox { min-width: 0; flex: 1; }
.detail-titlebox h1 {
  margin-top: 0;
  font-size: clamp(1.3rem, 3vw, 1.75rem);
  color: var(--text);
}
.detail-meta { margin-bottom: 0.5rem; color: var(--text-dim); font-size: 0.92rem; }

@media (max-width: 600px) {
  .detail-header { flex-direction: column; }
  .detail-thumb { width: 100%; max-height: 240px; }
  .detail-thumb.thumb-placeholder { width: 100%; height: 180px; }
}

/* ----- Result wrap (post-transcription on /) ----- */

.result-wrap { margin-top: 1rem; }
.result-header {
  display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 0.75rem;
}
.result-thumb {
  width: 120px; height: auto; max-height: 160px;
  object-fit: contain;
  flex-shrink: 0;
  background: var(--bg-tinted);
  border-radius: 8px;
}
.result-titlebox { min-width: 0; flex: 1; }
.result-title { margin: 0 0 0.3rem; font-size: 1.05rem; font-weight: 600; color: var(--text); }
.result-meta { font-size: 0.85rem; color: var(--text-dim); }

/* ----- Live progress block (on /transcricoes/<id>) ----- */

.live-progress {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin: 1rem 0 1.5rem;
}
.live-progress .small { font-size: 0.82rem; margin-top: 0.5rem; }

/* ----- Preview banner + upsell CTA ----- */

.preview-banner {
  background: var(--warning-soft);
  border: 1px solid rgba(217, 119, 6, 0.35);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin: 1rem 0 1.5rem;
}
.preview-banner strong { color: var(--warning); display: block; margin-bottom: 0.3rem; }
.preview-banner p { margin: 0; font-size: 0.92rem; color: var(--text); }

.upsell-cta {
  margin: 2rem 0;
  padding: 1.75rem 2rem;
  background: linear-gradient(135deg, var(--accent-soft), rgba(22, 163, 74, 0.07));
  border: 1px solid var(--border);
  border-radius: 14px;
  text-align: center;
}
.upsell-cta h2 { margin: 0 0 0.4rem; font-size: 1.2rem; color: var(--text); }
.upsell-cta p { margin: 0.4rem 0; color: var(--text-dim); }
.cta-btn {
  display: inline-block;
  margin-top: 0.6rem;
  padding: 0.8rem 1.6rem;
  background: var(--accent);
  color: white;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}
.cta-btn:hover { background: var(--accent-hover); color: white; }

.share-tip {
  margin-top: 2rem;
  padding: 1rem 1.25rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.92rem;
}
.share-tip strong { color: var(--text); }

/* ----- API Keys page ----- */

.api-keys-create { margin: 1.5rem 0; }
.api-keys-form { display: flex; gap: 0.5rem; margin-top: 0.75rem; }
.api-keys-form input[type="text"] {
  flex: 1;
  padding: 0.65rem 0.9rem;
  background: white;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
}
.api-keys-form input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.reveal-block {
  background: rgba(22, 163, 74, 0.06);
  border: 1px solid rgba(22, 163, 74, 0.35);
  border-radius: 12px;
  padding: 1.25rem;
  margin: 1.25rem 0;
}
.reveal-block h3 { margin: 0 0 0.4rem; color: var(--success); font-size: 1.05rem; }
.reveal-secret { display: flex; gap: 0.5rem; align-items: stretch; margin: 0.75rem 0; }
.reveal-secret code {
  flex: 1;
  background: var(--code-bg);
  color: var(--code-text);
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 0.85rem;
  word-break: break-all;
  user-select: all;
}
.reveal-secret button { white-space: nowrap; padding: 0.65rem 1rem; font-size: 0.85rem; }
.reveal-dismiss {
  display: block;
  margin-top: 0.6rem;
  background: var(--bg-tinted);
  color: var(--text);
  font-size: 0.85rem;
}
.reveal-dismiss:hover { background: var(--border); }

.api-keys-list { margin: 2rem 0; }
.key-list { list-style: none; padding: 0; margin: 0.75rem 0 0; }
.key-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}
.key-item.revoked { opacity: 0.5; }
.key-prefix { display: flex; align-items: center; gap: 0.5rem; }
.key-prefix code {
  font-family: ui-monospace, monospace;
  font-size: 0.88rem;
  background: var(--bg-tinted);
  padding: 0.15rem 0.5rem;
  border-radius: 5px;
}
.key-meta { grid-column: 1 / 2; font-size: 0.8rem; color: var(--text-dim); }
.key-revoke {
  background: transparent; color: var(--text-dim);
  font-size: 0.82rem; padding: 0.35rem 0.85rem;
  border: 1px solid var(--border-strong);
}
.key-revoke:hover { color: var(--error); border-color: var(--error); }

.api-keys-docs { margin-top: 2.5rem; }
.api-keys-docs pre {
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: 10px;
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.55;
}
.api-keys-docs code { font-family: ui-monospace, monospace; }
.api-keys-docs p code {
  background: var(--bg-tinted);
  color: var(--text);
  padding: 0.05rem 0.4rem;
  border-radius: 4px;
}

/* ----- Docs page ----- */

.docs h2 {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
}
.docs h3 { margin-top: 1.5rem; font-size: 1.05rem; color: var(--text); }
.docs pre {
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: 10px;
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.55;
}
.docs pre code { font-family: ui-monospace, monospace; color: var(--code-text); }
.docs p code, .docs li code, .docs td code {
  background: var(--bg-tinted);
  color: var(--text);
  padding: 0.05rem 0.4rem;
  border-radius: 4px;
  font-family: ui-monospace, monospace;
  font-size: 0.88em;
}
.docs ul, .docs ol { padding-left: 1.5rem; color: var(--text-dim); }
.docs li { margin: 0.35rem 0; }
.docs a { color: var(--accent); }
.docs table {
  border-collapse: collapse;
  width: 100%; font-size: 0.88rem;
  margin: 0.75rem 0;
}
.docs th, .docs td {
  text-align: left;
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
}
.docs th { color: var(--text); font-weight: 600; }
.docs hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0 1rem; }

/* Shell: fixed-width sidebar on the left, readable content column on the
   right — same recipe as claude.com/docs. */
.docs-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 2.5rem;
  max-width: 1160px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 3rem;
}
.docs-content {
  max-width: 780px;
  min-width: 0;
}
.docs-content h1 { margin-top: 0.5rem; }
.docs-content .subtitle { color: var(--text-dim); margin-bottom: 2rem; }
/* First section right under the subtitle doesn't need the divider. */
.docs-content h2:first-of-type { border-top: none; padding-top: 0; }
/* Anchored headings land below the sticky-ish header. */
.docs-content h2[id] { scroll-margin-top: 84px; }

.docs-sidebar {
  position: sticky;
  top: 1.25rem;
  align-self: start;
  max-height: calc(100vh - 2.5rem);
  overflow-y: auto;
  padding-right: 0.5rem;
  border-right: 1px solid var(--border);
}
.docs-group { margin-bottom: 1.4rem; }
.docs-group-title {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin-bottom: 0.4rem;
  padding-left: 0.6rem;
}
.docs-sidebar a {
  display: block;
  padding: 0.32rem 0.6rem;
  border-radius: 8px;
  font-size: 0.88rem;
  color: var(--text-dim);
  line-height: 1.35;
}
.docs-sidebar a:hover { color: var(--text); background: var(--bg-tinted); }
.docs-sidebar a.active {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

@media (max-width: 900px) {
  .docs-shell { grid-template-columns: 1fr; gap: 1rem; padding: 1rem 1rem 2.5rem; }
  .docs-sidebar {
    position: static;
    max-height: none;
    border-right: none;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-soft);
    padding: 0.9rem 0.9rem 0.4rem;
  }
  .docs-sidebar nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0 1rem;
  }
}

/* ----- Live transcription page (transcricao_em_andamento.html) ----- */

.live-card {
  max-width: 720px;
  margin: 2.5rem auto;
  background: white;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem 2rem;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}
.live-card h1 {
  font-size: clamp(1.4rem, 3vw, 1.75rem);
  margin: 0 0 0.5rem;
  color: var(--text);
}
.live-card .intro {
  color: var(--text-dim);
  margin: 0 0 1.25rem;
  font-size: 0.98rem;
  line-height: 1.55;
}

.live-orbit {
  display: flex; justify-content: center;
  margin: 1.25rem 0;
}
.live-spinner {
  width: 56px; height: 56px;
  border: 3px solid var(--bg-tinted);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: orbit-spin 1s linear infinite;
}

.live-video {
  display: flex; gap: 1rem; align-items: center;
  background: var(--bg-soft);
  border-radius: 12px;
  padding: 0.9rem 1.1rem;
  margin: 1.25rem 0;
}
.live-video-thumb {
  width: 96px; height: auto; max-height: 132px;
  object-fit: contain;
  background: var(--bg-tinted);
  border-radius: 8px;
  flex-shrink: 0;
}
.live-video-body { min-width: 0; flex: 1; }
.live-video-title { font-weight: 600; color: var(--text); margin: 0 0 0.25rem; line-height: 1.3; }
.live-video-meta { font-size: 0.85rem; color: var(--text-dim); }

.live-estimate {
  background: var(--accent-soft);
  border-radius: 10px;
  padding: 0.85rem 1.1rem;
  color: var(--text);
  font-size: 0.92rem;
  margin: 1rem 0;
}

.live-bar { margin: 1.25rem 0 0.75rem; }
.live-bar .live-meter {
  display: flex; justify-content: space-between;
  font-size: 0.82rem; color: var(--text-dim);
  margin-top: 0.4rem;
  font-variant-numeric: tabular-nums;
}

.live-stage-msg {
  text-align: center;
  color: var(--text);
  font-size: 1rem;
  font-weight: 500;
  margin: 1.5rem 0 0.5rem;
}

.live-permalink {
  background: var(--bg-tinted);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  font-size: 0.88rem;
  color: var(--text-dim);
  margin: 1.5rem 0 0;
}
.live-permalink code {
  display: block;
  margin-top: 0.4rem;
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  word-break: break-all;
  background: white;
  border: 1px solid var(--border);
  padding: 0.55rem 0.7rem;
  border-radius: 6px;
  user-select: all;
  color: var(--text);
}

.live-footer-note {
  margin-top: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.5;
}

@media (max-width: 600px) {
  .live-card { margin: 1rem; padding: 1.5rem 1.25rem; }
  .live-video { flex-direction: column; align-items: stretch; }
  .live-video-thumb { width: 100%; max-height: 200px; }
}

/* ---------- Chat with AI ---------- */
.chat-cta {
  display: block;
  text-align: center;
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
}
.chat-cta:hover { filter: brightness(1.1); text-decoration: none; }

.chat-container { max-width: 1200px; }
.chat-layout {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 1.25rem;
  align-items: start;
}
.chat-main { display: flex; flex-direction: column; min-height: 60vh; }
.chat-video-head { display: flex; gap: 0.75rem; align-items: center; margin-bottom: 0.75rem; }
.chat-thumb { width: 84px; border-radius: 6px; flex-shrink: 0; }
.chat-video-title { font-size: 1.05rem; margin: 0; }
.chat-messages {
  flex: 1;
  overflow-y: auto;
  max-height: 55vh;
  min-height: 30vh;
  padding: 0.75rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.chat-empty { margin: auto; text-align: center; padding: 1rem; }
.chat-bubble { max-width: 85%; padding: 0.6rem 0.85rem; border-radius: 12px; }
.chat-bubble.from-user { align-self: flex-end; background: var(--accent); color: #fff; }
.chat-bubble.from-ai { align-self: flex-start; background: var(--bg); border: 1px solid var(--border); }
.chat-bubble-text { white-space: pre-wrap; word-break: break-word; font-size: 0.95rem; line-height: 1.45; }
.chat-inputbar { margin-top: 0.75rem; }
.chat-inputbar form { display: flex; gap: 0.5rem; align-items: flex-end; }
.chat-inputbar textarea {
  flex: 1;
  resize: none;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.chat-inputbar button { white-space: nowrap; }
.chat-quota { margin-bottom: 0.35rem; }
.chat-side { position: sticky; top: 1rem; }
.chat-side-body { max-height: 70vh; overflow-y: auto; margin-top: 0.6rem; }
.chat-transcript {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-dim);
  padding: 0.75rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.frames-grid.compact { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }

@media (max-width: 900px) {
  .chat-layout { grid-template-columns: 1fr; }
  .chat-side { position: static; }
  .chat-side-body { max-height: 45vh; }
}
