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

.lang-trigger-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.8rem;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background var(--transition-fast);
  white-space: nowrap;
}
.lang-trigger-btn:hover { background: var(--bg-hover); }

.lang-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 220px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  overflow: hidden;
  animation: langDropIn 0.15s ease;
}
.lang-dropdown.open { display: block; }

@keyframes langDropIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.lang-search-box {
  padding: 10px;
  border-bottom: 1px solid var(--border-subtle);
}
.lang-search-box input {
  width: 100%;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.8rem;
  font-family: var(--font-sans);
  outline: none;
  box-sizing: border-box;
}
.lang-search-box input:focus { border-color: var(--border-focus); }

.lang-list { max-height: 320px; overflow-y: auto; padding: 4px; }

.lang-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  border: none;
  background: transparent;
  color: #9ca3af;
  font-size: 0.82rem;
  font-family: var(--font-sans);
  cursor: pointer;
  text-align: left;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.lang-item:hover {
  background: var(--bg-hover);
  color: #e5e7eb;
}
.lang-item .lang-flag { font-size: 1rem; }
.lang-item .lang-name { flex: 1; }

.lang-item.active {
  color: var(--color-primary);
  font-weight: 600;
}
.lang-item.active:hover {
  background: var(--bg-hover);
  color: var(--color-primary);
}
.lang-item.active .lang-check {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--color-primary);
}

.lang-no-result {
  padding: 16px 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
}

/* === MODAL SECRETO === */
.secret-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  animation: overlayFadeIn 0.2s ease;
}

@keyframes overlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.secret-modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg), 0 0 40px rgba(245,158,11,0.18);
  text-align: center;
  animation: secretCardIn 0.25s cubic-bezier(0.16,1,0.3,1);
}

@keyframes secretCardIn {
  from { opacity: 0; transform: scale(0.92) translateY(16px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.secret-modal-lock { font-size: 2.5rem; margin-bottom: 12px; }
.secret-modal-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 6px;
}
.secret-modal-sub {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0 0 24px;
}

.secret-modal-field {
  text-align: left;
  margin-bottom: 20px;
}
.secret-modal-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.secret-modal-field input {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: var(--font-mono);
  outline: none;
  box-sizing: border-box;
  transition: border-color var(--transition-fast);
  letter-spacing: 0.15em;
}
.secret-modal-field input:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-light); }

.secret-error-msg {
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--color-expense);
  font-weight: 500;
}
.secret-error-msg.hidden { display: none; }

.secret-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%,60% { transform: translateX(-6px); }
  40%,80% { transform: translateX(6px); }
}
.shake { animation: shake 0.4s ease; }

/* === CONTAINER DO MÓDULO COSMÉTICOS === */
#cosmeticosApp {
  display: none;
  min-height: 100vh;
  background: var(--bg-app);
}

/* Barra Superior com Alternador Sociedade vs Individual */
.cosm-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: rgba(15, 23, 42, 0.65);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(12px);
  gap: 12px;
  flex-wrap: wrap;
}

.cosm-mode-switch {
  display: inline-flex;
  align-items: center;
  background: var(--bg-input);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.cosm-mode-btn {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.825rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.cosm-mode-btn:hover {
  color: var(--text-primary);
}

.cosm-mode-btn.active {
  background: var(--color-primary);
  color: #0b0f19;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.cosm-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-family: var(--font-sans);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.cosm-action-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-focus);
}

.cosm-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-card);
  overflow-x: auto;
}

.cosm-nav-btn {
  padding: 14px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.84rem;
  font-family: var(--font-sans);
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}
.cosm-nav-btn:hover { color: var(--text-primary); }
.cosm-nav-btn.active { color: var(--color-primary); border-bottom-color: var(--color-primary); font-weight: 600; }

.cosm-page { display: none; padding: 28px 24px; }
.cosm-page.active { display: block; }

.cosm-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.cosm-page-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
}

.cosm-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.cosm-kpi-card {
  background: var(--bg-card-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  backdrop-filter: blur(12px);
}
.cosm-kpi-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.cosm-kpi-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* === TABELAS DO MÓDULO === */
.cosm-table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.cosm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}
.cosm-table th {
  padding: 12px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-input);
}
.cosm-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}
.cosm-table tr:last-child td { border-bottom: none; }
.cosm-table tr:hover td { background: var(--bg-hover); }

.cosm-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
}
.cosm-badge-green { background: rgba(16,185,129,0.14); color: #10B981; }
.cosm-badge-yellow { background: rgba(245,158,11,0.14); color: #F59E0B; }
.cosm-badge-red { background: rgba(244,63,94,0.14); color: #F43F5E; }

/* === PRODUTO IMAGEM === */
.cosm-product-thumb {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
}
.cosm-product-thumb-placeholder {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px dashed var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--text-muted);
}

/* === UPLOAD DE IMAGEM === */
.cosm-upload-area {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 28px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: var(--bg-input);
  position: relative;
}
.cosm-upload-area:hover, .cosm-upload-area.drag-over {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}
.cosm-upload-area input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.cosm-upload-icon { font-size: 2rem; margin-bottom: 8px; }
.cosm-upload-text { font-size: 0.85rem; color: var(--text-secondary); }
.cosm-upload-preview {
  max-width: 100%;
  max-height: 160px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  margin: 0 auto;
  display: block;
}

/* === MODAIS COSMÉTICOS === */
.cosm-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 8888;
  padding: 16px;
}
.cosm-modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.cosm-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-color);
}
.cosm-modal-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}
.cosm-modal-body { padding: 24px; }
.cosm-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
}

/* === FORMULÁRIOS === */
.cosm-form-group { margin-bottom: 16px; }
.cosm-form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cosm-form-input {
  width: 100%;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color var(--transition-fast);
  box-sizing: border-box;
}
.cosm-form-input:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-light); }
.cosm-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* === COMPRAS: GRADE DINÂMICA === */
.cosm-purchase-grid { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.cosm-purchase-grid th {
  padding: 8px 10px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-color);
}
.cosm-purchase-grid td, .cosm-sale-grid td { padding: 6px 4px; vertical-align: middle; }
.cosm-purchase-grid input, .cosm-sale-grid input {
  width: 100%;
  padding: 7px 9px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.82rem;
  outline: none;
  box-sizing: border-box;
}
.cosm-purchase-grid input:focus, .cosm-sale-grid input:focus { border-color: var(--color-primary); }
.cosm-purchase-grid .subtotal-cell, .cosm-sale-grid .subtotal-cell {
  font-weight: 600;
  color: var(--color-income);
  white-space: nowrap;
  text-align: right;
  padding-right: 6px;
}
.cosm-add-row-btn {
  margin-top: 10px;
  font-size: 0.8rem;
  padding: 6px 12px;
}

/* Badges de Pagamento e Conta */
.cosm-badge-paid {
  background: rgba(16, 185, 129, 0.15);
  color: #10B981;
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.cosm-badge-pending {
  background: rgba(245, 158, 11, 0.15);
  color: #F59E0B;
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.cosm-account-tag {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
  margin-top: 2px;
}
