/* Personal Control — estilos mobile-first */
:root {
  --bg: #f2f5f3;
  --card: #ffffff;
  --ink: #1c2420;
  --muted: #6b7a72;
  --brand: #0d7a4f;
  --brand-dark: #0b3d2a;
  --accent: #ffb020;
  --danger: #d64545;
  --ok: #1f9d55;
  --line: #e3e9e6;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(20, 40, 30, 0.08);
  --tabbar-h: 64px;
}
* { box-sizing: border-box; }
/* Garante que o atributo hidden sempre esconda o elemento,
   mesmo quando outra regra define display (ex.: modal-backdrop) */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}

/* Barra superior */
#appbar {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(135deg, var(--brand-dark), var(--brand));
  color: #fff;
  padding: calc(10px + env(safe-area-inset-top)) 16px 12px;
  display: flex; align-items: center; justify-content: space-between;
}
.appbar-title { display: flex; align-items: center; gap: 10px; }
.appbar-title strong { display: block; font-size: 17px; letter-spacing: 0.2px; }
.appbar-title small { display: block; font-size: 11px; opacity: 0.85; }
.appbar-logo {
  width: 38px; height: 38px; border-radius: 12px;
  background: rgba(255,255,255,0.16);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px;
}
.appbar-date { font-size: 12px; opacity: 0.9; text-align: right; line-height: 1.4; }
.appbar-manual {
  color: #fff; text-decoration: none; font-size: 13px; font-weight: 600;
  border: 1.5px solid rgba(255,255,255,0.7); border-radius: 999px;
  padding: 6px 14px; white-space: nowrap;
}

/* Conteúdo */
#view { padding: 14px 14px 20px; max-width: 640px; margin: 0 auto; }
h2.page-title { font-size: 20px; margin: 4px 2px 12px; }
h3.section-title { font-size: 14px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); margin: 18px 2px 8px; }

.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px;
  border: 1px solid var(--line);
}
.card.tint-warn { border-left: 4px solid var(--accent); }
.card.tint-danger { border-left: 4px solid var(--danger); }
.card.tint-ok { border-left: 4px solid var(--ok); }

