/* ============================================================
   Fluência Contábil — Design Tokens + Base
   ============================================================ */

:root {
  /* Brand */
  --fc-azul-profundo: #1B2A4A;
  --fc-azul-medio: #2E4A7A;
  --fc-azul-escuro: #0F1B33;
  --fc-dourado: #C8A84B;
  --fc-dourado-claro: #E0C778;
  --fc-dourado-escuro: #A88A32;
  --fc-cream: #FBF6E9;
  --fc-cream-deep: #F2EBD3;

  /* Neutrals */
  --fc-white: #FFFFFF;
  --fc-gray-50: #FAFAF8;
  --fc-gray-100: #F5F4F0;
  --fc-gray-200: #E8E6DF;
  --fc-gray-300: #D4D1C7;
  --fc-gray-400: #A8A598;
  --fc-gray-500: #8A8A8A;
  --fc-gray-600: #5E5E5E;
  --fc-gray-700: #3F3F3F;
  --fc-gray-800: #2A2A2A;
  --fc-gray-900: #1A1A1A;

  /* Semantic */
  --fc-success: #2E7D32;
  --fc-success-bg: #E8F3E9;
  --fc-error: #D93E3E;
  --fc-error-bg: #FCEAEA;
  --fc-warning: #B8860B;
  --fc-warning-bg: #FBF1D4;
  --fc-info: #2E4A7A;
  --fc-info-bg: #E7EDF5;

  /* Spacing scale (4px base) */
  --fc-s1: 4px;
  --fc-s2: 8px;
  --fc-s3: 12px;
  --fc-s4: 16px;
  --fc-s5: 20px;
  --fc-s6: 24px;
  --fc-s8: 32px;
  --fc-s10: 40px;
  --fc-s12: 48px;
  --fc-s16: 64px;

  /* Radii */
  --fc-r-sm: 6px;
  --fc-r-md: 8px;
  --fc-r-lg: 12px;
  --fc-r-xl: 16px;
  --fc-r-pill: 999px;

  /* Shadows (subtle) */
  --fc-shadow-xs: 0 1px 2px rgba(27, 42, 74, 0.05);
  --fc-shadow-sm: 0 1px 3px rgba(27, 42, 74, 0.06), 0 1px 2px rgba(27, 42, 74, 0.04);
  --fc-shadow-md: 0 4px 12px rgba(27, 42, 74, 0.08), 0 2px 4px rgba(27, 42, 74, 0.04);
  --fc-shadow-lg: 0 12px 32px rgba(27, 42, 74, 0.12), 0 4px 8px rgba(27, 42, 74, 0.06);
  --fc-shadow-gold: 0 6px 20px rgba(200, 168, 75, 0.24);

  /* Typography */
  --fc-font: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --fc-font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Monaco, 'Courier New', monospace;

  /* Layout */
  --fc-sidebar-w: 264px;
  --fc-header-h: 64px;

  /* Transitions */
  --fc-t: 180ms cubic-bezier(.2,.8,.2,1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--fc-font);
  color: var(--fc-gray-800);
  background: var(--fc-gray-100);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; padding: 0; color: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

/* ---------- Typography utilities ---------- */
.fc-h1 { font-size: 32px; font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; color: var(--fc-azul-profundo); }
.fc-h2 { font-size: 24px; font-weight: 700; line-height: 1.2;  letter-spacing: -0.01em; color: var(--fc-azul-profundo); }
.fc-h3 { font-size: 18px; font-weight: 600; line-height: 1.3;  color: var(--fc-azul-profundo); }
.fc-h4 { font-size: 15px; font-weight: 600; line-height: 1.4;  color: var(--fc-azul-profundo); }
.fc-body { font-size: 15px; line-height: 1.55; color: var(--fc-gray-700); }
.fc-small { font-size: 13px; line-height: 1.45; color: var(--fc-gray-600); }
.fc-caption { font-size: 12px; line-height: 1.4; color: var(--fc-gray-500); letter-spacing: 0.02em; }
.fc-overline { font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--fc-gray-500); }

