/* Shared UI components (Components/UI) and the app shell (Components/Layout). */

.icon { display: inline-block; flex: none; vertical-align: -0.2em; }

/* ---------- App shell ---------- */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
.app-main { min-width: 0; }
.app-content { max-width: var(--content-width); margin: 0 auto; padding: var(--space-6) var(--space-6) 4rem; }

.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: var(--space-4);
  padding: var(--space-4) var(--space-3); background: var(--surface); border-right: 1px solid var(--line);
}
.sidebar-brand { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-1) var(--space-2); font-weight: var(--weight-semibold); font-size: var(--text-md); letter-spacing: -0.015em; color: var(--ink); }
.sidebar-brand-mark { width: 10px; height: 10px; border-radius: 3px; background: var(--accent); box-shadow: 4px 4px 0 var(--ink); margin-right: 6px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-section { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: var(--space-3); border-top: 1px solid var(--line); }
.sidebar-section-label { color: var(--muted); font-size: var(--text-xs); padding: 0 var(--space-2) var(--space-1); }
.nav-link-item {
  display: flex; align-items: center; gap: var(--space-3); height: 34px; padding: 0 var(--space-2);
  border-radius: var(--radius); color: var(--ink-2); font-weight: var(--weight-medium); font-size: var(--text-base);
}
.nav-link-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-link-item.active { background: var(--surface-2); color: var(--ink); box-shadow: inset 2px 0 0 var(--accent); }
.nav-link-item .icon { color: var(--muted); }
.nav-link-item.active .icon { color: var(--ink); }
.sidebar-create { width: 100%; justify-content: flex-start; }

/* Active brand switcher */
.brand-switcher { position: relative; }
.brand-switcher-button {
  width: 100%; display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2);
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink);
  font-size: var(--text-base); font-weight: var(--weight-medium); text-align: left;
}
.brand-switcher-button:hover { background: var(--surface-2); }
.brand-switcher-button span.name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--line-strong); box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.brand-menu {
  position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0; padding: var(--space-1);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-pop);
}
.brand-menu button, .brand-menu a {
  width: 100%; display: flex; align-items: center; gap: var(--space-2); padding: 6px var(--space-2); border: 0; background: none;
  border-radius: var(--radius-sm); color: var(--ink); font-size: var(--text-base); text-align: left;
}
.brand-menu button:hover, .brand-menu a:hover { background: var(--surface-2); }
.menu-dismiss { position: fixed; inset: 0; z-index: 25; }
.brand-menu hr { margin: var(--space-1) 0; border-color: var(--line); opacity: 1; }
.brand-menu .check { margin-left: auto; color: var(--accent); }

/* Mobile shell */
.mobile-bar { display: none; }
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; align-content: start; }
  .mobile-bar {
    position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--space-3);
    height: 56px; padding: 0 var(--space-4); background: var(--surface); border-bottom: 1px solid var(--line);
  }
  .sidebar { position: fixed; z-index: 40; inset: 0 auto 0 0; width: min(300px, 85vw); transform: translateX(-100%); transition: transform 0.18s ease; visibility: hidden; }
  .app-shell.nav-open .sidebar { transform: none; visibility: visible; box-shadow: var(--shadow-pop); }
  .nav-backdrop { position: fixed; inset: 0; z-index: 35; background: rgba(18, 21, 27, 0.32); }
  .app-content { padding: var(--space-5) var(--space-4) 3rem; }
}

/* ---------- Page header ---------- */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-5); }
.page-header-text { min-width: 0; }
.page-header-text p { margin: var(--space-1) 0 0; color: var(--muted); font-size: var(--text-base); }
.page-header-actions { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; justify-content: flex-end; }
.page-back { display: inline-flex; align-items: center; gap: var(--space-1); color: var(--muted); font-size: var(--text-sm); margin-bottom: var(--space-2); }
.page-back:hover { color: var(--ink); }
@media (max-width: 640px) { .page-header { flex-direction: column; } .page-header-actions { justify-content: flex-start; } }

/* ---------- Card ---------- */
.ui-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
section.ui-card + section.ui-card { margin-top: var(--space-4); }
.ui-card-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--line); min-height: 48px; }
.ui-card-header h2 { font-size: var(--text-base); }
.ui-card-header .count { color: var(--muted); font-weight: var(--weight-regular); margin-left: var(--space-1); }
.ui-card-body { padding: var(--space-4); }
.ui-card-body.flush { padding: 0; }

/* ---------- Rows (lists of content) ---------- */
.row-list { list-style: none; margin: 0; padding: 0; }
.row-item {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto auto; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4); border-top: 1px solid var(--line); color: var(--ink);
}
.row-list > li:first-child > .row-item { border-top: 0; }
a.row-item:hover { background: var(--surface-2); color: var(--ink); }
.row-main { min-width: 0; }
.row-title { font-weight: var(--weight-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { color: var(--muted); font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta .sep { margin: 0 6px; color: var(--line-strong); }
.row-time { color: var(--muted); font-size: var(--text-sm); white-space: nowrap; }
@media (max-width: 640px) { .row-item { grid-template-columns: 44px minmax(0, 1fr) auto; } .row-time { display: none; } }

/* The creative is the protagonist: rows show the selected media */
.thumb { width: 44px; height: 44px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; display: grid; place-items: center; color: var(--muted); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Status badge ---------- */
.status-badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: var(--radius-sm); font-size: var(--text-xs); font-weight: var(--weight-medium); white-space: nowrap; background: var(--tone-neutral-bg); color: var(--tone-neutral-fg); }
.status-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-badge.tone-info { background: var(--tone-info-bg); color: var(--tone-info-fg); }
.status-badge.tone-warn { background: var(--tone-warn-bg); color: var(--tone-warn-fg); }
.status-badge.tone-danger { background: var(--tone-danger-bg); color: var(--tone-danger-fg); }
.status-badge.tone-success { background: var(--tone-success-bg); color: var(--tone-success-fg); }

/* ---------- Empty state ---------- */
.empty-block { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--space-2); padding: var(--space-6) var(--space-4); color: var(--muted); }
.empty-block .icon { color: var(--line-strong); margin-bottom: var(--space-1); }
.empty-block strong { color: var(--ink); font-weight: var(--weight-medium); font-size: var(--text-base); }
.empty-block p { margin: 0; max-width: 380px; font-size: var(--text-sm); }
.empty-block .btn { margin-top: var(--space-2); }

/* ---------- Tabs ---------- */
.ui-tabs { display: flex; gap: var(--space-1); border-bottom: 1px solid var(--line); margin-bottom: var(--space-4); overflow-x: auto; }
.ui-tab {
  display: inline-flex; align-items: center; gap: 6px; padding: var(--space-2) var(--space-3); margin-bottom: -1px;
  border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font-weight: var(--weight-medium); font-size: var(--text-base); white-space: nowrap;
}
.ui-tab:hover { color: var(--ink); }
.ui-tab.active { color: var(--ink); border-bottom-color: var(--ink); }
.ui-tab .count { color: var(--muted); font-weight: var(--weight-regular); font-variant-numeric: tabular-nums; }

/* ---------- Modal ---------- */
.ui-modal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: var(--space-4); background: rgba(18, 21, 27, 0.36); }
.ui-modal { width: min(560px, 100%); max-height: calc(100vh - 2rem); display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); }
.ui-modal.wide { width: min(760px, 100%); }
.ui-modal-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--line); }
.ui-modal-header h2 { font-size: var(--text-md); }
.ui-modal-body { padding: var(--space-5); overflow-y: auto; }
.ui-modal-footer { display: flex; justify-content: flex-end; gap: var(--space-2); padding: var(--space-3) var(--space-5); border-top: 1px solid var(--line); }
.icon-button { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: var(--radius); background: none; color: var(--muted); }
.icon-button:hover { background: var(--surface-2); color: var(--ink); }

