:root {
  --bg: #0F0F10;
  --surface: #18181B;
  --surface-2: #1F1F23;
  --border: #2A2A2E;
  --text: #F4F4F5;
  --text-dim: #A1A1AA;
  --text-faded: #71717A;
  --accent: #F97316;
  --accent-soft: rgba(249, 115, 22, 0.12);
  --success: #22C55E;
  --success-soft: rgba(34, 197, 94, 0.12);
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,0.35), 0 4px 14px rgba(0,0,0,0.25);
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

/* Garante que [hidden] vença qualquer regra de display (inline-flex, flex, etc) */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

#app {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 0 80px;
  min-height: 100vh;
}

/* Hero */
.hero {
  background: linear-gradient(180deg, #18181B 0%, #0F0F10 100%);
  border-bottom: 1px solid var(--border);
  padding: 28px 20px 24px;
}
.hero-inner { max-width: 680px; margin: 0 auto; }
.hero h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.hero-sub {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--text-dim);
}

/* Botão "Antes de gravar" */
.btn-guide {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 10px 14px;
  background: var(--accent-soft);
  border: 1px solid rgba(249, 115, 22, 0.35);
  border-radius: 999px;
  color: var(--accent);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-guide:hover {
  background: rgba(249, 115, 22, 0.18);
  border-color: var(--accent);
}
.btn-guide.is-complete {
  background: var(--success-soft);
  border-color: rgba(34, 197, 94, 0.35);
  color: var(--success);
}
.guide-progress {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 7px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

/* Drawer + backdrop */
.guide-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
  z-index: 90;
  animation: fadeIn 0.18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.guide-drawer {
  position: fixed;
  z-index: 100;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  box-shadow: 0 -10px 40px rgba(0,0,0,0.5);
  animation: slideUp 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* Mobile: full screen bottom sheet */
@media (max-width: 760px) {
  .guide-drawer {
    left: 0; right: 0; bottom: 0;
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
  }
}
/* Desktop: lateral panel direita */
@media (min-width: 761px) {
  .guide-drawer {
    top: 0; right: 0; bottom: 0;
    width: min(520px, 92vw);
    border-left: 1px solid var(--border);
    animation: slideRight 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  @keyframes slideRight { from { transform: translateX(100%); } to { transform: translateX(0); } }
}

.guide-header {
  padding: 18px 18px 0;
  border-bottom: 1px solid var(--border);
}
.guide-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.guide-header-top h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}
.btn-guide-close {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
}
.btn-guide-close:hover { color: var(--text); }
.guide-sub {
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--text-faded);
}
.guide-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 -4px;
  padding: 0 4px;
}
.guide-tabs::-webkit-scrollbar { display: none; }
.guide-tab {
  flex-shrink: 0;
  padding: 9px 12px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.guide-tab-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.guide-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.guide-section-intro {
  margin: 0;
  padding: 12px 14px;
  background: var(--surface-2);
  border-radius: 10px;
  border-left: 3px solid var(--accent);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-dim);
}
.guide-section-intro ul {
  margin: 0;
  padding-left: 18px;
}
.guide-section-intro li { margin: 4px 0; }

.guide-callout {
  padding: 12px 14px;
  background: var(--accent-soft);
  border: 1px solid rgba(249, 115, 22, 0.3);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

/* Itens checkáveis */
.guide-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.guide-check:hover { border-color: var(--accent); }
.guide-check.is-highlight {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.06);
}
.guide-check.is-checked {
  opacity: 0.55;
  background: var(--surface);
}
.guide-check input[type="checkbox"] {
  margin-top: 2px;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}
.guide-check .check-text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}
.guide-check.is-checked .check-text {
  text-decoration: line-through;
  color: var(--text-dim);
}
.guide-check.is-highlight .check-text { font-weight: 600; }
.guide-check .check-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
}
.guide-check .check-link:hover { text-decoration: underline; }

