@import url("tokens.css?v=2");

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(56, 189, 248, 0.14), transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 10%, rgba(125, 211, 252, 0.08), transparent 50%),
    radial-gradient(ellipse 50% 30% at 50% 100%, rgba(14, 165, 233, 0.06), transparent 45%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(125, 211, 252, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(125, 211, 252, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, black, transparent);
}

body.page-enter .app-main {
  animation: page-enter 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes page-enter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

.app-shell {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100vh;
  height: 100vh;
  max-width: 100vw;
  overflow: hidden;
}

/* ── Sidebar ── */
.app-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  backdrop-filter: blur(var(--blur-lg));
  -webkit-backdrop-filter: blur(var(--blur-lg));
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width var(--transition), transform var(--transition);
  overflow: hidden;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
}

.app-shell.sidebar-collapsed .app-sidebar {
  width: var(--sidebar-w-collapsed);
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 1rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.logo-mark {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent-bright), var(--accent-dim));
  color: var(--on-accent);
  font-weight: 800;
  font-size: 1rem;
  border-radius: 10px;
  box-shadow: var(--glow);
  transition: box-shadow var(--transition), transform var(--transition-fast);
}

.logo-mark:hover {
  box-shadow: var(--glow-strong);
  transform: scale(1.04);
}

.sidebar-brand-text strong {
  display: block;
  font-size: 0.9rem;
  white-space: nowrap;
}

.env-badge {
  font-size: 0.62rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-account {
  padding: 0.65rem 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--accent-muted), transparent);
}

.sidebar-account-label {
  display: block;
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.2rem;
}