/* ---------- Toasts ---------- */
.toast-stack { position: fixed; z-index: 60; right: var(--space-4); bottom: var(--space-4); display: flex; flex-direction: column; gap: var(--space-2); width: min(380px, calc(100vw - 2rem)); }
.ui-toast { display: flex; align-items: flex-start; gap: var(--space-2); padding: var(--space-3) var(--space-4); background: var(--ink); color: #fff; border-radius: var(--radius); box-shadow: var(--shadow-pop); font-size: var(--text-sm); }
.ui-toast .icon { margin-top: 1px; color: #7ed8bd; }
.ui-toast.error .icon { color: #ff9b91; }
.ui-toast span { flex: 1; }
.ui-toast button { border: 0; background: none; color: rgba(255,255,255,.6); padding: 0; }

/* ---------- Brand cards ---------- */
.brand-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-4); }
.brand-tile { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); }
.brand-tile-head { display: flex; align-items: center; gap: var(--space-3); }
.brand-avatar { width: 36px; height: 36px; border-radius: var(--radius); display: grid; place-items: center; color: #fff; font-weight: var(--weight-semibold); background: var(--brand-color, var(--ink)); flex: none; }
.brand-tile-head h2 { font-size: var(--text-md); }
.brand-tile-name { flex: 1; min-width: 0; }
.brand-tile-name h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-tile-name span { display: block; color: var(--muted); font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-tile-head .icon-button { flex: none; align-self: flex-start; }
.brand-tile p { margin: 0; color: var(--ink-2); font-size: var(--text-sm); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.brand-tile-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: auto; }

/* ---------- Inline summary under page titles ---------- */
.summary-line { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); color: var(--muted); font-size: var(--text-sm); }
.summary-line strong { color: var(--ink); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }

.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3) var(--space-4); }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

/* ---------- Brand assets ---------- */
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--space-3); padding: var(--space-4); }
.asset-tile { margin: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.asset-tile img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--surface-2); }
.asset-tile figcaption { padding: var(--space-2) var(--space-3); font-size: var(--text-sm); }
.asset-tile strong { display: block; font-weight: var(--weight-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-tile span { color: var(--muted); font-size: var(--text-xs); }

/* ---------- Simple data rows inside cards (profiles, takes, jobs) ---------- */
.data-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-top: 1px solid var(--line); }
.data-row:first-child { border-top: 0; }
.data-row-main { flex: 1; min-width: 0; }
.data-row-main strong { display: block; font-weight: var(--weight-medium); }
.data-row-main span { display: block; color: var(--muted); font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data-row audio { height: 32px; max-width: 280px; }
.rule-grid { display: grid; grid-template-columns: 1fr 1fr 1fr auto auto; gap: var(--space-2); align-items: center; margin-bottom: var(--space-2); }
@media (max-width: 860px) { .rule-grid { grid-template-columns: 1fr 1fr; } }
.split-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); align-items: start; }
.split-2 > .ui-card { margin-top: 0 !important; }
@media (max-width: 860px) { .split-2 { grid-template-columns: 1fr; } }

/* ---------- Criar ---------- */
.create-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--space-4); align-items: start; }
.create-layout aside { position: sticky; top: var(--space-4); }
.create-layout .ui-card { margin-top: 0 !important; }
@media (max-width: 960px) { .create-layout { grid-template-columns: 1fr; } .create-layout aside { position: static; } }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.target-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: var(--space-2); }
.target-option { position: relative; display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); cursor: pointer; }
.target-option:hover { background: var(--surface-2); }
.target-option input { position: absolute; opacity: 0; pointer-events: none; }
.target-option .icon { color: var(--muted); }
.target-option strong { display: block; font-weight: var(--weight-medium); font-size: var(--text-base); }
.target-option small { display: block; color: var(--muted); font-size: var(--text-xs); }
.target-option.selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.target-option.selected .icon { color: var(--accent-ink); }
.target-option:has(input:focus-visible) { box-shadow: var(--focus-ring); }
/* Narrow column (Onde publicar, in the review): two per row, no hint. */
.target-grid.compact { grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); margin-bottom: var(--space-2); }
.target-grid.compact .target-option { padding: var(--space-2); gap: var(--space-2); }
.target-grid.compact .target-option strong { font-size: var(--text-sm); }
.target-grid.compact .target-option small { display: none; }
.summary-row { display: flex; justify-content: space-between; gap: var(--space-3); font-size: var(--text-sm); }
.summary-row span { color: var(--muted); }
.plan-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.plan-list li { display: flex; justify-content: space-between; gap: var(--space-3); padding: var(--space-2) 0; border-bottom: 1px solid var(--line); font-size: var(--text-sm); }