/* Extras (Tripé, Espelhamento) */
.guide-extras {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}
.guide-extras-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-faded);
  text-transform: uppercase;
  margin-bottom: 2px;
}
.guide-extra {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--accent-soft);
  border: 1px solid rgba(249, 115, 22, 0.3);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  transition: all 0.15s ease;
}
.guide-extra:hover {
  background: rgba(249, 115, 22, 0.18);
  border-color: var(--accent);
  transform: translateY(-1px);
}
.guide-extra-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.guide-extra-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.guide-extra-desc {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.4;
}
.guide-extra-cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: var(--accent);
  border-radius: 999px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}
.guide-extra:hover .guide-extra-cta {
  background: #FB923C;
}
.guide-warning {
  padding: 14px;
  background: rgba(234, 179, 8, 0.08);
  border: 1px solid rgba(234, 179, 8, 0.3);
  border-radius: 10px;
}
.guide-warning-title {
  font-size: 13px;
  font-weight: 700;
  color: #FBBF24;
  margin-bottom: 4px;
}
.guide-warning-body {
  font-size: 12px;
  line-height: 1.55;
  color: var(--text);
}

/* Enquadramentos — imagens de referência */
.plano-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.plano-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.plano-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.plano-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.04em;
}
.plano-desc {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.45;
}
.plano-img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  background: #000;
  display: block;
}

/* Tabs */
.tabs {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: rgba(15, 15, 16, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}
.tab:hover { color: var(--text); }
.tab-active {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}
.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
}
.tab-active .tab-count {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
}

/* Lista */
.lista {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.loading, .empty p, .error {
  text-align: center;
  color: var(--text-dim);
  padding: 40px 20px;
  font-size: 14px;
}
.error { color: #EF4444; }

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: relative;
  transition: border-color 0.2s ease, transform 0.3s ease, opacity 0.3s ease;
}
.card.is-removing { opacity: 0; transform: translateX(20px); }
.card[open] { border-color: rgba(249, 115, 22, 0.3); }

/* Card header (sempre visível: título + pills + outro) */
.card-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 14px 12px;
}

/* Linha 1: SEQ + título + chevron (clicável p/ expandir) */
.header-toggle {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 0;
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  width: 100%;
}
.header-toggle:hover .card-title { color: var(--accent); }

.seq {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.card-title {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--text);
  transition: color 0.15s ease;
}