/* ---------- App shell ---------- */
.app-shell, .fc-app { display: flex; min-height: 100vh; background: var(--fc-gray-100); }
.app-main, .fc-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  margin-left: var(--fc-sidebar-w);
}
.app-topbar, .fc-topbar {
  height: var(--fc-header-h);
  background: var(--fc-white);
  border-bottom: 1px solid var(--fc-gray-200);
  display: flex;
  align-items: center;
  padding: 0 32px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.app-content, .fc-content { padding: 32px; flex: 1; max-width: 1320px; width: 100%; }

/* Aliases for nav/sidebar naming used in app.jsx */
.fc-nav { flex: 1; padding: 12px 12px; overflow-y: auto; }
.fc-sidebar-ftr {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.fc-streak-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--fc-r-pill);
  background: rgba(200, 168, 75, 0.12);
  color: var(--fc-dourado-escuro, #8F7830);
  font-size: 12px;
  font-weight: 600;
}

/* ---------- Sidebar ---------- */
.fc-sidebar {
  width: var(--fc-sidebar-w);
  background: var(--fc-azul-profundo);
  color: var(--fc-white);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
}
.fc-sidebar-brand {
  padding: 20px 20px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.fc-sidebar-brand img { width: 36px; height: 36px; object-fit: contain; }
.fc-sidebar-brand-text { display: flex; flex-direction: column; line-height: 1; }
.fc-sidebar-brand-name {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--fc-white);
  text-transform: uppercase;
}
.fc-sidebar-brand-tag {
  font-size: 9.5px;
  letter-spacing: 0.08em;
  color: var(--fc-dourado);
  margin-top: 4px;
  text-transform: uppercase;
  font-weight: 500;
}

.fc-sidebar-nav { flex: 1; padding: 12px 12px; overflow-y: auto; }
.fc-sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  padding: 16px 12px 8px;
}
.fc-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--fc-r-md);
  color: rgba(255,255,255,0.72);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--fc-t), color var(--fc-t);
  margin-bottom: 2px;
}
.fc-nav-item:hover { background: rgba(255,255,255,0.06); color: var(--fc-white); }
.fc-nav-item.active {
  background: linear-gradient(90deg, rgba(200,168,75,0.18), rgba(200,168,75,0.04));
  color: var(--fc-white);
  position: relative;
}
.fc-nav-item.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: var(--fc-dourado);
  border-radius: 0 2px 2px 0;
}
.fc-nav-item .nav-badge {
  margin-left: auto;
  background: var(--fc-dourado);
  color: var(--fc-azul-profundo);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--fc-r-pill);
}
.fc-nav-item.locked { opacity: 0.5; }
.fc-nav-item svg { flex-shrink: 0; }

.fc-sidebar-foot {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.fc-avatar {
  width: 36px; height: 36px;
  border-radius: var(--fc-r-pill);
  background: var(--fc-dourado);
  color: var(--fc-azul-profundo);
  font-weight: 700;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.fc-avatar img { width: 100%; height: 100%; object-fit: cover; }
.fc-sidebar-user-name { font-size: 13px; font-weight: 600; color: var(--fc-white); }
.fc-sidebar-user-plan { font-size: 11px; color: var(--fc-dourado); margin-top: 1px; }
.fc-sidebar-logout {
  color: rgba(255,255,255,0.55);
  padding: 6px;
  border-radius: 6px;
  transition: var(--fc-t);
}
.fc-sidebar-logout:hover { color: var(--fc-white); background: rgba(255,255,255,0.06); }

/* Admin sidebar variant */
.fc-sidebar.admin .fc-sidebar-brand-tag::before { content: 'painel admin · '; }

/* ---------- Card ---------- */
.fc-card {
  background: var(--fc-white);
  border: 1px solid var(--fc-gray-200);
  border-radius: var(--fc-r-lg);
  box-shadow: var(--fc-shadow-xs);
  padding: 24px;
}
.fc-card-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.fc-card-ft { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--fc-gray-200); }

/* ---------- Buttons ---------- */
.fc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--fc-r-md);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  transition: all var(--fc-t);
  border: 1px solid transparent;
  white-space: nowrap;
}
.fc-btn-primary { background: var(--fc-dourado); color: var(--fc-azul-profundo); box-shadow: var(--fc-shadow-gold); }
.fc-btn-primary:hover { background: var(--fc-dourado-claro); transform: translateY(-1px); }
.fc-btn-azul { background: var(--fc-azul-profundo); color: var(--fc-white); }
.fc-btn-azul:hover { background: var(--fc-azul-medio); }
.fc-btn-secondary { background: var(--fc-white); color: var(--fc-azul-profundo); border-color: var(--fc-gray-300); }
.fc-btn-secondary:hover { border-color: var(--fc-azul-profundo); background: var(--fc-gray-50); }
.fc-btn-ghost { color: var(--fc-gray-700); }
.fc-btn-ghost:hover { background: var(--fc-gray-100); }
.fc-btn-danger { color: var(--fc-error); background: var(--fc-white); border-color: var(--fc-gray-300); }
.fc-btn-danger:hover { background: var(--fc-error-bg); border-color: var(--fc-error); }
.fc-btn-sm { padding: 7px 12px; font-size: 13px; }
.fc-btn-lg { padding: 14px 24px; font-size: 15px; }
.fc-btn-block { width: 100%; }