/* ---------- Revisão ---------- */
.review-layout { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: var(--space-5); align-items: start; }
.review-layout .ui-card { margin-top: 0 !important; }
@media (max-width: 960px) { .review-layout { grid-template-columns: 1fr; } }
.phone { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-sm); overflow: hidden; }
.phone-top { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-3) var(--space-4); font-size: var(--text-sm); }
.phone-format { margin-left: auto; color: var(--muted); font-size: var(--text-xs); }
.brand-avatar.sm { width: 28px; height: 28px; border-radius: 50%; font-size: var(--text-xs); }
.phone-media { position: relative; background: var(--surface-2); }
.phone-media.square { aspect-ratio: 1; }
.phone-media.vertical { aspect-ratio: 9 / 16; max-height: 360px; margin: 0 auto; }
.phone-media img, .phone-media video { display: block; width: 100%; height: 100%; object-fit: cover; }
.phone-media video { background: #000; }
.phone-flag { display: flex; align-items: center; gap: 6px; padding: 6px var(--space-3); font-size: var(--text-xs); font-weight: 600; background: var(--tone-warn-bg); color: var(--tone-warn-fg); }
.video-assembly { display: grid; gap: var(--space-3); margin-bottom: var(--space-3); padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.scene-strip-head { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: var(--space-2); }
.scene-strip-head > * { white-space: nowrap; }
.scene-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--space-2); max-width: 340px; margin: 0; padding: 0; list-style: none; }
.scene-strip li { position: relative; aspect-ratio: 9 / 16; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); border: 1px solid var(--line); }
.scene-strip img { display: block; width: 100%; height: 100%; object-fit: cover; }
.scene-strip span { position: absolute; left: 4px; bottom: 4px; min-width: 18px; padding: 0 4px; border-radius: 999px; font-size: var(--text-xs); font-weight: 600; text-align: center; background: var(--surface); color: var(--ink); }
.scene-single { padding: var(--space-3); border-radius: var(--radius-sm); background: var(--tone-warn-bg); color: var(--tone-warn-fg); }
.scene-single .form-text { color: inherit; opacity: .85; }
.media-video-note { display: flex; align-items: center; gap: var(--space-2); margin: 0 0 var(--space-3); padding: var(--space-2) var(--space-3); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); font-size: var(--text-sm); color: var(--ink-2); }
.phone-media-empty { height: 100%; min-height: 200px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-2); color: var(--muted); font-size: var(--text-sm); }
.phone-audio { display: block; width: calc(100% - 2rem); margin: var(--space-3) var(--space-4) 0; height: 36px; }
.phone-caption { padding: var(--space-3) var(--space-4) var(--space-4); font-size: var(--text-sm); white-space: pre-line; max-height: 170px; overflow-y: auto; }
.phone-caption p { margin: 0 0 var(--space-2); }
.phone-hashtags { color: var(--tone-info-fg); }
.phone-cta { font-weight: var(--weight-medium); }
.run-steps { list-style: none; margin: 0; padding: 0; }
.run-step { display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: var(--space-2); padding: var(--space-2) 0; color: var(--muted); font-size: var(--text-sm); }
.run-step-label { color: var(--ink); }
.run-step.done .run-step-icon { color: var(--accent); }
.run-step.failed .run-step-icon, .run-step.failed .run-step-state { color: var(--tone-danger-fg); }
.run-step.running .run-step-icon { color: var(--tone-info-fg); }
.run-step.running .run-step-icon .icon { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.pending-list { list-style: none; margin: 0 0 var(--space-3); padding: 0; font-size: var(--text-sm); color: var(--tone-warn-fg); }
.pending-list li { display: flex; gap: var(--space-2); align-items: center; padding: 2px 0; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: var(--radius); }
.segmented button { border: 0; background: none; padding: 5px 12px; border-radius: var(--radius-sm); color: var(--ink-2); font-size: var(--text-sm); font-weight: var(--weight-medium); }
.segmented button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.segmented.segmented-wrap { flex-wrap: wrap; }

/* Integrações */
.integration-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); align-items: start; }
.connection-list { list-style: none; margin: 0 0 var(--space-3); padding: 0; display: grid; gap: var(--space-2); }
.connection-list li { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); }
.connection-list li > span:not(.connection-state) { display: grid; }
.connection-list small { color: var(--muted); }
.connection-state { margin-left: auto; padding: 2px 8px; border-radius: 999px; font-size: var(--text-xs); font-weight: 600; }
.connection-state.ok { background: var(--tone-success-bg); color: var(--tone-success-fg); }
.connection-state.warn { background: var(--tone-warn-bg); color: var(--tone-warn-fg); }
.connection-problem { color: var(--tone-warn-fg); font-size: var(--text-xs); }
.scheduler-choice { display: grid; gap: var(--space-2); justify-items: start; margin-bottom: var(--space-3); }
.choice-row { display: flex; gap: var(--space-3); align-items: center; padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.choice-row span { display: grid; }
.choice-row small { color: var(--muted); }

/* Publicação (revisão) */
.publishing-panel { display: grid; gap: var(--space-3); margin-bottom: var(--space-3); padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.publishing-head { display: flex; align-items: baseline; gap: var(--space-2); }
.publication-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }
.publication-list li { display: grid; gap: var(--space-2); }
.publication-line { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.publication-error { margin: 0; font-size: var(--text-sm); color: var(--tone-danger-fg); }
.publication-problem { margin: 0; font-size: var(--text-sm); color: var(--tone-warn-fg); }
.publication-channels { display: flex; flex-wrap: wrap; column-gap: var(--space-4); }
.publication-time { max-width: 240px; }
.publication-youtube { display: grid; gap: 2px; max-width: 320px; }
.publication-ai { display: grid; gap: 2px; max-width: 560px; }
.publication-tiktok { display: grid; gap: var(--space-2); max-width: 560px; justify-items: start; }
.publication-tiktok > select { max-width: 320px; }
.publication-tiktok-options { display: grid; gap: 2px; }

/* Vídeo (editor da montagem) */
.video-editor { display: grid; grid-template-columns: minmax(240px, 340px) minmax(0, 1fr); gap: var(--space-5); align-items: start; }
.video-editor-preview { position: sticky; top: var(--space-4); display: grid; gap: var(--space-2); }
.video-editor fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.editor-phone { position: relative; aspect-ratio: 9 / 16; border-radius: 20px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.editor-phone img { display: block; width: 100%; height: 100%; object-fit: cover; }
.editor-loading { position: absolute; top: var(--space-2); right: var(--space-2); display: inline-flex; padding: 6px; border-radius: 999px; background: var(--surface); color: var(--muted); box-shadow: var(--shadow-sm); }
.editor-marks { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1); }
.editor-marks > span { margin-right: auto; }
.editor-field { display: grid; gap: var(--space-1); }
.editor-field .form-label { margin-bottom: 0; }
.editor-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.color-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.scene-editor { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.scene-editor li { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: var(--space-3); align-items: center; padding: var(--space-2); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.scene-editor img { width: 48px; aspect-ratio: 9 / 16; object-fit: cover; border-radius: var(--radius-sm); }
.scene-editor-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-1) var(--space-2); align-items: center; }
.scene-editor-fields strong { grid-column: 1 / -1; font-size: var(--text-sm); }
/* What the narration says in the scene (scene direction), and its time and motion. */
.scene-editor-fields .scene-excerpt, .scene-editor-fields .scene-timing { grid-column: 1 / -1; }
.scene-excerpt { color: var(--muted); font-size: var(--text-xs); font-style: italic; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.scene-editor-move { display: flex; flex-direction: column; }
.scene-editor-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: var(--space-1); }
.icon.flip { transform: rotate(180deg); }
@media (max-width: 1200px) { .scene-editor-fields { grid-template-columns: minmax(0, 1fr); } }
/* Texto da legenda: one row per block (time, text, undo). */
.subtitle-blocks { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-1); }
.subtitle-blocks li { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: var(--space-2); align-items: center; }
.subtitle-blocks .subtitle-time { justify-content: flex-start; padding-left: 0; color: var(--muted); font-variant-numeric: tabular-nums; }
.subtitle-blocks li.edited .form-control { border-color: var(--ink-2); background: var(--surface-2); }
.music-row { align-items: flex-start; }
.music-player { display: block; width: 100%; max-width: 360px; height: 32px; margin-top: var(--space-2); }
.editor-sync { display: grid; gap: var(--space-1); padding: var(--space-3); border-radius: var(--radius); background: var(--surface-2); }
.editor-sync .icon { color: var(--accent-ink); vertical-align: -2px; }
.swatch { width: 28px; height: 28px; padding: 0; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--swatch); }
.swatch.selected { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.swatch:focus-visible { box-shadow: var(--focus-ring); }
.color-row .form-control-color { width: 44px; height: 32px; padding: 2px; }
@media (max-width: 900px) {
    .video-editor { grid-template-columns: minmax(0, 1fr); }
    .video-editor-preview { position: static; max-width: 340px; }
}

/* Calendário */
.calendar-nav { display: flex; align-items: center; gap: var(--space-2); }
.calendar-month { min-width: 150px; text-align: center; }
.calendar { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calendar-weekdays span { padding: var(--space-2); font-size: var(--text-xs); font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); }
.calendar-day { min-height: 104px; padding: var(--space-2); display: flex; flex-direction: column; gap: 4px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-day.outside { background: var(--surface-2); }
.calendar-day.outside .calendar-date { color: var(--muted); }
.calendar-date { font-size: var(--text-xs); font-weight: 600; color: var(--ink-2); }
.calendar-day.today .calendar-date { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 999px; background: var(--ink); color: var(--surface); }
.calendar-item { display: flex; align-items: center; gap: 4px; min-width: 0; padding: 2px 6px; border-radius: var(--radius-sm); font-size: var(--text-xs); text-decoration: none; background: var(--tone-neutral-bg); color: var(--tone-neutral-fg); }
.calendar-item.tone-info { background: var(--tone-info-bg); color: var(--tone-info-fg); }
.calendar-item.tone-success { background: var(--tone-success-bg); color: var(--tone-success-fg); }
.calendar-item.tone-warn { background: var(--tone-warn-bg); color: var(--tone-warn-fg); }
.calendar-item.tone-danger { background: var(--tone-danger-bg); color: var(--tone-danger-fg); }
.calendar-time { font-weight: 600; }
.calendar-channel { white-space: nowrap; }
.calendar-network { flex: none; }
.calendar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .85; }
.calendar-state { margin-left: auto; white-space: nowrap; }
.calendar-agenda { display: none; }
.calendar-agenda h3 { margin: var(--space-3) 0 var(--space-2); font-size: var(--text-sm); }
.calendar-agenda .calendar-item { padding: var(--space-2); margin-bottom: var(--space-2); font-size: var(--text-sm); }
@media (max-width: 720px) {
    .calendar { display: none; }
    .calendar-agenda { display: block; }
}
.attention-banner { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-4); padding: var(--space-3); border-radius: var(--radius); background: var(--tone-warn-bg); color: var(--tone-warn-fg); font-size: var(--text-sm); text-decoration: none; }

