/* ============================================================================
   NutriHouse — Dashboard Financeiro
   Folha de estilos única, baseada nos design tokens e componentes oficiais
   da identidade visual Nutrihouse (skill "nutrihouse-identidade-visual").
   ========================================================================= */

:root {
  color-scheme: light;

  /* Cores institucionais */
  --nh-red:    #C8383A;
  --nh-teal:   #7BAAB0;
  --nh-gold:   #C9A035;
  --nh-dark:   #2B2B2B;

  /* Neutros */
  --nh-light:  #F7F5F2;
  --nh-white:  #FFFFFF;
  --nh-border: #E2DDD8;

  /* Estados semânticos */
  --nh-success: #27ae60;
  --nh-warning: #e67e22;

  --nh-radius-sm: 6px;
  --nh-radius-md: 10px;
  --nh-radius-lg: 12px;

  --nh-shadow-sm: 0 1px 4px rgba(0,0,0,0.06);
  --nh-shadow-md: 0 2px 8px rgba(0,0,0,0.06);
  --nh-shadow-lg: 0 8px 32px rgba(0,0,0,0.2);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  color: var(--nh-dark);
  background: var(--nh-light);
  min-height: 100vh;
}

a { color: var(--nh-teal); }

/* ---------- Header institucional + wave-bar ---------- */

