/* ============================================
   CHIPAK TOOLS - DESIGN SYSTEM
   Tema Claro Moderno
   ============================================ */

/* ============================================
   CSS VARIABLES
   ============================================ */
:root {
  /* Primary Colors - ALC teal */
  --primary: #1f6580;
  --primary-hover: #2d8fb8;
  --primary-light: #e0f2f7;
  --primary-dark: #1a5468;

  /* Secondary Colors */
  --secondary: #2d8fb8;
  --secondary-hover: #1f6580;
  --secondary-light: #d6ecf3;

  /* Accent Colors - vermelho vivo CTA (estilo Conrado) */
  --accent: #e63946;
  --accent-hover: #c81d2a;
  --accent-light: #fde8ea;

  /* Neutral Colors - tema claro */
  --white: #ffffff;
  --background: #ffffff;
  --surface: #f8fafc;
  --surface-hover: #f1f5f9;
  --border: #e2e8f0;
  --border-dark: #cbd5e1;

  /* Text Colors */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;

  /* Status Colors */
  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --error: #ef4444;
  --error-light: #fee2e2;
  --info: #3b82f6;
  --info-light: #dbeafe;

  /* Shadows */
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;

  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;

  /* Z-index */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-modal-backdrop: 400;
  --z-modal: 500;
  --z-popover: 600;
  --z-tooltip: 700;
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--background);
  min-height: 100vh;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}

input, button, textarea, select {
  font: inherit;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-hover);
}

ul, ol {
  list-style: none;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: var(--leading-tight);
  color: var(--text-primary);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p {
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

.text-gradient {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-error { color: var(--error); }

/* ============================================
   LAYOUT
   ============================================ */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.container-sm { max-width: 640px; }
.container-md { max-width: 768px; }
.container-lg { max-width: 1024px; }
.container-xl { max-width: 1280px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.flex-1 { flex: 1; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1;
  border-radius: var(--radius-lg);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
}

.btn-lg {
  padding: var(--space-4) var(--space-6);
  font-size: var(--text-base);
}

.btn-xl {
  padding: var(--space-5) var(--space-8);
  font-size: var(--text-lg);
  border-radius: var(--radius-xl);
}

/* Primary Button */
.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: var(--text-inverse);
  box-shadow: var(--shadow-sm), 0 0 0 0 var(--primary-light);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--primary-hover) 0%, var(--primary) 100%);
  box-shadow: var(--shadow-md), 0 0 0 4px var(--primary-light);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

/* Secondary Button */
.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--border-dark);
}

/* Success Button */
.btn-success {
  background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-hover) 100%);
  color: var(--text-inverse);
}

.btn-success:hover:not(:disabled) {
  box-shadow: var(--shadow-md), 0 0 0 4px var(--secondary-light);
  transform: translateY(-1px);
}

/* Outline Button */
.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-outline:hover:not(:disabled) {
  background: var(--primary);
  color: var(--text-inverse);
}

/* Ghost Button */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface);
  color: var(--text-primary);
}

/* Accent Button */
.btn-accent {
  background: var(--accent);
  color: var(--text-inverse);
}

.btn-accent:not(:hover) {
  box-shadow: 0 4px 14px rgba(230, 57, 70, 0.35);
}

.btn-accent:hover:not(:disabled) {
  box-shadow: var(--shadow-md), 0 0 0 4px var(--accent-light);
  transform: translateY(-1px);
}

/* Error Button */
.btn-error {
  background: linear-gradient(135deg, var(--error) 0%, #dc2626 100%);
  color: var(--text-inverse);
}

.btn-error:hover:not(:disabled) {
  box-shadow: var(--shadow-md), 0 0 0 4px var(--error-light);
}

/* Icon Button */
.btn-icon {
  padding: var(--space-3);
  border-radius: var(--radius-md);
}

.btn-icon svg {
  width: 20px;
  height: 20px;
}

.btn-icon.btn-sm {
  padding: var(--space-2);
  width: 32px;
  height: 32px;
}

.btn-icon.btn-sm svg {
  width: 16px;
  height: 16px;
}

/* ============================================
   CARDS
   ============================================ */
.card {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: all var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

.card-body {
  padding: var(--space-6);
}

.card-header {
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.card-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* Tool Card */
.tool-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  padding: var(--space-6);
  transition: all var(--transition-base);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
  transform: scaleX(0);
  transition: transform var(--transition-base);
}

.tool-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
  border-color: var(--primary-light);
}

.tool-card:hover::before {
  transform: scaleX(1);
}

.tool-card-icon,
.tool-card .icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--accent-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
  font-size: 24px;
}