/* Guide: "O que fazer agora" (Início, Criar) and the project bar. Warn is "missing", info "on the way", danger "blocked". */
.guide-state-icon { flex: none; display: inline-flex; color: var(--tone-warn-fg); }
.guide-state-done .guide-state-icon { color: var(--accent); }
.guide-state-waiting .guide-state-icon { color: var(--tone-info-fg); }
.guide-state-waiting .guide-state-icon .icon { animation: spin 1.2s linear infinite; }
.guide-state-blocked .guide-state-icon { color: var(--tone-danger-fg); }
.guide-state-optional .guide-state-icon { color: var(--muted); }
.guide-next-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.guide-next-text strong { font-weight: var(--weight-semibold); color: var(--ink); }
.guide-next-text span { color: var(--muted); font-size: var(--text-sm); }
.guide-action { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.guide-cost { font-size: var(--text-xs); color: var(--muted); }
.guide-cost:empty { display: none; }

.guide-hero { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4); border-radius: var(--radius); background: var(--surface-2); border-left: 3px solid var(--tone-warn-fg); }
.guide-hero.guide-state-done { border-left-color: var(--accent); }
.guide-hero.guide-state-waiting { border-left-color: var(--tone-info-fg); }
.guide-hero.guide-state-blocked { border-left-color: var(--tone-danger-fg); }
.guide-hero .guide-next-text strong { font-size: var(--text-md); }

