:root {
  --navy: #0A2540;
  --navy-2: #071629;
  --teal: #0891B2;
  --gold: #F59E0B;
  --cream: #FBF7EF;
  --ink: #1F2937;
  --muted: #64748B;
  --border: rgba(10, 37, 64, 0.08);
  --danger: #DC2626;
  --success: #059669;
  --radius: 16px;
  --font-head: 'Lora', Georgia, serif;
  --font-body: 'Raleway', -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

body {
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-head); color: var(--navy); }

/* ---- Botões ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 12px; padding: 13px 20px;
  font-family: var(--font-body); font-weight: 700; font-size: 15px;
  cursor: pointer; transition: transform .15s, opacity .15s;
  text-align: center;
}
.btn:active { transform: scale(0.97); }
.btn--block { width: 100%; }
.btn--sm { padding: 8px 14px; font-size: 13px; border-radius: 10px; }
.btn--primary { background: var(--navy); color: #fff; }
.btn--accent { background: var(--teal); color: #fff; }
.btn--gold { background: var(--gold); color: var(--navy); }
.btn--ghost { background: transparent; color: var(--navy); border: 1px solid var(--border); }
.btn--ghost:hover { background: rgba(10,37,64,0.04); }

/* ---- Auth pages ---- */
.auth-page {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  position: relative; overflow: hidden; padding: 24px 16px;
}
.auth-page__glow {
  position: absolute; top: 0; left: 0; width: 100%; height: 40vh; background: var(--navy);
}
.auth-wrap { width: 100%; max-width: 420px; position: relative; z-index: 1; }
.auth-brand { text-align: center; margin-bottom: 24px; color: #fff; }
.auth-brand__logo { font-family: var(--font-head); font-weight: 800; font-size: 22px; margin-bottom: 8px; }
.auth-brand h1 { color: rgba(255,255,255,0.92); font-size: 20px; font-weight: 500; }
.auth-card {
  background: #fff; border-radius: 20px; padding: 32px; box-shadow: 0 20px 60px rgba(10,37,64,0.18);
  border: 1px solid var(--border);
}
.auth-card--center { text-align: center; }
.auth-switch { text-align: center; margin-top: 20px; font-size: 14px; color: var(--muted); }
.auth-switch a { color: var(--teal); font-weight: 700; }
.auth-hint { font-size: 14px; color: var(--muted); margin-bottom: 16px; }
.pending-icon { font-size: 48px; margin-bottom: 12px; }

/* ---- Forms ---- */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 13px; font-weight: 600; color: var(--navy); }
.field input, .field select {
  border: 1px solid #D1D5DB; border-radius: 10px; padding: 12px 14px; font-size: 15px;
  font-family: var(--font-body); color: var(--ink);
}
.field input:focus, .field select:focus { outline: 2px solid var(--teal); outline-offset: 1px; }
.field small { color: var(--muted); font-size: 12px; }
.form__aux { display: flex; justify-content: flex-end; font-size: 13px; }
.form__aux a { color: var(--teal); font-weight: 600; }

