/* ============================================================
   ESTILOS GERAIS & VARIÁVEIS DE DESIGN SYSTEM CONTÁBIL
   ============================================================ */
:root {
  /* Fundo sólido estrito da tela de login requisitado pelo usuário */
  --bg-login-solid: #0d1b2a; 
  --card-login-bg: #1b263b;
  --card-login-border: #415a77;

  /* Cores da Aplicação do Sistema */
  --bg-app: #f4f6f9;
  --bg-surface: #ffffff;
  --bg-surface-secondary: #f8fafc;
  
  /* Paleta Corporativa Contábil */
  --primary-900: #0f172a;
  --primary-800: #1e293b;
  --primary-700: #334155;
  --primary-600: #2563eb;
  --primary-500: #3b82f6;
  --primary-100: #dbeafe;
  --primary-50: #eff6ff;

  /* Sucesso, Alerta, Perigo */
  --emerald-600: #059669;
  --emerald-100: #d1fae5;
  --emerald-800: #065f46;
  --amber-600: #d97706;
  --amber-100: #fef3c7;
  --amber-800: #92400e;
  --rose-600: #e11d48;
  --rose-100: #ffe4e6;

  /* Bordas e Textos */
  --border-light: #e2e8f0;
  --border-focus: #3b82f6;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;

  /* Sombras */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --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);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-main);
  background-color: var(--bg-app);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Utilitários */
.hidden {
  display: none !important;
}

/* ============================================================
   TELA DE LOGIN - FUNDO DE COR SÓLIDA REQUISITADO
   ============================================================ */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100vw;
  /* Fundo de cor sólida estrita sem gradientes conforme requisitado */
  background-color: var(--bg-login-solid);
  padding: 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 460px;
  background-color: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45);
  padding: 2.5rem 2.25rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  animation: fadeIn 0.3s ease-in-out;
}

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

.login-brand {
  text-align: center;
  margin-bottom: 2rem;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: var(--primary-900);
  color: #60a5fa;
  margin-bottom: 1rem;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
}

.login-brand h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary-900);
  letter-spacing: -0.02em;
}

.login-brand .subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.login-form .form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-800);
  margin-bottom: 0.4rem;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: #94a3b8;
  pointer-events: none;
  flex-shrink: 0;
  z-index: 2;
}

.input-wrapper input,
.form-group input[type="text"],
.form-group input[type="password"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem 0.85rem;
  font-size: 0.95rem;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  background-color: #ffffff;
  color: var(--text-main);
  transition: all 0.2s ease;
  font-family: inherit;
}

/* IMPORTANTE: estas regras vêm DEPOIS para sobrescrever o padding geral acima */
.input-wrapper input[type="text"],
.input-wrapper input[type="password"] {
  padding-left: 2.75rem !important;
}

.input-wrapper input:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
}

.remember-me {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  color: var(--text-muted);
  user-select: none;
}

.remember-me input {
  accent-color: var(--primary-600);
}

.forgot-link {
  color: var(--primary-600);
  text-decoration: none;
  font-weight: 500;
}

.forgot-link:hover {
  text-decoration: underline;
}