.header {
  background: var(--nh-white);
  border-bottom: 3px solid var(--nh-red);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--nh-shadow-md);
  flex-wrap: wrap;
  gap: 12px;
}
.header-left { display: flex; align-items: center; gap: 22px; }
.logo-mark { width: 52px; height: 52px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.logo-mark img { max-width: 100%; height: auto; }
.header h1 { font-size: 17px; font-weight: 700; color: var(--nh-dark); }
.header .subtitle { font-size: 11px; color: #888; margin-top: 2px; }
.brand-tag { font-size: 10px; font-weight: 700; color: var(--nh-red); text-transform: uppercase; letter-spacing: 1px; }
.header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.usuario-atual { font-size: 12px; color: #666; }
.usuario-atual strong { color: var(--nh-dark); }

.wave-bar {
  height: 6px;
  background: linear-gradient(90deg, var(--nh-gold) 0%, var(--nh-teal) 45%, var(--nh-red) 100%);
}

/* ---------- Navegação por abas ---------- */

.tabs { display: flex; background: var(--nh-dark); padding: 0 8px; flex-wrap: wrap; overflow-x: auto; }
.tab {
  padding: 10px 16px; color: rgba(255,255,255,0.65); font-size: 11px; font-weight: 700;
  cursor: pointer; border-bottom: 3px solid transparent; text-transform: uppercase;
  letter-spacing: 0.4px; white-space: nowrap; background: none; border-top: none;
  border-left: none; border-right: none;
}
.tab:hover { color: #fff; background: rgba(255,255,255,0.08); }
.tab.active { color: #fff; border-bottom: 3px solid var(--nh-red); background: rgba(255,255,255,0.12); }

/* ---------- Botões ---------- */

.btn-add, .btn-primario {
  background: var(--nh-red); color: #fff; border: none; border-radius: var(--nh-radius-sm);
  padding: 9px 18px; font-size: 13px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; box-shadow: 0 2px 6px rgba(200,56,58,0.3);
  min-height: 40px;
}
.btn-add:hover, .btn-primario:hover { background: #a82e30; }
.btn-add:disabled, .btn-primario:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secundario {
  background: var(--nh-white); color: var(--nh-dark); border: 1px solid var(--nh-border);
  border-radius: var(--nh-radius-sm); padding: 9px 18px; font-size: 13px; font-weight: 600;
  cursor: pointer; min-height: 40px;
}
.btn-secundario:hover { background: #f3f1ee; }

.btn-sair {
  background: none; border: 1px solid var(--nh-border); color: #666; border-radius: var(--nh-radius-sm);
  padding: 8px 14px; font-size: 12px; cursor: pointer; min-height: 36px;
}
.btn-sair:hover { border-color: var(--nh-red); color: var(--nh-red); }

/* ---------- Cards de resumo (KPIs) ---------- */

.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; padding: 16px 24px; }
.card { background: var(--nh-white); border-radius: var(--nh-radius-md); padding: 14px 16px; box-shadow: var(--nh-shadow-sm); border-top: 3px solid var(--nh-teal); }
.card.card-red   { border-top-color: var(--nh-red); }
.card.card-gold  { border-top-color: var(--nh-gold); }
.card.card-dark  { border-top-color: var(--nh-dark); }
.card.card-green { border-top-color: var(--nh-success); }
.card.card-warn  { border-top-color: var(--nh-warning); }
.card .label { font-size: 11px; color: #888; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.card .value { font-size: 22px; font-weight: 800; color: var(--nh-dark); word-break: break-word; }
.card.card-red  .value { color: var(--nh-red); }
.card.card-gold .value { color: var(--nh-gold); }
.card.card-green .value { color: var(--nh-success); }
.card.card-warn  .value { color: var(--nh-warning); }
.card .sub { font-size: 11px; color: #999; margin-top: 4px; }

/* ---------- Filtros ---------- */

.filters { padding: 0 24px 8px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters input, .filters select {
  border: 1px solid var(--nh-border); border-radius: var(--nh-radius-sm); padding: 8px 10px;
  font-size: 13px; background: var(--nh-white); color: var(--nh-dark); outline: none; min-height: 38px;
}
.filters input:focus, .filters select:focus { border-color: var(--nh-teal); box-shadow: 0 0 0 3px rgba(123,170,176,0.15); }
.filters input { flex: 1; min-width: 180px; }

/* ---------- Tabela ---------- */

.content { padding: 16px 24px 32px; }
.content h2 { font-size: 15px; font-weight: 700; margin-bottom: 12px; color: var(--nh-dark); }

.table-wrap { overflow-x: auto; border-radius: var(--nh-radius-md); box-shadow: var(--nh-shadow-sm); }
table { width: 100%; border-collapse: collapse; background: var(--nh-white); border-radius: var(--nh-radius-md); overflow: hidden; }
thead { background: var(--nh-dark); color: #fff; }
th { padding: 11px 10px; text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--nh-border); vertical-align: middle; font-size: 13px; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #faf9f7; }
td.numero { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.paginacao { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px 0; }
.paginacao button {
  background: var(--nh-white); border: 1px solid var(--nh-border); border-radius: var(--nh-radius-sm);
  padding: 7px 14px; font-size: 12px; cursor: pointer; min-height: 36px;
}
.paginacao button:disabled { opacity: 0.4; cursor: not-allowed; }
.paginacao span { font-size: 12px; color: #666; }

/* ---------- Badges ---------- */

.badge { display: inline-block; padding: 3px 9px; border-radius: 12px; font-size: 11px; font-weight: 700; }
.badge-aberto    { background: #cce5ff; color: #004085; }
.badge-baixado   { background: #d4edda; color: #155724; }
.badge-vencido   { background: #f8d7da; color: #721c24; }

/* ---------- Estado vazio / carregando ---------- */

.empty, .carregando { text-align: center; padding: 48px; color: #aaa; }

/* ---------- Alert banner ---------- */

.alert-banner { margin: 10px 24px 0; padding: 12px 16px; background: #fff5f5; border: 1px solid #f5c6c6; border-left: 4px solid var(--nh-red); border-radius: 8px; }
.alert-banner.erro { display: block; }
.alert-banner h4 { font-size: 13px; font-weight: 700; color: var(--nh-red); }
.alert-banner p { font-size: 12px; color: #666; margin-top: 4px; }

/* ---------- Tela de login ---------- */

.tela-login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.caixa-login { background: var(--nh-white); border-radius: var(--nh-radius-lg); border-top: 4px solid var(--nh-red); box-shadow: var(--nh-shadow-lg); padding: 32px; width: 100%; max-width: 380px; text-align: center; }
.caixa-login .logo-mark { width: 72px; height: 72px; margin: 0 auto 8px; }
.caixa-login h1 { font-size: 16px; margin: 8px 0 2px; }
.caixa-login .subtitle { margin-bottom: 24px; }
.campo { display: flex; flex-direction: column; gap: 4px; text-align: left; margin-bottom: 14px; }
.campo label { font-size: 11px; font-weight: 700; color: #888; text-transform: uppercase; letter-spacing: 0.4px; }
.campo input {
  border: 1px solid var(--nh-border); border-radius: var(--nh-radius-sm); padding: 10px 12px;
  font-size: 14px; outline: none; min-height: 42px;
}
.campo input:focus { border-color: var(--nh-teal); box-shadow: 0 0 0 3px rgba(123,170,176,0.15); }
.caixa-login .btn-primario { width: 100%; justify-content: center; margin-top: 6px; }
.erro-login { color: var(--nh-red); font-size: 12px; margin-top: 12px; min-height: 16px; }

/* ---------- Tela de importação ---------- */

.painel-import { background: var(--nh-white); border-radius: var(--nh-radius-md); box-shadow: var(--nh-shadow-sm); padding: 18px; margin-bottom: 16px; }
.painel-import h3 { font-size: 14px; margin-bottom: 6px; }
.painel-import p { font-size: 12px; color: #777; margin-bottom: 12px; }
.barra-progresso { background: var(--nh-border); border-radius: 8px; height: 10px; overflow: hidden; margin: 10px 0; }
.barra-progresso-preenchimento { background: var(--nh-teal); height: 100%; width: 0%; transition: width 0.2s; }
.log-import { font-family: monospace; font-size: 12px; background: var(--nh-dark); color: #d9d9d9; border-radius: var(--nh-radius-sm); padding: 12px; max-height: 220px; overflow-y: auto; white-space: pre-wrap; }

/* ---------- Responsividade ---------- */

@media (max-width: 1024px) {
  .summary { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 760px) {
  body { font-size: 13px; }
  .header { flex-direction: column; align-items: stretch; }
  .header-left { gap: 12px; }
  .logo-mark { width: 42px; height: 42px; }
  .header h1 { font-size: 15px; }
  .brand-tag { font-size: 9px; }
  .header .subtitle { font-size: 10px; }
  .header-actions { justify-content: space-between; }
  .summary { grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px 14px; }
  .card { padding: 12px; }
  .card .value { font-size: 18px; }
  .filters { padding: 0 14px 8px; gap: 8px; }
  .filters input, .filters select { flex: 1 1 100%; min-width: 0; font-size: 14px; }
  .content { padding: 12px 14px 24px; }
  table { min-width: 720px; font-size: 12px; }
  th, td { padding: 8px 8px; }
  .alert-banner { margin: 10px 14px 0; }
}

@media (max-width: 480px) {
  .summary { grid-template-columns: 1fr; }
  .caixa-login { padding: 24px 18px; }
}
