/* ==========================================================================
   Sasta Dawa Finder — v2 design system
   ========================================================================== */

:root {
  --bg: #f4f5f0;
  --bg-tint: #eaf1ec;
  --surface: #ffffff;
  --surface-2: #f8f9f6;
  --ink: #0f201c;
  --ink-2: #334540;
  --muted: #5f706b;
  --line: #e1e6e0;
  --line-strong: #cdd5ce;
  --brand: #0f5c54;
  --brand-2: #13786d;
  --brand-soft: #e2f0ec;
  --brand-contrast: #ffffff;
  --save: #137a3f;
  --save-soft: #e3f4e8;
  --accent: #e59a14;
  --accent-soft: #fdf1da;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --focus: #1f8f82;
  --shadow-sm: 0 1px 2px rgba(15, 32, 28, 0.06);
  --shadow: 0 1px 2px rgba(15, 32, 28, 0.05), 0 8px 24px -12px rgba(15, 32, 28, 0.18);
  --shadow-lg: 0 24px 60px -20px rgba(15, 32, 28, 0.35);
  --radius: 16px;
  --radius-sm: 10px;
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-ur: 'Noto Nastaliq Urdu', 'Jameel Noori Nastaleeq', serif;
  color-scheme: light;
}

:root[data-theme='dark'] {
  --bg: #0b1412;
  --bg-tint: #0f1d1a;
  --surface: #121e1b;
  --surface-2: #172522;
  --ink: #e6efec;
  --ink-2: #c3d1cd;
  --muted: #8fa29d;
  --line: #22322e;
  --line-strong: #2f433e;
  --brand: #3cc2ae;
  --brand-2: #5ad3c0;
  --brand-soft: #143832;
  --brand-contrast: #06201c;
  --save: #4ad17f;
  --save-soft: #12301f;
  --accent: #f2b544;
  --accent-soft: #33280f;
  --danger: #ff7b6e;
  --danger-soft: #3a1714;
  --focus: #5ad3c0;
  --shadow-sm: none;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.02), 0 10px 30px -14px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 24px 60px -16px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  background-image: radial-gradient(1200px 500px at 85% -120px, var(--bg-tint), transparent 70%);
  background-repeat: no-repeat;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

[dir='rtl'] body,
[dir='rtl'] .urdu-able { font-family: var(--font-ur), var(--font); line-height: 2; }

img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 8px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }

.skip-link { position: absolute; left: 12px; top: -60px; background: var(--brand); color: var(--brand-contrast); padding: 10px 14px; border-radius: 10px; z-index: 100; }
.skip-link:focus { top: 12px; }

.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 28px; } }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------------------
   Buttons & inputs
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 700; font-size: 15px; cursor: pointer; text-decoration: none !important;
  transition: background .15s, border-color .15s, transform .05s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: var(--brand-contrast); }
.btn-primary:hover { background: var(--brand-2); }
.btn-ghost { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-soft { background: var(--brand-soft); color: var(--brand); }
.btn-soft:hover { filter: brightness(0.97); }
.btn-save { background: var(--save); color: #fff; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn .ic { width: 18px; height: 18px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-2); cursor: pointer; flex-shrink: 0;
}
.icon-btn:hover { color: var(--brand); border-color: var(--line-strong); }
.icon-btn.ghost { border-color: transparent; background: transparent; }
.icon-btn.ghost:hover { background: var(--surface-2); }
.icon-btn.solid { background: var(--brand); color: var(--brand-contrast); border-color: transparent; }
.icon-btn.solid:hover { background: var(--brand-2); color: var(--brand-contrast); }
.icon-btn.sm { width: 34px; height: 34px; border-radius: 10px; }
.icon-btn.sm .ic { width: 16px; height: 16px; }
.icon-btn.active { color: var(--danger); }

.link-btn { background: none; border: 0; padding: 4px 6px; color: var(--brand); font-weight: 600; cursor: pointer; font-size: 14px; }

.input {
  min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--surface); width: 100%;
}
.input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.select { appearance: none; padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%; background-size: 5px 5px; background-repeat: no-repeat; cursor: pointer; }
[dir='rtl'] .select { padding-right: 14px; padding-left: 36px; background-position: 18px 52%, 13px 52%; }
.select.sm { min-height: 36px; font-size: 14px; border-radius: 10px; width: auto; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.center { justify-content: center; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink-2); font-weight: 600; font-size: 14px; cursor: pointer;
}
.chip:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }

