/* SRConsulta Design System - Modern Clean Tax Tech UI */
:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-sidebar: #0f172a;
  --sidebar-hover: #1e293b;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-white: #ffffff;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --accent-emerald: #10b981;
  --accent-emerald-light: #ecfdf5;
  --accent-amber: #f59e0b;
  --accent-amber-light: #fffbeb;
  --accent-rose: #ef4444;
  --accent-rose-light: #fef2f2;
  --accent-purple: #8b5cf6;
  --accent-purple-light: #f5f3ff;
  --border: #e2e8f0;
  --border-focus: #3b82f6;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 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);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Landing Page Styles */
.landing-header {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.25rem;
}

.logo-text {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: #0f172a;
}

.logo-badge {
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--accent-emerald-light);
  color: #065f46;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  border: 1px solid #a7f3d0;
  margin-left: 0.5rem;
}

.hero-section {
  max-width: 1200px;
  margin: 4rem auto;
  padding: 0 2rem;
  text-align: center;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 1rem;
  border-radius: 9999px;
  margin-bottom: 1.5rem;
}

.hero-title {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: #0f172a;
  margin-bottom: 1.25rem;
}

.hero-title span {
  background: linear-gradient(135deg, #2563eb, #0284c7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.2rem;
  color: var(--text-muted);
  max-width: 750px;
  margin: 0 auto 2.5rem;
}

.cta-group {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 3.5rem;
}

.btn-primary {
  background: var(--primary);
  color: white;
  padding: 0.85rem 1.75rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px 0 rgba(37, 99, 235, 0.35);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: white;
  color: #334155;
  border: 1px solid #cbd5e1;
  padding: 0.85rem 1.75rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: #f1f5f9;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
  text-align: left;
}

.feature-card {
  background: white;
  padding: 1.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.feature-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

/* Dashboard App Layout */
.app-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 270px;
  background-color: var(--bg-sidebar);
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-right: 1px solid #1e293b;
}

.sidebar-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #1e293b;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-menu {
  flex: 1;
  padding: 1rem 0.75rem;
  overflow-y: auto;
}

.menu-section-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  padding: 0.5rem 0.75rem;
  font-weight: 700;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: #cbd5e1;
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-bottom: 0.25rem;
}

.menu-item:hover {
  background-color: var(--sidebar-hover);
  color: #ffffff;
}

.menu-item.active {
  background-color: var(--primary);
  color: #ffffff;
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid #1e293b;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #f8fafc;
}

.user-quota {
  font-size: 0.75rem;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.btn-logout {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.4rem;
  border-radius: var(--radius-sm);
}

.btn-logout:hover {
  background: var(--sidebar-hover);
  color: var(--accent-rose);
}

/* Main Content Area */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background-color: var(--bg-main);
}

.top-navbar {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.top-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.quota-pill {
  background: var(--accent-emerald-light);
  color: #065f46;
  border: 1px solid #a7f3d0;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.content-body {
  padding: 2rem;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}

/* NCM Search Bar */
.search-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
}

.search-input-wrapper {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.search-input {
  flex: 1;
  padding: 0.85rem 1.25rem;
  font-size: 1.05rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-family: inherit;
  transition: border-color 0.15s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.quick-pills {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.quick-pill {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #334155;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.15s;
}

.quick-pill:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

/* Result Cards */
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.results-count {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 500;
}

.ncm-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.ncm-card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow);
}

.ncm-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.ncm-code-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ncm-code-badge {
  background: #0f172a;
  color: white;
  font-family: monospace;
  font-weight: 700;
  font-size: 1.05rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
}

.ncm-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
}