/* ---------- Progress ---------- */
.fc-progress {
  height: 8px;
  background: var(--fc-gray-200);
  border-radius: var(--fc-r-pill);
  overflow: hidden;
  position: relative;
}
.fc-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--fc-dourado), var(--fc-dourado-claro));
  border-radius: var(--fc-r-pill);
  transition: width 400ms ease-out;
}
.fc-progress-sm { height: 6px; }
.fc-progress-xs { height: 4px; }

/* ---------- Badges / chips ---------- */
.fc-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--fc-r-pill);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.fc-badge-gold { background: rgba(200,168,75,0.14); color: var(--fc-dourado-escuro); }
.fc-badge-blue { background: rgba(46,74,122,0.1); color: var(--fc-azul-medio); }
.fc-badge-green { background: var(--fc-success-bg); color: var(--fc-success); }
.fc-badge-red { background: var(--fc-error-bg); color: var(--fc-error); }
.fc-badge-yellow { background: var(--fc-warning-bg); color: var(--fc-warning); }
.fc-badge-gray { background: var(--fc-gray-100); color: var(--fc-gray-600); }

.fc-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--fc-r-pill);
  border: 1px solid var(--fc-gray-200);
  background: var(--fc-white);
  color: var(--fc-gray-700);
}

/* ---------- Inputs ---------- */
.fc-input, .fc-textarea, .fc-select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--fc-gray-300);
  border-radius: var(--fc-r-md);
  background: var(--fc-white);
  font-size: 14px;
  color: var(--fc-gray-800);
  transition: border-color var(--fc-t), box-shadow var(--fc-t);
}
.fc-input:focus, .fc-textarea:focus, .fc-select:focus {
  outline: none;
  border-color: var(--fc-azul-medio);
  box-shadow: 0 0 0 3px rgba(46,74,122,0.12);
}
.fc-textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.fc-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--fc-gray-700); }

/* ---------- Modal ---------- */
.fc-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 27, 51, 0.5);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 160ms ease-out;
}
.fc-modal {
  background: var(--fc-white);
  border-radius: var(--fc-r-lg);
  max-width: 560px;
  width: 100%;
  max-height: calc(100vh - 48px);
  overflow: auto;
  box-shadow: var(--fc-shadow-lg);
  animation: slideUp 180ms cubic-bezier(.2,.8,.2,1);
}
.fc-modal-hd { padding: 20px 24px 12px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.fc-modal-bd { padding: 4px 24px 24px; }
.fc-modal-ft { padding: 16px 24px; background: var(--fc-gray-50); border-top: 1px solid var(--fc-gray-200); display: flex; gap: 10px; justify-content: flex-end; border-radius: 0 0 var(--fc-r-lg) var(--fc-r-lg); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Toast ---------- */
.fc-toast-host { position: fixed; bottom: 24px; right: 24px; z-index: 120; display: flex; flex-direction: column; gap: 8px; }
.fc-toast {
  background: var(--fc-azul-profundo);
  color: var(--fc-white);
  padding: 12px 18px;
  border-radius: var(--fc-r-md);
  box-shadow: var(--fc-shadow-lg);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  animation: slideUp 200ms cubic-bezier(.2,.8,.2,1);
}
.fc-toast-gold { background: var(--fc-dourado); color: var(--fc-azul-profundo); }

/* ---------- Tabs ---------- */
.fc-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--fc-gray-200); }
.fc-tab {
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 500;
  color: var(--fc-gray-600);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: var(--fc-t);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.fc-tab:hover { color: var(--fc-azul-profundo); }
.fc-tab.active {
  color: var(--fc-azul-profundo);
  border-bottom-color: var(--fc-dourado);
  font-weight: 600;
}
.fc-tab-count {
  background: var(--fc-gray-100);
  color: var(--fc-gray-600);
  font-size: 11px;
  padding: 2px 7px;
  border-radius: var(--fc-r-pill);
  font-weight: 600;
}
.fc-tab.active .fc-tab-count { background: rgba(200,168,75,0.18); color: var(--fc-dourado-escuro); }

/* ---------- Helpers ---------- */
.fc-stack { display: flex; flex-direction: column; }
.fc-row { display: flex; }
.fc-gap-1 { gap: 4px; }
.fc-gap-2 { gap: 8px; }
.fc-gap-3 { gap: 12px; }
.fc-gap-4 { gap: 16px; }
.fc-gap-6 { gap: 24px; }
.fc-gap-8 { gap: 32px; }
.fc-mt-2 { margin-top: 8px; }
.fc-mt-4 { margin-top: 16px; }
.fc-mt-6 { margin-top: 24px; }
.fc-mt-8 { margin-top: 32px; }
.fc-mb-2 { margin-bottom: 8px; }
.fc-mb-4 { margin-bottom: 16px; }
.fc-mb-6 { margin-bottom: 24px; }
.fc-items-center { align-items: center; }
.fc-justify-between { justify-content: space-between; }
.fc-flex-1 { flex: 1; }
.fc-grid { display: grid; gap: 16px; }
.fc-divider { height: 1px; background: var(--fc-gray-200); margin: 16px 0; border: 0; }
.fc-text-gold { color: var(--fc-dourado-escuro); }
.fc-text-azul { color: var(--fc-azul-profundo); }
.fc-text-muted { color: var(--fc-gray-500); }

/* ---------- Tweaks panel ---------- */
.tweaks-fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 48px; height: 48px;
  border-radius: var(--fc-r-pill);
  background: var(--fc-azul-profundo);
  color: var(--fc-dourado);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--fc-shadow-lg);
  z-index: 90;
  cursor: pointer;
  transition: var(--fc-t);
}
.tweaks-fab:hover { transform: scale(1.05); }
.tweaks-panel {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 320px;
  background: var(--fc-white);
  border-radius: var(--fc-r-lg);
  box-shadow: var(--fc-shadow-lg);
  z-index: 91;
  padding: 18px;
  border: 1px solid var(--fc-gray-200);
}
.tweaks-panel h4 { margin: 0 0 12px; font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fc-azul-profundo); }
.tweaks-group { margin-bottom: 16px; }
.tweaks-group-label { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fc-gray-500); margin-bottom: 6px; display: block; }
.tweaks-seg { display: grid; gap: 4px; padding: 3px; background: var(--fc-gray-100); border-radius: var(--fc-r-md); }
.tweaks-seg button {
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  color: var(--fc-gray-600);
  text-align: left;
  transition: var(--fc-t);
}
.tweaks-seg button.on { background: var(--fc-white); color: var(--fc-azul-profundo); box-shadow: var(--fc-shadow-xs); font-weight: 600; }