.alert { padding: 14px 16px; border-radius: 10px; font-size: 14px; margin-bottom: 20px; }
.alert--error { background: #FEF2F2; border: 1px solid #FECACA; color: #B91C1C; }
.alert--success { background: #ECFEFF; border: 1px solid #A5F3FC; color: #0E7490; }

/* ---- App header/nav ---- */
.app-header { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 50; }
.app-header__inner {
  max-width: 1100px; margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.app-header__brand { font-family: var(--font-head); font-weight: 800; font-size: 18px; }
.app-header__nav { display: flex; gap: 20px; flex: 1; justify-content: center; }
.app-header__nav a { color: rgba(255,255,255,0.7); font-weight: 600; font-size: 14px; padding: 6px 4px; border-bottom: 2px solid transparent; }
.app-header__nav a.is-active, .app-header__nav a:hover { color: #fff; border-color: var(--gold); }
.app-header__user { display: flex; align-items: center; gap: 12px; font-size: 13px; color: rgba(255,255,255,0.8); }
.app-header__user .btn--ghost { color: #fff; border-color: rgba(255,255,255,0.25); }

.static-header {
  background: var(--navy); color: #fff; padding: 16px 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.static-header__brand { font-family: var(--font-head); font-weight: 800; }

/* ---- Layout ---- */
.page-wrap { max-width: 1100px; margin: 0 auto; padding: 28px 20px 60px; }
.page-wrap--narrow { max-width: 760px; }
.static-page h1 { margin-bottom: 4px; }
.static-page h2 { margin-top: 28px; margin-bottom: 8px; font-size: 19px; }
.static-page p { margin-bottom: 10px; color: var(--ink); }
.static-page__updated { color: var(--muted); font-size: 13px; margin-bottom: 24px; }

/* ---- App toolbar / filtros ---- */
.app-toolbar { display: flex; flex-direction: column; gap: 14px; margin-bottom: 24px; }
.app-search { display: flex; gap: 10px; }
.app-search input {
  flex: 1; border: 1px solid #D1D5DB; border-radius: 12px; padding: 13px 16px; font-size: 15px;
}
.app-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  --chip-color: #0891B2;
  padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: #fff; border: 1px solid var(--border); color: var(--navy);
}
.chip--active { background: var(--chip-color); color: #fff; border-color: var(--chip-color); }
.app-filter-select { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.app-filter-select select { padding: 8px 10px; border-radius: 8px; border: 1px solid #D1D5DB; }

/* ---- Protocolos grid/card ---- */
.protocol-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.protocol-card {
  background: #fff; border-radius: var(--radius); padding: 18px; border: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(10,37,64,0.04); transition: transform .15s, box-shadow .15s;
  display: flex; flex-direction: column; gap: 8px;
}
.protocol-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(10,37,64,0.10); }
.protocol-card__top { display: flex; justify-content: space-between; align-items: center; }
.protocol-card__num { font-size: 12px; font-weight: 800; color: var(--teal); }
.protocol-card__star { color: var(--gold); }
.protocol-card h3 { font-size: 16px; }
.protocol-card__padrao { font-size: 13px; color: var(--muted); }
.tag {
  --chip-color: #0891B2; display: inline-block; align-self: flex-start;
  background: color-mix(in srgb, var(--chip-color) 14%, white); color: var(--chip-color);
  padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
}
.tag--outline { background: transparent; border: 1px solid var(--border); color: var(--muted); }
.tag--sm { font-size: 11px; padding: 3px 8px; }
.empty-state { color: var(--muted); padding: 40px 0; text-align: center; }

/* ---- Detalhe do protocolo ---- */
.back-link { display: inline-block; margin-bottom: 16px; color: var(--teal); font-weight: 600; font-size: 14px; }
.protocol-detail__head { margin-bottom: 20px; }
.protocol-detail__head h1 { margin: 6px 0 12px; font-size: 26px; }
.protocol-detail__meta { display: flex; gap: 8px; margin-bottom: 16px; }
.protocol-detail__content {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; font-size: 15px; white-space: pre-line;
}
.protocol-detail__tags { display: flex; gap: 6px; margin-top: 16px; flex-wrap: wrap; }

/* ---- Admin ---- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-card { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 16px; text-align: center; }
.stat-card__value { display: block; font-size: 26px; font-weight: 800; color: var(--navy); }
.stat-card__label { font-size: 12px; color: var(--muted); }
.panel { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 18px; margin-bottom: 20px; }
.panel--warn { background: #FFFBEB; border-color: #FDE68A; }
.panel h2 { font-size: 16px; margin-bottom: 10px; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; }
.inline-form input { flex: 1; min-width: 220px; border: 1px solid #D1D5DB; border-radius: 10px; padding: 10px 12px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 8px; }
.plain-list { list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.search-form { margin-bottom: 14px; }
.search-form input { width: 100%; padding: 11px 14px; border: 1px solid #D1D5DB; border-radius: 10px; }

.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--border); border-radius: 14px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; padding: 12px; color: var(--muted); border-bottom: 1px solid var(--border); font-weight: 600; }
.data-table td { padding: 10px 12px; border-bottom: 1px solid #F1F5F9; vertical-align: middle; }
.data-table .muted { color: var(--muted); font-size: 12px; }
.inline-edit input { border: 1px solid transparent; background: transparent; font-weight: 600; padding: 2px 4px; border-radius: 6px; width: 100%; }
.inline-edit input:hover, .inline-edit input:focus { border-color: #D1D5DB; background: #fff; }
.badge-btn { border: none; border-radius: 999px; padding: 6px 12px; font-size: 12px; font-weight: 700; cursor: pointer; }
.badge-btn--on { background: #ECFDF5; color: var(--success); }
.badge-btn--off { background: #F1F5F9; color: var(--muted); }
.btn-delete { border: none; background: #FEF2F2; color: var(--danger); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; }

.notice { border-radius: 12px; padding: 16px; font-size: 14px; }
.notice--info { background: #ECFEFF; border: 1px solid #A5F3FC; color: #0E7490; }

/* ---- Footer ---- */
.site-footer { text-align: center; padding: 30px 20px; color: var(--muted); font-size: 13px; }
.site-footer__links { display: flex; gap: 14px; justify-content: center; margin: 8px 0; flex-wrap: wrap; }
.site-footer__links a { color: var(--muted); }
.site-footer__links a:hover { color: var(--teal); }
.site-footer__support a { color: var(--teal); font-weight: 600; }

/* ---- Modal de termos ---- */
.termos-overlay {
  position: fixed; inset: 0; z-index: 9999; background: rgba(10,37,64,0.92);
  display: flex; align-items: flex-start; justify-content: center; padding: 16px;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.termos-card { background: #fff; border-radius: 18px; width: 100%; max-width: 440px; margin: auto; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,0.45); }
.termos-card__head { background: var(--navy); color: #fff; padding: 26px 24px 22px; }
.termos-card__head h2 { font-family: var(--font-head); font-size: 24px; color: #fff; margin-bottom: 8px; }
.termos-card__head p { color: rgba(255,255,255,0.78); font-size: 14px; }
.termos-card__body { padding: 22px 24px; font-size: 14px; }
.termos-card__body ul { padding-left: 20px; margin: 12px 0; }
.termos-card__body li { margin-bottom: 8px; }
.termos-check { display: flex; align-items: flex-start; gap: 10px; margin-top: 18px; cursor: pointer; font-size: 13px; }
.termos-check input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--teal); }
.termos-card__foot { padding: 16px 24px 20px; border-top: 1px solid #E5E7EB; }
.termos-card__foot .btn:disabled { background: #9CA3AF; cursor: not-allowed; }

/* ---- Install banner ---- */
.install-banner {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 200; padding: 16px;
}
.install-banner__inner {
  max-width: 420px; margin: 0 auto; background: var(--navy); color: var(--cream);
  border-radius: 16px; box-shadow: 0 20px 50px rgba(10,37,64,0.3); padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid rgba(255,255,255,0.1);
}
.install-banner__text { font-size: 13px; }
.install-banner__text strong { color: var(--gold); }
.install-banner__close { background: none; border: none; color: rgba(255,255,255,0.5); font-size: 18px; cursor: pointer; }

@media (max-width: 640px) {
  .app-header__nav { display: none; }
  .protocol-grid { grid-template-columns: 1fr; }
}