.guide-sections { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-5); margin-top: var(--space-5); }
.guide-heading { display: flex; align-items: baseline; gap: var(--space-2); margin: 0 0 var(--space-2); font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--ink); }
.guide-heading span { color: var(--muted); font-weight: var(--weight-regular); }
.guide-steps { list-style: none; margin: 0; padding: 0; }
.guide-all-done { display: flex; align-items: center; gap: var(--space-2); margin: 0; padding: var(--space-2) 0 0; font-size: var(--text-sm); color: var(--ink-2); }
.guide-all-done .icon { color: var(--accent); }
.guide-steps li { display: flex; align-items: flex-start; gap: var(--space-2); padding: var(--space-2) 0; border-top: 1px solid var(--line); }
.guide-steps li:first-child { border-top: 0; }
.guide-steps .guide-state-icon { margin-top: 2px; }
.guide-done summary { padding: var(--space-2) 0 0; font-size: var(--text-sm); color: var(--muted); cursor: pointer; }
.guide-done[open] summary { padding-bottom: var(--space-1); }
.guide-projects-heading { margin-top: var(--space-5); }
.guide-projects { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); }
.guide-projects li { padding: var(--space-3); border-top: 1px solid var(--line); }
.guide-projects li:first-child { border-top: 0; }
.guide-project-head { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-2); min-width: 0; }
.guide-project-head a { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: var(--weight-medium); color: var(--ink); text-decoration: none; }
.guide-project-head a:hover { text-decoration: underline; }
.guide-project-head .guide-trail { margin-left: auto; flex: none; }
.guide-project-next { display: flex; align-items: center; gap: var(--space-2); }
.create-layout aside .guide-panel { margin-bottom: var(--space-4); }

/* The trail: stages joined by a line that turns jade as they are done; the current one is an ink ring. */
.guide-trail { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; overflow-x: auto; scrollbar-width: none; }
.guide-trail li { display: flex; align-items: center; gap: var(--space-2); color: var(--muted); font-size: var(--text-sm); white-space: nowrap; }
.guide-trail li + li::before { content: ""; flex: none; width: 24px; height: 2px; margin: 0 var(--space-2); border-radius: 1px; background: var(--line-strong); }
.guide-trail li.done + li::before { background: var(--accent); }
.guide-trail li.done { color: var(--ink-2); }
.guide-trail li.current { color: var(--ink); font-weight: var(--weight-semibold); }
.guide-dot { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border: 2px solid var(--line-strong); border-radius: 50%; background: var(--surface); }
.guide-trail li.done .guide-dot { border-color: var(--accent); background: var(--accent); color: var(--surface); }
.guide-trail li.current .guide-dot { border-color: var(--ink); box-shadow: inset 0 0 0 3px var(--surface), inset 0 0 0 8px var(--ink); }
.guide-trail.compact li + li::before { width: 8px; margin: 0 2px; }
.guide-trail.compact .guide-dot { width: 10px; height: 10px; }
.guide-trail.compact .guide-dot .icon { display: none; }
.guide-trail.compact li.current .guide-dot { box-shadow: none; background: var(--ink); }

.guide-bar { margin-bottom: var(--space-4); padding: var(--space-3) var(--space-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.guide-next-line { display: flex; align-items: center; gap: var(--space-3); margin-top: var(--space-3); padding-top: var(--space-3); border-top: 1px solid var(--line); }

@media (max-width: 860px) { .guide-sections { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .guide-hero, .guide-next-line, .guide-project-next { flex-wrap: wrap; }
  .guide-action { align-items: flex-start; width: 100%; padding-left: calc(16px + var(--space-3)); }
  .guide-project-head { flex-wrap: wrap; }
  .guide-project-head .guide-trail { margin-left: 0; }
  /* Dots, with only the current stage named (the others stay readable to screen readers). */
  .guide-trail li:not(.current) .guide-stage-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .guide-trail li + li::before { width: 14px; margin: 0 var(--space-1); }
}
@media (prefers-reduced-motion: reduce) { .guide-state-waiting .guide-state-icon .icon { animation: none; } }

/* Banco gratuito (StockPicker) */
.stock-picker { margin: var(--space-4) 0; }
.stock-search { display: flex; gap: var(--space-2); }
.stock-search .form-control { flex: 1; min-width: 0; }
.stock-heading { display: flex; align-items: baseline; gap: var(--space-2); margin: var(--space-4) 0 var(--space-2); font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--ink); }
.stock-heading span { color: var(--muted); font-weight: var(--weight-regular); }
.stock-heading a { font-weight: var(--weight-regular); color: var(--ink-2); }
.stock-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--space-3); }
.stock-tile { position: relative; margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.stock-tile img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; background: var(--surface-3); }
.stock-tile figcaption { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-2); background: var(--surface); }
.stock-credit { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-xs); color: var(--muted); }
.stock-credit a { color: var(--ink-2); }
.stock-badge { position: absolute; top: var(--space-2); left: var(--space-2); padding: 2px 6px; border-radius: var(--radius-sm); background: var(--surface); color: var(--ink-2); font-size: var(--text-xs); box-shadow: var(--shadow-sm); }
@media (max-width: 640px) { .stock-search { flex-direction: column; } .stock-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stock-duration { top: auto; bottom: calc(var(--space-2) + 40px); left: auto; right: var(--space-2); display: inline-flex; align-items: center; gap: 2px; }
.media-thumb .stock-duration { bottom: var(--space-2); }
.scene-kind { display: inline-flex; align-items: center; gap: 2px; margin-left: var(--space-2); color: var(--muted); font-weight: var(--weight-regular); font-size: var(--text-xs); }
.scene-strip .scene-clip { position: absolute; right: 2px; bottom: 2px; display: inline-flex; padding: 1px; border-radius: 3px; background: var(--surface); color: var(--ink-2); }
.scene-credits { margin: var(--space-2) 0 0; font-size: var(--text-xs); color: var(--muted); }
.scene-credits a { color: var(--ink-2); }
.target-option.disabled { opacity: 0.55; cursor: not-allowed; }
.upload-inline { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); cursor: pointer; }
.upload-inline input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-inline:focus-within .btn { box-shadow: var(--focus-ring); }
.photo-chosen { display: flex; align-items: flex-end; gap: var(--space-3); }
.photo-chosen img { width: 120px; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); }
.photo-video { margin-top: var(--space-2); padding: var(--space-3); border-radius: var(--radius); background: var(--surface-2); }