.tool-card-icon svg,
.tool-card .icon svg {
  width: 24px;
  height: 24px;
  color: var(--primary);
}

.tool-card-title,
.tool-card h3 {
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: var(--space-2);
  color: var(--text-primary);
}

.tool-card-description,
.tool-card p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

.tool-card-badge {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
  background: var(--secondary-light);
  color: var(--secondary);
}

.tool-card-badge.premium {
  background: var(--accent-light);
  color: var(--accent);
}

/* Data Card */
.data-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}

.data-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

/* Glass Card */
.glass-card {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
  margin-bottom: var(--space-4);
}

.form-group > label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-input:disabled,
.form-textarea:disabled {
  background: var(--surface);
  opacity: 0.6;
  cursor: not-allowed;
}

.form-input.error {
  border-color: var(--error);
}

.form-input.error:focus {
  box-shadow: 0 0 0 4px var(--error-light);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--error);
  margin-top: var(--space-1);
}

/* Checkbox & Radio */
.form-check {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
}

.form-check-input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.form-check-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* Toggle Switch */
.toggle {
  position: relative;
  width: 48px;
  height: 26px;
  cursor: pointer;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: var(--radius-full);
  transition: var(--transition-base);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  background: var(--white);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-base);
}

.toggle input:checked + .toggle-slider {
  background: var(--primary);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

/* ============================================
   HEADER
   ============================================ */
.header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: rgba(15, 23, 42, 0.97);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) 0;
  max-width: 1280px;
  margin: 0 auto;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xl);
  font-weight: 700;
  color: #ffffff;
  text-decoration: none;
}

.header-logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: var(--text-lg);
}

.header-logo-img {
  height: 27px;
  width: auto;
  display: block;
  margin-right: 10px;
}

.header-logo-text {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.header-nav a {
  font-size: var(--text-sm);
  font-weight: 500;
  color: rgba(255, 255, 255, 0.75);
  transition: color var(--transition-fast);
}

.header-nav a:hover {
  color: #ffffff;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* Mobile Menu */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: var(--space-2);
  background: none;
  border: none;
  cursor: pointer;
}

.menu-toggle span {
  width: 20px;
  height: 2px;
  background: #ffffff;
  border-radius: 2px;
  transition: all var(--transition-base);
}

.menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

@media (max-width: 768px) {
  .header-nav {
    display: none;
  }

  .menu-toggle {
    display: flex;
  }

  .header-nav.active {
    display: flex;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: #0f172a;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: var(--space-4);
    gap: var(--space-4);
    box-shadow: var(--shadow-lg);
  }
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero {
  padding: var(--space-20) 0;
  background: linear-gradient(135deg, var(--surface) 0%, var(--white) 50%, var(--primary-light) 100%);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 60%;
  height: 200%;
  background: radial-gradient(circle, var(--primary-light) 0%, transparent 70%);
  opacity: 0.5;
}

.hero-section {
  padding: var(--space-20) 0;
  background: linear-gradient(135deg, var(--surface) 0%, var(--white) 50%, var(--primary-light) 100%);
  position: relative;
  overflow: hidden;
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-6);
}

.hero-badge-dot {
  width: 8px;
  height: 8px;
  background: var(--secondary);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.hero-title {
  font-size: var(--text-5xl);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: var(--space-6);
}

.hero-subtitle {
  font-size: var(--text-xl);
  color: var(--text-secondary);
  margin-bottom: var(--space-8);
  line-height: var(--leading-relaxed);
}

.hero-actions,
.hero-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.hero-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  margin-top: var(--space-12);
  padding-top: var(--space-8);
  border-top: 1px solid var(--border);
}

.hero-stat {
  text-align: center;
}

.hero-stat-value {
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--primary);
}

.hero-stat-label {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .hero,
  .hero-section {
    padding: var(--space-12) 0;
  }

  .hero-title {
    font-size: var(--text-3xl);
  }

  .hero-subtitle {
    font-size: var(--text-base);
  }

  .hero-stats {
    flex-direction: column;
    gap: var(--space-4);
  }
}