.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.big-number { font-size: 26px; font-weight: 800; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Estatísticas do painel */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 4px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); }
.stat .num { font-size: 24px; font-weight: 800; }
.stat .lbl { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.warn .num { color: #b97a0a; }
.stat.danger .num { color: var(--danger); }
.stat.ok .num { color: var(--ok); }

/* Listas */
.list-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 8px; box-shadow: var(--shadow);
  width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer;
}
.list-item:active { background: #eef4f1; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%; flex: none;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px;
}
.badge {
  display: inline-block; font-size: 11px; font-weight: 700;
  padding: 3px 8px; border-radius: 999px; margin: 2px 4px 2px 0;
  white-space: nowrap;
}
.badge.ok { background: #e3f5e9; color: #14663a; }
.badge.warn { background: #fff3d9; color: #8a5c00; }
.badge.danger { background: #fde7e7; color: #a02c2c; }
.badge.info { background: #e2eefb; color: #1d4f9c; }
.badge.neutral { background: #edf1ef; color: var(--muted); }
.badge.birthday { background: #f3e2fb; color: #6d2a9c; }

/* Botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 12px; padding: 12px 16px;
  font: inherit; font-weight: 700; font-size: 15px; cursor: pointer;
  background: var(--brand); color: #fff; box-shadow: var(--shadow);
}
.btn:active { transform: scale(0.98); }
.btn.block { display: flex; width: 100%; }
.btn.secondary { background: #e8efec; color: var(--ink); }
.btn.ghost { background: transparent; color: var(--brand); box-shadow: none; padding: 8px 10px; }
.btn.danger { background: var(--danger); }
.btn.small { padding: 8px 12px; font-size: 13px; border-radius: 10px; }
.btn-row { display: flex; gap: 8px; margin-top: 10px; }
.btn-row .btn { flex: 1; }

/* Links dentro de card (login: Ativação, Portal, Manual, Termos) — menores que o texto */
.card a { font-size: 13px; line-height: 1.6; }

/* Botões de login/online — btn-primary/btn-secondary (antes sem regra, caíam no padrão do navegador) */
.btn-primary, .btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 12px; padding: 15px 16px; font: inherit; font-weight: 800; font-size: 16px;
  cursor: pointer; width: 100%; margin-bottom: 10px;
}
.btn-primary { border: none; background: linear-gradient(135deg, var(--brand-dark), var(--brand)); color: #fff; box-shadow: 0 4px 14px rgba(13,122,79,.35); }
.btn-primary:active { transform: scale(.98); }
.btn-secondary { border: 1.5px solid var(--brand); background: #fff; color: var(--brand); }
.btn-secondary:active { transform: scale(.98); }
/* Título de seção vale para h2 e h3 (o login usa h2.section-title) */
.section-title { font-size: 15px; text-transform: uppercase; letter-spacing: .8px; color: var(--brand-dark); font-weight: 800; margin: 4px 2px 14px; }


.fab {
  position: fixed; right: 18px; bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom));
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--brand); color: #fff; border: none;
  font-size: 30px; line-height: 1; cursor: pointer;
  box-shadow: 0 4px 14px rgba(13, 122, 79, 0.4); z-index: 15;
}

/* Formulários */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 5px; color: #33413a; }
.field input, .field select, .field textarea {
  width: 100%; font: inherit; font-size: 16px;
  padding: 13px 12px; border: 1.5px solid #cfd8d3; border-radius: 12px;
  background: #fff; color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand);
}
.field textarea { min-height: 90px; resize: vertical; }
.field .hint { font-size: 11px; color: var(--muted); margin-top: 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Busca e filtros */
.searchbar { display: flex; gap: 8px; margin-bottom: 10px; }
.searchbar input {
  flex: 1; font: inherit; font-size: 15px; padding: 11px 12px;
  border: 1px solid #cfd8d3; border-radius: 10px; background: #fff;
}
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 6px; }
.chip {
  flex: none; border: 1px solid #cfd8d3; background: #fff; color: var(--ink);
  border-radius: 999px; padding: 8px 13px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* Check-in */
.check-row { display: flex; align-items: center; gap: 12px; }
.check-toggle {
  width: 52px; height: 52px; border-radius: 50%; flex: none;
  border: 2px solid #cfd8d3; background: #fff; cursor: pointer;
  font-size: 22px; color: transparent; display: flex; align-items: center; justify-content: center;
}
.check-toggle.done { background: var(--ok); border-color: var(--ok); color: #fff; }

/* Overlay de detalhe */
.screen-overlay {
  position: fixed; inset: 0; z-index: 30; background: var(--bg);
  overflow-y: auto; padding-bottom: 40px;
}
.detail-head {
  position: sticky; top: 0; z-index: 5;
  background: linear-gradient(135deg, var(--brand-dark), var(--brand)); color: #fff;
  padding: calc(10px + env(safe-area-inset-top)) 14px 14px;
}
.detail-head .row { align-items: center; }
.back-btn {
  background: rgba(255,255,255,0.16); color: #fff; border: none;
  width: 38px; height: 38px; border-radius: 50%; font-size: 18px; cursor: pointer; flex: none;
}
.detail-body { padding: 14px; max-width: 640px; margin: 0 auto; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--muted); }
.kv .v { text-align: right; font-weight: 600; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 40; background: rgba(15, 25, 20, 0.55);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: #fff; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto;
  border-radius: 18px 18px 0 0; padding: 18px 16px calc(20px + env(safe-area-inset-bottom));
}
.modal h3 { margin: 0 0 12px; font-size: 17px; }
.modal-actions { display: flex; gap: 8px; margin-top: 14px; }
.modal-actions .btn { flex: 1; }

/* Toast */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom));
  background: #1c2420; color: #fff; padding: 11px 18px; border-radius: 999px;
  font-size: 14px; z-index: 60; box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  max-width: 90vw; text-align: center;
}

/* Barra de abas */
#tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: #fff; border-top: 1px solid var(--line);
  display: flex;
}
.tab {
  flex: 1; border: none; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); font: inherit;
}
.tab-icon { font-size: 19px; line-height: 1; }
.tab-label { font-size: 11px; font-weight: 600; }
.tab.active { color: var(--brand); }

.empty { text-align: center; color: var(--muted); padding: 34px 16px; font-size: 14px; }
.divider { height: 1px; background: var(--line); margin: 12px 0; }
.link { color: var(--brand); font-weight: 700; text-decoration: none; }
pre.sheet {
  background: #f7faf8; border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; white-space: pre-wrap; font: inherit; font-size: 14px; margin: 0;
}
table.mini { width: 100%; border-collapse: collapse; font-size: 13px; }
table.mini th, table.mini td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--line); }
table.mini th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; }

