/* ============================================================
   NutriVeda Wellness — User app styles
   Palette from brand image:
   Lime Green #B0E454 | Forest Green #224F10 | Soft Ivory #EAFFD0 | Jet Black #0D0D0D
   ============================================================ */
:root {
  --lime: #B0E454;
  --lime-soft: #d3f39a;
  --forest: #224F10;
  --forest-2: #2f6b17;
  --ivory: #EAFFD0;
  --ivory-soft: #F7FDEF;
  --black: #0D0D0D;
  --white: #ffffff;
  --muted: #5b6b52;
  --border: #dcecc8;
  --danger: #c0392b;
  --amber: #b7791f;
  --radius: 16px;
  --shadow: 0 8px 30px rgba(34, 79, 16, 0.10);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Poppins', system-ui, -apple-system, sans-serif;
  background: var(--ivory-soft);
  color: var(--black);
  min-height: 100vh;
  font-size: 15px;
}
a { color: var(--forest); text-decoration: none; }

/* ---------- Top navigation ---------- */
.topnav {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 14px 5%;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; color: var(--forest); }
.brand .leaf {
  width: 36px; height: 36px; border-radius: 50% 50% 50% 4px;
  background: linear-gradient(135deg, var(--lime), var(--forest-2));
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--white); font-size: 1.1rem;
}
.brand-logo { height: 42px; width: auto; display: block; }
@media (max-width: 640px) { .brand-logo { height: 32px; } }
.auth-logo { display: block; height: 46px; width: auto; margin: 0 auto 18px; }
.print-logo { display: none; }
.topnav .navlinks { display: flex; align-items: center; gap: 22px; }
.topnav .navlinks a { font-weight: 500; color: var(--forest); font-size: .92rem; }
.topnav .navlinks a:hover { color: var(--forest-2); }
.topnav .navlinks a.active { border-bottom: 2px solid var(--lime); padding-bottom: 3px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; border: none; cursor: pointer; font-family: inherit;
  font-weight: 600; font-size: .92rem; border-radius: 999px;
  padding: 11px 26px; transition: all .2s ease; text-align: center;
}
.btn-primary { background: var(--forest); color: var(--white); }
.btn-primary:hover { background: var(--forest-2); transform: translateY(-1px); }
.btn-lime { background: var(--lime); color: var(--black); }
.btn-lime:hover { background: #a2d944; transform: translateY(-1px); }
.btn-outline { background: transparent; color: var(--forest); border: 2px solid var(--forest); }
.btn-outline:hover { background: var(--ivory); }
.btn-sm { padding: 7px 16px; font-size: .82rem; }
.btn-danger { background: #fdecea; color: var(--danger); }
.btn-danger:hover { background: #fadbd8; }
.btn-block { display: block; width: 100%; }

/* ---------- Layout ---------- */
.container { max-width: 1100px; margin: 0 auto; padding: 34px 5%; }
.container-narrow { max-width: 520px; margin: 0 auto; padding: 48px 5%; }
.page-title { font-size: 1.6rem; font-weight: 700; color: var(--forest); margin-bottom: 6px; }
.page-sub { color: var(--muted); margin-bottom: 26px; }

.card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 28px; margin-bottom: 22px;
  border: 1px solid var(--border);
}
.card h3 { color: var(--forest); margin-bottom: 14px; font-size: 1.08rem; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 860px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ---------- Stat cards ---------- */
.stat {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: var(--shadow);
}
.stat .label { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.stat .value { font-size: 1.9rem; font-weight: 700; color: var(--forest); margin-top: 4px; }
.stat .hint { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.stat.stat-lime { background: linear-gradient(135deg, var(--lime) 0%, var(--lime-soft) 100%); border: none; }
.stat.stat-lime .value, .stat.stat-lime .label, .stat.stat-lime .hint { color: var(--black); }

/* ---------- Forms ---------- */
label { display: block; font-weight: 600; font-size: .86rem; margin: 14px 0 6px; color: var(--forest); }
input[type=text], input[type=number], input[type=email], input[type=tel], input[type=date], input[type=password], select, textarea {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: 10px;
  font-family: inherit; font-size: .95rem; background: var(--white); color: var(--black);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--lime); box-shadow: 0 0 0 3px rgba(176, 228, 84, .3); }
textarea { resize: vertical; min-height: 90px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }

/* ---------- Alerts ---------- */
.alert { padding: 13px 18px; border-radius: 12px; margin-bottom: 16px; font-size: .9rem; font-weight: 500; }
.alert-success { background: var(--ivory); color: var(--forest); border: 1px solid var(--lime); }
.alert-error   { background: #fdecea; color: var(--danger); border: 1px solid #f5c6c0; }
.alert-info    { background: #eef7ff; color: #1a5276; border: 1px solid #cfe7f8; }
.alert-warning { background: #fef7e6; color: var(--amber); border: 1px solid #f6e3b8; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.badge-green  { background: var(--ivory); color: var(--forest); }
.badge-lime   { background: var(--lime); color: var(--black); }
.badge-amber  { background: #fef7e6; color: var(--amber); }
.badge-red    { background: #fdecea; color: var(--danger); }
.badge-gray   { background: #eee; color: #555; }

/* ---------- Tables ---------- */
table.data { width: 100%; border-collapse: collapse; background: var(--white); }
table.data th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 12px; border-bottom: 2px solid var(--border); }
table.data td { padding: 11px 12px; border-bottom: 1px solid #eef4e4; font-size: .9rem; }
table.data tr:hover td { background: var(--ivory-soft); }
.text-right { text-align: right; }
.muted { color: var(--muted); font-size: .85rem; }

/* ---------- Meal sections ---------- */
.meal-block { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 18px; background: var(--white); }
.meal-head { display: flex; justify-content: space-between; align-items: center; padding: 13px 20px; background: var(--ivory); font-weight: 700; color: var(--forest); }
.meal-head .kcal { font-size: .85rem; background: var(--lime); color: var(--black); padding: 3px 12px; border-radius: 999px; }
.meal-body { padding: 6px 20px 16px; }

/* ---------- OTP boxes ---------- */
.otp-input { letter-spacing: 14px; text-align: center; font-size: 1.5rem; font-weight: 700; }

/* ---------- Auth card ---------- */
.auth-card { background: var(--white); border-radius: 22px; box-shadow: var(--shadow); padding: 40px 36px; border-top: 6px solid var(--lime); }
.auth-card h1 { color: var(--forest); font-size: 1.5rem; margin-bottom: 6px; }
.auth-card p.sub { color: var(--muted); font-size: .9rem; margin-bottom: 10px; }
.auth-tabs { display: flex; background: var(--ivory-soft); border-radius: 999px; padding: 4px; margin: 18px 0 4px; }
.auth-tabs button { flex: 1; border: none; background: transparent; padding: 9px; border-radius: 999px; font-family: inherit; font-weight: 600; cursor: pointer; color: var(--muted); }
.auth-tabs button.active { background: var(--forest); color: var(--white); }

/* ---------- Footer ---------- */
.app-footer { text-align: center; padding: 28px; color: var(--muted); font-size: .82rem; }

/* ---------- Progress bar ---------- */
.progress { background: var(--ivory); border-radius: 999px; height: 14px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--lime), var(--forest-2)); border-radius: 999px; transition: width .4s; }

/* ---------- Gamification ---------- */
.gami-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
@media (max-width: 720px) { .gami-stats { grid-template-columns: 1fr 1fr; } }
.gami-stat { background: var(--ivory-soft); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; text-align: center; }
.gami-stat .num { font-size: 1.7rem; font-weight: 800; color: var(--forest); line-height: 1.1; }
.gami-stat .lbl { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-top: 3px; }
.gami-stat.flame { background: linear-gradient(135deg, var(--lime) 0%, var(--lime-soft) 100%); border: none; }
.gami-stat.flame .num, .gami-stat.flame .lbl { color: var(--black); }
.badge-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 720px) { .badge-grid { grid-template-columns: 1fr 1fr; } }
.badge-tile { border: 1.5px solid var(--border); border-radius: 16px; padding: 16px 12px; text-align: center; position: relative; background: var(--white); }
.badge-tile .bicon { font-size: 1.9rem; display: block; margin-bottom: 6px; }
.badge-tile .btitle { font-weight: 700; font-size: .86rem; color: var(--forest); }
.badge-tile .bdesc { font-size: .72rem; color: var(--muted); margin-top: 3px; line-height: 1.35; }
.badge-tile .bprog { display: inline-block; margin-top: 8px; font-size: .7rem; font-weight: 700; background: var(--ivory-soft); border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; color: var(--muted); }
.badge-tile.earned { background: linear-gradient(160deg, var(--ivory) 0%, var(--lime-soft) 100%); border-color: var(--lime); box-shadow: 0 6px 18px rgba(176, 228, 84, .35); }
.badge-tile.earned .bdate { display: inline-block; margin-top: 8px; font-size: .68rem; font-weight: 700; background: var(--forest); color: var(--lime); border-radius: 999px; padding: 2px 10px; }
.badge-tile.locked { opacity: .62; }
.badge-tile.locked .bicon { filter: grayscale(1); }

/* ---------- Macro chips ---------- */
.macros { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.macros span { font-size: .72rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--ivory-soft); border: 1px solid var(--border); color: var(--forest); }
.macros .m-p { background: #eef7ff; border-color: #cfe7f8; color: #1a5276; }
.macros .m-c { background: #fef7e6; border-color: #f6e3b8; color: var(--amber); }
.macros .m-f { background: #fdf0ec; border-color: #f5d5c8; color: #b0562e; }

@media print {
  .topnav, .no-print, .app-footer { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ccc; }
  .print-logo { display: block !important; height: 54px; width: auto; margin: 0 auto 18px; }
}