.login-error {
  background-color: var(--rose-100);
  color: var(--rose-600);
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 1rem;
  border: 1px solid rgba(225, 29, 72, 0.2);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: var(--primary-600);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.8rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  background-color: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-block {
  width: 100%;
}

.demo-logins {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px dashed var(--border-light);
}

.demo-title {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 0.6rem;
  text-align: center;
}

.demo-buttons {
  display: flex;
  gap: 0.5rem;
}

.btn-demo {
  flex: 1;
  background-color: var(--bg-surface-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.65rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
}

.btn-demo:hover {
  background-color: #ffffff;
  border-color: var(--primary-500);
  box-shadow: var(--shadow-sm);
}

.demo-role {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.btn-demo strong {
  font-size: 0.8rem;
  color: var(--primary-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.login-footer {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* ============================================================
   APLICAÇÃO / PORTAL PRINCIPAL
   ============================================================ */
.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-app);
}

/* BARRA SUPERIOR */
.top-nav {
  background-color: var(--primary-900);
  color: #ffffff;
  padding: 0.75rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-brand-office {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.office-badge {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.35);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.system-title {
  font-size: 0.88rem;
  font-weight: 500;
  color: #e2e8f0;
}

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

.company-switch-box {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: rgba(255, 255, 255, 0.08);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.company-switch-box label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #94a3b8;
  white-space: nowrap;
}

.company-switch-box select {
  background: #1e293b;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.75rem;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  min-width: 340px;
  max-width: 460px;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.company-switch-box select:hover,
.company-switch-box select:focus {
  border-color: #60a5fa;
  background: #0f172a;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.2);
}

.company-switch-box select option {
  background: #0f172a;
  color: #ffffff;
  padding: 0.5rem;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
}

.role-pill {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  background-color: var(--primary-600);
  color: #ffffff;
  text-transform: uppercase;
}

.role-pill.admin-badge {
  background-color: var(--amber-600);
}

.user-name {
  font-size: 0.82rem;
  color: #f1f5f9;
  font-weight: 500;
}

.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: transparent;
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}

/* ============================================================
   CABEÇALHO REQUISITADO: LOGO, NOME DA EMPRESA E CNPJ
   ============================================================ */
.company-header {
  background: #ffffff;
  border-bottom: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  padding: 2rem 2rem 1.75rem;
}

.company-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.75rem;
  flex-wrap: wrap;
}

.company-logo-area {
  position: relative;
  width: 80px;
  height: 80px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  background: var(--bg-surface-secondary);
  border: 2px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.client-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.client-logo-img.has-logo {
  display: block;
}

.client-logo-fallback {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary-700);
  background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-change-logo {
  position: absolute;
  bottom: 2px;
  right: 2px;
  background: var(--primary-900);
  color: #ffffff;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.company-details {
  flex: 1;
  min-width: 280px;
}

.company-tagline {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--primary-600);
  margin-bottom: 0.2rem;
}

.company-name {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary-900);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.company-meta-row {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-top: 0.6rem;
  flex-wrap: wrap;
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.cnpj-box {
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-light);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
}

.meta-label {
  font-weight: 500;
}

.meta-value {
  color: var(--primary-900);
  font-family: monospace;
  font-size: 0.95rem;
  font-weight: 700;
}

.btn-copy-cnpj {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  padding: 2px;
  border-radius: 4px;
}

.btn-copy-cnpj:hover {
  color: var(--primary-600);
  background: #e2e8f0;
}

.regime-pill {
  background-color: var(--primary-100);
  color: var(--primary-700);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
}

.status-pill-active {
  background-color: var(--emerald-100);
  color: var(--emerald-800);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.status-pill-active::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--emerald-600);
}

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

.action-card {
  text-align: right;
  padding: 0.5rem 1rem;
  background: var(--bg-surface-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.action-stat-number {
  display: block;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary-900);
  line-height: 1;
}

.action-stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.btn-action-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--primary-900);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.75rem 1.15rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.btn-action-primary:hover {
  background-color: var(--primary-800);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* ============================================================
   CONTEÚDO PRINCIPAL
   ============================================================ */
.main-content {
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem;
  flex: 1;
}

.admin-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  background: #fefce8;
  border: 1px solid #fef08a;
  border-left: 4px solid var(--amber-600);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 2rem;
}

.banner-icon {
  color: var(--amber-600);
  flex-shrink: 0;
  margin-top: 2px;
}

.banner-content strong {
  display: block;
  font-size: 0.92rem;
  color: #854d0e;
  margin-bottom: 0.2rem;
}

.banner-content p {
  font-size: 0.85rem;
  color: #713f12;
}

/* TOOLBAR & FILTROS */
.docs-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  max-width: 440px;
  display: flex;
  align-items: center;
}

.search-box svg {
  position: absolute;
  left: 12px;
  color: var(--text-dim);
}

.search-box input {
  width: 100%;
  padding: 0.65rem 0.85rem 0.65rem 2.5rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: #ffffff;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

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

.filter-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-chip {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  padding: 0.45rem 0.95rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-chip:hover {
  border-color: var(--primary-500);
  color: var(--primary-600);
}

.filter-chip.active {
  background: var(--primary-900);
  border-color: var(--primary-900);
  color: #ffffff;
}

/* SEÇÕES DE DOCUMENTOS */
.docs-section {
  margin-bottom: 2.75rem;
}

.section-title-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-light);
  flex-wrap: wrap;
  gap: 0.75rem;
}

.section-title-bar h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary-900);
}

.section-title-bar p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.required-badge {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--emerald-800);
  background: var(--emerald-100);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
}