.badge-benefit {
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.benefit-zero {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.benefit-60 {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.benefit-is {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.benefit-standard {
  background: #f8fafc;
  color: #475569;
  border: 1px solid #e2e8f0;
}

/* Tax Breakdown Grid */
.tax-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.tax-item {
  display: flex;
  flex-direction: column;
}

.tax-item-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #64748b;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.tax-item-value {
  font-size: 1.1rem;
  font-weight: 800;
  color: #0f172a;
}

.tax-item-sub {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 0.15rem;
}

/* Legal Footer */
.legal-footer {
  border-top: 1px solid #f1f5f9;
  padding-top: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.legal-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.legal-tag {
  background: #f1f5f9;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.75rem;
  color: #475569;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 1rem;
}

.modal-content {
  background: white;
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #0f172a;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #94a3b8;
  cursor: pointer;
}

.form-group {
  margin-bottom: 1.15rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.35rem;
}

.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.divider {
  text-align: center;
  position: relative;
  margin: 1.5rem 0;
}

.divider::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: #e2e8f0;
}

.divider span {
  position: relative;
  background: white;
  padding: 0 0.75rem;
  color: #94a3b8;
  font-size: 0.8rem;
  text-transform: uppercase;
}

.demo-box {
  background: #f0fdf4;
  border: 1px dashed #86efac;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-align: center;
  margin-bottom: 1.25rem;
}

/* Loading & Empty States */
.state-box {
  text-align: center;
  padding: 3.5rem 1rem;
  color: var(--text-muted);
}

.state-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

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

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

/* ==========================================================================
   FICHA CADASTRAL OFICIAL (EMPRESAS CNPJ E PRODUTOR RURAL CPF)
   Formato oficial integrado "Tudo Junto" estilo Receita Federal / SEFAZ
   ========================================================================== */
.ficha-container {
  max-width: 1100px;
  margin: 0 auto;
}

.ficha-card {
  background: #ffffff;
  border: 2px solid #94a3b8;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  padding: 1.5rem 1.75rem;
  margin-bottom: 2rem;
  color: #0f172a;
}

.ficha-header-official {
  border-bottom: 2px solid #0f172a;
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.ficha-header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.ficha-header-crest {
  width: 52px;
  height: 52px;
  border-radius: 6px;
  background: linear-gradient(135deg, #1e3a8a, #0284c7);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.ficha-header-titles h1 {
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #475569;
  margin: 0;
}

.ficha-header-titles h2 {
  font-size: 1.2rem;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: -0.01em;
  margin: 0.15rem 0 0 0;
}

.ficha-header-titles .ficha-sub {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 600;
  text-transform: uppercase;
}

.ficha-actions-bar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.btn-ficha-action {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #334155;
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
}

.btn-ficha-action:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.btn-ficha-primary {
  background: #2563eb;
  border-color: #1d4ed8;
  color: white;
}

.btn-ficha-primary:hover {
  background: #1d4ed8;
  color: white;
}

/* Título de Seções na Ficha */
.ficha-section-title {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #1e3a8a;
  background: #f1f5f9;
  padding: 0.4rem 0.75rem;
  border-left: 4px solid #2563eb;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Grid de Células Oficiais */
.ficha-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 0;
  border: 1px solid #cbd5e1;
  background: #e2e8f0;
}

.ficha-cell {
  background: #ffffff;
  padding: 0.55rem 0.75rem;
  border: 1px solid #cbd5e1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 58px;
}

.ficha-cell-title {
  font-size: 0.65rem;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.2rem;
  display: block;
}

.ficha-cell-value {
  font-size: 0.92rem;
  font-weight: 700;
  color: #0f172a;
  word-break: break-word;
}

.ficha-cell-value-highlight {
  font-size: 1.05rem;
  font-weight: 800;
  color: #1e3a8a;
}

/* Span helpers para colunas */
.col-12 { grid-column: span 12; }
.col-9 { grid-column: span 9; }
.col-8 { grid-column: span 8; }
.col-7 { grid-column: span 7; }
.col-6 { grid-column: span 6; }
.col-5 { grid-column: span 5; }
.col-4 { grid-column: span 4; }
.col-3 { grid-column: span 3; }
.col-2 { grid-column: span 2; }

@media (max-width: 768px) {
  .col-9, .col-8, .col-7, .col-6, .col-5, .col-4, .col-3, .col-2 {
    grid-column: span 12;
  }
}

/* Badges da Ficha */
.ficha-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.ficha-badge-active {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.ficha-badge-inactive {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

.ficha-badge-simples {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #7dd3fc;
}

.ficha-badge-geral {
  background: #ede9fe;
  color: #6d28d9;
  border: 1px solid #c4b5fd;
}

.ficha-badge-rural {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

/* Tabela de Sócios e IE Secundárias dentro da Ficha */
.ficha-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.ficha-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  text-align: left;
  padding: 0.5rem 0.75rem;
  border: 1px solid #cbd5e1;
  font-size: 0.7rem;
  text-transform: uppercase;
}

.ficha-table td {
  padding: 0.5rem 0.75rem;
  border: 1px solid #cbd5e1;
  color: #1e293b;
}

.ficha-table tr:nth-child(even) td {
  background: #fbfcfe;
}

/* Bloco Integrado de Reforma Tributária */
.ficha-rtc-integrated {
  background: #f0fdf4;
  border: 1.5px solid #86efac;
  border-radius: 6px;
  padding: 1rem 1.25rem;
  margin-top: 0.5rem;
}

.ficha-rtc-integrated-header {
  font-size: 0.85rem;
  font-weight: 800;
  color: #166534;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ficha-footer-legend {
  margin-top: 1.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid #cbd5e1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.7rem;
  color: #64748b;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Estilo para Impressão da Ficha */
@media print {
  body * {
    visibility: hidden;
  }
  .ficha-container, .ficha-container * {
    visibility: visible;
  }
  .ficha-container {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 0;
  }
  .ficha-actions-bar, .landing-header, .app-sidebar, .search-card, .results-header {
    display: none !important;
  }
  .ficha-card {
    border: 1px solid #000;
    box-shadow: none;
    padding: 1cm;
  }
}