/* ============================================
   SECTIONS
   ============================================ */
.section {
  padding: var(--space-16) 0;
}

.section-header {
  text-align: center;
  margin-bottom: var(--space-12);
}

.section-badge {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  background: var(--primary-light);
  color: var(--primary);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: var(--radius-full);
  margin-bottom: var(--space-4);
}

.section-title {
  font-size: var(--text-3xl);
  margin-bottom: var(--space-4);
}

.section-subtitle {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* ============================================
   TOOLS GRID
   ============================================ */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-6);
}

/* Category Section */
.category-section {
  margin-bottom: var(--space-12);
}

.category-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.category-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.category-icon.geradores { background: var(--primary-light); color: var(--primary); }
.category-icon.validadores { background: var(--secondary-light); color: var(--secondary); }
.category-icon.texto { background: var(--accent-light); color: var(--accent); }
.category-icon.codificacao { background: var(--warning-light); color: var(--warning); }
.category-icon.utilitarios { background: var(--info-light); color: var(--info); }

.category-title {
  font-size: var(--text-xl);
  font-weight: 600;
}

/* ============================================
   SIDEBAR (App Area)
   ============================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 280px;
  background: #171e31;
  border-right: none;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: var(--z-fixed);
  transition: transform var(--transition-base);
}

.sidebar-header {
  padding: 0 var(--space-5);
  background: #171e31;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  height: 70px;
  min-height: 70px;
  display: flex;
  align-items: center;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  border-right: 1px solid rgba(255,255,255,0.08);
}

.sidebar-section {
  margin-bottom: var(--space-1);
}

/* Remove o marcador padrão do <details> */
details.sidebar-section > summary {
  list-style: none;
}
details.sidebar-section > summary::-webkit-details-marker {
  display: none;
}

.sidebar-section-title,
details.sidebar-section > summary {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-lg);
  color: rgba(255, 255, 255, 0.55);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition-fast), color var(--transition-fast);
  width: 100%;
  text-align: left;
}

details.sidebar-section > summary:hover {
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.9);
}

details.sidebar-section[open] > summary {
  color: rgba(255, 255, 255, 0.9);
}

.sidebar-menu-chevron {
  margin-left: auto;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

details.sidebar-section[open] > summary .sidebar-menu-chevron {
  transform: rotate(90deg);
}

.sidebar-submenu {
  padding-left: var(--space-5);
  padding-bottom: var(--space-2);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-lg);
  color: rgba(255, 255, 255, 0.55);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--transition-fast);
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.9);
}

.sidebar-link.active {
  background: rgba(230, 57, 70, 0.15);
  color: var(--accent);
}

.sidebar-link svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: var(--space-4);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-right: 1px solid rgba(255,255,255,0.08);
}

.main-content,
.app-content {
  flex: 1;
  margin-left: 280px;
  background: var(--surface);
  min-height: 100vh;
}

.tool-container {
  margin-left: 280px;
  background: var(--background);
  min-height: 100vh;
  padding: 0 var(--space-6) var(--space-6);
}

/* Header injetado pelo components.js dentro do tool-container */
.tool-container > .app-header {
  margin-left: calc(-1 * var(--space-6));
  margin-right: calc(-1 * var(--space-6));
  margin-bottom: var(--space-6);
  position: sticky;
  top: 0;
}

.app-header {
  background: #171e31;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0 var(--space-6);
  height: 70px;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}

.app-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

/* Protect app-header buttons from page-level .btn overrides */
.app-header .btn-ghost {
  background: transparent !important;
  color: rgba(255, 255, 255, 0.75) !important;
  padding: var(--space-2) !important;
}

.app-header .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #ffffff !important;
}

.app-header .btn-icon {
  width: 36px !important;
  height: 36px !important;
  padding: var(--space-2) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: var(--radius-md) !important;
}

.app-header .btn-sm {
  padding: var(--space-2) var(--space-3) !important;
  font-size: var(--text-sm) !important;
}

.app-header .btn-primary {
  background: var(--primary) !important;
  color: white !important;
}

.app-header .btn-primary:hover {
  background: var(--primary-hover) !important;
}