/* --------------------------------------------------------------------------
   Top bar
   -------------------------------------------------------------------------- */

.topbar { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; gap: 12px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none !important; margin-inline-end: auto; }
.brand-mark { color: var(--brand); width: 36px; height: 36px; }
.brand-mark svg { width: 36px; height: 36px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-weight: 800; font-size: 18px; letter-spacing: -0.02em; }
.brand-sub { font-size: 12px; color: var(--muted); font-weight: 600; }
[dir='rtl'] .brand-sub { font-size: 11px; line-height: 1.8; }

.topnav { display: none; align-items: center; gap: 4px; }
.topnav-link { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 10px; color: var(--ink-2); font-weight: 650; font-size: 15px; background: none; border: 0; cursor: pointer; text-decoration: none !important; }
.topnav-link:hover { background: var(--surface); color: var(--brand); }
.topnav-link.active { color: var(--brand); background: var(--brand-soft); }
.count-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--brand); color: var(--brand-contrast); font-size: 12px; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; }
@media (min-width: 820px) { .topnav { display: flex; } }

.topbar-actions { display: flex; align-items: center; gap: 8px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 12px; padding: 3px; background: var(--surface); }
.seg-btn { border: 0; background: transparent; padding: 0 10px; height: 36px; border-radius: 9px; font-weight: 700; font-size: 14px; cursor: pointer; color: var(--muted); }
.seg-btn.urdu { font-family: var(--font-ur); font-size: 14px; line-height: 1; }
.seg-btn[aria-pressed='true'] { background: var(--brand); color: var(--brand-contrast); }

/* Mobile bottom nav */
.mobile-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 45; display: flex; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.mobile-nav a, .mobile-nav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 10px; font-size: 12px; font-weight: 700; color: var(--muted); background: none; border: 0; text-decoration: none !important; cursor: pointer; position: relative; }
.mobile-nav .active { color: var(--brand); }
.mobile-nav .ic { width: 22px; height: 22px; }
.mobile-nav .count-badge { position: absolute; top: 4px; inset-inline-start: calc(50% + 6px); height: 18px; min-width: 18px; font-size: 11px; }
@media (min-width: 820px) { .mobile-nav { display: none; } }

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */

main.wrap { flex: 1; padding-top: 8px; padding-bottom: 96px; }
@media (min-width: 820px) { main.wrap { padding-bottom: 64px; } }

.view { animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.block { margin-top: 40px; }
.block-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.block-title { margin: 0; font-size: 20px; letter-spacing: -0.01em; font-weight: 800; }
.block-sub { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

.view-head { padding: 16px 0 18px; }
.view-head.compact { padding-bottom: 6px; }
.view-title { margin: 6px 0 4px; font-size: clamp(22px, 4vw, 30px); line-height: 1.2; letter-spacing: -0.02em; font-weight: 800; }
.view-sub { margin: 0; color: var(--muted); max-width: 70ch; }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; color: var(--muted); font-size: 14px; padding: 6px 8px 6px 2px; margin-inline-start: -2px; }
.back-link:hover { color: var(--brand); text-decoration: none; }
[dir='rtl'] .back-link .ic, [dir='rtl'] .flip { transform: scaleX(-1); }

/* --------------------------------------------------------------------------
   Hero & search
   -------------------------------------------------------------------------- */

.hero-band {
  position: relative; margin-top: 16px; padding: 28px 18px 24px; border-radius: 28px;
  background:
    radial-gradient(600px 260px at 100% 0%, color-mix(in srgb, var(--brand) 16%, transparent), transparent 70%),
    radial-gradient(420px 220px at 0% 100%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%),
    var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow);
  display: grid; gap: 22px; grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 720px) { .hero-band { padding: 40px 36px 32px; } }
