/* Autor: Ernestino Barcellos | https://tem3.com.br | 2026-02-24 */
:root {
  --bg:        #0f172a;
  --bg2:       #1e293b;
  --bg3:       #334155;
  --border:    #334155;
  --text:      #f1f5f9;
  --text2:     #94a3b8;
  --text3:     #64748b;
  --accent:    #38bdf8;
  --accent2:   #0ea5e9;
  --green:     #22c55e;
  --yellow:    #eab308;
  --orange:    #f97316;
  --red:       #ef4444;
  --purple:    #a855f7;
  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 4px 24px rgba(0,0,0,.4);
  --trans:     all .2s ease;
  --font:      'Inter', system-ui, -apple-system, sans-serif;
}

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

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ── */
#app { display: flex; flex-direction: column; min-height: 100dvh; }

.screen {
  display: none;
  flex-direction: column;
  flex: 1;
  padding-bottom: 80px;
}
.screen.active { display: flex; }

/* ── Topbar ── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex; align-items: center; gap: 12px;
}
.topbar-title { font-size: 1rem; font-weight: 600; flex: 1; }
.topbar-score {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: .8rem; font-weight: 700;
  color: var(--accent);
}
.topbar-score.good  { color: var(--green); }
.topbar-score.warn  { color: var(--yellow); }
.topbar-score.bad   { color: var(--red); }
.btn-back {
  background: none; border: none; color: var(--text2);
  cursor: pointer; padding: 4px; display: flex; align-items: center;
  border-radius: var(--radius-sm);
}
.btn-back:hover { color: var(--text); background: var(--bg2); }

/* ── Bottom Nav ── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: var(--bg);
  border-top: 1px solid var(--border);
  display: flex; height: 60px;
}
.nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  background: none; border: none; color: var(--text3);
  cursor: pointer; font-size: .65rem; font-weight: 500;
  transition: var(--trans);
  padding: 0 4px;
}
.nav-item svg { width: 20px; height: 20px; }
.nav-item.active { color: var(--accent); }
.nav-item:hover { color: var(--text2); }

/* ── Cards ── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 0 16px 12px;
}
.card-title {
  font-size: .75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--text3); margin-bottom: 12px;
}
.card-value { font-size: 2rem; font-weight: 700; }
.card-sub   { font-size: .8rem; color: var(--text2); margin-top: 2px; }

/* ── Score Ring ── */
.score-ring-wrap {
  display: flex; align-items: center; gap: 20px;
  padding: 20px 16px 12px;
}
.score-ring {
  position: relative; width: 88px; height: 88px; flex-shrink: 0;
}
.score-ring svg { transform: rotate(-90deg); }
.score-ring-val {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 700; line-height: 1;
}
.score-ring-val small { font-size: .6rem; color: var(--text3); font-weight: 400; }
.score-info { flex: 1; }
.score-info h2 { font-size: 1.1rem; font-weight: 600; }
.score-info p  { font-size: .82rem; color: var(--text2); margin-top: 4px; line-height: 1.4; }

/* ── Grid métricas ── */
.metrics-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; margin: 0 16px 12px;
}
.metric-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px;
}
.metric-card .label { font-size: .7rem; color: var(--text3); text-transform: uppercase; letter-spacing: .05em; }
.metric-card .val   { font-size: 1.35rem; font-weight: 700; margin: 4px 0 2px; }
.metric-card .sub   { font-size: .72rem; color: var(--text2); }

/* ── Quick Actions ── */
.quick-actions {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; margin: 0 16px 12px;
}
.qa-btn {
  display: flex; flex-direction: column;
  align-items: flex-start; gap: 6px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 12px;
  color: var(--text); cursor: pointer;
  transition: var(--trans); text-align: left;
  font-size: .82rem; font-weight: 500;
}
.qa-btn svg { width: 22px; height: 22px; color: var(--accent); }
.qa-btn:hover, .qa-btn:active { background: var(--bg3); border-color: var(--accent); }