/* ---- Tela de licença (código de ativação) ---- */
.lock-screen {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.lock-card { text-align: center; max-width: 320px; width: 100%; }
.lock-logo {
  width: 72px; height: 72px; border-radius: 20px;
  background: linear-gradient(135deg, var(--brand-dark), var(--brand));
  color: #fff; font-size: 28px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}
.lock-input {
  width: 100%; font-size: 28px; text-align: center; letter-spacing: 12px;
  text-indent: 12px; padding: 12px; border: 2px solid var(--line);
  border-radius: 12px; margin: 12px 0; background: #fff; color: var(--ink);
}
.lock-input:focus { border-color: var(--brand); outline: none; }
.lock-card .btn { width: 100%; }

/* ---- Aviso de período de teste ---- */
.card.trial { border-left: 4px solid var(--accent); }

/* ---- Botões empilhados (ex.: backup) ---- */
.btn-col { display: flex; flex-direction: column; gap: 8px; }

/* ---- Checkboxes de lembretes na agenda (cadastro) ---- */
.check { display: flex; gap: 10px; align-items: flex-start; background: #eef4ff; border-radius: 10px; padding: 12px; margin: 8px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 2px; flex-shrink: 0; accent-color: var(--brand); }
.check span { font-size: 14px; font-weight: 600; }
.check small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; margin-top: 2px; }

/* ---- Tela de ativação: planos, oferta e indicação ---- */
.lock-card.wide { max-width: 340px; }
.promo-tag { display: inline-block; background: #dcfce7; color: #15803d; font-size: 11px; font-weight: 700; padding: 2px 10px; border-radius: 20px; }
.plan-card { position: relative; border: 1px solid #e2e8f0; border-radius: 12px; padding: 12px 14px; margin: 10px 0; text-align: left; background: #fff; }
.plan-card.popular { border: 2px solid var(--brand); box-shadow: 0 4px 14px rgba(0,0,0,.10); }
.badge-pop { position: absolute; top: -11px; left: 50%; transform: translateX(-50%); background: #f59e0b; color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .6px; padding: 3px 12px; border-radius: 20px; white-space: nowrap; }
.plan-price { font-size: 22px; font-weight: 800; color: var(--brand); margin: 2px 0 8px; }
.plan-note { color: #059669; font-size: 12px; font-weight: 600; margin-bottom: 8px; }
.strike { color: #94a3b8; font-size: 12px; text-decoration: line-through; }
.btn.wa { background: #25d366; color: #fff; width: 100%; }
.offer-banner { background: #fef9c3; border: 1px solid #fde68a; border-radius: 12px; padding: 12px 14px; margin: 12px 0; text-align: left; font-size: 13px; line-height: 1.5; color: #78350f; }
.offer-tag { display: inline-block; background: #f59e0b; color: #fff; font-size: 10px; font-weight: 800; letter-spacing: .8px; padding: 2px 10px; border-radius: 20px; margin-bottom: 6px; }
.or-div { display: flex; align-items: center; gap: 10px; margin: 14px 2px 10px; color: #64748b; font-size: 12px; }
.or-div::before, .or-div::after { content: ''; flex: 1; height: 1px; background: #e2e8f0; }
.ref-code { font-size: 24px; font-weight: 800; letter-spacing: 2px; text-align: center; margin: 8px 0 12px; color: var(--brand); }