@media (min-width: 980px) { .hero-band { grid-template-columns: minmax(0, 1fr) 320px; gap: 36px; align-items: center; padding: 52px 44px 44px; } }
.hero { padding: 0; max-width: 760px; }

.hero-side { padding: 18px; border-radius: 20px; background: var(--bg); border: 1px solid var(--line); }
.hs-title { margin: 0 0 12px; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
[dir='rtl'] .hs-title { text-transform: none; letter-spacing: 0; font-size: 15px; }
.hs-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.hs-steps li { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 15px; line-height: 1.35; }
.hs-num { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; background: var(--brand); color: var(--brand-contrast); font-weight: 800; font-size: 14px; }
.hs-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line-strong); }
.hs-stats div { min-width: 0; }
.hs-stats b { display: block; font-size: 16px; font-weight: 800; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hs-stats span { display: block; font-size: 12px; color: var(--muted); line-height: 1.3; }
@media (max-width: 979px) { .hero-side { display: none; } }

/* Theme switch */
.theme-seg .seg-btn { width: 36px; padding: 0; display: inline-grid; place-items: center; }
.theme-seg .ic { width: 18px; height: 18px; }
@media (max-width: 520px) { .theme-auto { display: none !important; } .brand-sub { display: none; } }
@media (max-width: 380px) { .brand-name { font-size: 16px; } .seg-btn { padding: 0 8px; } .theme-seg .seg-btn { width: 32px; } }

/* Announcement from the admin panel */
#announce { margin-top: 12px; }
.announce { display: flex; align-items: center; gap: 10px; padding: 10px 8px 10px 14px; border-radius: 14px; font-weight: 650; font-size: 14.5px; background: var(--brand-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent); }
.announce > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.announce .ic { color: var(--brand); }
.announce.tone-success { background: var(--save-soft); border-color: color-mix(in srgb, var(--save) 30%, transparent); }
.announce.tone-success .ic { color: var(--save); }
.announce.tone-warn { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.announce.tone-warn .ic { color: var(--accent); }
.announce.off { opacity: .55; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 14px; padding: 6px 12px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 13px; }
.hero-title { margin: 0; font-size: clamp(30px, 6vw, 52px); line-height: 1.06; letter-spacing: -0.035em; font-weight: 800; }
[dir='rtl'] .hero-title { line-height: 1.7; letter-spacing: 0; font-size: clamp(26px, 5vw, 42px); }
.hero-sub { margin: 14px 0 24px; font-size: clamp(16px, 2.2vw, 18px); color: var(--ink-2); max-width: 60ch; }

.search { position: relative; }
.search-box {
  display: flex; align-items: center; gap: 4px; padding: 6px 6px 6px 16px; border-radius: 18px;
  background: var(--surface); border: 1.5px solid var(--line-strong); box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s;
}
[dir='rtl'] .search-box { padding: 6px 16px 6px 6px; }
.search-box:focus-within { border-color: var(--focus); box-shadow: 0 0 0 4px color-mix(in srgb, var(--focus) 18%, transparent), var(--shadow); }
.search-ic { color: var(--muted); width: 22px; height: 22px; }
.search-input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; height: 48px; font-size: 17px; padding: 0 6px; }
.search-input::-webkit-search-cancel-button { display: none; }
.search-input::placeholder { color: var(--muted); opacity: .85; }
.search-submit { height: 48px; border-radius: 13px; padding: 0 20px; }
@media (max-width: 480px) { .search-submit { padding: 0 14px; } .search-submit span { display: none; } }

.suggest {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 30; margin: 0; padding: 6px; list-style: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); max-height: min(60vh, 460px); overflow: auto;
}
.suggest li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; cursor: pointer; }
.suggest li[aria-selected='true'], .suggest li:hover { background: var(--brand-soft); }
.sg-main { flex: 1; min-width: 0; }
.sg-name { font-weight: 750; }
mark { background: none; color: var(--brand); font-weight: inherit; }
.sg-meta { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-price { text-align: end; font-weight: 750; font-size: 14px; white-space: nowrap; }
.sg-price small { display: block; font-weight: 600; color: var(--muted); font-size: 12px; }
.sg-head { padding: 8px 12px 4px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); cursor: default !important; background: none !important; }