.page-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
}

.app-body,
.app-main,
.content-area {
  padding: var(--space-6);
}

/* Content Area */
.content-area {
  max-width: 900px;
}

/* Full width content (for editors, etc) */
.content-area.full-width {
  max-width: none;
}

/* Card improvements */
.card {
  background: var(--white);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: var(--space-6);
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: var(--text-xl);
  font-weight: 600;
  margin-bottom: var(--space-1);
}

.card-description {
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.card-body {
  padding: var(--space-6);
}

.card-footer {
  padding: var(--space-4) var(--space-6);
  background: var(--surface);
  border-top: 1px solid var(--border);
}

/* User Menu */
.user-menu {
  position: relative;
}

/* Esconde menus de auth por padrao para evitar flash */
#loggedOutMenu,
#loggedInMenu {
  display: none;
}

.user-menu-trigger {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.user-menu-trigger:hover {
  border-color: var(--primary);
}

.user-avatar {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--white);
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 200px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all var(--transition-fast);
}

.user-menu.active .user-menu-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-menu-dropdown a,
.user-menu-dropdown button {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: 0.875rem;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.user-menu-dropdown a:hover,
.user-menu-dropdown button:hover {
  background: var(--surface);
  color: var(--text-primary);
}

.user-menu-dropdown .divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-2) 0;
}

/* User Dropdown (alternative class names) */
.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all var(--transition-fast);
  z-index: 1000;
}

.user-dropdown.active,
.user-dropdown.show,
.user-menu.active .user-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-dropdown-item {
  display: block;
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: 0.875rem;
  color: var(--text-secondary);
  background: none;
  border: none;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.user-dropdown-item:hover {
  background: var(--surface);
  color: var(--text-primary);
}

.user-dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-2) 0;
}

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.active,
  .sidebar.open {
    transform: translateX(0);
  }

  .main-content,
  .app-content,
  .tool-container {
    margin-left: 0;
  }

  .menu-toggle {
    display: flex;
  }

  .content-area {
    padding: var(--space-4);
  }
}

@media (max-width: 640px) {
  .content-area {
    padding: var(--space-3);
  }

  .card-header,
  .card-body {
    padding: var(--space-4);
  }

  .app-header {
    padding: var(--space-3) var(--space-4);
  }

  .page-title {
    font-size: 1rem;
  }
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: var(--z-modal-backdrop);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--white);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-modal);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow: hidden;
  transform: scale(0.95) translateY(20px);
  transition: all var(--transition-base);
  position: relative;
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
}

.modal-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-4);
  background: var(--primary-light);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.modal-title {
  font-size: var(--text-xl);
  font-weight: 600;
}

.modal-description {
  color: var(--text-secondary);
}

.modal-close {
  padding: var(--space-2);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--surface);
  color: var(--text-primary);
}

.modal-body {
  padding: var(--space-6);
  overflow-y: auto;
}

.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
}

.modal-footer .btn {
  flex: 1;
}

/* Modal Sizes */
.modal-lg {
  max-width: 720px;
}

.modal-xl {
  max-width: 960px;
}

/* ============================================
   REPORT MODAL (injected by chipak-features.js)
   ============================================ */
.report-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: var(--z-modal-backdrop);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}
.report-modal-overlay.active {
  display: flex;
}
.report-modal {
  background: var(--white);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.report-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
}
.report-modal-header h3 {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-lg);
  font-weight: 600;
  margin: 0;
}
.report-modal-header h3 svg { width: 20px; height: 20px; color: var(--primary); }
.report-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: var(--space-1);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
}
.report-modal-close:hover { background: var(--surface); color: var(--text-primary); }
.report-modal-body { padding: var(--space-5) var(--space-6); flex: 1; }
.report-type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.report-type-option {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--transition-fast);
  background: var(--surface);
}
.report-type-option:hover,
.report-type-option.selected { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.report-type-option input[type="radio"] { display: none; }
.report-type-option svg { width: 16px; height: 16px; flex-shrink: 0; }
.report-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
}

/* ============================================
   AUTH MODAL
   ============================================ */
.auth-tabs {
  display: flex;
  gap: var(--space-1);
  background: var(--surface);
  padding: var(--space-1);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-6);
}

