/* صحت و خوراک ٹریکر — انداز / Styles */
@import url('https://fonts.googleapis.com/css2?family=Noto+Nastaliq+Urdu:wght@400;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --ink: #1c2430;
  --ink-soft: #5c6b7d;
  --line: #dfe5ec;
  --brand: #1f6f8b;
  --brand-2: #b0407a;
  --ok: #2e9e5b;
  --warn: #d98324;
  --bad: #c0392b;
  --shadow: 0 2px 10px rgba(20,35,55,.07);
  --shadow-lg: 0 8px 28px rgba(20,35,55,.12);
  --r: 14px;
  --ur: 'Noto Nastaliq Urdu', 'Jameel Noori Nastaleeq', 'Alvi Nastaleeq', serif;
  --lat: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12171e; --card: #1b222c; --ink: #e8edf3; --ink-soft: #9aa8b8;
    --line: #2b3542; --shadow: 0 2px 10px rgba(0,0,0,.35); --shadow-lg: 0 8px 28px rgba(0,0,0,.5);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--lat); direction: rtl;
  font-size: 15px; line-height: 1.7;
}
.ur { font-family: var(--ur); line-height: 2.4; }
.fr { font-family: var(--lat); direction: ltr; font-size: .82em; color: var(--ink-soft); }
input, select, button, textarea { font-family: inherit; font-size: 1rem; color: inherit; }