#quick-chips { margin-top: 16px; }
.data-stamp { margin: 16px 0 0; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.data-stamp::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--save); box-shadow: 0 0 0 4px var(--save-soft); }

/* Recent */
.recent-row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.recent-card { flex: 0 0 auto; min-width: 180px; max-width: 240px; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none !important; }
.recent-card:hover { border-color: var(--brand); }
.recent-card b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-card span { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }

/* Categories */
.cat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .cat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 980px) { .cat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.cat-card { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none !important; min-height: 72px; transition: border-color .15s, transform .15s; }
.cat-card:hover { border-color: var(--brand); transform: translateY(-1px); }
.cat-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex-shrink: 0; }
.cat-ic .ic { width: 22px; height: 22px; }
.cat-name { font-weight: 750; font-size: 15px; line-height: 1.3; }
.cat-n { font-size: 12.5px; color: var(--muted); }

/* Deals */
.deal-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .deal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 980px) { .deal-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.deal { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none !important; box-shadow: var(--shadow-sm); }
.deal:hover { border-color: var(--brand); }
.deal-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.deal-name { font-weight: 800; font-size: 17px; }
.deal-gen { font-size: 13px; color: var(--muted); }
.save-pill { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; background: var(--save-soft); color: var(--save); font-weight: 800; font-size: 13px; white-space: nowrap; }
.deal-compare { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 14px; }
.deal-compare .lbl { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deal-compare .val { font-weight: 700; text-align: end; }
.deal-compare .cheap { color: var(--save); }

/* How it works */
.how { display: grid; gap: 12px; grid-template-columns: 1fr; padding: 20px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); }
@media (min-width: 820px) { .how { grid-template-columns: repeat(3, 1fr); } }
.how-step { display: flex; gap: 12px; }
.how-num { width: 36px; height: 36px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 800; flex-shrink: 0; }
.how-num .ic { width: 18px; height: 18px; }

/* Medicine page extras */
.mh-report { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; color: var(--muted); font-size: 13.5px; }
.mh-report:hover { color: var(--danger); }
.mh-report .ic { width: 16px; height: 16px; }
.mh-corrected { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; font-size: 13.5px; color: var(--save); font-weight: 650; }
.mh-corrected .ic { width: 16px; height: 16px; }

/* Report / request dialog */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: end center; }
@media (min-width: 640px) { .modal { place-items: center; } }
.modal-backdrop { position: absolute; inset: 0; background: rgba(4, 12, 10, .55); animation: fade .15s ease; }
.modal-card { position: relative; width: 100%; max-width: 480px; max-height: calc(100vh - 24px); overflow: auto; padding: 20px; padding-bottom: max(20px, env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; background: var(--surface); box-shadow: var(--shadow-lg); display: grid; gap: 12px; animation: slideup .2s ease; }
@media (min-width: 640px) { .modal-card { border-radius: 22px; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.modal-head h2 { margin: 0; font-size: 19px; }
.modal-card p { margin: 0; }
.fb-about { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-weight: 700; font-size: 14px; }
.field { display: grid; gap: 6px; font-size: 14px; font-weight: 650; color: var(--ink-2); }
.field textarea.input { padding: 10px 14px; resize: vertical; min-height: 88px; line-height: 1.5; }
.field small { font-weight: 500; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.fb-status { font-size: 14px; font-weight: 650; color: var(--ink-2); }
.fb-status.bad { color: var(--danger); }
.hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
body.modal-open { overflow: hidden; }
.footer-fb { padding: 4px 0; margin-top: 4px; }
.how-step h3 { margin: 2px 0 4px; font-size: 16px; }
.how-step p { margin: 0; color: var(--muted); font-size: 14px; }

/* --------------------------------------------------------------------------
   Results list
   -------------------------------------------------------------------------- */

.result-list { display: grid; gap: 8px; }
.result {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; align-items: center; padding: 14px 16px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none !important;
}
.result:hover { border-color: var(--brand); }
.r-name { font-weight: 800; font-size: 16px; }
.r-name .r-strength { font-weight: 650; color: var(--ink-2); }
.r-meta { grid-column: 1; font-size: 13.5px; color: var(--muted); }
.r-price { grid-row: 1 / span 2; grid-column: 2; text-align: end; }
.r-price b { display: block; font-size: 16px; }
.r-price span { font-size: 12.5px; color: var(--muted); }
.r-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; font-weight: 700; color: var(--ink-2); }
.tag.save { background: var(--save-soft); color: var(--save); border-color: transparent; }
.tag.brand { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.tag.warn { background: var(--accent-soft); color: color-mix(in srgb, var(--accent) 70%, var(--ink)); border-color: transparent; }
.more-note { color: var(--muted); font-size: 14px; padding: 8px 2px; }

/* Category groups */
.filter-row { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.filter-row .field-inline { flex: 1 1 220px; }
.filter-row .select { flex: 0 0 auto; width: auto; min-width: 150px; }
.group-list { display: grid; gap: 8px; }
.group-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 16px; padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none !important; align-items: center; }
.group-row:hover { border-color: var(--brand); }
.g-name { font-weight: 800; }
.g-meta { font-size: 13.5px; color: var(--muted); }
.g-price { grid-row: 1 / span 2; grid-column: 2; text-align: end; font-size: 14px; }
.g-price b { display: block; font-size: 15px; color: var(--save); }
.more-btn { margin: 16px auto 0; display: flex; }

/* --------------------------------------------------------------------------
   Medicine detail
   -------------------------------------------------------------------------- */

.detail-grid { display: grid; gap: 16px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 980px) { .detail-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 24px; } .detail-main { position: sticky; top: 84px; } }

.med-hero { padding: 22px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.mh-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.mh-name { margin: 0; font-size: clamp(24px, 4vw, 32px); line-height: 1.15; letter-spacing: -0.02em; font-weight: 800; }
.mh-product { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.mh-formula { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); }
.mh-formula small { display: block; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; opacity: .85; }
[dir='rtl'] .mh-formula small { text-transform: none; letter-spacing: 0; }
.mh-formula b { font-size: 17px; color: var(--ink); }
.mh-prices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.mh-price { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); }
.mh-price small { display: block; font-size: 12.5px; color: var(--muted); font-weight: 650; }
.mh-price b { font-size: 22px; letter-spacing: -0.01em; }
.mh-facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 16px 0 0; font-size: 14px; }
.mh-facts dt { color: var(--muted); }
.mh-facts dd { margin: 0; font-weight: 650; overflow-wrap: anywhere; }
.mh-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.mh-actions .btn { flex: 1 1 auto; }

.savings {
  margin-top: 14px; padding: 16px 18px; border-radius: 16px; display: flex; gap: 14px; align-items: flex-start;
  background: var(--save-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--save) 25%, transparent);
}
.savings .big { font-size: 28px; font-weight: 800; color: var(--save); line-height: 1; letter-spacing: -0.02em; white-space: nowrap; }
.savings p { margin: 0; }
.savings .s-title { font-weight: 750; }
.savings .s-sub { font-size: 14px; color: var(--ink-2); margin-top: 2px; }
.savings a { font-weight: 800; color: var(--save); }
.savings.neutral { background: var(--brand-soft); border-color: transparent; }
.notice { margin-top: 14px; padding: 12px 14px; border-radius: 12px; display: flex; gap: 10px; align-items: flex-start; font-size: 14px; background: var(--accent-soft); color: var(--ink); }
.notice .ic { color: var(--accent); margin-top: 2px; }

.panel { border-radius: 20px; background: var(--surface); border: 1px solid var(--line); overflow: hidden; box-shadow: var(--shadow-sm); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 16px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-title { margin: 0; font-size: 17px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.pill-count { font-size: 12.5px; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.alt-list { display: flex; flex-direction: column; }
.alt {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 16px; border-bottom: 1px solid var(--line);
  color: var(--ink); text-decoration: none !important; position: relative;
}
.alt:last-child { border-bottom: 0; }
.alt:hover { background: var(--surface-2); }
.alt.current { background: var(--brand-soft); }
.alt-name { font-weight: 750; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.alt-meta { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.alt-price { text-align: end; grid-row: 1 / span 2; grid-column: 2; }
.alt-price b { display: block; font-size: 15px; }
.alt-price span { font-size: 12.5px; color: var(--muted); }
.alt-bar { grid-column: 1 / -1; height: 4px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin-top: 4px; }
.alt-bar i { display: block; height: 100%; border-radius: 4px; background: var(--brand); opacity: .55; }
.alt.cheapest .alt-bar i { background: var(--save); opacity: 1; }
.alt-delta { font-size: 12px; font-weight: 800; }
.alt-delta.down { color: var(--save); }
.alt-delta.up { color: var(--danger); }
.alt-empty { padding: 20px 16px; color: var(--muted); }

.strengths { margin-top: 14px; padding: 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.strengths h3 { margin: 0 0 10px; font-size: 15px; }
.strength-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.strength-chip { display: inline-flex; flex-direction: column; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); text-decoration: none !important; font-size: 14px; line-height: 1.35; }
.strength-chip:hover { border-color: var(--brand); }
.strength-chip b { font-weight: 800; }
.strength-chip span { font-size: 12px; color: var(--muted); }

/* --------------------------------------------------------------------------
   My Medicines
   -------------------------------------------------------------------------- */

.cab-summary { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; margin-bottom: 16px; }
.cab-summary .stat.good { grid-column: 1 / -1; }
@media (min-width: 720px) { .cab-summary { grid-template-columns: repeat(3, 1fr); } .cab-summary .stat.good { grid-column: auto; } }
@media (max-width: 420px) { .stat b { font-size: 21px; } }
.stat { padding: 16px 18px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.stat small { display: block; color: var(--muted); font-weight: 650; font-size: 13px; }
.stat b { font-size: 26px; letter-spacing: -0.02em; }
.stat.good { background: var(--save-soft); border-color: transparent; }
.stat.good b { color: var(--save); }
.stat .sub { font-size: 13px; color: var(--ink-2); }
.cab-list { display: grid; gap: 10px; }
.cab-item { padding: 14px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .cab-item { grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; } }
.cab-name a { font-weight: 800; color: var(--ink); }
.cab-meta { font-size: 13px; color: var(--muted); }
.stepper { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line-strong); border-radius: 12px; padding: 3px; }
.stepper input { width: 46px; text-align: center; border: 0; background: transparent; font-weight: 800; height: 32px; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper-label { font-size: 13px; color: var(--muted); margin-inline-start: 6px; }
.cab-qty { display: flex; align-items: center; gap: 6px; }
.cab-cost { text-align: end; min-width: 140px; }
.cab-cost b { display: block; font-size: 17px; }
.cab-cost span { font-size: 12.5px; color: var(--muted); }
.cab-switch { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--save-soft); font-size: 14px; flex-wrap: wrap; }
.cab-switch a { font-weight: 800; color: var(--save); }
.cab-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.cab-note { font-size: 13px; color: var(--muted); margin-top: 14px; }

/* Empty state */
.empty { text-align: center; padding: 56px 12px; max-width: 560px; margin: 0 auto; }
.empty-ic { width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.empty-ic .ic { width: 28px; height: 28px; }
.empty .view-sub { margin: 0 auto 18px; }
.empty-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }

/* Loading */
.loading { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 48px 0; color: var(--muted); font-weight: 650; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line-strong); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { height: 72px; border-radius: 14px; background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border: 1px solid var(--line); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.footer { border-top: 1px solid var(--line); background: var(--surface-2); padding: 28px 0 100px; font-size: 14px; }
@media (min-width: 820px) { .footer { padding-bottom: 32px; } }
.footer-note { display: flex; gap: 10px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); }
.footer-note p { margin: 0; }
.footer-note .ic { color: var(--brand); margin-top: 2px; }
.footer-cols { display: grid; gap: 20px; grid-template-columns: 1fr; margin-top: 22px; }
@media (min-width: 720px) { .footer-cols { grid-template-columns: 2fr 1fr 1fr; } }
.footer-brand { font-weight: 800; margin: 0 0 4px; }
.footer-cols p { margin: 0 0 4px; }
.footer-h { font-weight: 800; margin: 0 0 6px !important; }
.footer-link { display: block; color: var(--ink-2); padding: 2px 0; overflow-wrap: anywhere; }
.footer-copy { margin: 22px 0 0; color: var(--muted); font-size: 13px; }

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */

.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(20px); z-index: 90; padding: 12px 18px; border-radius: 12px; background: var(--ink); color: var(--bg); font-weight: 700; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (min-width: 820px) { .toast { bottom: 32px; } }
body.as-open .toast { bottom: auto; top: 76px; }

/* --------------------------------------------------------------------------
   Assistant
   -------------------------------------------------------------------------- */

.fab {
  position: fixed; z-index: 50; inset-inline-end: 16px; bottom: calc(76px + env(safe-area-inset-bottom));
  display: inline-flex; align-items: center; gap: 8px; height: 52px; padding: 0 18px 0 16px; border-radius: 999px; border: 0;
  background: var(--brand); color: var(--brand-contrast); font-weight: 800; font-size: 15px; cursor: pointer; box-shadow: var(--shadow-lg);
}
.fab:hover { background: var(--brand-2); }
.fab .ic { width: 22px; height: 22px; }
@media (max-width: 480px) { .fab span { display: none; } .fab { width: 56px; height: 56px; padding: 0; justify-content: center; } }
@media (min-width: 820px) { .fab { bottom: 24px; inset-inline-end: 24px; } }
body.as-open .fab { display: none; }

.assistant {
  position: fixed; z-index: 60; inset: 0; display: flex; flex-direction: column; background: var(--surface);
  animation: slideup .22s ease;
}
@media (min-width: 720px) {
  .assistant { inset: auto; inset-inline-end: 24px; bottom: 24px; width: 420px; height: min(680px, calc(100vh - 110px)); border-radius: 22px; border: 1px solid var(--line); box-shadow: var(--shadow-lg); overflow: hidden; }
}
@keyframes slideup { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.as-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 10px 12px 16px; border-bottom: 1px solid var(--line); padding-top: max(12px, env(safe-area-inset-top)); }
.as-id { display: flex; align-items: center; gap: 10px; min-width: 0; }
.as-avatar { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--brand); color: var(--brand-contrast); flex-shrink: 0; }
.as-title { margin: 0; font-size: 16px; font-weight: 800; line-height: 1.2; }
.as-mode { margin: 0; font-size: 12px; color: var(--muted); font-weight: 650; display: flex; align-items: center; gap: 6px; }
.as-mode::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--save); }
.as-actions { display: flex; }

.as-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; background: var(--surface-2); overscroll-behavior: contain; }
.msg { max-width: 92%; display: flex; flex-direction: column; gap: 8px; }
.msg.user { align-self: flex-end; }
.msg.bot { align-self: flex-start; }
.bubble { padding: 10px 14px; border-radius: 16px; font-size: 15px; line-height: 1.55; overflow-wrap: anywhere; }
.msg.user .bubble { background: var(--brand); color: var(--brand-contrast); border-end-end-radius: 6px; }
.msg.bot .bubble { background: var(--surface); border: 1px solid var(--line); border-end-start-radius: 6px; }
.bubble p { margin: 0 0 6px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble ul, .bubble ol { margin: 4px 0 6px; padding-inline-start: 20px; }
.bubble li { margin: 2px 0; }
.bubble strong { font-weight: 800; }
.bubble a { font-weight: 700; }
.bubble.warn { background: var(--danger-soft); border-color: transparent; }
.typing { display: inline-flex; gap: 4px; padding: 14px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.mcards { display: flex; flex-direction: column; gap: 6px; }
.mcard { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none !important; font-size: 14px; }
.mcard:hover { border-color: var(--brand); }
.mcard b { font-weight: 800; }
.mcard .mc-meta { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mcard .mc-price { grid-row: 1 / span 2; grid-column: 2; text-align: end; font-weight: 800; }
.mcard .mc-price small { display: block; font-weight: 650; font-size: 12px; color: var(--muted); }
.mcard.cheap { border-color: color-mix(in srgb, var(--save) 40%, transparent); }
.mcard.cheap .mc-price { color: var(--save); }
.msg-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.msg-actions .chip { min-height: 32px; font-size: 13px; padding: 0 12px; }

.as-suggest { display: flex; gap: 6px; overflow-x: auto; padding: 8px 12px 0; background: var(--surface); scrollbar-width: none; }
.as-suggest::-webkit-scrollbar { display: none; }
.as-suggest .chip { flex: 0 0 auto; min-height: 34px; font-size: 13px; }
.as-input { display: flex; align-items: flex-end; gap: 6px; padding: 10px 12px; padding-bottom: max(10px, env(safe-area-inset-bottom)); background: var(--surface); }
.as-text { flex: 1; resize: none; min-height: 44px; max-height: 140px; padding: 11px 14px; border-radius: 14px; border: 1px solid var(--line-strong); background: var(--surface-2); outline: none; line-height: 1.4; }
.as-text:focus { border-color: var(--focus); }
#assistant-mic.listening { color: var(--danger); background: var(--danger-soft); }

/* --------------------------------------------------------------------------
   Print (My Medicines list)
   -------------------------------------------------------------------------- */

@media print {
  .topbar, .mobile-nav, .fab, .assistant, .footer, .cab-tools, .back-link, .stepper button { display: none !important; }
  body { background: #fff; }
  .cab-item, .stat { break-inside: avoid; border-color: #bbb; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* --------------------------------------------------------------------------
   v2.1 polish
   -------------------------------------------------------------------------- */
.deal, .cat-card, .result, .group-row, .recent-card { transition: border-color .15s, transform .15s, box-shadow .15s; }
.deal:hover, .result:hover, .group-row:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.deal { position: relative; overflow: hidden; }
.deal::after { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--save); opacity: .8; }
[dir='rtl'] .deal::after { inset: 0 0 0 auto; }
.block-title { font-size: 21px; }
.data-stamp { padding: 6px 12px 6px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); width: fit-content; max-width: 100%; }
.how { background: var(--surface); }
@media (max-width: 719px) { .hero-band { margin-left: -4px; margin-right: -4px; border-radius: 22px; } }