/* ---------- Placeholder (honest fallback) ---------- */
.fc-logo-fallback {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  background: var(--fc-azul-profundo);
  color: var(--fc-dourado);
  border: 2px dashed var(--fc-dourado);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: var(--fc-r-md);
}

/* ---------- Empty state ---------- */
.fc-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--fc-gray-600);
}
.fc-empty-icon {
  width: 56px; height: 56px;
  border-radius: var(--fc-r-pill);
  background: var(--fc-cream);
  color: var(--fc-dourado-escuro);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}

/* ---------- Watermark in video ---------- */
.fc-video-placeholder {
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, #0F1B33, #1B2A4A 55%, #2E4A7A);
  border-radius: var(--fc-r-lg);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--fc-white);
}
.fc-video-placeholder::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at 30% 20%, rgba(200,168,75,0.12), transparent 40%);
}
.fc-video-play {
  width: 72px; height: 72px;
  border-radius: var(--fc-r-pill);
  background: var(--fc-dourado);
  color: var(--fc-azul-profundo);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--fc-shadow-gold);
  z-index: 2;
  position: relative;
}
.fc-watermark {
  position: absolute;
  top: 14px; right: 18px;
  font-size: 10px;
  color: rgba(255,255,255,0.35);
  font-family: var(--fc-font-mono);
  letter-spacing: 0.04em;
  z-index: 3;
  pointer-events: none;
}
.fc-video-meta {
  position: absolute;
  bottom: 14px; left: 18px;
  font-size: 11px;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 500;
  z-index: 3;
}

/* ---------- Tooltip ---------- */
.fc-tip {
  position: relative;
}
.fc-tip[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--fc-gray-900);
  color: var(--fc-white);
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 50;
  pointer-events: none;
}

/* ---------- Scroll ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--fc-gray-300); border-radius: 5px; border: 2px solid var(--fc-gray-100); }
::-webkit-scrollbar-thumb:hover { background: var(--fc-gray-400); }

/* ---------- Print (certificate) ---------- */
@media print {
  .fc-sidebar, .app-topbar, .tweaks-fab, .tweaks-panel, .no-print { display: none !important; }
  .app-main { margin-left: 0 !important; }
  .app-content { padding: 0 !important; }
  body { background: white; }
}