/* ── Alertas ── */
.alert-banner {
  margin: 0 16px 10px; padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: .82rem; line-height: 1.4;
  display: flex; align-items: flex-start; gap: 10px;
}
.alert-banner.red    { background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.35); color: #fca5a5; }
.alert-banner.orange { background: rgba(249,115,22,.12); border: 1px solid rgba(249,115,22,.35); color: #fdba74; }
.alert-banner.yellow { background: rgba(234,179,8,.12); border: 1px solid rgba(234,179,8,.35); color: #fde047; }
.alert-banner svg    { flex-shrink: 0; width: 18px; height: 18px; margin-top: 1px; }

/* ── Formulários ── */
.form-group { margin: 0 16px 14px; }
.form-label { font-size: .78rem; font-weight: 600; color: var(--text2); margin-bottom: 6px; display: block; }
.form-input {
  width: 100%; background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 14px;
  color: var(--text); font-size: .92rem; font-family: var(--font);
  transition: var(--trans); outline: none;
}
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(56,189,248,.15); }
.form-input::placeholder { color: var(--text3); }

textarea.form-input { resize: vertical; min-height: 80px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }

/* ── Slider ── */
.slider-wrap { position: relative; }
.slider-labels { display: flex; justify-content: space-between; font-size: .68rem; color: var(--text3); margin-top: 4px; }
input[type=range] {
  width: 100%; -webkit-appearance: none; appearance: none;
  height: 6px; border-radius: 3px; background: var(--bg3); outline: none;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); cursor: pointer;
  box-shadow: 0 0 0 3px rgba(56,189,248,.2);
}
input[type=range]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); cursor: pointer; border: none;
}
.slider-val {
  text-align: center; font-size: 1.2rem; font-weight: 700;
  color: var(--accent); margin-top: 4px;
}

/* ── Toggle chips ── */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 6px 14px; border-radius: 20px;
  border: 1px solid var(--border); background: var(--bg2);
  color: var(--text2); font-size: .8rem; cursor: pointer;
  transition: var(--trans);
}
.chip.active { background: var(--accent); border-color: var(--accent); color: #0f172a; font-weight: 600; }
.chip:hover  { border-color: var(--accent); color: var(--text); }

/* ── Botões ── */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 14px; border-radius: var(--radius);
  font-size: .95rem; font-weight: 600; cursor: pointer;
  border: none; transition: var(--trans); font-family: var(--font);
}
.btn-primary { background: var(--accent); color: #0f172a; }
.btn-primary:hover, .btn-primary:active { background: var(--accent2); }
.btn-secondary { background: var(--bg2); border: 1px solid var(--border); color: var(--text); }
.btn-secondary:hover { background: var(--bg3); }
.btn-danger { background: rgba(239,68,68,.15); border: 1px solid rgba(239,68,68,.3); color: #fca5a5; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }

.btn-group { padding: 0 16px; display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }

/* ── PIN screen ── */
#screen-login {
  align-items: center; justify-content: center;
  padding: 32px 24px;
}
.login-logo {
  width: 72px; height: 72px; background: var(--accent);
  border-radius: 20px; display: flex; align-items: center; justify-content: center;
  margin-bottom: 20px;
}
.login-logo svg { width: 40px; height: 40px; color: #0f172a; }
.login-title { font-size: 1.6rem; font-weight: 700; margin-bottom: 6px; }
.login-sub   { font-size: .88rem; color: var(--text2); margin-bottom: 32px; }

.pin-display {
  display: flex; gap: 12px; margin-bottom: 24px; justify-content: center;
}
.pin-dot {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--border); transition: var(--trans);
}
.pin-dot.filled { background: var(--accent); border-color: var(--accent); }

.pin-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 12px; width: 100%; max-width: 280px;
}
.pin-key {
  aspect-ratio: 1; background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 1.4rem; font-weight: 600;
  color: var(--text); cursor: pointer; transition: var(--trans);
  display: flex; align-items: center; justify-content: center;
}
.pin-key:hover, .pin-key:active { background: var(--bg3); border-color: var(--accent); }
.pin-key.del { font-size: .9rem; color: var(--text2); }
.pin-error { color: var(--red); font-size: .82rem; margin-top: 12px; text-align: center; min-height: 20px; }

/* ── Section header ── */
.section-header {
  padding: 16px 16px 8px;
  font-size: .78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--text3);
}

/* ── Lista items ── */
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  background: var(--bg2);
}
.list-item:last-child { border-bottom: none; }
.list-icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.list-icon svg { width: 20px; height: 20px; }
.list-content { flex: 1; }
.list-title  { font-size: .9rem; font-weight: 500; }
.list-desc   { font-size: .75rem; color: var(--text2); margin-top: 2px; }
.list-right  { text-align: right; }
.list-val    { font-size: .9rem; font-weight: 600; }
.list-time   { font-size: .72rem; color: var(--text3); }