.sidebar-account-username {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-account-name {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.15rem;
}

.sidebar-logout {
  display: block;
  padding: 0.65rem 0.75rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-decoration: none;
}

.sidebar-logout:hover {
  color: var(--accent);
}

.app-shell.sidebar-collapsed .sidebar-account,
.app-shell.sidebar-collapsed .sidebar-account-name,
.app-shell.sidebar-collapsed .sidebar-account-label,
.app-shell.sidebar-collapsed .sidebar-account-username {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar-top {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.75rem 0.35rem;
}

.app-shell.sidebar-collapsed .sidebar-brand {
  justify-content: center;
  width: 100%;
}

.app-shell.sidebar-collapsed .logo-mark {
  width: 32px;
  height: 32px;
  font-size: 0.85rem;
}

.app-shell.sidebar-collapsed .sidebar-toggle {
  transform: none;
  width: 28px;
  height: 28px;
}

.app-shell.sidebar-collapsed .sidebar-footer {
  padding: 0.5rem 0.35rem;
  text-align: center;
}

.app-shell.sidebar-collapsed .sidebar-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  font-size: 0;
}

.app-shell.sidebar-collapsed .sidebar-logout i,
.app-shell.sidebar-collapsed .sidebar-logout svg {
  width: 16px !important;
  height: 16px !important;
  margin: 0 !important;
}

.sidebar-toggle {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}

.sidebar-toggle svg {
  width: 16px;
  height: 16px;
  transition: transform var(--transition);
}

.sidebar-toggle:hover {
  color: var(--accent);
  border-color: var(--accent-border);
  background: var(--accent-muted);
  box-shadow: var(--glow);
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0.5rem;
  overflow-y: auto;
}

.nav-section {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0.75rem 0 0.35rem 0.65rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 0.2rem;
  border: 1px solid transparent;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
  white-space: nowrap;
}

.nav-link:hover:not(.disabled) {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

.nav-link.active {
  background: var(--accent-muted);
  color: var(--accent-bright);
  font-weight: 600;
  border-color: var(--accent-border);
  box-shadow: inset 3px 0 0 var(--accent);
}

.nav-link.disabled {
  opacity: 0.45;
  cursor: default;
  font-size: 0.82rem;
}

.nav-icon {
  flex-shrink: 0;
  width: 1.35rem;
  height: 1.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-icon svg,
.nav-icon .gsm-icon {
  width: 1.15rem;
  height: 1.15rem;
  stroke-width: 2;
}

.card-icon .gsm-icon {
  width: 20px;
  height: 20px;
}

.app-shell.sidebar-collapsed .nav-label,
.app-shell.sidebar-collapsed .nav-section-text,
.app-shell.sidebar-collapsed .sidebar-brand-text,
.app-shell.sidebar-collapsed .sidebar-footer .nav-label {
  display: none;
}

.app-shell.sidebar-collapsed .nav-link {
  justify-content: center;
  padding: 0.55rem;
}

.app-shell.sidebar-collapsed .nav-section {
  text-align: center;
  margin-left: 0;
}

.sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-footer-link {
  margin-bottom: 0;
}

/* ── Main area ── */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.page-header {
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
}

.page-header h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text), var(--accent-bright));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.app-content {
  flex: 1;
  padding: 1.25rem 1.5rem;
  overflow: auto;
}

.app-content--tool {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.page-video-editor .editor-frame {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  background: var(--bg);
}

/* ── Overview page ── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.card {
  background: var(--surface);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-accent {
  border-color: var(--accent-border);
  background: linear-gradient(145deg, var(--accent-muted), var(--surface));
  box-shadow: var(--glow);
}
.card h2 { font-size: 1rem; margin-bottom: 0.5rem; }
.card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 0.85rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.55rem 1rem;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-bright), var(--accent-dim));
  color: var(--on-accent);
  box-shadow: 0 2px 12px var(--accent-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #d4f0fd, var(--accent-bright));
  box-shadow: var(--glow-strong);
  transform: translateY(-1px);
}

.tag {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--accent-muted);
  color: var(--accent-bright);
  border: 1px solid var(--accent-border);
}

.tag.muted {
  background: var(--surface-2);
  color: var(--text-muted);
}

.info-panel {
  background: var(--surface);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
}

.info-panel h3 { font-size: 0.95rem; margin-bottom: 0.65rem; }
.info-panel ol {
  margin-left: 1.2rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.6;
}

.info-panel code {
  font-size: 0.8rem;
  font-family: var(--font-mono);
  background: var(--surface-3);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* ── Video editor embedded in shell ── */
.page-video-editor .video-editor-root {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.page-video-editor .video-editor-root .layout {
  flex: 1;
  height: auto;
  min-height: 0;
}

.page-video-editor body,
body.page-video-editor {
  overflow: hidden;
}

body.page-docs {
  overflow: auto;
}

body.page-docs .app-content {
  overflow-y: auto;
}

/* ── Instagram Extract / docs pages ── */
.download-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.25rem;
  background: linear-gradient(135deg, var(--accent-muted), rgba(12, 18, 32, 0.9));
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glow);
  position: relative;
  overflow: hidden;
}

.download-hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.download-hero h2 {
  font-size: 1.35rem;
  margin: 0.35rem 0 0.65rem;
}

.download-hero-text {
  flex: 1;
  min-width: 240px;
}

.download-hero-text p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.55;
  max-width: 560px;
}

.download-hero-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  align-items: flex-start;
}

.btn-lg {
  padding: 0.65rem 1.15rem;
  font-size: 0.95rem;
}

.tutorial-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.tutorial-panel h4 {
  font-size: 0.88rem;
  margin: 1rem 0 0.5rem;
  color: var(--accent);
}