/* Video upload: a thin bar while the file arrives, a moving one while it is converted. */
.video-upload { display: flex; flex-direction: column; gap: var(--space-2); }
.upload-progress { position: relative; height: 4px; border-radius: 999px; background: var(--surface-2); overflow: hidden; max-width: 320px; }
.upload-progress span { position: absolute; inset: 0 auto 0 0; background: var(--ink); border-radius: inherit; transition: width .2s ease; }
.upload-progress.indeterminate span { width: 35% !important; animation: upload-slide 1.4s ease-in-out infinite; }
@keyframes upload-slide { from { left: -35%; } to { left: 100%; } }
@media (prefers-reduced-motion: reduce) { .upload-progress.indeterminate span { animation: none; width: 100% !important; opacity: .5; } }
.upload-row { display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-4); align-items: flex-start; }

/* "Vídeos": the brand's own videos as an editor's media bin. */
.video-gallery { display: flex; flex-direction: column; gap: var(--space-4); }
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--space-3); }
.video-gallery-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); }
.video-gallery-tools:empty { display: none; }
/* How many contents use a video: "Não usado" stands out, the used ones stay quiet. */
.video-tile-uses { display: block; width: fit-content; margin-bottom: 4px; padding: 1px 7px; border-radius: 999px; background: rgba(255, 255, 255, 0.2); color: #fff; font-size: var(--text-xs); font-weight: var(--weight-medium); }
.video-tile-uses.unused { background: var(--tone-info-bg); color: var(--tone-info-fg); }
.video-tile { position: relative; display: block; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: #000; overflow: hidden; text-align: left; cursor: pointer; }
.video-tile:hover, .video-tile:focus-visible { border-color: var(--ink); box-shadow: var(--shadow-sm); }
.video-tile.selected { outline: 2px solid var(--accent); outline-offset: 1px; }
.video-tile video { display: block; width: 100%; aspect-ratio: 9 / 16; object-fit: cover; background: #000; pointer-events: none; }
.video-tile-badges { position: absolute; top: var(--space-2); left: var(--space-2); right: var(--space-2); display: flex; justify-content: space-between; gap: var(--space-1); pointer-events: none; }
.video-tile-badges span { display: inline-flex; align-items: center; gap: 2px; padding: 2px 6px; border-radius: var(--radius-sm); background: rgba(18, 21, 27, .72); color: #fff; font-size: var(--text-xs); }
.video-tile-title { position: absolute; left: 0; right: 0; bottom: 0; padding: var(--space-4) var(--space-2) var(--space-2); background: linear-gradient(transparent, rgba(0, 0, 0, .75)); color: #fff; font-size: var(--text-sm); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.video-player { display: grid; grid-template-columns: minmax(0, 300px) 1fr; gap: var(--space-5); align-items: start; }
.video-player video { width: 100%; aspect-ratio: 9 / 16; border-radius: var(--radius); background: #000; }
.video-facts { display: grid; gap: var(--space-3); margin: 0; }
.video-facts dt { font-size: var(--text-xs); color: var(--muted); font-weight: 500; }
.video-facts dd { margin: 0; }
@media (max-width: 640px) { .video-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .video-player { grid-template-columns: 1fr; } }

/* Imagens: the brand's pictures, and the ordered picks of "Da biblioteca" on Criar. */
.image-gallery-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin-bottom: var(--space-2); }
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--space-3); }
.image-tile { position: relative; display: block; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-3); overflow: hidden; text-align: left; cursor: pointer; }
.image-tile:hover, .image-tile:focus-visible { border-color: var(--ink); box-shadow: var(--shadow-sm); }
.image-tile.selected { outline: 2px solid var(--accent); outline-offset: 1px; }
.image-tile:disabled { cursor: not-allowed; opacity: .45; }
.image-tile img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; pointer-events: none; }
.image-tile-badge { position: absolute; top: var(--space-2); left: var(--space-2); padding: 2px 6px; border-radius: var(--radius-sm); background: rgba(18, 21, 27, .72); color: #fff; font-size: var(--text-xs); pointer-events: none; }
.image-tile-order { position: absolute; top: var(--space-2); right: var(--space-2); display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; font-size: var(--text-xs); font-weight: var(--weight-semibold); pointer-events: none; }
.image-viewer { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: var(--space-5); align-items: start; }
.image-viewer img { width: 100%; max-height: 70vh; object-fit: contain; border-radius: var(--radius); background: var(--surface-3); }
.library-picks { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.library-pick { position: relative; width: 84px; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-3); }
.library-pick img { display: block; width: 100%; aspect-ratio: 9 / 16; object-fit: cover; }
.library-pick-tools { display: flex; justify-content: space-between; background: var(--surface); }
.library-pick-tools button { border: 0; background: none; padding: 2px 4px; color: var(--ink-2); }
.library-pick-tools button:disabled { opacity: .35; }
@media (max-width: 640px) { .image-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .image-viewer { grid-template-columns: 1fr; } }
/* "Meu vídeo" on Criar: the chosen video, playable, next to its facts. */
.own-video { display: flex; gap: var(--space-4); align-items: flex-start; }
.own-video video { width: 160px; aspect-ratio: 9 / 16; border-radius: var(--radius); background: #000; flex: none; }

/* A ready script pasted in the objective: what will be kept as written. */
.brief-note { display: flex; gap: var(--space-2); align-items: flex-start; margin-top: var(--space-2); padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); font-size: var(--text-sm); }
.brief-note > .icon { flex: none; margin-top: 2px; color: var(--ink-2); }
.brief-note > div { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.brief-note ul { margin: 0; padding-left: 1.1em; }
.brief-note small { color: var(--muted); }
.objective-text { white-space: pre-line; overflow-wrap: anywhere; }
.objective-more summary { cursor: pointer; list-style: none; }
.objective-more summary::-webkit-details-marker { display: none; }
.objective-toggle::after { content: "Ver tudo"; font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--ink); text-decoration: underline; }
.objective-more[open] .objective-preview { display: none; }
.objective-more[open] .objective-toggle::after { content: "Mostrar menos"; }
.objective-more[open] summary { margin-bottom: var(--space-2); }

/* Marca → Visual: the subtitle style of new videos, three cards with a sample. */
.subtitle-styles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--space-3); }
.subtitle-style { display: grid; gap: var(--space-1); align-content: start; padding: var(--space-2); text-align: left; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.subtitle-style:hover:not(:disabled) { border-color: var(--line-strong); }
.subtitle-style.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.subtitle-style:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.subtitle-style strong { font-size: var(--text-sm); }
.subtitle-sample { display: flex; align-items: flex-end; justify-content: center; aspect-ratio: 4 / 3; margin-bottom: var(--space-1); padding: var(--space-3) var(--space-2) var(--space-4);
    border-radius: var(--radius-sm); background: linear-gradient(170deg, var(--video-frame-top), var(--video-frame-mid) 55%, var(--video-frame-bottom)); color: var(--video-text); text-align: center; line-height: 1.25; }
.subtitle-sample.look-cinematic { font-size: var(--text-md); font-weight: var(--weight-semibold); text-shadow: var(--video-shadow-soft); }
.subtitle-sample.look-words { font-size: var(--text-lg); font-weight: 700; paint-order: stroke fill; -webkit-text-stroke: 4px var(--video-outline); }
.subtitle-sample.look-words em { font-style: normal; color: var(--video-highlight); }
.subtitle-sample.look-minimal { font-size: var(--text-sm); font-weight: var(--weight-medium); text-shadow: var(--video-shadow-subtle); }

/* The ready video styles: a sample frame (9:16) and the name, chosen like a radio. */
.video-styles { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: var(--space-2); }
.video-style { display: grid; gap: var(--space-1); padding: var(--space-1); text-align: center; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.video-style:hover:not(:disabled) { border-color: var(--line-strong); }
.video-style.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.video-style:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.video-style img { display: block; width: 100%; height: auto; aspect-ratio: 9 / 16; object-fit: cover; border-radius: var(--radius-sm); background: var(--video-frame-mid); }
.video-style strong { font-size: var(--text-sm); padding-bottom: 2px; }

/* A clip scene's excerpt: start and end seconds, with the frame at each point. */
.clip-excerpt { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); }
.clip-excerpt input { width: 5.5rem; }
.clip-excerpt img { width: 36px; height: 64px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); }