.chevron {
  color: var(--text-faded);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
.card[open] .chevron { transform: rotate(180deg); }

/* Pills (linha 2 do header) */
.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.pill:hover {
  border-color: var(--accent);
  color: var(--text);
}
.pill-icon {
  font-size: 12px;
  line-height: 1;
  pointer-events: none;
}
.pill-data-display,
.pill-ambiente-display {
  pointer-events: none;
}

/* Status pill + menu */
.pill-status-wrap {
  position: relative;
}
.pill-status {
  border: 1px solid var(--border);
}
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-faded);
  flex-shrink: 0;
  display: inline-block;
}
.pill-status[data-status="pendente"] {
  background: rgba(113, 113, 122, 0.12);
  color: var(--text-dim);
}
.pill-status[data-status="pendente"] .dot,
.dot-pendente { background: #71717A; }

.pill-status[data-status="na_fila"] {
  background: rgba(59, 130, 246, 0.12);
  color: #93C5FD;
  border-color: rgba(59, 130, 246, 0.3);
}
.pill-status[data-status="na_fila"] .dot,
.dot-na-fila { background: #3B82F6; }

.pill-status[data-status="gravado"] {
  background: var(--success-soft);
  color: var(--success);
  border-color: rgba(34, 197, 94, 0.3);
}
.pill-status[data-status="gravado"] .dot,
.dot-gravado { background: var(--success); }

/* Menu dropdown do status */
.status-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 50;
  min-width: 140px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.status-menu[hidden] { display: none; }
.status-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
  width: 100%;
}
.status-option:hover {
  background: var(--surface-2);
}
.status-option.is-current {
  background: var(--accent-soft);
  color: var(--accent);
}

/* Pill com input/select nativo dentro (data e ambiente) */
.pill-input {
  position: relative;
  cursor: pointer;
}
.pill-input.has-value {
  background: var(--accent-soft);
  border-color: rgba(249, 115, 22, 0.3);
  color: var(--accent);
}

/* Date pill: input nativo invisualmente "naked", visualmente parece pill */
.pill-data {
  padding: 0 10px;
}
.pill-data .input-data {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0;
  outline: 0;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: inherit;
  padding: 0;
  cursor: pointer;
  color-scheme: dark;
  min-width: 86px;
}
/* Indicador nativo (Chrome/Edge) cobre toda a pill = clique em qualquer parte abre o picker */
.pill-data .input-data::-webkit-calendar-picker-indicator {
  opacity: 0;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  margin: 0;
}
.pill-data .input-data::-webkit-datetime-edit-fields-wrapper,
.pill-data .input-data::-webkit-datetime-edit { padding: 0; }

/* Ambiente pill: select nativo styled */
.pill-ambiente {
  padding: 0 22px 0 10px;
}
.pill-ambiente::after {
  content: "▾";
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: currentColor;
  pointer-events: none;
}
.pill-ambiente .input-ambiente {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0;
  outline: 0;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: inherit;
  padding: 0;
  cursor: pointer;
  max-width: 140px;
}
.pill-ambiente .input-ambiente option {
  background: var(--surface);
  color: var(--text);
}

/* Link inspiração */
.pill-link {
  background: var(--surface-2);
  color: var(--text-dim);
}
.pill-link:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(249, 115, 22, 0.3);
}

/* Ambiente outro */
.ambiente-outro-wrap {
  margin-top: 2px;
}
.input-ambiente-outro {
  width: 100%;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
}
.input-ambiente-outro:focus {
  outline: none;
  border-color: var(--accent);
}

/* Card body (apenas roteiro + copiar quando expandido) */
.card-body {
  padding: 0 14px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.bloco-roteiro {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-copy {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-copy:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}
.btn-copy.is-copied {
  background: var(--success-soft);
  color: var(--success);
  border-color: transparent;
}

.roteiro {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: var(--mono);
  max-height: 65vh;
  overflow-y: auto;
}
.roteiro strong { color: var(--accent); font-weight: 700; }
.roteiro em { color: var(--text-dim); font-style: italic; }
.roteiro code {
  display: inline;
  padding: 2px 6px;
  background: rgba(249, 115, 22, 0.08);
  border-radius: 4px;
  font-size: 0.9em;
  color: #FCA56F;
}
.roteiro a { color: var(--accent); text-decoration: none; }
.roteiro a:hover { text-decoration: underline; }
.roteiro hr {
  border: 0;
  border-top: 1px dashed var(--border);
  margin: 14px 0;
}
.roteiro .sgv-line,
.roteiro .stage-direction {
  display: inline-block;
  color: var(--text-faded);
  font-size: 0.9em;
  font-style: italic;
  font-weight: 400;
  opacity: 0.75;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 10px 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform 0.25s ease;
  z-index: 100;
}
.toast.is-visible { transform: translateX(-50%) translateY(0); }
.toast.is-success { border-color: rgba(34, 197, 94, 0.4); }

/* Rodapé */
.rodape {
  text-align: center;
  font-size: 12px;
  color: var(--text-faded);
  padding: 24px;
}

/* Responsivo */
@media (max-width: 600px) {
  .hero { padding: 24px 16px 20px; }
  .hero h1 { font-size: 20px; }
  .lista { padding: 12px; gap: 8px; }
  .card-header { padding: 12px 12px 10px; gap: 8px; }
  .card-body { padding: 0 12px 14px; }
  .card-title { font-size: 14px; }
  .pill { font-size: 11px; height: 28px; }
  .roteiro { font-size: 13px; padding: 12px 14px; }
}