.auth-tab {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.auth-tab:hover {
  color: var(--text-primary);
}

.auth-tab.active {
  background: var(--white);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
}

/* Auth Modal - Wide Layout with Benefits */
.auth-modal-wide {
  max-width: 440px;
  overflow: hidden;
}

.auth-modal-layout {
  display: flex;
  flex-direction: column;
}

.auth-benefits-panel {
  position: relative;
  background: var(--primary-light);
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
}

.auth-benefits-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.auth-benefits-icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.auth-benefits-icon svg {
  width: 18px;
  height: 18px;
}

.auth-benefits-text h3 {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.auth-benefits-text p {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 1px;
}

.auth-benefits-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px var(--space-4);
}

.auth-benefits-list li {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.auth-benefits-list li svg {
  flex-shrink: 0;
  color: var(--primary);
}

.auth-form-panel {
  padding: var(--space-5) var(--space-6) var(--space-6);
}

.auth-form-panel .modal-title {
  font-size: var(--text-lg);
  font-weight: 700;
  margin-bottom: 2px;
  color: var(--text-primary);
}

.auth-form-panel .modal-description {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}

@media (max-width: 480px) {
  .auth-modal-wide {
    max-width: 100%;
  }
  .auth-benefits-panel {
    padding: var(--space-4);
  }
  .auth-benefits-list {
    gap: 4px var(--space-3);
  }
  .auth-benefits-list li {
    font-size: 0.72rem;
  }
  .auth-form-panel {
    padding: var(--space-4);
  }
}

/* ============================================
   TABS
   ============================================ */
.tabs {
  display: flex;
  gap: var(--space-1);
  background: var(--surface);
  padding: var(--space-1);
  border-radius: var(--radius-lg);
}

.tab {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tab:hover {
  color: var(--text-primary);
}

.tab.active {
  background: var(--white);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Editor Tabs */
.editor-tabs {
  display: flex;
  gap: var(--space-1);
}

.editor-tab {
  padding: var(--space-2) var(--space-4);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.editor-tab:hover {
  color: var(--text-primary);
  background: var(--surface);
}

.editor-tab.active {
  color: var(--primary);
  background: var(--primary-light);
}

/* ============================================
   ALERTS & TOASTS
   ============================================ */
.alert {
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.alert-success {
  background: var(--success-light);
  color: var(--success);
}

.alert-warning {
  background: var(--warning-light);
  color: var(--warning);
}

.alert-error {
  background: var(--error-light);
  color: var(--error);
}

.alert-info {
  background: var(--info-light);
  color: var(--info);
}

.toast-container {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-tooltip);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.toast {
  padding: var(--space-4) var(--space-5);
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 300px;
  max-width: 400px;
  transform: translateX(120%);
  transition: transform var(--transition-base);
}

.toast.show {
  transform: translateX(0);
}

.toast-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.toast-message {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.toast-close {
  padding: var(--space-1);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition-fast);
}

.toast-close:hover {
  color: var(--text-primary);
}

.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--error); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-info { border-left: 3px solid var(--info); }

@media (max-width: 768px) {
  .toast-container {
    right: var(--space-3);
    left: var(--space-3);
  }

  .toast {
    min-width: auto;
    max-width: none;
  }
}

/* ============================================
   BADGES
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
}

.badge-primary {
  background: var(--primary-light);
  color: var(--primary);
}

.badge-secondary {
  background: var(--surface);
  color: var(--text-secondary);
}

.badge-success {
  background: var(--success-light);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-light);
  color: var(--warning);
}

.badge-error {
  background: var(--error-light);
  color: var(--error);
}

.badge-accent {
  background: var(--accent-light);
  color: var(--accent);
}

.badge-html {
  background: #fee2e2;
  color: #e34f26;
}

.badge-markdown {
  background: var(--info-light);
  color: var(--info);
}

/* ============================================
   TOOL PAGE LAYOUT
   ============================================ */
.tool-page {
  max-width: 900px;
  margin: 0 auto;
}

.tool-header {
  text-align: center;
  margin-bottom: var(--space-8);
}

.tool-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-4);
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--accent-light) 100%);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tool-icon svg {
  width: 32px;
  height: 32px;
  color: var(--primary);
}

.tool-title {
  font-size: var(--text-3xl);
  margin-bottom: var(--space-2);
}

.tool-description {
  color: var(--text-secondary);
  font-size: var(--text-lg);
}

.tool-content {
  background: var(--white);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  padding: var(--space-6);
}

.tool-result {
  margin-top: var(--space-6);
  padding: var(--space-4);
  background: var(--surface);
  border-radius: var(--radius-lg);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.tool-actions {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

/* Tool Grid (two-column layout for tools) */
.tool-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
}

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

/* Tool Section */
.tool-section {
  display: block;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
}

.tool-tab-section {
  display: none;
  padding: var(--space-6);
}

.tool-tab-section.active {
  display: block;
}

/* ============================================
   EDITOR STYLES
   ============================================ */
.editor-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 140px);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.editor-actions {
  display: flex;
  gap: var(--space-2);
}

.editor-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.editor-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.editor-pane + .editor-pane {
  border-left: 1px solid var(--border);
}

.editor-textarea {
  flex: 1;
  padding: var(--space-4);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: transparent;
  border: none;
  outline: none;
  resize: none;
}

.editor-textarea::placeholder {
  color: var(--text-muted);
}

.editor-preview {
  flex: 1;
  background: var(--white);
  overflow: auto;
}

.editor-preview iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border-top: 1px solid var(--border);
}

@media (max-width: 768px) {
  .editor-body {
    flex-direction: column;
  }

  .editor-pane + .editor-pane {
    border-left: none;
    border-top: 1px solid var(--border);
  }

  .editor-toolbar {
    flex-direction: column;
    gap: var(--space-3);
  }

  .editor-tabs,
  .editor-actions {
    width: 100%;
    justify-content: center;
  }
}

/* ============================================
   STATS GRID
   ============================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.stat-icon {
  width: 48px;
  height: 48px;
  background: var(--primary-light);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
  color: var(--primary);
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  margin-bottom: var(--space-2);
}

.stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

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

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

/* ============================================
   FOOTER
   ============================================ */
.footer {
  background: var(--text-primary);
  color: var(--text-inverse);
  padding: var(--space-16) 0 var(--space-8);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-8);
  margin-bottom: var(--space-12);
}