/* ---------- ہیڈر ---------- */
header.top {
  position: sticky; top: 0; z-index: 40;
  background: linear-gradient(135deg, #1f6f8b, #17506b);
  color: #fff; padding: 10px 14px; box-shadow: var(--shadow-lg);
}
header.top .row { display: flex; align-items: center; gap: 10px; max-width: 1100px; margin: 0 auto; }
header.top h1 { font-family: var(--ur); font-size: 1.15rem; margin: 0; font-weight: 700; line-height: 2; flex: 1; }
.who { display: flex; align-items: center; gap: 7px; background: rgba(255,255,255,.16); padding: 4px 11px; border-radius: 999px; font-size: .85rem; }
.who .dot { width: 11px; height: 11px; border-radius: 50%; background: #fff; }
.btn-ghost { background: rgba(255,255,255,.14); border: 0; color: #fff; padding: 6px 12px; border-radius: 9px; cursor: pointer; font-size: .85rem; }
.btn-ghost:hover { background: rgba(255,255,255,.26); }

nav.tabs { display: flex; gap: 4px; max-width: 1100px; margin: 8px auto 0; overflow-x: auto; }
nav.tabs button {
  flex: 1; min-width: 92px; background: rgba(255,255,255,.10); border: 0; color: #fff;
  padding: 9px 6px; border-radius: 10px 10px 0 0; cursor: pointer;
  font-family: var(--ur); font-size: .95rem; line-height: 2; white-space: nowrap;
}
nav.tabs button.on { background: var(--bg); color: var(--brand); font-weight: 700; }

main { max-width: 1100px; margin: 0 auto; padding: 14px 12px 90px; }

/* ---------- کارڈ ---------- */
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px; margin-bottom: 14px; border: 1px solid var(--line); }
.card > h2 { font-family: var(--ur); font-size: 1.05rem; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; line-height: 2.2; }
.card > h2 .em { font-size: 1.25rem; }
.card.tint { border-inline-start: 5px solid var(--brand); }
.sub { color: var(--ink-soft); font-size: .85rem; }

.grid { display: grid; gap: 10px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 720px) { .g3, .g4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 420px) { .g2 { grid-template-columns: 1fr; } }

/* ---------- فارم ---------- */
label.f { display: block; margin-bottom: 4px; }
label.f > span { display: block; font-family: var(--ur); font-size: .9rem; line-height: 2.1; color: var(--ink-soft); }
input[type=text], input[type=number], input[type=date], input[type=time], input[type=password], select, textarea {
  width: 100%; padding: 9px 11px; border: 1.5px solid var(--line); border-radius: 10px;
  background: var(--card); outline: none; transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); }
textarea { min-height: 70px; resize: vertical; font-family: var(--ur); line-height: 2.2; }

.btn {
  background: var(--brand); color: #fff; border: 0; padding: 11px 18px; border-radius: 11px;
  cursor: pointer; font-family: var(--ur); font-size: 1rem; line-height: 2; font-weight: 700;
  box-shadow: var(--shadow);
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.sec { background: var(--card); color: var(--brand); border: 1.5px solid var(--brand); }
.btn.sm { padding: 6px 12px; font-size: .9rem; }
.btn.danger { background: var(--bad); }

/* ---------- تاریخ نیویگیشن ---------- */
.datenav { display: flex; align-items: center; gap: 8px; justify-content: center; flex-wrap: wrap; }
.datenav input[type=date] { max-width: 175px; text-align: center; }
.datenav .arrow { background: var(--card); border: 1.5px solid var(--line); width: 40px; height: 40px; border-radius: 11px; cursor: pointer; font-size: 1.2rem; }

/* ---------- کھانے کے حصے ---------- */
.meal { border: 1.5px solid var(--line); border-radius: 12px; padding: 11px; margin-bottom: 11px; }
.meal > h3 { font-family: var(--ur); font-size: 1rem; margin: 0 0 8px; line-height: 2.1; display: flex; align-items: center; gap: 7px; }
.meal .adder { display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-end; }
.meal .adder .grow { flex: 1 1 190px; }
.meal .adder .narrow { flex: 0 0 88px; }

ul.items { list-style: none; margin: 9px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
ul.items li {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px;
  background: var(--bg); border-radius: 9px; border-inline-start: 4px solid var(--line);
}
ul.items li .nm { flex: 1; font-family: var(--ur); line-height: 2; }
ul.items li .tag { font-size: .72rem; padding: 2px 8px; border-radius: 999px; color: #fff; font-family: var(--ur); line-height: 1.9; }
ul.items li .q { font-size: .82rem; color: var(--ink-soft); white-space: nowrap; }
ul.items li .x { background: none; border: 0; color: var(--bad); cursor: pointer; font-size: 1.1rem; padding: 0 4px; }

/* ---------- کاؤنٹر ---------- */
.counters { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 9px; }
.counter { background: var(--bg); border: 1.5px solid var(--line); border-radius: 12px; padding: 9px; text-align: center; }
.counter .lb { font-family: var(--ur); font-size: .88rem; line-height: 2; }
.counter .ctl { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 4px; }
.counter button { width: 30px; height: 30px; border-radius: 8px; border: 1.5px solid var(--line); background: var(--card); cursor: pointer; font-size: 1.1rem; line-height: 1; }
.counter .v { min-width: 30px; font-weight: 700; font-size: 1.15rem; }

/* ---------- ریٹنگ ---------- */
.rate { display: flex; gap: 5px; flex-wrap: wrap; }
.rate button {
  flex: 1; min-width: 38px; padding: 8px 2px; border: 1.5px solid var(--line); background: var(--card);
  border-radius: 9px; cursor: pointer; font-size: 1.05rem;
}
.rate button.on { border-color: var(--brand); background: var(--brand); color: #fff; transform: scale(1.04); }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  padding: 7px 13px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--card);
  cursor: pointer; font-family: var(--ur); font-size: .9rem; line-height: 2;
}
.chip.on { background: var(--bad); border-color: var(--bad); color: #fff; }

/* ---------- تجزیہ ---------- */
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 11px; text-align: center; box-shadow: var(--shadow); }
.stat .v { font-size: 1.6rem; font-weight: 800; line-height: 1.3; }
.stat .l { font-family: var(--ur); font-size: .82rem; color: var(--ink-soft); line-height: 1.9; }

.bar-row { display: grid; grid-template-columns: 130px 1fr 88px; gap: 8px; align-items: center; margin-bottom: 7px; }
.bar-row .nm { font-family: var(--ur); font-size: .88rem; line-height: 1.9; text-align: start; }
.bar-track { background: var(--bg); border-radius: 999px; height: 20px; position: relative; overflow: hidden; border: 1px solid var(--line); }
.bar-fill { height: 100%; border-radius: 999px; transition: width .4s; }
.bar-target { position: absolute; top: -2px; bottom: -2px; width: 2.5px; background: var(--ink); opacity: .55; }
.bar-row .val { font-size: .8rem; color: var(--ink-soft); text-align: start; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .72rem; font-family: var(--ur); line-height: 1.9; color: #fff; }
.p-manque { background: var(--bad); } .p-faible { background: var(--warn); }
.p-ok { background: var(--ok); } .p-trop { background: #8b2f8b; }

.reco { border-radius: 12px; padding: 11px 13px; margin-bottom: 9px; border-inline-start: 5px solid; background: var(--bg); }
.reco .t { font-family: var(--ur); font-size: .98rem; line-height: 2.2; }
.reco .w { font-size: .8rem; color: var(--ink-soft); margin-top: 3px; font-family: var(--ur); line-height: 1.9; }
.reco .fr { margin-top: 2px; }

table.tbl { width: 100%; border-collapse: collapse; font-size: .87rem; }
table.tbl th, table.tbl td { padding: 7px 9px; border-bottom: 1px solid var(--line); text-align: start; }
table.tbl th { font-family: var(--ur); color: var(--ink-soft); font-weight: 600; font-size: .85rem; }
table.tbl td.ur { font-family: var(--ur); line-height: 2; }
.pos { color: var(--ok); font-weight: 700; } .neg { color: var(--bad); font-weight: 700; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: .78rem; color: var(--ink-soft); margin-top: 6px; }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-inline-end: 4px; }

/* ---------- لاگ اِن ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: linear-gradient(150deg, #1f6f8b 0%, #17506b 55%, #123b52 100%); }
.login-box { background: var(--card); border-radius: 20px; padding: 26px 22px; width: 100%; max-width: 380px; box-shadow: var(--shadow-lg); text-align: center; }
.login-box h1 { font-family: var(--ur); font-size: 1.35rem; margin: 0 0 4px; line-height: 2.2; }
.userpick { display: flex; gap: 10px; margin: 16px 0; }
.userpick button {
  flex: 1; padding: 14px 6px; border-radius: 14px; border: 2.5px solid var(--line);
  background: var(--card); cursor: pointer; font-family: var(--ur); font-size: 1.05rem; line-height: 2;
}
.userpick button.on { border-color: currentColor; box-shadow: 0 0 0 4px rgba(31,111,139,.12); font-weight: 700; }
.msg { padding: 9px 12px; border-radius: 10px; font-family: var(--ur); line-height: 2; font-size: .9rem; margin-top: 10px; }
.msg.err { background: #fdecea; color: #932; } .msg.ok { background: #e8f6ee; color: #1c6b3c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .msg.err { background: #3a1f1c; color: #f3b8ae; }
  :root:not([data-theme="light"]) .msg.ok { background: #17301f; color: #a9dcbe; } }

.hidden { display: none !important; }
.toast {
  position: fixed; bottom: 18px; inset-inline-start: 50%; transform: translateX(50%);
  background: #1c2430; color: #fff; padding: 10px 20px; border-radius: 999px;
  font-family: var(--ur); line-height: 2; z-index: 99; box-shadow: var(--shadow-lg); opacity: 0;
  transition: opacity .25s, bottom .25s; pointer-events: none; font-size: .92rem;
}
.toast.show { opacity: 1; bottom: 28px; }
.spin { border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; width: 26px; height: 26px; animation: sp .8s linear infinite; margin: 20px auto; }
@keyframes sp { to { transform: rotate(360deg); } }
datalist { direction: rtl; }
.savebar { position: sticky; bottom: 0; background: var(--card); border-top: 1px solid var(--line);
  padding: 10px 12px; margin: 0 -12px -90px; display: flex; gap: 9px; justify-content: center; box-shadow: 0 -3px 14px rgba(0,0,0,.07); }
