/* =====================================================================
   NexoGuard 2.0 — Tema claro (estilos compartilhados)
   Usado por todas as páginas: <link rel="stylesheet" href="nexoguard.css">
   ===================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@500;600;700&family=DM+Sans:wght@400;500;600;700&display=swap');

:root {
  /* Base */
  --bg: #F4F7FA;
  --card: #FFFFFF;
  --border: #E1E8EF;
  --border2: #D5DEE6;
  --text: #0E2236;
  --text2: #3E5266;
  --muted: #5C6F82;
  --field: #F8FAFC;

  /* Marca */
  --navy: #0E2236;
  --navy2: #16304C;
  --teal: #00A9AC;
  --teal-bright: #14C2C5;
  --teal-light: #4FE0E2;
  --teal-text: #007A7D;
  --teal-bg: #E3F6F6;

  /* Status */
  --ok: #1A7F4E;
  --ok-fill: #1A8A55;
  --ok-bg: #E3F5EC;
  --ok-border: #BFE5D1;

  --nc: #C8372A;
  --nc-text: #A8382E;
  --nc-bg: #FDECEA;
  --nc-soft: #FFF4F2;
  --nc-border: #F3C4BF;

  --na: #8A5C00;
  --na-fill: #F5C451;
  --na-bg: #FFF4D6;
  --na-border: #F0D99A;

  --radius: 16px;
  --shadow: 0 1px 2px rgba(14, 34, 54, 0.04);
  --shadow-lg: 0 16px 40px rgba(14, 34, 54, 0.12);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--teal-text); }
button, input, select, textarea { font-family: inherit; }
svg { flex-shrink: 0; }

.app {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 20px 120px;
}

/* ---------- Topo ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 0 8px;
}

.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-word {
  font-family: 'Sora', sans-serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text);
}
.brand-word span { color: var(--teal); font-weight: 500; }

.topbar-title { min-width: 0; }
.topbar-title strong {
  display: block;
  font-family: 'Sora', sans-serif;
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-title small { display: block; font-size: 12px; color: var(--muted); }

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.icon-btn:hover { border-color: var(--border2); background: #FBFCFD; }

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--navy);
  color: #fff;
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ---------- Títulos ---------- */
.page-head { padding: 16px 0 4px; }
.page-head h1 {
  font-family: 'Sora', sans-serif;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.3px;
}
.page-head p { margin-top: 4px; font-size: 13px; color: var(--muted); }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 24px 0 12px;
}
.section-head h2 { font-family: 'Sora', sans-serif; font-size: 16px; font-weight: 600; }
.section-head span, .section-head a { font-size: 13px; color: var(--muted); }
.section-head a { color: var(--teal-text); font-weight: 600; text-decoration: none; }

.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--teal-text);
}

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 16px; }
.card + .card { margin-top: 10px; }

.card-navy {
  background: var(--navy);
  color: #fff;
  border-radius: 20px;
  padding: 18px;
  box-shadow: 0 10px 28px rgba(14, 34, 54, 0.18);
}
.card-navy .eyebrow { color: var(--teal-light); }
.card-navy .muted { color: #A9BBCC; }

.list { display: flex; flex-direction: column; gap: 10px; }

.row-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
  width: 100%;
  text-align: left;
  font: inherit;
}
.row-card:hover { border-color: var(--border2); }
.row-card:active { transform: scale(0.99); }

.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; font-size: 14px; }
.row-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.row-side small { font-size: 11px; color: var(--muted); }