.btn-outline-sm {
  background: #ffffff;
  border: 1px solid var(--border-light);
  color: var(--primary-700);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-outline-sm:hover {
  background: var(--bg-surface-secondary);
  border-color: var(--primary-500);
  color: var(--primary-600);
}

/* ============================================================
   GRID & CARDS DE DOCUMENTOS
   ============================================================ */
.documents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.25rem;
}

.doc-card {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
  position: relative;
}

.doc-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.doc-card.status-pending {
  border-style: dashed;
  background-color: #fafbfc;
}

.doc-card.drag-target {
  border: 2px dashed var(--primary-600) !important;
  background-color: #eff6ff !important;
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 12px 20px -5px rgba(37, 99, 235, 0.25) !important;
}

.doc-card.drag-target::before {
  content: "⬇ Solte o arquivo aqui para anexar a este documento";
  position: absolute;
  inset: 0;
  background: rgba(30, 58, 138, 0.92);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: var(--radius-lg);
  z-index: 20;
  pointer-events: none;
  animation: fadeIn 0.15s ease-in;
}

.doc-card-header {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin-bottom: 0.9rem;
}

.doc-type-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--primary-50);
  color: var(--primary-600);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.doc-type-icon.icon-societario {
  background: #e0e7ff;
  color: #4338ca;
}

.doc-type-icon.icon-fiscal {
  background: #ecfdf5;
  color: #047857;
}

.doc-type-icon.icon-socios {
  background: #fef3c7;
  color: #b45309;
}

.doc-type-icon.icon-pending {
  background: #f1f5f9;
  color: #94a3b8;
}

.doc-card-title-wrap {
  flex: 1;
}

.doc-category-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 0.2rem;
}

.doc-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-900);
  line-height: 1.3;
}

.doc-meta {
  background: var(--bg-surface-secondary);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  font-size: 0.8rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.doc-meta-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.doc-meta-label {
  color: var(--text-muted);
}

.doc-meta-val {
  font-weight: 600;
  color: var(--primary-800);
}

.status-badge-ok {
  color: var(--emerald-800);
  background: var(--emerald-100);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
}

.status-badge-waiting {
  color: var(--amber-800);
  background: var(--amber-100);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
}

.doc-notes-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 1rem;
  line-height: 1.4;
}

.doc-card-actions {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-light);
}

.btn-card-action {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid var(--border-light);
  background: #ffffff;
  color: var(--primary-700);
}

.btn-card-action:hover {
  background: var(--bg-surface-secondary);
  border-color: var(--primary-500);
  color: var(--primary-600);
}

.btn-card-action.btn-download-primary {
  background: var(--primary-600);
  color: #ffffff;
  border-color: var(--primary-600);
}

.btn-card-action.btn-download-primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.btn-card-icon {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-card-icon:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
}

/* ============================================================
   MODAIS & DROPZONE
   ============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.modal-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
}

.modal-card.modal-large {
  max-width: 880px;
  height: 85vh;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-light);
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.modal-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--primary-100);
  color: var(--primary-600);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-header h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary-900);
}

.modal-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.6rem;
  color: var(--text-dim);
  cursor: pointer;
  line-height: 1;
}

.modal-close-btn:hover {
  color: var(--primary-900);
}

.modal-actions-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-download-action {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--primary-600);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-download-action:hover {
  background: #1d4ed8;
}

.form-row {
  display: flex;
  gap: 1rem;
}

.col-half {
  flex: 1;
}

/* DROPZONE */
.dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 1.75rem 1rem;
  text-align: center;
  cursor: pointer;
  background-color: var(--bg-surface-secondary);
  transition: all 0.2s ease;
  color: var(--primary-600);
}