.list-wrap {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  margin: 0 16px 12px;
}

/* ── BP Badge ── */
.bp-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: .78rem; font-weight: 600;
}
.bp-badge.ok     { background: rgba(34,197,94,.15); color: var(--green); }
.bp-badge.warn   { background: rgba(234,179,8,.15); color: var(--yellow); }
.bp-badge.danger { background: rgba(249,115,22,.15); color: var(--orange); }
.bp-badge.crit   { background: rgba(239,68,68,.15); color: var(--red); }

/* ── Daily Brief ── */
.brief-section { margin: 0 16px 12px; }
.brief-card {
  background: linear-gradient(135deg, #1e293b, #0f1e33);
  border: 1px solid rgba(56,189,248,.25);
  border-radius: var(--radius); padding: 16px;
}
.brief-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 10px; font-size: .75rem;
  font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--accent);
}
.brief-header svg { width: 16px; height: 16px; }
.brief-text { font-size: .86rem; color: var(--text2); line-height: 1.5; }
.brief-actions { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.brief-action {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: .82rem; color: var(--text);
}
.brief-action::before {
  content: '→'; color: var(--accent);
  flex-shrink: 0; margin-top: 1px;
}

/* ── Gráfico simples ── */
.chart-wrap { padding: 0 16px 12px; }
.chart-bars {
  display: flex; align-items: flex-end; gap: 4px;
  height: 80px;
}
.chart-bar { flex: 1; border-radius: 4px 4px 0 0; min-height: 4px; transition: var(--trans); }
.chart-labels { display: flex; gap: 4px; margin-top: 4px; }
.chart-label { flex: 1; text-align: center; font-size: .6rem; color: var(--text3); }

/* ── Protocolo cards ── */
.protocol-card {
  background: var(--bg2); border: 2px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  margin: 0 16px 10px; cursor: pointer; transition: var(--trans);
}
.protocol-card.active { border-color: var(--accent); }
.protocol-card:hover  { border-color: var(--accent2); }
.protocol-name { font-size: 1rem; font-weight: 600; margin-bottom: 4px; }
.protocol-desc { font-size: .8rem; color: var(--text2); line-height: 1.4; }
.protocol-weights {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px;
}
.weight-tag {
  padding: 3px 8px; border-radius: 6px;
  background: var(--bg3); font-size: .68rem;
  color: var(--text2);
}
.weight-tag span { color: var(--accent); font-weight: 600; }

/* ── Progress bars ── */
.prog-bar-wrap { display: flex; flex-direction: column; gap: 10px; }
.prog-item { display: flex; flex-direction: column; gap: 4px; }
.prog-label { display: flex; justify-content: space-between; font-size: .78rem; color: var(--text2); }
.prog-label span { color: var(--text); font-weight: 600; }
.prog-bar { height: 6px; background: var(--bg3); border-radius: 3px; overflow: hidden; }
.prog-fill { height: 100%; border-radius: 3px; transition: width .5s ease; }

/* ── Upload ── */
.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 28px 16px; text-align: center; cursor: pointer;
  transition: var(--trans); color: var(--text2); font-size: .84rem;
}
.upload-zone:hover { border-color: var(--accent); color: var(--text); }
.upload-zone svg { width: 32px; height: 32px; margin-bottom: 8px; color: var(--text3); display: block; margin-inline: auto; }
.upload-preview {
  width: 100%; max-height: 200px; object-fit: cover;
  border-radius: var(--radius-sm); margin-top: 8px; display: none;
}

/* ── Loading ── */
.spinner {
  width: 22px; height: 22px; border: 3px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(15,23,42,.7); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
  flex-direction: column; gap: 14px;
}
.loading-overlay.active { display: flex; }
.loading-text { font-size: .9rem; color: var(--text2); }