.tutorial-intro {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.tutorial-steps {
  margin-left: 1.2rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.65;
}

.tutorial-steps li + li {
  margin-top: 0.45rem;
}

.callout {
  margin-top: 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  line-height: 1.5;
}

.code-block {
  margin-top: 0.65rem;
  padding: 0.85rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.78rem;
  line-height: 1.5;
  overflow-x: auto;
  color: var(--text-muted);
}

.bullet-list {
  margin-left: 1.2rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.65;
}

.bullet-list li + li {
  margin-top: 0.35rem;
}

.limits-panel {
  margin-bottom: 1rem;
}

.limits-panel a {
  color: var(--accent);
  text-decoration: none;
}

.limits-panel a:hover {
  text-decoration: underline;
}

/* ── Contas Instagram (Meta OAuth) ── */
.tab-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.tab-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.tab-btn:hover {
  color: var(--text);
  background: var(--surface-2);
}

.tab-btn.active {
  color: var(--on-accent);
  background: linear-gradient(135deg, var(--accent-bright), var(--accent-dim));
  border-color: transparent;
  box-shadow: var(--glow);
}

.tab-btn-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.tab-panel.hidden {
  display: none !important;
}

.meta-alert {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.88rem;
}

.meta-alert--success {
  background: rgba(46, 204, 113, 0.12);
  border: 1px solid rgba(46, 204, 113, 0.35);
  color: #8be8b0;
}

.meta-alert--error {
  background: rgba(231, 76, 60, 0.12);
  border: 1px solid rgba(231, 76, 60, 0.35);
  color: #f1a097;
}

.meta-alert--info {
  background: var(--accent-muted);
  border: 1px solid var(--accent-border);
  color: var(--accent-bright);
}

.connection-badge {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.connection-badge.ok strong {
  color: var(--accent);
}

.pages-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.pages-summary {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.pages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.page-card {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  padding: 1rem;
  background: var(--surface);
  backdrop-filter: blur(var(--blur));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.page-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.page-card-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.page-card-avatar--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
}

.page-card-body {
  flex: 1;
  min-width: 0;
}

.page-card-body h3 {
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
}

.page-card-name,
.page-card-meta,
.page-card-stats {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.page-card .tag {
  flex-shrink: 0;
}

.hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.hidden {
  display: none !important;
}

.btn-secondary {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
}

.btn-secondary:hover {
  border-color: var(--accent-border);
  color: var(--accent-bright);
  background: var(--accent-muted);
  box-shadow: var(--glow);
}

.btn-sm {
  padding: 0.3rem 0.55rem;
  font-size: 0.72rem;
}

/* ── Analytics Instagram ── */
.analytics-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.analytics-toolbar-left,
.analytics-toolbar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
}

.analytics-label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.analytics-select {
  min-width: 200px;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.88rem;
}

.analytics-loading {
  margin-bottom: 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.analytics-warnings {
  margin-bottom: 1rem;
}

.analytics-profile {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.25rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.analytics-profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
}

.analytics-profile-meta,
.analytics-profile-period {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.kpi-card {
  padding: 0.9rem 1rem;
  background: var(--surface);
  backdrop-filter: blur(var(--blur));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.kpi-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--glow);
}

.kpi-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.kpi-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent);
}

.kpi-change {
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.growth-up { color: #8be8b0; }
.growth-down { color: #f1a097; }
.growth-flat { color: var(--text-muted); }

.analytics-panel {
  margin-bottom: 1.25rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.analytics-panel h3 {
  font-size: 0.95rem;
  margin-bottom: 0.85rem;
}

.growth-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}

.growth-stat {
  padding: 0.75rem;
  background: var(--surface-2);
  border-radius: 8px;
}

.growth-stat-label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.analytics-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.chart-card {
  padding: 1rem;
  background: var(--surface);
  backdrop-filter: blur(var(--blur));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  min-height: 260px;
  transition: border-color var(--transition);
}

.chart-card:hover {
  border-color: var(--border-strong);
}

.chart-card h3 {
  font-size: 0.88rem;
  margin-bottom: 0.75rem;
  color: var(--text-muted);
}

.chart-card canvas {
  max-height: 220px;
}

.content-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
}

.breakdown-card {
  padding: 0.75rem;
  background: var(--surface-2);
  border-radius: 8px;
}

.breakdown-card h4 {
  font-size: 0.82rem;
  margin-bottom: 0.35rem;
  color: var(--accent);
}

.breakdown-card p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.top-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.85rem;
}

.media-card {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--surface-2);
  border-radius: 8px;
}

.media-card-thumb {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.media-card-thumb--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 700;
}

.media-card-type {
  font-size: 0.68rem;
  color: var(--accent);
  text-transform: uppercase;
}

.media-card-caption {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0.25rem 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.media-card-stats {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.media-card-link {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.72rem;
  color: var(--accent);
  text-decoration: none;
}

.demographics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
}

.demo-block {
  padding: 0.75rem;
  background: var(--surface-2);
  border-radius: 8px;
}

.demo-block h4 {
  font-size: 0.82rem;
  margin-bottom: 0.5rem;
  text-transform: capitalize;
}

.demo-list {
  list-style: none;
}

.demo-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--border);
}

/* ── Auto-Reply ── */
.autoreply-form {
  display: grid;
  gap: 0.75rem;
  max-width: 560px;
}

.autoreply-form .field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.autoreply-form .field span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.autoreply-form input,
.autoreply-form textarea,
.autoreply-form select {
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.88rem;
}

.autoreply-rules {
  display: grid;
  gap: 0.75rem;
}

.autoreply-rule-card {
  padding: 0.85rem;
  background: var(--surface-2);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.autoreply-rule-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.autoreply-rule-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.autoreply-logs {
  display: grid;
  gap: 0.65rem;
}

.autoreply-log-row {
  padding: 0.75rem;
  background: var(--surface-2);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.autoreply-log-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.webhook-status {
  margin-bottom: 0.75rem;
}

.webhook-status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.webhook-status-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
  display: grid;
  gap: 0.35rem;
}

.webhook-status-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.webhook-status-list .ok {
  color: #22c55e;
}

.webhook-status-list .bad {
  color: #ef4444;
}

.callout--warn {
  border-color: #f59e0b55;
  background: #f59e0b12;
}

.webhook-inbox {
  display: grid;
  gap: 0.5rem;
}

.webhook-inbox-row {
  padding: 0.65rem 0.75rem;
  background: var(--surface-2);
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.82rem;
}

.webhook-debug-toolbar {
  display: grid;
  gap: 0.75rem;
}

.webhook-debug-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.webhook-debug-auto {
  font-size: 0.85rem;
}

.webhook-debug-list {
  display: grid;
  gap: 0.85rem;
  margin-top: 1rem;
}

.webhook-debug-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
}

.webhook-debug-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.35rem;
}

