:root {
  --green: #21be3a;
  --green-dark: #189c2f;
  --green-light: #e8f5e8;
  --text: #1a1a1a;
  --muted: #737373;
  --border: #e2e2e2;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: #f7f8f7; color: var(--text); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }

.app-header {
  position: sticky; top: 0; z-index: 60; background: #fff; border-bottom: 1px solid var(--border);
  padding: 12px 18px; display: flex; align-items: center; gap: 14px;
}
.app-header .logo { font-size: 17px; font-weight: 700; font-style: italic; color: var(--green-dark); margin-left: auto; }
.app-greeting { font-size: 15px; font-weight: 700; }

.header-streak-btn {
  display: inline-flex; align-items: center; gap: 4px; background: #fff7e6; border: 1px solid #f5d999;
  border-radius: 999px; padding: 4px 10px 4px 8px; cursor: pointer; margin-left: 8px;
}
.header-streak-flame { font-size: 15px; line-height: 1; filter: grayscale(1); opacity: .4; }
.header-streak-btn.is-active .header-streak-flame { filter: none; opacity: 1; }
.header-streak-badge { font-size: 12.5px; font-weight: 800; color: #8a5a00; }

.header-notif-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  background: none; border: none; font-size: 19px; cursor: pointer; padding: 4px 6px; margin-left: 4px; line-height: 1;
}
.header-notif-bell { filter: grayscale(1); opacity: .55; }
.header-notif-badge {
  position: absolute; top: 0; right: 0; background: #c0392b; color: #fff; font-size: 10px; font-weight: 800;
  border-radius: 999px; min-width: 16px; height: 16px; display: flex; align-items: center; justify-content: center;
  padding: 0 3px; line-height: 1;
}

.notif-list { display: flex; flex-direction: column; gap: 1px; max-height: 60vh; overflow-y: auto; margin: 0 -8px; }
.notif-row {
  display: flex; align-items: center; gap: 12px; width: calc(100% - 16px); margin: 0 8px; text-align: left;
  background: none; border: none; border-radius: 10px; padding: 10px 8px; cursor: pointer; font-family: inherit;
}
.notif-row:hover { background: #f7f8f7; }
.notif-avatar-wrap { position: relative; flex-shrink: 0; }
.notif-avatar {
  width: 40px; height: 40px; border-radius: 50%; overflow: hidden; background: var(--green-light);
  color: var(--green-dark); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px;
}
.notif-avatar img { width: 100%; height: 100%; object-fit: cover; }
.notif-type-badge {
  position: absolute; bottom: -2px; right: -2px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 0 2px #fff; display: flex; align-items: center; justify-content: center; font-size: 10px;
}
.notif-body { flex: 1; min-width: 0; }
.notif-text { font-size: 13.5px; line-height: 1.35; color: var(--text); }
.notif-text strong { font-weight: 700; }
.notif-row.is-unread .notif-text { font-weight: 600; }
.notif-time { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex-shrink: 0; }
.app-menu-toggle {
  display: none; background: none; border: none; font-size: 20px; cursor: pointer; padding: 4px 6px; line-height: 1;
}

.app-sidebar-overlay { display: none; }

.app-sidebar {
  position: fixed; top: 49px; left: 0; width: 230px; flex-shrink: 0;
  background: #fff; border-right: 1px solid var(--border); height: calc(100vh - 49px);
  padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; z-index: 70;
}
.app-nav { display: flex; flex-direction: column; gap: 2px; margin-bottom: 14px; }
.app-nav-link {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; font-size: 14.5px;
  font-weight: 600; color: var(--text); cursor: pointer; border: none; background: none; width: 100%; text-align: left;
  position: relative;
}
.app-nav-link:hover { background: var(--green-light); }
.app-nav-link.is-active { background: var(--green-light); color: var(--green-dark); }
.app-nav-icon { font-size: 17px; width: 20px; text-align: center; flex-shrink: 0; }
.app-nav-soon {
  margin-left: auto; font-size: 9.5px; font-weight: 700; color: var(--muted); background: var(--border);
  padding: 2px 6px; border-radius: 999px; text-transform: uppercase; letter-spacing: .3px;
}
.app-nav-whatsapp { color: #189c2f; border-top: 1px solid var(--border); border-radius: 0; padding-top: 16px; margin-top: 4px; }
.app-nav-logout { color: #c0392b; margin-top: auto; }
.app-nav-logout:hover { background: #fdecea; }

.app-main { max-width: 760px; margin: 0; padding: 28px 32px 60px 262px; width: 100%; }

@media (max-width: 899px) {
  .app-menu-toggle { display: block; }
  .app-header .logo { margin-left: 0; }
  .app-greeting { margin-left: auto; }
  .app-main { padding: 24px 20px 50px; max-width: 100%; }
  .app-sidebar {
    top: 0; height: 100vh; z-index: 90; transform: translateX(-100%);
    transition: transform .2s ease; box-shadow: 2px 0 16px rgba(0,0,0,.12); padding-top: 60px;
  }
  .app-sidebar.is-open { transform: translateX(0); }
  .app-sidebar-overlay {
    display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 80;
    opacity: 0; pointer-events: none; transition: opacity .2s ease;
  }
  .app-sidebar-overlay.is-open { opacity: 1; pointer-events: auto; }
}

/* Cards genéricos reaproveitados nas páginas do app */
.app-card { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 24px; margin-bottom: 18px; }
.app-card h1, .app-card h2 { margin: 0 0 6px; font-size: 19px; }
.app-card .app-card-sub { font-size: 13px; color: var(--muted); margin: 0 0 20px; }

.app-input {
  width: 100%; padding: 12px 13px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 14px; margin-bottom: 4px;
}
.app-input:focus { outline: none; border-color: var(--green); }

.app-btn {
  background: var(--green); color: #fff; border: none; border-radius: 999px; padding: 12px 22px;
  font-size: 14px; font-weight: 700; cursor: pointer;
}
.app-btn:hover { background: var(--green-dark); }
.app-btn:disabled { opacity: .6; cursor: not-allowed; }
.app-btn-outline {
  background: #fff; color: var(--green); border: 1.5px solid var(--green); border-radius: 999px; padding: 10px 20px;
  font-size: 13.5px; font-weight: 700; cursor: pointer;
}
.app-btn-outline:hover { background: var(--green-light); }

.app-alert {
  background: #fdecea; color: #c0392b; border: 1px solid #f0c4c0; border-radius: 8px;
  padding: 10px 14px; font-size: 13px; margin-bottom: 16px; display: none;
}
.app-alert.is-visible { display: block; }
.app-alert.is-success { background: var(--green-light); color: var(--green-dark); border-color: #b8e6c0; }

.quiz-checks { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.quiz-checks label {
  display: flex; align-items: center; gap: 10px; font-size: 14.5px; border: 1.5px solid var(--border);
  border-radius: 10px; padding: 12px 14px; cursor: pointer;
}
.quiz-checks input { width: 17px; height: 17px; accent-color: var(--green); flex-shrink: 0; }

.app-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 300;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.app-modal-overlay.is-visible { opacity: 1; pointer-events: auto; }
.app-modal {
  background: #fff; border-radius: 16px; padding: 22px; max-width: 340px; width: 100%;
  max-height: 85vh; overflow-y: auto; transform: translateY(10px); transition: transform .2s;
}
.app-modal-overlay.is-visible .app-modal { transform: translateY(0); }
.app-modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.app-modal-header h2 { font-size: 17px; margin: 0; }
.app-modal-close-btn { background: none; border: none; font-size: 20px; color: var(--muted); cursor: pointer; line-height: 1; padding: 2px 6px; }

.journey-history-link { display: block; text-align: center; font-size: 13px; font-weight: 700; color: var(--green-dark); margin: 4px 0 18px; }
.journey-history-link:hover { text-decoration: underline; }

.weight-log-history { display: flex; flex-direction: column; gap: 8px; }
.wlh-row {
  display: flex; align-items: center; justify-content: space-between; padding: 9px 4px;
  border-bottom: 1px solid var(--border); font-size: 13.5px;
}
.wlh-row:last-child { border-bottom: none; }
.wlh-date { color: var(--muted); }
.wlh-weight { font-weight: 700; display: flex; align-items: center; gap: 6px; }
.wlh-delta { font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.wlh-delta.is-down { background: var(--green-light); color: var(--green-dark); }
.wlh-delta.is-up { background: #fdecea; color: #c0392b; }
.wlh-delta.is-flat { background: #f0f0f0; color: var(--muted); }

.app-empty-state { text-align: center; padding: 40px 20px; }
.app-empty-state .aes-icon { font-size: 40px; margin-bottom: 12px; }
.app-empty-state h2 { font-size: 18px; margin: 0 0 8px; }
.app-empty-state p { font-size: 14px; color: var(--muted); margin: 0; }