.sigla {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--teal-bg);
  color: var(--teal-text);
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ---------- Estatísticas ---------- */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stats.three { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stats.four { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }

.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  text-decoration: none;
  color: var(--text);
  display: block;
}
.stats.three .stat, .stats.four .stat { padding: 12px; border-radius: 14px; }
.stat-label { font-size: 12px; color: var(--muted); }
.stat-value { font-family: 'Sora', sans-serif; font-size: 28px; font-weight: 700; margin-top: 6px; line-height: 1.1; }
.stats.three .stat-value, .stats.four .stat-value { font-size: 22px; margin-top: 0; }
.stats.three .stat-label, .stats.four .stat-label { font-size: 11px; }
.stat-foot { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat.alert { background: var(--nc-soft); border-color: var(--nc-border); }
.stat.alert .stat-label, .stat.alert .stat-foot { color: var(--nc-text); }
.stat.alert .stat-value { color: var(--nc); }
.stat.center { text-align: center; }

.c-ok { color: var(--ok) !important; }
.c-nc { color: var(--nc) !important; }
.c-na { color: var(--na) !important; }
.c-teal { color: var(--teal-text) !important; }
.c-muted { color: var(--muted) !important; }

/* ---------- Barra de progresso ---------- */
.progress { height: 6px; border-radius: 999px; background: #E6EDF3; overflow: hidden; }
.progress > div { height: 100%; background: var(--teal); border-radius: 999px; transition: width 0.3s; }
.progress.ok > div { background: #1FA56A; }
.card-navy .progress { background: #22405E; }
.card-navy .progress > div { background: var(--teal-bright); }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s, background 0.15s, box-shadow 0.15s, opacity 0.15s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-block { width: 100%; }
.btn-lg { height: 54px; font-size: 15px; font-family: 'Sora', sans-serif; }
.btn-sm { height: 40px; padding: 0 14px; font-size: 13px; border-radius: 12px; }

.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: #17324F; box-shadow: 0 8px 20px rgba(14, 34, 54, 0.2); }
.btn-primary svg { color: var(--teal-light); }

.btn-teal { background: var(--teal-bright); color: #06222A; }
.btn-teal:hover { background: #2ED3D6; }

.btn-ghost { background: var(--card); color: var(--text2); border-color: var(--border2); }
.btn-ghost:hover { background: #FBFCFD; }

.btn-ghost-dark { background: transparent; color: #D4E0EA; border-color: #2F4D6B; }

.btn-danger { background: var(--card); color: var(--nc); border-color: var(--nc-border); }
.btn-danger:hover { background: var(--nc-soft); }

.btn-wpp { background: #1FA855; color: #fff; }
.btn-wpp:hover { background: #1A9549; }

/* ---------- Formulários ---------- */
.field { display: block; margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field > span, .field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 6px;
}
.input, .app select, .app textarea, .sheet select, .sheet textarea {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--border2);
  background: var(--field);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
.app select, .sheet select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%235C6F82' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}
.app textarea, .sheet textarea { padding: 12px 14px; min-height: 96px; resize: vertical; line-height: 1.45; }
.input:focus, .app select:focus, .app textarea:focus, .sheet select:focus, .sheet textarea:focus {
  border-color: var(--teal);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(0, 169, 172, 0.12);
}
.input::placeholder, textarea::placeholder { color: #8A9AAB; }
.input[readonly] { color: var(--muted); background: #EEF2F6; }

.input-icon { position: relative; display: block; }
.input-icon > svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.input-icon > .input { padding-left: 44px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 380px) { .form-grid { grid-template-columns: 1fr; gap: 0; } }

/* ---------- Chips e abas ---------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border2);
  background: var(--card);
  color: var(--text2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  user-select: none;
  transition: all 0.15s;
}
.chip.ativo { background: var(--navy); border-color: var(--navy); color: #fff; }

.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: #E8EEF3;
}
.segmented button {
  height: 40px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.segmented button.ativo { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(14, 34, 54, 0.15); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  background: #EEF2F6;
  color: var(--text2);
}
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-nc { background: var(--nc-bg); color: var(--nc); }
.badge-na { background: var(--na-bg); color: var(--na); }
.badge-teal { background: var(--teal-bg); color: var(--teal-text); }
.badge-navy { background: var(--navy); color: #fff; }

/* ---------- Estados ---------- */
.empty {
  text-align: center;
  padding: 36px 20px;
  color: var(--muted);
  font-size: 14px;
}
.empty svg { color: #9FB0C0; margin-bottom: 8px; }

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #DDE5EC;
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: ng-spin 0.8s linear infinite;
  margin: 0 auto 12px;
}
.spinner.sm { width: 18px; height: 18px; border-width: 2px; margin: 0; }
@keyframes ng-spin { to { transform: rotate(360deg); } }

.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.45;
  background: var(--teal-bg);
  color: var(--text);
  border: 1px solid #BFE9EA;
}
.notice.warn { background: var(--na-bg); border-color: var(--na-border); }
.notice.error { background: var(--nc-bg); border-color: var(--nc-border); color: var(--nc-text); }
.notice small { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translate(-50%, -20px);
  width: max-content;
  max-width: calc(100% - 32px);
  background: var(--navy);
  color: #fff;
  padding: 12px 18px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 500;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.success { background: var(--ok-fill); }
.toast.error { background: var(--nc); }
.toast.warning { background: #5C4200; }

/* ---------- Bottom sheet / modal ---------- */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(14, 34, 54, 0.45);
  z-index: 1500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.sheet-overlay.show { opacity: 1; pointer-events: auto; }
.sheet {
  width: 100%;
  max-width: 640px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--card);
  border-radius: 24px 24px 0 0;
  padding: 10px 20px 28px;
  transform: translateY(24px);
  transition: transform 0.25s;
}
.sheet-overlay.show .sheet { transform: translateY(0); }
.sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: #D5DEE6; margin: 4px auto 16px; }
.sheet h2 { font-family: 'Sora', sans-serif; font-size: 19px; font-weight: 600; }
.sheet-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.sheet-actions { display: flex; gap: 10px; margin-top: 20px; }
.sheet-actions .btn { flex: 1; }

.sheet-overlay.center { align-items: center; padding: 20px; }
.sheet-overlay.center .sheet { border-radius: 24px; padding: 26px 22px 20px; max-width: 400px; }

@media (min-width: 700px) {
  .sheet-overlay { align-items: center; padding: 20px; }
  .sheet { border-radius: 24px; }
}

/* ---------- Menu inferior ---------- */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav-inner {
  max-width: 640px;
  margin: 0 auto;
  height: 68px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: center;
}
.nav-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  padding: 6px 0;
}
.nav-item.ativo { color: var(--teal-text); font-weight: 700; }
.nav-fab {
  justify-self: center;
  width: 56px;
  height: 56px;
  margin-top: -26px;
  border-radius: 18px;
  background: var(--navy);
  color: var(--teal-light);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 22px rgba(14, 34, 54, 0.28);
  text-decoration: none;
}
.nav-badge {
  position: absolute;
  top: -2px;
  left: 50%;
  margin-left: 6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #D2433A;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Rodapé fixo de ação (substitui o menu em telas de fluxo) */
.action-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 12px 20px calc(16px + env(safe-area-inset-bottom));
}
.action-bar-inner { max-width: 600px; margin: 0 auto; display: flex; gap: 10px; }
.action-bar-inner .grow { flex: 1; }

/* ---------- Utilidades ---------- */
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.flex { display: flex; }
.between { justify-content: space-between; }
.center-y { align-items: center; }
.gap-8 { gap: 8px; }
.gap-10 { gap: 10px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