/* ── Toast ── */
.toast-container { position: fixed; bottom: 70px; left: 0; right: 0; z-index: 200; pointer-events: none; display: flex; flex-direction: column-reverse; align-items: center; gap: 8px; padding: 0 16px; }
.toast {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 16px;
  font-size: .84rem; max-width: 360px; width: 100%;
  animation: toastIn .25s ease; pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
}
.toast.success { border-color: var(--green); color: var(--green); }
.toast.error   { border-color: var(--red); color: #fca5a5; }
.toast.warn    { border-color: var(--yellow); color: var(--yellow); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ── Offline banner ── */
.offline-bar {
  background: var(--orange); color: #0f172a;
  text-align: center; padding: 6px;
  font-size: .78rem; font-weight: 600; display: none;
}
.offline-bar.show { display: block; }

/* ── Misc ── */
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-0  { margin-bottom: 0; }
.text-center { text-align: center; }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-orange { color: var(--orange); }
.text-yellow { color: var(--yellow); }
.text-accent { color: var(--accent); }
.text-muted  { color: var(--text2); }
.hidden { display: none !important; }
.w-full { width: 100%; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Screen headers ── */
.screen-header {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; position: sticky; top: 56px; z-index: 50;
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.screen-header h2 { font-size: 1rem; font-weight: 600; flex: 1; }
.header-date { font-size: .75rem; color: var(--text3); }
.screen-header-simple { padding: 16px 16px 8px; }
.screen-header-simple h2 { font-size: 1.1rem; font-weight: 700; }

/* ── Topbar brand ── */
.topbar-brand { display: flex; align-items: center; gap: 8px; font-size: 1rem; font-weight: 700; flex: 1; }
.topbar-action {
  background: none; border: none; color: var(--text3);
  cursor: pointer; padding: 6px; border-radius: var(--radius-sm);
  display: flex; align-items: center;
}
.topbar-action:hover { color: var(--text); background: var(--bg2); }

/* ── Card score ── */
.card-score { display: flex; align-items: center; gap: 16px; padding: 20px 16px; }

/* ── Input group / row ── */
.input-group { display: flex; flex-direction: column; gap: 5px; flex: 1; }
.input-group label {
  font-size: .72rem; font-weight: 600; color: var(--text3);
  text-transform: uppercase; letter-spacing: .05em;
}
.input-group input,
.input-group select,
.input-group textarea {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px;
  color: var(--text); font-size: .9rem; font-family: var(--font);
  transition: var(--trans); outline: none; width: 100%;
}
.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(56,189,248,.12); }
.input-group input::placeholder,
.input-group textarea::placeholder { color: var(--text3); }
.input-group textarea { resize: vertical; min-height: 72px; }
.input-group select { appearance: none; cursor: pointer; }

.card .input-group input,
.card .input-group select,
.card .input-group textarea { background: var(--bg); }

.card textarea { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; color: var(--text); font-size: .9rem; font-family: var(--font); outline: none; resize: vertical; min-height: 72px; transition: var(--trans); }
.card textarea:focus { border-color: var(--accent); }

.input-row { display: flex; gap: 10px; align-items: flex-end; }
.input-sep { padding-bottom: 10px; font-size: 1.1rem; color: var(--text3); flex-shrink: 0; }
.optional { font-size: .7rem; color: var(--text3); font-weight: 400; text-transform: none; letter-spacing: 0; }

/* ── Slider group ── */
.slider-group { display: flex; flex-direction: column; gap: 6px; }
.slider-group label { font-size: .82rem; color: var(--text2); }
.slider-group label strong { color: var(--accent); }

/* ── Checkbox group ── */
.checkbox-group { display: flex; flex-wrap: wrap; gap: 8px; }
.checkbox-item {
  display: flex; align-items: center; gap: 7px;
  font-size: .85rem; color: var(--text2); cursor: pointer;
  padding: 6px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg);
  transition: var(--trans);
}
.checkbox-item input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }
.checkbox-item:has(input:checked) { border-color: var(--accent); color: var(--text); }

/* ── Checkin row ── */
.checkin-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.checkin-btn {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; padding: 16px 10px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer; transition: var(--trans);
  font-size: .82rem; color: var(--text2);
}
.checkin-btn:hover { border-color: var(--accent); color: var(--text); background: var(--bg3); }
.checkin-btn span:first-of-type { font-size: .9rem; font-weight: 600; color: var(--text); }

/* ── Badges de status ── */
.badge-ok      { background: rgba(34,197,94,.15); color: var(--green); font-size: .7rem; font-weight: 600; padding: 3px 8px; border-radius: 10px; }
.badge-pending { background: rgba(100,116,139,.15); color: var(--text3); font-size: .7rem; font-weight: 600; padding: 3px 8px; border-radius: 10px; }

/* ── Metric card complemento ── */
.metric-card { cursor: default; }
.metric-card .metric-icon { font-size: 1.2rem; margin-bottom: 4px; }
.metric-card .metric-label { font-size: .68rem; color: var(--text3); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.metric-card .val { font-size: 1.25rem; font-weight: 700; }
.metric-card .sub { font-size: .72rem; color: var(--text2); }

/* ── BP Average row ── */
.bp-avg-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.bp-avg-block { text-align: center; }
.bp-avg-val { font-size: 2rem; font-weight: 700; color: var(--accent); }
.bp-avg-label { font-size: .7rem; color: var(--text3); text-transform: uppercase; letter-spacing: .05em; }
.bp-avg-sep { font-size: 1.8rem; color: var(--text3); }
.bp-avg-unit { font-size: .78rem; color: var(--text3); margin-left: auto; }
.bp-streak { font-size: .8rem; margin-top: 4px; }

/* ── Range buttons ── */
.range-btns {
  display: flex; gap: 8px; margin: 0 16px 12px;
}
.range-btns button {
  flex: 1; padding: 8px 4px; background: var(--bg2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text2); font-size: .8rem; font-weight: 600; cursor: pointer;
  transition: var(--trans);
}
.range-btns button.active { background: var(--accent); border-color: var(--accent); color: #0f172a; }
.range-btns button:hover:not(.active) { border-color: var(--accent); color: var(--text); }

/* ── Chips row ── */
.chips-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ── Btn variants ── */
.btn-full    { width: 100%; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); padding: 12px; border-radius: var(--radius); font-size: .88rem; font-weight: 600; cursor: pointer; transition: var(--trans); display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost  { background: transparent; border: none; color: var(--text3); padding: 10px; border-radius: var(--radius); font-size: .85rem; font-weight: 500; cursor: pointer; transition: var(--trans); width: 100%; }
.btn-ghost:hover { color: var(--text); background: var(--bg2); }
.btn-sm     { padding: 7px 14px; font-size: .8rem; border-radius: var(--radius-sm); width: auto; }
.btn-link   { background: none; border: none; color: var(--accent); font-size: .75rem; font-weight: 600; cursor: pointer; padding: 2px 6px; border-radius: 4px; }
.btn-link:hover { background: rgba(56,189,248,.1); }

/* ── Upload zone complemento ── */
.upload-zone {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 24px 16px; margin-top: 8px;
}
.upload-zone.drag-over { border-color: var(--accent); background: rgba(56,189,248,.06); }
.upload-zone span { font-size: .82rem; color: var(--text3); }

/* ── Insights ── */
.score-avg-row { display: flex; align-items: center; justify-content: space-around; gap: 12px; }
.score-avg-block { text-align: center; }
.score-big { font-size: 2.2rem; font-weight: 800; }
.score-ring-sm { width: 72px; height: 72px; }
.score-pill { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: .82rem; font-weight: 700; }
.score-pill.good { background: rgba(34,197,94,.15); color: var(--green); }
.score-pill.warn { background: rgba(234,179,8,.15); color: var(--yellow); }
.score-pill.bad  { background: rgba(239,68,68,.15); color: var(--red); }
.score-big.good { color: var(--green); }
.score-big.warn { color: var(--yellow); }
.score-big.bad  { color: var(--red); }

/* ── Componentes insights ── */
.component-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.component-label { width: 68px; font-size: .75rem; color: var(--text2); flex-shrink: 0; }
.component-bar-track { flex: 1; height: 6px; background: var(--bg3); border-radius: 3px; overflow: hidden; }
.component-bar-fill  { height: 100%; border-radius: 3px; transition: width .5s ease; }
.component-val { width: 28px; font-size: .78rem; font-weight: 700; text-align: right; flex-shrink: 0; }

/* ── Relatórios ── */
.report-week-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 0 16px 10px; }
.report-week-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.report-week-title { font-size: .9rem; font-weight: 600; }
.report-result { margin-top: 8px; }

/* ── Rotina ── */
.routine-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: .88rem; }
.routine-row:last-child { border-bottom: none; }

/* ── Config ── */
.config-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: .88rem; }
.config-row:last-child { border-bottom: none; }
.config-nav-list { display: flex; flex-direction: column; gap: 2px; }
.config-nav-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 0;
  background: none; border: none; border-bottom: 1px solid var(--border);
  color: var(--text); font-size: .9rem; cursor: pointer; width: 100%;
  transition: var(--trans);
}
.config-nav-item:last-child { border-bottom: none; }
.config-nav-item:hover { color: var(--accent); }
.config-nav-item span:last-of-type { margin-left: auto; color: var(--text3); }
.export-btns { display: flex; gap: 10px; }
.export-btns .btn-outline { flex: 1; }
.card-disclaimer { background: rgba(56,189,248,.06); border-color: rgba(56,189,248,.2); }
.card-disclaimer p { font-size: .8rem; color: var(--text2); line-height: 1.5; }