.webhook-debug-head-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.webhook-debug-method {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.webhook-debug-method.method-get {
  background: #3b82f622;
  color: #60a5fa;
}

.webhook-debug-method.method-post {
  background: #22c55e22;
  color: #4ade80;
}

.webhook-debug-badge {
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: var(--surface-3, #ffffff10);
  color: var(--text-muted);
}

.webhook-debug-badge.ok {
  background: #22c55e22;
  color: #4ade80;
}

.webhook-debug-badge.bad {
  background: #ef444422;
  color: #f87171;
}

.webhook-debug-meta {
  margin: 0 0 0.65rem;
}

.webhook-debug-block {
  margin-top: 0.5rem;
}

.webhook-debug-block summary {
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.webhook-debug-pre {
  margin: 0;
  padding: 0.75rem;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 8px;
  overflow: auto;
  max-height: 420px;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.schedule-toolbar {
  margin-bottom: 1rem;
}

.schedule-list {
  display: grid;
  gap: 1rem;
}

.schedule-batch-card {
  padding: 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.schedule-batch-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.schedule-posts {
  display: grid;
  gap: 0.65rem;
}

.schedule-post-row {
  padding: 0.65rem 0.75rem;
  background: var(--surface-1, var(--surface-2));
  border-radius: 8px;
  border: 1px solid var(--border);
}

.schedule-post-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.schedule-post-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.schedule-form .field legend {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.schedule-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.video-picker {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.video-picker-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.schedule-mode-panel {
  margin: 0.75rem 0;
  padding: 0.75rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
}

.page-card-actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex-shrink: 0;
}

.page-card.active-account {
  border-color: var(--accent);
}

.page-card .tag.active {
  background: var(--accent-muted);
  color: var(--accent-bright);
}

/* ── SaaS Overview ── */
.saas-hero {
  position: relative;
  padding: 2rem 2rem 2.25rem;
  margin-bottom: 1.75rem;
  border-radius: var(--radius-xl);
  border: 1px solid var(--accent-border);
  background: linear-gradient(135deg, var(--accent-muted) 0%, rgba(12, 18, 32, 0.95) 60%);
  overflow: hidden;
}

.saas-hero::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -20%;
  width: 60%;
  height: 200%;
  background: radial-gradient(circle, rgba(125, 211, 252, 0.15), transparent 70%);
  pointer-events: none;
}

.saas-hero-content {
  position: relative;
  z-index: 1;
}

.saas-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-bright);
  background: var(--accent-muted);
  border: 1px solid var(--accent-border);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  margin-bottom: 0.85rem;
}

.saas-hero h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 0.65rem;
  background: linear-gradient(135deg, var(--text) 30%, var(--accent-bright));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.saas-hero p {
  font-size: 0.95rem;
  color: var(--text-muted);
  max-width: 560px;
  line-height: 1.6;
}

.saas-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.5rem;
}

.saas-stat {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  backdrop-filter: blur(var(--blur));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 140px;
}

.saas-stat-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-muted);
  border-radius: var(--radius-sm);
  color: var(--accent-bright);
}