.footer-brand {
  max-width: 300px;
}

.footer-brand-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-inverse);
  margin-bottom: var(--space-4);
}

.footer-brand-text {
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

.footer-title {
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-4);
  color: var(--text-inverse);
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.footer-link {
  color: var(--text-muted);
  font-size: var(--text-sm);
  transition: color var(--transition-fast);
}

.footer-link:hover {
  color: var(--text-inverse);
}

.footer-bottom {
  padding-top: var(--space-8);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.footer-copyright {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.footer-social {
  display: flex;
  gap: var(--space-4);
}

.footer-social a {
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.footer-social a:hover {
  color: var(--text-inverse);
}

/* ============================================
   LOADING STATES
   ============================================ */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--border) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-lg {
  width: 48px;
  height: 48px;
  border-width: 4px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  z-index: var(--z-modal);
}

/* ============================================
   COPY BUTTON
   ============================================ */
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.copy-btn:hover {
  background: var(--white);
  border-color: var(--primary);
  color: var(--primary);
}

.copy-btn.copied {
  background: var(--success-light);
  border-color: var(--success);
  color: var(--success);
}

/* ============================================
   ANIMATIONS
   ============================================ */
.fade-in {
  animation: fadeIn 0.6s ease-out forwards;
  opacity: 0;
}

@keyframes fadeIn {
  to { opacity: 1; }
}

.slide-up {
  animation: slideUp 0.8s ease-out forwards;
  opacity: 0;
  transform: translateY(30px);
}

@keyframes slideUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.slide-in-right {
  animation: slideInRight 0.5s ease-out forwards;
  opacity: 0;
  transform: translateX(30px);
}

@keyframes slideInRight {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ============================================
   UTILITIES
   ============================================ */
.hidden { display: none !important; }
.block { display: block; }
.inline-block { display: inline-block; }
.inline-flex { display: inline-flex; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.uppercase { text-transform: uppercase; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.mx-auto { margin-left: auto; margin-right: auto; }
.m-0 { margin: 0; }

.p-2 { padding: var(--space-2); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.px-6 { padding-left: var(--space-6); padding-right: var(--space-6); }
.py-2 { padding-top: var(--space-2); padding-bottom: var(--space-2); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }

.w-full { width: 100%; }
.h-full { height: 100%; }
.min-h-screen { min-height: 100vh; }
.max-w-sm { max-width: 24rem; }
.max-w-md { max-width: 28rem; }
.max-w-lg { max-width: 32rem; }
.max-w-xl { max-width: 36rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-4xl { max-width: 56rem; }
.max-w-6xl { max-width: 72rem; }
.max-w-7xl { max-width: 80rem; }

.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.top-0 { top: 0; }
.right-0 { right: 0; }
.bottom-0 { bottom: 0; }
.left-0 { left: 0; }

.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-y-auto { overflow-y: auto; }

.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }

.pointer-events-none { pointer-events: none; }

.z-10 { z-index: 10; }
.z-20 { z-index: 20; }
.z-50 { z-index: 50; }

/* ============================================
   RESPONSIVE UTILITIES
   ============================================ */
@media (max-width: 640px) {
  .sm\:hidden { display: none; }
}

@media (min-width: 641px) {
  .sm\:block { display: block; }
  .sm\:flex { display: flex; }
}

@media (max-width: 768px) {
  .md\:hidden { display: none; }
}

@media (min-width: 769px) {
  .md\:block { display: block; }
  .md\:flex { display: flex; }
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 1025px) {
  .lg\:block { display: block; }
  .lg\:flex { display: flex; }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ============================================
   MOBILE HEADER
   Hidden on desktop, shown on mobile
   ============================================ */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--white);
  border-top: 1px solid var(--border);
  align-items: center;
  justify-content: space-around;
  z-index: var(--z-fixed);
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text-muted);
  font-size: 10px;
  padding: var(--space-2);
}

.mobile-nav-item.active {
  color: var(--primary);
}

.mobile-nav-item svg {
  width: 20px;
  height: 20px;
}

.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 var(--space-4);
  align-items: center;
  justify-content: space-between;
  z-index: 100;
}

.mobile-header .menu-toggle {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
}

.mobile-header .menu-toggle:hover {
  background: var(--surface);
}

.mobile-header .menu-toggle svg {
  width: 24px;
  height: 24px;
}

.mobile-header .mobile-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  font-weight: 700;
  font-size: var(--text-lg);
}

@media (max-width: 1024px) {
  .mobile-header {
    display: flex;
  }

  .mobile-bottom-nav {
    display: flex;
  }

  /* Add padding to content when mobile-header is shown */
  .content-wrapper {
    padding-top: 70px;
  }
}

/* =============================================
   SPA Router - Loading Bar
   ============================================= */
#chipak-router-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    z-index: 99999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

#chipak-router-loading.active {
    opacity: 1;
}

#chipak-router-loading.done {
    opacity: 0;
}

.router-loading-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent, #8b5cf6));
    border-radius: 0 2px 2px 0;
    animation: routerLoading 1.5s ease-in-out infinite;
}