/* ---------- Help (/ajuda and the "?" drawer) ---------- */
.help-page { display: grid; gap: var(--space-4); }
.help-search { display: flex; align-items: center; gap: var(--space-2); padding: 0 var(--space-3); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-lg); color: var(--muted); }
.help-search:focus-within { border-color: var(--ink); box-shadow: var(--focus-ring); }
.help-search input { flex: 1; min-width: 0; height: 48px; border: 0; outline: 0; background: none; color: var(--ink); font-size: var(--text-md); }
.help-search.compact input { height: 40px; font-size: var(--text-base); }
.help-search input::-webkit-search-cancel-button { display: none; }
.help-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: calc(-1 * var(--space-2)); }
.help-chip { padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-2); font-size: var(--text-sm); }
.help-chip:hover { border-color: var(--line-strong); color: var(--ink); }
.help-chip.active { border-color: var(--ink); color: var(--ink); }
.help-chip:focus-visible, .help-stop:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.help-next { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--ink); border-radius: var(--radius-lg); }
.help-next-icon { display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 999px; background: var(--surface-2); color: var(--ink); }
.help-next-text { display: grid; flex: 1; min-width: 0; }
.help-next-text strong { font-size: var(--text-md); }

/* The way of a post: stops joined by a line, the chosen one filled. */
.help-trail { display: flex; align-items: stretch; gap: 0; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.help-stop { position: relative; display: flex; align-items: center; gap: var(--space-2); flex: 1 1 0; min-width: 150px; padding: var(--space-2) var(--space-3) var(--space-2) var(--space-2); border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-align: left; }
.help-stop + .help-stop { border-left: 0; }
.help-stop:first-child { border-radius: var(--radius-lg) 0 0 var(--radius-lg); }
.help-stop:last-child { border-radius: 0 var(--radius-lg) var(--radius-lg) 0; }
.help-stop.all { flex: 0 0 auto; min-width: 0; padding: var(--space-2) var(--space-4); justify-content: center; }
.help-stop + .help-stop:not(.all)::before { content: ""; position: absolute; left: -7px; top: 50%; width: 12px; height: 12px; transform: translateY(-50%) rotate(45deg); background: inherit; border-top: 1px solid var(--line); border-right: 1px solid var(--line); z-index: 1; }
.help-stop:first-child + .help-stop::before { display: none; }
.help-stop:hover { background: var(--surface-2); }
.help-stop.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.help-stop.active + .help-stop::before { background: var(--ink); border-color: var(--ink); }
.help-stop-icon { display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 999px; background: var(--surface-2); color: var(--ink); }
.help-stop.active .help-stop-icon { background: rgba(255, 255, 255, 0.16); color: #fff; }
.help-stop-text { display: grid; line-height: 1.25; }
.help-stop-text strong { font-size: var(--text-base); }
.help-stop-text small { color: var(--muted); font-size: var(--text-xs); }
.help-stop.active .help-stop-text small { color: rgba(255, 255, 255, 0.72); }

.help-section h2 { font-size: var(--text-md); margin: var(--space-2) 0 var(--space-3); }
.help-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-3); }
.help-card { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3) var(--space-4) var(--space-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.help-card-head { display: flex; align-items: center; gap: var(--space-2); }
.help-card-head h3 { margin: 0; font-size: var(--text-base); font-weight: var(--weight-semibold); }
.help-card-icon { display: inline-grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: var(--radius); background: var(--surface-2); color: var(--ink); }
.help-card-line { margin: 0; color: var(--ink-2); font-size: var(--text-sm); }
.help-steps { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; counter-reset: help-step; }
.help-steps li { display: flex; align-items: baseline; gap: var(--space-2); font-size: var(--text-sm); counter-increment: help-step; }
.help-steps li::before { content: counter(help-step); display: inline-grid; place-items: center; width: 18px; height: 18px; flex: none; border-radius: 999px; background: var(--ink); color: #fff; font-size: 0.6875rem; font-weight: var(--weight-semibold); transform: translateY(-1px); }
.help-card-foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); margin-top: auto; padding-top: var(--space-1); }
.help-where { color: var(--muted); font-size: var(--text-xs); }
.help-cost { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: var(--text-xs); font-weight: var(--weight-medium); }
.help-cost.free { background: var(--tone-success-bg); color: var(--tone-success-fg); }
.help-cost.paid { background: var(--tone-warn-bg); color: var(--tone-warn-fg); }
.help-cost.depends { background: var(--tone-info-bg); color: var(--tone-info-fg); }
.help-show { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; }
.help-card.compact { padding: var(--space-3); box-shadow: none; }