.saas-stat-icon svg {
  width: 18px;
  height: 18px;
}

.saas-stat-value {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-bright);
}

.saas-stat-label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.card-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-muted);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-sm);
  color: var(--accent-bright);
  margin-bottom: 0.85rem;
}

.card-icon svg {
  width: 20px;
  height: 20px;
}

/* ── Mobile topbar ── */
.mobile-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  backdrop-filter: blur(var(--blur-lg));
  -webkit-backdrop-filter: blur(var(--blur-lg));
  border-bottom: 1px solid var(--border);
  min-height: var(--header-h);
}

.mobile-menu-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}

.mobile-menu-btn:hover {
  border-color: var(--accent-border);
  background: var(--accent-muted);
  box-shadow: var(--glow);
}

.mobile-menu-btn svg {
  width: 20px;
  height: 20px;
}

.mobile-topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.95rem;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(4, 8, 16, 0.65);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

.sidebar-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

/* ── Form fields ── */
.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field span {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
}

.field input,
.field textarea,
.field select,
.autoreply-form input,
.autoreply-form textarea,
.autoreply-form select,
.analytics-select {
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-3);
  color: var(--text);
  font-size: 0.88rem;
  font-family: inherit;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.autoreply-form input:focus,
.autoreply-form textarea:focus,
.autoreply-form select:focus,
.analytics-select:focus {
  outline: none;
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

/* ── Page exit transition ── */
body.page-exit .app-main {
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

@media (max-width: 900px) {
  .mobile-topbar {
    display: flex;
  }

  .app-shell {
    flex-direction: column;
  }

  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    width: min(85vw, var(--sidebar-w));
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }

  .app-shell.sidebar-open .app-sidebar {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: block;
  }

  .app-shell.sidebar-open .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  .app-shell.sidebar-collapsed .app-sidebar {
    width: min(85vw, var(--sidebar-w));
    transform: translateX(-100%);
  }

  .app-shell.sidebar-collapsed.sidebar-open .app-sidebar {
    transform: translateX(0);
  }

  .sidebar-top .sidebar-toggle {
    display: none;
  }

  .app-main {
    flex: 1;
    min-height: 0;
  }

  .page-header {
    display: none;
  }

  .app-content {
    padding: 1rem;
  }

  .cards-grid {
    grid-template-columns: 1fr;
  }

  .saas-hero {
    padding: 1.5rem;
  }

  .saas-stats {
    flex-direction: column;
  }

  .download-hero {
    padding: 1.25rem;
  }

  .analytics-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .pages-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (min-width: 901px) {
  .sidebar-overlay {
    display: none !important;
  }
}