@keyframes routerLoading {
    0% { width: 0%; }
    20% { width: 30%; }
    50% { width: 60%; }
    80% { width: 85%; }
    100% { width: 95%; }
}

#chipak-router-loading.done .router-loading-bar {
    width: 100% !important;
    animation: none;
    transition: width 0.15s ease-out;
}

/* =============================================
   Globally injected component classes
   (injected by JS — must live in global CSS)
   ============================================= */

/* Input wrapper / label / field (used in report modal & feedback modal) */
.input-wrapper {
  margin-bottom: var(--space-4);
}

.input-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.input-field {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
  font-family: inherit;
  color: var(--text-primary);
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  resize: vertical;
  box-sizing: border-box;
  transition: all var(--transition-fast);
}

.input-field:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
}

.input-field::placeholder {
  color: var(--text-muted);
}

/* Badge-lock icon for premium sidebar links */
.badge-lock {
  width: 12px;
  height: 12px;
  margin-left: auto;
  flex-shrink: 0;
  color: var(--text-muted);
  opacity: 0.6;
}

/* Mobile header elements */
.mobile-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
}

.home-link:hover {
  background: var(--surface);
  color: var(--text-primary);
}

.home-link svg {
  width: 20px;
  height: 20px;
}

/* User name in app header */
.user-name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
}
