/* ==========================================================================
   APTA — design system (tema branco moderno, white-label via --brand*)
   ========================================================================== */
:root {
  --brand: #2D6A4F;
  --brand-dark: #1B4332;
  --brand-light: #52B788;
  --brand-accent: #B7E4C7;
  --brand-rgb: 45, 106, 79;

  --surface: #FFFFFF;
  --bg: #F4F6F8;
  --text: #0F172A;
  --text-muted: #64748B;
  --border: #EAECEF;
  --border-strong: #E2E5E9;

  --danger: #DC2626;
  --warning: #D97706;
  --success: #16A34A;

  --radius: 16px;
  --radius-sm: 12px;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.04);
  --shadow: 0 1px 3px rgba(16,24,40,.06), 0 1px 2px rgba(16,24,40,.04);
  --shadow-md: 0 6px 20px rgba(16,24,40,.08);
  --shadow-lg: 0 18px 40px rgba(16,24,40,.12);
}

body { background: var(--bg); color: var(--text); }
[x-cloak] { display: none !important; }

/* Tipografia display para títulos e wordmark */
h1, h2, .display, .apta-wordmark {
  font-family: 'Sora', 'Inter', sans-serif; letter-spacing: -.02em;
}

.material-symbols-rounded {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  line-height: 1; vertical-align: middle;
}

/* ---- Mapeia utilitários "forest-*" para a marca (white-label) ---- */
.text-forest-700 { color: var(--brand-dark) !important; }
.text-forest-600, .text-forest-500 { color: var(--brand) !important; }
.text-forest-300 { color: var(--brand-light) !important; }
.bg-forest-700 { background-color: var(--brand-dark) !important; }
.bg-forest-600, .bg-forest-500 { background-color: var(--brand) !important; }
.bg-forest-100 { background-color: rgba(var(--brand-rgb), .12) !important; }
.bg-forest-50  { background-color: rgba(var(--brand-rgb), .06) !important; }
.border-forest-200 { border-color: var(--border-strong) !important; }
.border-forest-100 { border-color: var(--border) !important; }
.hover\:bg-forest-700:hover { background-color: var(--brand-dark) !important; }
.hover\:text-forest-600:hover, .hover\:text-forest-700:hover { color: var(--brand) !important; }
.ring-forest-300 { --tw-ring-color: rgba(var(--brand-rgb), .25) !important; }
.focus\:border-forest-500:focus { border-color: var(--brand) !important; }
.divide-forest-50 > * + * { border-color: var(--border) !important; }

/* ---- Cards ---- */
.card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid var(--border);
  transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}
a.card:hover, .card-hover:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--border-strong); }

/* ---- Métrica cards (ícone vira chip colorido automaticamente) ---- */
.metric-card {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  padding: 1.25rem 1.4rem; transition: box-shadow .2s ease, transform .2s ease;
  display: flex; flex-direction: column;
}
.metric-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.metric-card > .material-symbols-rounded {
  width: 46px; height: 46px; border-radius: 13px; display: inline-flex;
  align-items: center; justify-content: center; font-size: 24px;
  background: rgba(var(--brand-rgb), .10); color: var(--brand) !important; margin-bottom: .85rem;
}
.metric-card .metric-value {
  font-family: 'Sora', sans-serif; font-size: 1.9rem; font-weight: 700;
  color: var(--brand-dark); line-height: 1; letter-spacing: -.02em;
}
.metric-card .metric-label { font-size: .82rem; color: var(--text-muted); margin-top: .4rem; font-weight: 500; }

/* ---- Page header ---- */
.page-title { font-size: 1.65rem; font-weight: 700; color: var(--text); }
.page-subtitle { color: var(--text-muted); margin-top: .15rem; }

/* ---- Tabelas ---- */
.apta-table { width: 100%; border-collapse: collapse; background: #fff; }
.apta-table thead th {
  text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); background: transparent; padding: .65rem 1rem; border-bottom: 1px solid var(--border);
}
.apta-table tbody td { padding: .9rem 1rem; border-bottom: 1px solid var(--border); font-size: .9rem; }
.apta-table tbody tr:last-child td { border-bottom: none; }
.apta-table tbody tr { transition: background .12s ease; }
.apta-table tbody tr:hover { background: rgba(var(--brand-rgb), .04); }