/* ── Meal ── */
.meal-thumb { width: 42px; height: 42px; object-fit: cover; border-radius: 8px; }
.meal-photo { padding: 0; overflow: hidden; background: none; }
.meal-ai-score { font-size: 1rem; font-weight: 700; color: var(--green); }
.meal-ai-score small { font-size: .65rem; color: var(--text3); font-weight: 400; }
.meal-cal { font-size: .75rem; color: var(--text3); }

/* ── Protocolo card complemento ── */
.protocol-card { margin-bottom: 10px; cursor: default; }
.protocol-header { display: flex; align-items: flex-start; gap: 12px; }
.protocol-icon { font-size: 1.4rem; flex-shrink: 0; }
.protocol-info { flex: 1; }
.badge-active { background: rgba(56,189,248,.15); color: var(--accent); font-size: .7rem; font-weight: 600; padding: 3px 8px; border-radius: 10px; white-space: nowrap; }
.protocol-guidelines { font-size: .78rem; color: var(--text2); margin-top: 10px; line-height: 1.5; border-top: 1px solid var(--border); padding-top: 8px; }

/* ── Empty state ── */
.empty-state { padding: 32px 16px; text-align: center; color: var(--text3); font-size: .85rem; }

/* ── Loading overlay ── */
#loading-overlay {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(15,23,42,.75); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
  flex-direction: column; gap: 16px;
}
#loading-overlay.active { display: flex; }
.loading-spinner {
  width: 36px; height: 36px; border: 3px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* ── Toast container ── */
#toast-container {
  position: fixed; bottom: 70px; left: 0; right: 0; z-index: 200;
  pointer-events: none; display: flex; flex-direction: column-reverse;
  align-items: center; gap: 8px; padding: 0 16px;
}
.toast {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 16px;
  font-size: .84rem; max-width: 360px; width: 100%;
  animation: toastIn .25s ease; pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
}
.toast.success { border-color: var(--green); color: var(--green); }
.toast.error   { border-color: var(--red); color: #fca5a5; }
.toast.warn    { border-color: var(--yellow); color: var(--yellow); }
.toast.info    { border-color: var(--accent); color: var(--accent); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ── Bottom nav icons ── */
.nav-item svg { width: 20px; height: 20px; }

/* ── Login wrap ── */
.login-wrap {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; flex: 1; padding: 32px 24px;
}
#screen-login { justify-content: center; align-items: stretch; }

/* ── Score ring SVG rotation ── */
.score-ring svg { transform: rotate(-90deg); display: block; }

/* ── Chart wrap inline ── */
#bp-chart, #insights-chart { min-height: 96px; }

/* ── Btn-primary base ── */
.btn-primary {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 14px; border-radius: var(--radius);
  background: var(--accent); color: #0f172a;
  font-size: .95rem; font-weight: 700; cursor: pointer;
  border: none; transition: var(--trans); font-family: var(--font);
}
.btn-primary:hover, .btn-primary:active { background: var(--accent2); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

/* ── Responsivo desktop ── */
@media (min-width: 640px) {
  .metrics-grid    { grid-template-columns: repeat(3, 1fr); }
  .quick-actions   { grid-template-columns: repeat(3, 1fr); }
  .form-row        { grid-template-columns: repeat(3, 1fr); }
  .screen, .topbar, .bottom-nav {
    max-width: 480px; margin-inline: auto;
  }
  .bottom-nav      { left: 50%; transform: translateX(-50%); width: 480px; }
  .loading-overlay { padding-inline: calc(50% - 240px); }
}