.help-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--space-4); align-items: start; }
.help-columns > section.ui-card + section.ui-card { margin-top: 0; }
.help-costs { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--space-3); margin-bottom: var(--space-3); }
.help-costs ul { margin: var(--space-2) 0 0; padding-left: 1.1rem; font-size: var(--text-sm); display: grid; gap: 4px; }
.help-terms { display: grid; gap: var(--space-2); margin: 0; }
.help-terms div { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: var(--space-2); font-size: var(--text-sm); }
.help-terms dt { font-weight: var(--weight-semibold); }
.help-terms dd { margin: 0; color: var(--ink-2); }
.help-owner { padding: var(--space-3) var(--space-4); border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); color: var(--ink-2); font-size: var(--text-sm); }
.help-owner summary { cursor: pointer; color: var(--ink); font-weight: var(--weight-medium); }
.help-owner ul { margin: var(--space-2) 0 var(--space-3); padding-left: 1.1rem; }

/* The "?" drawer. */
.page-help { flex: none; }
.help-backdrop { position: fixed; inset: 0; z-index: 54; background: rgba(18, 21, 27, 0.28); }
.help-drawer { position: fixed; z-index: 55; top: 0; right: 0; bottom: 0; display: flex; flex-direction: column; width: min(420px, 100vw); background: var(--canvas); border-left: 1px solid var(--line); box-shadow: var(--shadow-pop); animation: help-drawer-in 0.16s ease-out; }
.help-drawer-header { display: flex; align-items: center; justify-content: space-between; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--line); background: var(--surface); }
.help-drawer-header h2 { margin: 0; font-size: var(--text-md); }
.help-drawer .help-search { margin: var(--space-3) var(--space-4) 0; }
.help-drawer-body { flex: 1; overflow-y: auto; display: grid; align-content: start; gap: var(--space-2); padding: var(--space-3) var(--space-4); }
.help-drawer-footer { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-3) var(--space-4); border-top: 1px solid var(--line); background: var(--surface); }
.help-drawer kbd { padding: 0 5px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface-2); color: var(--ink); font-size: var(--text-xs); }
@keyframes help-drawer-in { from { transform: translateX(16px); opacity: 0; } to { transform: none; opacity: 1; } }

/* "Mostrar onde fica": the control rings twice, then stays ringed for a moment. */
.help-spot { border-radius: var(--radius); box-shadow: 0 0 0 3px var(--tone-info-fg), 0 0 0 9px var(--tone-info-bg) !important; animation: help-spot 0.9s ease-out 2; scroll-margin: 96px; }
@keyframes help-spot { 0% { box-shadow: 0 0 0 0 var(--tone-info-fg), 0 0 0 0 var(--tone-info-bg); } 45% { box-shadow: 0 0 0 4px var(--tone-info-fg), 0 0 0 14px var(--tone-info-bg); } 100% { box-shadow: 0 0 0 3px var(--tone-info-fg), 0 0 0 9px var(--tone-info-bg); } }
@media (prefers-reduced-motion: reduce) { .help-spot, .help-drawer { animation: none; } }
@media (max-width: 640px) {
    .help-next { flex-wrap: wrap; }
    .help-stop { flex: 0 0 auto; min-width: 0; }
    .help-stop-text small { display: none; }
    .help-terms div { grid-template-columns: 1fr; gap: 0; }
}

/* ---------- Sign-in (Pages/Login.razor, Layout/AuthLayout.razor) and account ---------- */
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: var(--space-6) var(--space-4); background: var(--canvas); }
.auth-card { width: 100%; max-width: 400px; padding: var(--space-6); }
.auth-card h1 { font-size: var(--text-xl); margin: var(--space-4) 0 var(--space-2); }
.auth-brand { display: flex; align-items: center; gap: var(--space-2); font-weight: var(--weight-semibold); font-size: var(--text-md); color: var(--ink); }
.auth-lead { color: var(--muted); margin-bottom: var(--space-4); }
.auth-form { display: grid; gap: var(--space-3); margin: var(--space-4) 0 var(--space-3); }
.auth-form .btn { width: 100%; margin-top: var(--space-1); }
.auth-note { padding: var(--space-2) var(--space-3); border-radius: var(--radius); background: var(--tone-success-bg); color: var(--tone-success-fg); font-size: var(--text-sm); }
.auth-error { margin: var(--space-3) 0 0; padding: var(--space-2) var(--space-3); border-radius: var(--radius); background: var(--tone-danger-bg); color: var(--tone-danger-fg); font-size: var(--text-sm); }
.auth-field-error { color: var(--tone-danger-fg); font-size: var(--text-xs); margin-top: var(--space-1); }
.account-form { display: grid; gap: var(--space-3); max-width: 420px; }
.nav-button { width: 100%; border: 0; background: none; text-align: left; cursor: pointer; }