/* ---- Botões ---- */
.btn {
  display: inline-flex; align-items: center; gap: .45rem; border-radius: var(--radius-sm);
  padding: .62rem 1.15rem; font-weight: 600; font-size: .9rem; transition: all .15s ease;
  cursor: pointer; border: 1px solid transparent; white-space: nowrap;
}
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 2px 8px rgba(var(--brand-rgb), .30); }
.btn-primary:hover { background: var(--brand-dark); box-shadow: 0 4px 14px rgba(var(--brand-rgb), .38); transform: translateY(-1px); }
.btn-secondary { background: #fff; color: var(--brand-dark); border: 1px solid var(--border-strong); }
.btn-secondary:hover { background: #FAFBFC; border-color: rgba(var(--brand-rgb), .35); }
.btn-danger { background: var(--danger); color: #fff; }

/* ---- Form ---- */
.field-label { display: block; font-size: .8rem; font-weight: 600; color: var(--brand-dark); margin-bottom: .4rem; }
.field-error { color: var(--danger); font-size: .78rem; margin-top: .25rem; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=datetime-local], input[type=date], select, textarea {
  background: #fff; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .15);
}

/* ---- Sidebar (moderna, branca) ---- */
.apta-sidebar { background: var(--surface); border-right: 1px solid var(--border); }
.apta-wordmark { font-weight: 800; }
.apta-nav-section { font-size: .66rem; text-transform: uppercase; letter-spacing: .08em; color: #94A3B8; padding: .5rem .75rem .25rem; font-weight: 700; }
.apta-nav-item {
  display: flex; align-items: center; gap: .7rem; padding: .6rem .75rem; border-radius: var(--radius-sm);
  color: #475569; font-size: .9rem; font-weight: 500; transition: all .14s ease; position: relative;
}
.apta-nav-item .material-symbols-rounded { font-size: 21px; color: #94A3B8; transition: color .14s ease; }
.apta-nav-item:hover { background: rgba(var(--brand-rgb), .06); color: var(--brand-dark); }
.apta-nav-item:hover .material-symbols-rounded { color: var(--brand); }
.apta-nav-item.active {
  background: rgba(var(--brand-rgb), .11); color: var(--brand-dark); font-weight: 600;
}
.apta-nav-item.active .material-symbols-rounded { color: var(--brand); }
.apta-nav-item.active::before {
  content: ""; position: absolute; left: -.75rem; top: 50%; transform: translateY(-50%);
  width: 4px; height: 22px; border-radius: 0 4px 4px 0; background: var(--brand);
}

/* ---- Topbar ---- */
.apta-topbar { background: rgba(255,255,255,.85); backdrop-filter: saturate(180%) blur(8px); border-bottom: 1px solid var(--border); }

/* ---- Badges / pills ---- */
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: .15rem .6rem; font-size: .72rem; font-weight: 600; }

/* ---- Wizard / Likert ---- */
/* Mobile-first: opções empilhadas em linha cheia, com área de toque grande. */
.likert { display: flex; flex-direction: column; gap: .5rem; }
.likert-option { cursor: pointer; }
.likert-option input { position: absolute; opacity: 0; }
.likert-btn {
  display: flex; flex-direction: row; align-items: center; justify-content: flex-start;
  gap: .75rem; padding: .95rem 1rem; border-radius: var(--radius-sm); border: 2px solid transparent;
  text-align: left; font-size: .95rem; font-weight: 500; color: #1f2937;
  transition: transform .12s ease, box-shadow .12s ease; min-height: 56px;
}
.likert-option:nth-child(1) .likert-btn { background: #FEE2E2; }
.likert-option:nth-child(2) .likert-btn { background: #FEF3C7; }
.likert-option:nth-child(3) .likert-btn { background: #F1F5F9; }
.likert-option:nth-child(4) .likert-btn { background: #DCFCE7; }
.likert-option:nth-child(5) .likert-btn { background: #BBF7D0; }
.likert-option input:checked + .likert-btn {
  border-color: var(--brand); box-shadow: 0 6px 16px rgba(var(--brand-rgb), .25);
}
.likert-num {
  font-size: 1.1rem; font-weight: 700; font-family: 'Sora', sans-serif;
  width: 2rem; height: 2rem; display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.6); border-radius: 999px; flex-shrink: 0;
}
/* A partir de telas médias: grade de 5 colunas (layout original). */
@media (min-width: 640px) {
  .likert { display: grid; grid-template-columns: repeat(5, 1fr); gap: .55rem; }
  .likert-btn {
    flex-direction: column; align-items: center; justify-content: center;
    gap: .35rem; padding: 1.05rem .5rem; text-align: center; font-size: .8rem; height: 100%;
  }
  .likert-num { background: transparent; width: auto; height: auto; font-size: 1.25rem; }
}

/* ---- Controles de formulário (padrão em todos os CRUDs) ---- */
.apta-form input:not([type=checkbox]):not([type=radio]):not([type=file]),
.apta-form select,
.apta-form textarea {
  width: 100%;
  border: 1px solid #E2E8F0;
  border-radius: .75rem;
  padding: .62rem .85rem;
  font-size: .95rem;
  color: #1f2937;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.apta-form input:focus,
.apta-form select:focus,
.apta-form textarea:focus {
  outline: none;
  border-color: var(--brand, #2D6A4F);
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb, 45,106,79), .15);
}
.apta-form textarea { min-height: 96px; resize: vertical; }
.apta-form input[type=file] { font-size: .9rem; color: #64748b; }