.dropzone:hover {
  border-color: var(--primary-500);
  background-color: var(--primary-50);
}

.dropzone.dragover {
  border: 2px dashed var(--primary-600) !important;
  background-color: #dbeafe !important;
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.dropzone-text {
  font-size: 0.9rem;
  color: var(--primary-800);
  margin-top: 0.5rem;
}

.dropzone-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.file-preview-pill {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-md);
  margin-top: 0.6rem;
  color: var(--primary-700);
}

.file-name-text {
  font-size: 0.85rem;
  font-weight: 600;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-size-text {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.btn-remove-file {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  color: var(--rose-600);
  cursor: pointer;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-light);
}

.btn-secondary {
  background: #ffffff;
  border: 1px solid var(--border-light);
  color: var(--primary-700);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-secondary:hover {
  background: var(--bg-surface-secondary);
}

/* PREVIEW DO ARQUIVO DENTRO DO MODAL */
.modal-body-preview {
  flex: 1;
  background: #0f172a;
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
}

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

.preview-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.preview-synthetic-doc {
  background: #ffffff;
  color: var(--text-main);
  padding: 2.5rem;
  width: 90%;
  max-width: 650px;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  font-family: serif;
}

.preview-synthetic-header {
  border-bottom: 2px solid #000;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.preview-synthetic-header h4 {
  font-size: 1.15rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.preview-synthetic-body {
  font-size: 0.95rem;
  line-height: 1.7;
}

/* RODAPÉ DO APP */
.app-footer {
  background: #ffffff;
  border-top: 1px solid var(--border-light);
  padding: 1.5rem 2rem;
  text-align: center;
  margin-top: auto;
}

.footer-content {
  max-width: 1280px;
  margin: 0 auto;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.footer-legal {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
}

/* TOAST NOTIFICAÇÃO */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  z-index: 2000;
  pointer-events: none;
}

.toast {
  background: var(--primary-900);
  color: #ffffff;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.88rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  pointer-events: auto;
  animation: slideUp 0.25s ease-out;
}

.toast.toast-success {
  border-left: 4px solid #10b981;
}

.toast.toast-error {
  border-left: 4px solid #ef4444;
}

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

/* ============================================================
   RESPONSIVIDADE
   ============================================================ */
/* ============================================================
   STATUS DA NUVEM (FIREBASE) E PROGRESSO DE UPLOAD
   ============================================================ */
.cloud-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
}

.cloud-pill:hover {
  background: rgba(255, 255, 255, 0.15);
}

.cloud-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.cloud-dot.online {
  background-color: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.cloud-dot.offline {
  background-color: #f59e0b;
  box-shadow: 0 0 6px #f59e0b;
}

.cloud-pill.cloud-online {
  border-color: rgba(16, 185, 129, 0.3);
  color: #a7f3d0;
}

.cloud-pill.cloud-offline {
  border-color: rgba(245, 158, 11, 0.3);
  color: #fde68a;
}

/* PROGRESSO DE UPLOAD NA NUVEM */
.cloud-progress-box {
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
}

.cloud-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary-800);
  margin-bottom: 0.4rem;
}

.progress-track {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #10b981);
  border-radius: var(--radius-full);
  transition: width 0.15s ease;
}

/* TUTORIAL NUVEM */
.cloud-tutorial-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 4px solid var(--primary-600);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.cloud-tutorial-box h4 {
  font-size: 0.9rem;
  color: var(--primary-900);
  margin-bottom: 0.5rem;
}

@media (max-width: 768px) {
  .top-nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
  }

  .nav-user-actions {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .company-header {
    padding: 1.25rem 1rem;
  }

  .company-header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .company-meta-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .main-content {
    padding: 1rem;
  }

  .docs-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box {
    max-width: 100%;
  }

  .documents-grid {
    grid-template-columns: 1fr;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }
}
